[anjal] Bold text for unread mails.



commit 359f78e9fd754886d8c86e30dd085ca87bbfae9b
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Thu Apr 2 12:13:32 2009 +0530

    Bold text for unread mails.
---
 src/mail-folder-view.c  |    2 +-
 src/mail-message-view.c |   42 +++++++++++++++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 34ff1d3..a66d11a 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -68,7 +68,7 @@ enum {
 };
 
 static const char * mfv_get_selected_uid (GtkTreeView *tree, MailFolderView *mfv);
-static const char *unread_image = ANJAL_IMAGEDIR"unread.png";
+const char *unread_image = ANJAL_IMAGEDIR"unread.png";
 static void mfv_message_activated (GtkTreeView       *tree_view,  GtkTreePath       *path, GtkTreeViewColumn *column,  MailFolderView *shell);
 static void mfv_delete (MailFolderView *mfv, gboolean del);
 static void mfv_read (MailFolderView *mfv, gboolean del);
diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index 635c6c4..17a87ee 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -50,6 +50,8 @@ struct  _MailMessageViewPrivate {
 	const char *active_color;
 	GtkWidget *spinner;
 	GtkWidget *unread_image;
+	char *bold[2];
+	char *normal[2];
 };
 
 G_DEFINE_TYPE (MailMessageView, mail_message_view, GTK_TYPE_VBOX)
@@ -85,6 +87,12 @@ mail_message_view_finalize (GObject *object)
 
 	g_object_unref (shell->efwd);
 	g_free (priv->uid);
+	g_free (priv->normal[0]);
+	g_free (priv->normal[1]);
+	g_free (priv->bold[0]);
+	g_free (priv->bold[1]);
+
+
 	if (priv->msg)
 		 camel_object_unref (priv->msg);
 	camel_message_info_free (priv->info);
@@ -364,6 +372,9 @@ 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_widget_set_sensitive (mmv->priv->unread_image, FALSE);
+	 gtk_label_set_markup (mmv->sub_details, mmv->priv->normal[0]);
+	 gtk_label_set_markup (mmv->date_details, mmv->priv->normal[1]);
+
 	 g_signal_handlers_disconnect_by_func(w, mark_mail_read, mmv);
 	 return FALSE;
 }
@@ -583,10 +594,13 @@ 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_widget_set_sensitive (mmv->priv->unread_image, TRUE);
-
+		  gtk_label_set_markup (mmv->sub_details, mmv->priv->bold[0]);
+		  gtk_label_set_markup (mmv->date_details, mmv->priv->bold[1]);
 	 } else {
 		  mmv_set_flags(mmv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
 		  gtk_widget_set_sensitive (mmv->priv->unread_image, FALSE);
+		  gtk_label_set_markup (mmv->sub_details, mmv->priv->normal[0]);
+		  gtk_label_set_markup (mmv->date_details, mmv->priv->normal[1]);
 	 }
 //	 mmv_invalidate_row (mmv->priv->header_row);
 }
@@ -701,16 +715,22 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 
 	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));
+	mmview->priv->normal[0] = g_strdup_printf("%s - %s", *strv, camel_message_info_subject(info));
+	mmview->priv->bold[0] = g_strdup_printf("<b>%s - %s</b>", *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);
+	gtk_label_set_max_width_chars (tmp, 75);
 	mmview->sub_details = tmp;
-	g_free(str);
 	g_strfreev(strv);
 	gtk_widget_show(tmp);
+	if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
+		gtk_label_set_markup (mmview->sub_details, mmview->priv->normal[0]);
+	else
+		gtk_label_set_markup (mmview->sub_details, mmview->priv->bold[0]);
+
+
 	gtk_box_pack_start (header_row, tmp, FALSE, FALSE, 2);
 
 	menu = gtk_button_new ();
@@ -726,14 +746,18 @@ mail_message_view_set_message (MailMessageView *mmview, CamelFolder *folder, con
 	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);
+	mmview->priv->normal[1] = filter_date(camel_message_info_date_sent(info));
+	mmview->priv->bold[1] = g_strdup_printf("<b>%s</b>", mmview->priv->normal[1]);
+
+	tmp = gtk_label_new (NULL);
 	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);
-
+	if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
+		gtk_label_set_markup (mmview->date_details, mmview->priv->normal[1]);
+	else
+		gtk_label_set_markup (mmview->date_details, mmview->priv->bold[1]);
 	
 	mmview->details_event = gtk_event_box_new ();
 	g_signal_connect (mmview->details_event, "button-press-event", G_CALLBACK(more_details_cb), mmview);



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