[anjal: 3/3] Use the dot for unread and toggle on move hover.



commit e9b19251be7b2b7605c069e5429df86539af3942
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Wed Apr 1 22:55:52 2009 +0530

    Use the dot for unread and toggle on move hover.
---
 src/mail-message-view.c |   40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index d9b892a..635c6c4 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -37,6 +37,7 @@ extern char *scolor_norm;
 extern char *scolor_sel;
 extern GdkColor *pcolor_fg_norm;
 extern GdkColor *pcolor_fg_sel;
+extern char *unread_image;
 
 struct  _MailMessageViewPrivate {
 	CamelFolder *folder;
@@ -362,7 +363,7 @@ mark_mail_read  (GtkWidget *w, GdkEventExpose *event, MailMessageView *mmv)
 {
 	 if ((mmv->priv->info->flags & CAMEL_MESSAGE_SEEN) == 0)
 		  mmv_set_flags (mmv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-	 gtk_image_set_from_pixbuf (mmv->priv->unread_image, e_icon_factory_get_icon ("mail-read", E_ICON_SIZE_MENU));
+	 gtk_widget_set_sensitive (mmv->priv->unread_image, FALSE);
 	 g_signal_handlers_disconnect_by_func(w, mark_mail_read, mmv);
 	 return FALSE;
 }
@@ -581,10 +582,11 @@ unread_toggled (GtkWidget *w, GdkEventButton *event, MailMessageView *mmv)
 {
 	 if (camel_message_info_flags(mmv->priv->info) & CAMEL_MESSAGE_SEEN) {
 		  mmv_set_flags(mmv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
-		  gtk_image_set_from_pixbuf (mmv->priv->unread_image, e_icon_factory_get_icon ("mail-unread", E_ICON_SIZE_MENU));
+		  gtk_widget_set_sensitive (mmv->priv->unread_image, TRUE);
+
 	 } else {
 		  mmv_set_flags(mmv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-		  gtk_image_set_from_pixbuf (mmv->priv->unread_image, e_icon_factory_get_icon ("mail-read", E_ICON_SIZE_MENU));
+		  gtk_widget_set_sensitive (mmv->priv->unread_image, FALSE);
 	 }
 //	 mmv_invalidate_row (mmv->priv->header_row);
 }
@@ -603,6 +605,27 @@ delete_clicked (GtkWidget *w, MailMessageView *mmv)
 	 g_signal_emit (mmv, signals[MESSAGE_REMOVED], 0);
 }
 
+static gboolean 
+unread_enter(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
+{
+	MailMessageView *mmv = user_data;
+	if (camel_message_info_flags(mmv->priv->info) & CAMEL_MESSAGE_SEEN)
+		gtk_widget_set_sensitive (mmv->priv->unread_image, TRUE);
+
+	return FALSE;
+}
+
+static gboolean 
+unread_leave(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
+{
+	MailMessageView *mmv = user_data;
+
+	if (camel_message_info_flags(mmv->priv->info) & CAMEL_MESSAGE_SEEN)
+		gtk_widget_set_sensitive (mmv->priv->unread_image, FALSE);
+	
+	return FALSE;
+}
+
 void
 mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, const char *uid)
 {
@@ -665,16 +688,17 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	EXPOSE(tmp, mmview);
 	mmview->priv->unread_image = gtk_image_new ();
 	EXPOSE(mmview->priv->unread_image, mmview);
-	if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
-		 gtk_image_set_from_pixbuf (mmview->priv->unread_image, e_icon_factory_get_icon ("mail-read", E_ICON_SIZE_MENU));
-	else
-		 gtk_image_set_from_pixbuf (mmview->priv->unread_image, e_icon_factory_get_icon ("mail-unread", E_ICON_SIZE_MENU));
+	gtk_image_set_from_pixbuf (mmview->priv->unread_image, gdk_pixbuf_new_from_file(unread_image, NULL));
 	gtk_widget_show (mmview->priv->unread_image);
+	if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
+		gtk_widget_set_sensitive (mmview->priv->unread_image, FALSE);
 	gtk_widget_show (tmp);
 	gtk_container_add (tmp, mmview->priv->unread_image);
 	gtk_box_pack_start (header_row, tmp, FALSE, FALSE, 2);
 	g_signal_connect (tmp, "button-press-event", G_CALLBACK(unread_toggled), mmview);
-	
+	g_signal_connect (tmp, "enter-notify-event", G_CALLBACK(unread_enter), mmview);
+	g_signal_connect (tmp, "leave-notify-event", G_CALLBACK(unread_leave), mmview);
+
 	str = camel_message_info_from(info);
 	strv = g_strsplit (str, "<", 2);
 	str = g_strdup_printf("<b>%s</b> - %s", *strv, camel_message_info_subject(info));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]