[geary] Render symbolic icons gray (like Nautilus): Refs bgo#720771



commit 9997d8e76b62fdc8b8b4cacce2c2f7b0d08e9739
Author: Wolfgang Steitz <wolfer7 web de>
Date:   Mon Jan 20 11:39:52 2014 -0800

    Render symbolic icons gray (like Nautilus): Refs bgo#720771
    
    This fixes most of the problems, but the icons in the toolbar
    and the Inbox icon in the sidebar are still black.

 src/client/components/icon-factory.vala            |   17 +++++++++++++++++
 .../conversation-viewer/conversation-web-view.vala |    2 +-
 src/client/sidebar/sidebar-tree.vala               |    6 +-----
 3 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/client/components/icon-factory.vala b/src/client/components/icon-factory.vala
index 3602254..63cc5dc 100644
--- a/src/client/components/icon-factory.vala
+++ b/src/client/components/icon-factory.vala
@@ -172,5 +172,22 @@ public class IconFactory {
         // Default: missing image icon.
         return get_missing_icon(size, flags);
     }
+    
+    public Gdk.Pixbuf? load_symbolic(string icon_name, int size, Gtk.StyleContext style,
+        Gtk.IconLookupFlags flags = 0) {
+        Gtk.IconInfo? icon_info = icon_theme.lookup_icon(icon_name, size, flags);
+        
+        // Attempt to load as a symbolic icon.
+        if (icon_info != null) {
+            try {
+                return icon_info.load_symbolic_for_context(style);
+            } catch (Error e) {
+                message("Couldn't load icon: %s", e.message);
+            }
+        }
+        
+        // Default: missing image icon.
+        return get_missing_icon(size, flags);
+    }
 }
 
diff --git a/src/client/conversation-viewer/conversation-web-view.vala 
b/src/client/conversation-viewer/conversation-web-view.vala
index 10d95c8..7c85a90 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -203,7 +203,7 @@ public class ConversationWebView : WebKit.WebView {
         try {
             // Load icon.
             uint8[]? icon_content = null;
-            Gdk.Pixbuf? pixbuf = IconFactory.instance.load_symbolic_colored(icon_name, 16);
+            Gdk.Pixbuf? pixbuf = IconFactory.instance.load_symbolic(icon_name, 16, get_style_context());
             if (pixbuf != null)
                 pixbuf.save_to_buffer(out icon_content, "png"); // Load as PNG.
             
diff --git a/src/client/sidebar/sidebar-tree.vala b/src/client/sidebar/sidebar-tree.vala
index 7e6331b..6699482 100644
--- a/src/client/sidebar/sidebar-tree.vala
+++ b/src/client/sidebar/sidebar-tree.vala
@@ -799,11 +799,7 @@ public class Sidebar.Tree : Gtk.TreeView {
             if (info == null)
                 return null;
             
-            // If the icon's symbolic, make it black.
-            Gdk.RGBA black = Gdk.RGBA();
-            black.red = black.green = black.blue = 0.0;
-            black.alpha = 1.0;
-            icon = info.load_symbolic(black);
+            icon = info.load_symbolic_for_context(get_style_context());
             
             if (icon == null)
                 return null;


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