[gnome-settings-daemon] media-keys: Get the symbolic icons recoloured properly



commit 29692209f141602e25f71676465ac629b4db9ede
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 11 17:19:37 2011 +0000

    media-keys: Get the symbolic icons recoloured properly
    
    By loading them using the correct function for them to be
    recoloured. Fixes the progress bar and icon colours not matching.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641507

 plugins/media-keys/gsd-media-keys-window.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-window.c b/plugins/media-keys/gsd-media-keys-window.c
index 033e8d4..01cf5e0 100644
--- a/plugins/media-keys/gsd-media-keys-window.c
+++ b/plugins/media-keys/gsd-media-keys-window.c
@@ -196,8 +196,11 @@ load_pixbuf (GsdMediaKeysWindow *window,
              const char         *name,
              int                 icon_size)
 {
-        GtkIconTheme *theme;
-        GdkPixbuf    *pixbuf;
+        GtkIconTheme    *theme;
+        GtkIconInfo     *info;
+        GdkPixbuf       *pixbuf;
+        GtkStyleContext *context;
+        GdkRGBA          color;
 
         if (window != NULL && gtk_widget_has_screen (GTK_WIDGET (window))) {
                 theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
@@ -205,11 +208,26 @@ load_pixbuf (GsdMediaKeysWindow *window,
                 theme = gtk_icon_theme_get_default ();
         }
 
-        pixbuf = gtk_icon_theme_load_icon (theme,
+        context = gtk_widget_get_style_context (GTK_WIDGET (window));
+        gtk_style_context_get_background_color (context, GTK_STATE_NORMAL, &color);
+        info = gtk_icon_theme_lookup_icon (theme,
                                            name,
                                            icon_size,
-                                           GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK,
-                                           NULL);
+                                           GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+
+        if (info == NULL) {
+                g_warning ("Failed to load '%s'", name);
+                return NULL;
+        }
+
+        pixbuf = gtk_icon_info_load_symbolic (info,
+                                              &color,
+                                              NULL,
+                                              NULL,
+                                              NULL,
+                                              NULL,
+                                              NULL);
+        gtk_icon_info_free (info);
 
         return pixbuf;
 }



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