[anjal] Fixed Coloring of fg for message view on selection
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjal] Fixed Coloring of fg for message view on selection
- Date: Sat, 21 Mar 2009 16:15:22 -0400 (EDT)
commit 9d3e072e07df971188527df6be80c4f4e9f3ddee
Author: Srinivasa Ragavan <sragavan novell com>
Date: Sun Mar 22 01:48:06 2009 +0530
Fixed Coloring of fg for message view on selection
Keyboard accel for show/hide details
Junk/Delete buttons on message view.
---
src/em-format-webkit-display.c | 1 -
src/mail-message-view.c | 83 ++++++++++++++++++++++++++++++++++-----
src/mail-message-view.h | 2 +
3 files changed, 74 insertions(+), 12 deletions(-)
diff --git a/src/em-format-webkit-display.c b/src/em-format-webkit-display.c
index 2edc194..2a48d83 100644
--- a/src/em-format-webkit-display.c
+++ b/src/em-format-webkit-display.c
@@ -2172,7 +2172,6 @@ efwd_create_attachment_cache (EAttachment *attachment)
/* Destroy everything */
g_object_unref (loader);
camel_object_unref (mstream);
- printf("everyting done\n");
}
}
diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index 01d232a..0556ccb 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -31,9 +31,12 @@
#include "e-msg-composer.h"
#include "misc/e-spinner.h"
#include <gdk/gdkkeysyms.h>
+#include "e-util/e-icon-factory.h"
extern char *scolor_norm;
extern char *scolor_sel;
+extern GdkColor *pcolor_fg_norm;
+extern GdkColor *pcolor_fg_sel;
struct _MailMessageViewPrivate {
CamelFolder *folder;
@@ -74,7 +77,8 @@ mail_message_view_finalize (GObject *object)
g_object_unref (shell->efwd);
g_free (priv->uid);
- camel_object_unref (priv->msg);
+ if (priv->msg)
+ camel_object_unref (priv->msg);
camel_message_info_free (priv->info);
g_free (priv);
@@ -123,6 +127,9 @@ mmv_invalidate_row (GtkWidget *w)
static gboolean
mmv_focus_out (GtkWidget *w, GdkEventFocus *event, MailMessageView *mmv)
{
+ gtk_widget_modify_fg (mmv->more_details, GTK_STATE_NORMAL, pcolor_fg_norm);
+ gtk_widget_modify_fg (mmv->sub_details, GTK_STATE_NORMAL, pcolor_fg_norm);
+ gtk_widget_modify_fg (mmv->date_details, GTK_STATE_NORMAL, pcolor_fg_norm);
mmv->priv->active_color = scolor_norm;
mmv_invalidate_row (mmv->priv->header_row);
@@ -132,6 +139,9 @@ mmv_focus_out (GtkWidget *w, GdkEventFocus *event, MailMessageView *mmv)
static gboolean
mmv_focus_in (GtkWidget *w, GdkEventFocus *event, MailMessageView *mmv)
{
+ gtk_widget_modify_fg (mmv->more_details, GTK_STATE_NORMAL, pcolor_fg_sel);
+ gtk_widget_modify_fg (mmv->sub_details, GTK_STATE_NORMAL, pcolor_fg_sel);
+ gtk_widget_modify_fg (mmv->date_details, GTK_STATE_NORMAL, pcolor_fg_sel);
mmv->priv->active_color = scolor_sel;;
mmv_invalidate_row (mmv->priv->header_row);
@@ -183,11 +193,25 @@ mmv_key_press (GtkWidget *w, GdkEventKey *event, MailMessageView *mmv)
break;
case GDK_KP_Right:
case GDK_Right:
- if (!GTK_WIDGET_VISIBLE(mmv->body))
+ if (event->state & GDK_SHIFT_MASK) {
+ if (!GTK_WIDGET_VISIBLE(mmv->main_header)) {
+ gtk_label_set_markup (mmv->more_details, _("<u>hide details</u>"));
+ gtk_widget_show (mmv->main_header);
+ }
+ break;
+ }
+ if (!GTK_WIDGET_VISIBLE(mmv->body))
mmv_show(mmv);
break;
case GDK_KP_Left:
case GDK_Left:
+ if (event->state & GDK_SHIFT_MASK) {
+ if (GTK_WIDGET_VISIBLE(mmv->main_header)) {
+ gtk_widget_hide (mmv->main_header);
+ gtk_label_set_markup (mmv->more_details, _("<u>show details</u>"));
+ }
+ break;
+ }
if (GTK_WIDGET_VISIBLE(mmv->body))
mmv_hide(mmv);
break;
@@ -377,7 +401,6 @@ mmv_sh_color_expose (GtkWidget *w, GdkEventExpose *event, MailMessageView *mmv)
GdkColor colr;
GdkRectangle rect = {0, 0, wid, heig};
- //gdk_cairo_set_source_color (cr, &(style->base[GTK_STATE_ACTIVE]));
gdk_color_parse (mmv->priv->active_color, &colr);
gdk_cairo_set_source_color (cr, &colr);
if (GTK_IS_HBOX(w))
@@ -413,7 +436,8 @@ mail_message_view_create_webview (MailMessageView *mmv, GtkWidget *box)
void
mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, const char *uid)
{
- GtkWidget *tmp;
+ GtkWidget *tmp, *menu;
+ GdkPixbuf *img;
CamelMessageInfoBase *info;
GtkWidget *box, *header_row, *details_row;
GtkWidget *reply, *reply_all, *forward, *discard;
@@ -443,7 +467,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
gtk_container_add (mmview->short_header, header_row);
gtk_widget_show (header_row);
- gtk_widget_set_size_request (header_row, -1, 25);
+ gtk_widget_set_size_request (header_row, -1, 28);
gtk_box_pack_start (box, mmview->short_header, FALSE, FALSE, 0);
@@ -470,16 +494,33 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
strv = g_strsplit (str, "<", 2);
str = g_strdup_printf("<b>%s</b> - %s", *strv, camel_message_info_subject(info));
tmp = gtk_label_new (NULL);
+ gtk_widget_modify_fg (tmp, GTK_STATE_NORMAL, pcolor_fg_norm);
gtk_label_set_markup (tmp, str);
gtk_label_set_ellipsize (tmp, PANGO_ELLIPSIZE_END);
gtk_label_set_max_width_chars (tmp, 50);
+ mmview->sub_details = tmp;
g_free(str);
g_strfreev(strv);
gtk_widget_show(tmp);
gtk_box_pack_start (header_row, tmp, FALSE, FALSE, 2);
+ menu = gtk_button_new ();
+ g_object_set (menu, "focus-on-click", FALSE, NULL);
+ gtk_container_add (menu, gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_ETCHED_OUT));
+ gtk_widget_show_all (menu);
+ gtk_box_pack_end (header_row, menu, FALSE, FALSE, 2);
+ /*
+ reply = gtk_button_new ();
+ img = e_icon_factory_get_icon ("mail-reply-sender", E_ICON_SIZE_MENU);
+ gtk_button_set_image (reply, gtk_image_new_from_pixbuf(img));
+ gtk_button_set_label (reply, _("Reply"));
+ gtk_widget_show_all (reply);
+ gtk_box_pack_end (header_row, reply, FALSE, FALSE, 0);
+ */
str = filter_date(camel_message_info_date_sent(info));
tmp = gtk_label_new (str);
+ gtk_widget_modify_fg (tmp, GTK_STATE_NORMAL, pcolor_fg_norm);
+ mmview->date_details = tmp;
gtk_widget_show(tmp);
g_free(str);
gtk_box_pack_end (header_row, tmp, FALSE, FALSE, 6);
@@ -488,12 +529,15 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
mmview->details_event = gtk_event_box_new ();
g_signal_connect (mmview->details_event, "button-press-event", G_CALLBACK(more_details_cb), mmview);
mmview->more_details = gtk_label_new (_("<u>show details</u>"));
+ gtk_widget_modify_fg (mmview->more_details, GTK_STATE_NORMAL, pcolor_fg_norm);
gtk_container_add (mmview->details_event, mmview->more_details);
gtk_label_set_use_markup (GTK_LABEL (mmview->more_details), TRUE);
EXPOSE(mmview->more_details, mmview);
gtk_box_pack_end (header_row, mmview->details_event, FALSE, FALSE, 12);
gtk_widget_show_all (mmview->details_event);
+
+
gtk_widget_show(mmview->short_header);
gtk_box_pack_start (mmview, box, FALSE, FALSE, 0);
@@ -504,7 +548,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
gtk_widget_show(tmp);
gtk_box_pack_start (GTK_BOX (mmview->main_header), tmp, FALSE, FALSE, 3);
- gtk_box_pack_start (GTK_BOX (mmview->main_header), GTK_WIDGET (table), FALSE, TRUE, 3);
+ gtk_box_pack_start (GTK_BOX (mmview->main_header), GTK_WIDGET (table), TRUE, TRUE, 3);
gtk_table_set_col_spacings (table ,12);
gtk_table_set_row_spacings (table, 6);
@@ -521,7 +565,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
widget = gtk_label_new (*strv);
g_strfreev(strv);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
row++;
/* The To field */
@@ -534,7 +578,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
widget = gtk_label_new (camel_message_info_to(info));
g_object_set (widget, "wrap", TRUE, NULL);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
row++;
/* The Cc field */
@@ -548,7 +592,7 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
widget = gtk_label_new (header_text);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
row++;
}
@@ -564,12 +608,29 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
//gtk_label_set_line_wrap_mode (widget, PANGO_WRAP_WORD_CHAR);
//gtk_label_set_max_width_chars (widget, 50);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
row++;
+
+ /* Delete / junk buttons */
+ vbox = gtk_vbox_new (FALSE, 2);
+ gtk_box_pack_end (mmview->main_header, vbox, FALSE, FALSE, 0);
+ tmp = gtk_button_new ();
+ gtk_button_set_relief(tmp, GTK_RELIEF_NONE);
+ img = e_icon_factory_get_icon ("stock_delete", E_ICON_SIZE_BUTTON);
+ gtk_button_set_label (tmp, _("Delete"));
+ gtk_button_set_image (tmp, gtk_image_new_from_pixbuf(img));
+ gtk_box_pack_start (vbox, tmp, FALSE, FALSE, 0);
+ tmp = gtk_button_new ();
+ gtk_button_set_relief(tmp, GTK_RELIEF_NONE);
+ img = e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_BUTTON);
+ gtk_button_set_label (tmp, _("Junk"));
+ gtk_button_set_image (tmp, gtk_image_new_from_pixbuf(img));
+ gtk_box_pack_start (vbox, tmp, FALSE, FALSE, 0);
gtk_box_pack_start (mmview, mmview->main_header, TRUE, TRUE, 0);
gtk_widget_show_all (mmview->main_header);
-
+
+
gtk_widget_hide (mmview->main_header);
/* Default: Body would be hidden */
diff --git a/src/mail-message-view.h b/src/mail-message-view.h
index 4f991ae..871540c 100644
--- a/src/mail-message-view.h
+++ b/src/mail-message-view.h
@@ -42,6 +42,8 @@ typedef struct _MailMessageView {
GtkWidget *short_header;
GtkWidget *details_event;
GtkWidget *more_details;
+ GtkWidget *sub_details;
+ GtkWidget *date_details;
GtkWidget *main_header;
GtkWidget *body;
GtkWidget *attachments;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]