[nautilus] places-sidebar: don't manually highlight the symbolic eject icon



commit a21d27b66fa307adaf87918f5feb2be44d52fdca
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Sep 7 10:54:56 2011 -0400

    places-sidebar: don't manually highlight the symbolic eject icon
    
    Set the right style class and state when rendering the icon, so the
    theming engine can fetch the right color from the theme and color the
    symbolic icon automatically.

 src/nautilus-places-sidebar.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index d8f6bfb..5970c4e 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -221,6 +221,7 @@ get_eject_icon (NautilusPlacesSidebar *sidebar,
 	int icon_size;
 	GtkIconTheme *icon_theme;
 	GtkStyleContext *style;
+	GtkStateFlags state;
 
 	icon_theme = gtk_icon_theme_get_default ();
 	icon_size = nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
@@ -228,17 +229,23 @@ get_eject_icon (NautilusPlacesSidebar *sidebar,
 	icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, icon_size, 0);
 
 	style = gtk_widget_get_style_context (GTK_WIDGET (sidebar));
+	state = gtk_widget_get_state_flags (GTK_WIDGET (sidebar));
+
+	gtk_style_context_save (style);
+	gtk_style_context_add_class (style, GTK_STYLE_CLASS_IMAGE);
+
+	if (highlighted) {
+		state |= GTK_STATE_FLAG_PRELIGHT;
+	}
+
+	gtk_style_context_set_state (style, state);
+
 	eject = gtk_icon_info_load_symbolic_for_context (icon_info,
 							 style,
 							 NULL,
 							 NULL);
 
-	if (highlighted) {
-		GdkPixbuf *high;
-		high = eel_create_spotlight_pixbuf (eject);
-		g_object_unref (eject);
-		eject = high;
-	}
+	gtk_style_context_restore (style);
 
 	g_object_unref (icon);
 	gtk_icon_info_free (icon_info);



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