[empathy] presence-chooser: Grey the 'favorite' icon when the status is not a favorite



commit 96f6ab994f7631af1a478f0f625357976195ace0
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Feb 26 14:04:00 2010 +0000

    presence-chooser: Grey the 'favorite' icon when the status is not a favorite
    
    This is more coherent as the favorite icon is now theme dependent and fix the
    problem that the old unstarred icon was not really visible (#584629).

 libempathy-gtk/empathy-presence-chooser.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 64aa797..ee92829 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -111,6 +111,7 @@ typedef struct {
 	PresenceChooserEntryType previous_type;
 
 	TpAccountManager *account_manager;
+	GdkPixbuf *not_favorite_pixbuf;
 } EmpathyPresenceChooserPriv;
 
 /* States to be listed in the menu.
@@ -327,6 +328,7 @@ presence_chooser_is_preset (EmpathyPresenceChooser *self)
 static void
 presence_chooser_set_favorite_icon (EmpathyPresenceChooser *self)
 {
+	EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
 	GtkWidget *entry;
 	PresenceChooserEntryType type;
 
@@ -345,9 +347,9 @@ presence_chooser_set_favorite_icon (EmpathyPresenceChooser *self)
 		}
 		else {
 			/* custom entries can be favorited */
-			gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+			gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (entry),
 				           GTK_ENTRY_ICON_SECONDARY,
-					   "empathy-unstarred");
+					   priv->not_favorite_pixbuf);
 			gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
 					 GTK_ENTRY_ICON_SECONDARY,
 					 _("Click to make this status a favorite"));
@@ -807,6 +809,22 @@ presence_chooser_connectivity_state_change (EmpathyConnectivity *connectivity,
 	presence_chooser_update_sensitivity (chooser);
 }
 
+/* Create a greyed version of the 'favorite' icon */
+static GdkPixbuf *
+create_not_favorite_pixbuf (void)
+{
+	GdkPixbuf *favorite, *result;
+
+	favorite = empathy_pixbuf_from_icon_name ("emblem-favorite",
+						  GTK_ICON_SIZE_MENU);
+
+	result = gdk_pixbuf_copy (favorite);
+	gdk_pixbuf_saturate_and_pixelate (favorite, result, 1.0, TRUE);
+
+	g_object_unref (favorite);
+	return result;
+}
+
 static void
 empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
 {
@@ -817,6 +835,10 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
 
 	chooser->priv = priv;
 
+	/* Create the not-favorite icon */
+	priv->not_favorite_pixbuf = create_not_favorite_pixbuf ();
+	g_assert (priv->not_favorite_pixbuf != NULL);
+
 	presence_chooser_create_model (chooser);
 
 	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (chooser),
@@ -924,6 +946,7 @@ presence_chooser_finalize (GObject *object)
 	g_object_unref (priv->idle);
 
 	g_object_unref (priv->connectivity);
+	g_object_unref (priv->not_favorite_pixbuf);
 
 	G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
 }



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