[anjal] Fix color of selected entry to be a readable one.



commit 5853f6ad447cf2ba0cde2e9a98cef9911a03595a
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Tue May 19 14:42:50 2009 +0530

    Fix color of selected entry to be a readable one.
---
 src/em-tree-store.c    |    4 ++--
 src/mail-folder-view.c |   10 +++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/em-tree-store.c b/src/em-tree-store.c
index dd8cd44..e15e881 100644
--- a/src/em-tree-store.c
+++ b/src/em-tree-store.c
@@ -231,7 +231,7 @@ emts_get_value(GtkTreeModel *tree_model, GtkTreeIter  *iter, gint column, GValue
 	 EMTreeNode *node;
 	 struct _emts_folder *f;
 	 struct _EMTreeStorePrivate *p = _PRIVATE(tree_model);
-	 
+	 gboolean sel = g_object_get_data (tree_model, "sel") != NULL; 
 	 f = (struct _emts_folder *)p->folders.head;
 	/*EMTreeStore *emts = (EMTreeStore *)tree_model;*/
 	g_return_if_fail(iter != NULL);
@@ -328,7 +328,7 @@ emts_get_value(GtkTreeModel *tree_model, GtkTreeIter  *iter, gint column, GValue
 			 /* FIXME: This should be done at the backend/camel. Doing here is expensive, but just ok for 0.001 release*/
 			 if (preview && *preview)
 				  nline = strchr (preview, '\n') != NULL;
-			 str  = g_markup_printf_escaped (_("<span foreground=\"#808080\" >%s%s</span>"), (preview && *preview) ? preview : _("Message not yet downloaded  or preview could not be constructed\n"), nline ? "" : "\n");
+			 str  = g_markup_printf_escaped (_("<span foreground=\"%s\" >%s%s</span>"), sel ? "#d3d7cf" : "#808080", (preview && *preview) ? preview : _("Message not yet downloaded  or preview could not be constructed\n"), nline ? "" : "\n");
 			 g_value_set_string(value, str);
 			 g_free(str);
 			 break;
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 205d68d..92ca967 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -583,7 +583,10 @@ draw_text (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *
 	gboolean bold, ellipsize, strike, markup;
 	gboolean unread;
 	guint32 flags;
-
+	GtkTreeIter sel_iter;
+	GtkTreeSelection *sel = gtk_tree_view_get_selection (mfv->tree);
+	gtk_tree_selection_get_selected (sel, NULL, &sel_iter);
+	gboolean selected = iter->user_data == sel_iter.user_data;
 	/*
 	gtk_tree_model_get (tree_model, iter, 27, &rec, -1);
 
@@ -615,7 +618,12 @@ draw_text (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *
 				  g_value_unset (&v);
 				  g_value_init (&v1,  G_TYPE_BOOLEAN);
 				  g_value_unset (&v1);
+				  if (i == EMTS_COL_THREADPREVIEW) /* Hack to set the selected color a bit different */
+					  g_object_set_data (tree_model, "sel", GINT_TO_POINTER(selected));
 				  gtk_tree_model_get_value (tree_model, iter, i, &value);
+				  if (i == EMTS_COL_THREADPREVIEW)
+					  g_object_set_data (tree_model, "sel", GINT_TO_POINTER(0));
+			  
 				  g_object_set_property ((GObject *)child, (gchar *) markup ? "markup" : "text", &value);
 				  if (mfv->priv->light) {
 					  gtk_tree_model_get_value (tree_model, iter, COL_FLAGS, &v);



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