[geary] Star icon in message viewer too light w/ dark theme: Closes bgo#724748



commit f8d71f51a4ffd6dd0b1b5c3bcac8febc2525d6d1
Author: Wolfgang Steitz <wolfer7 web de>
Date:   Mon Feb 24 15:30:24 2014 -0800

    Star icon in message viewer too light w/ dark theme: Closes bgo#724748

 src/client/components/icon-factory.vala            |   21 ++++++++++++++++++++
 .../conversation-viewer/conversation-web-view.vala |    5 +++-
 2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/src/client/components/icon-factory.vala b/src/client/components/icon-factory.vala
index d566855..c1478be 100644
--- a/src/client/components/icon-factory.vala
+++ b/src/client/components/icon-factory.vala
@@ -139,5 +139,26 @@ public class IconFactory {
         // Default: missing image icon.
         return get_missing_icon(size, flags);
     }
+    
+    /**
+     * Loads a symbolic icon into a pixbuf, where the color-key has been switched to the provided
+     * color.
+     */
+    public Gdk.Pixbuf? load_symbolic_colored(string icon_name, int size, Gdk.RGBA color,
+        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(color);
+            } catch (Error e) {
+                warning("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 88e7acc..56e85c0 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -13,6 +13,7 @@ public class ConversationWebView : WebKit.WebView {
     private const string USER_CSS = "user-message.css";
     private const string STYLE_NAME = "STYLE";
     private const string PREVENT_HIDE_STYLE = "nohide";
+    private Gdk.RGBA conversation_icon_color;
     
     // HTML element that contains message DIVs.
     public WebKit.DOM.HTMLDivElement? container { get; private set; default = null; }
@@ -141,6 +142,7 @@ public class ConversationWebView : WebKit.WebView {
         container = _container as WebKit.DOM.HTMLDivElement;
         assert(container != null);
         
+        conversation_icon_color.parse("#888888");
         // Load the icons.
         set_icon_src("#email_template .menu .icon", "go-down-symbolic");
         set_icon_src("#email_template .starred .icon", "starred-symbolic");
@@ -203,7 +205,8 @@ public class ConversationWebView : WebKit.WebView {
         try {
             // Load icon.
             uint8[]? icon_content = null;
-            Gdk.Pixbuf? pixbuf = IconFactory.instance.load_symbolic(icon_name, 16, get_style_context());
+            Gdk.Pixbuf? pixbuf = IconFactory.instance.load_symbolic_colored(icon_name, 16, 
+                conversation_icon_color);
             if (pixbuf != null)
                 pixbuf.save_to_buffer(out icon_content, "png"); // Load as PNG.
             


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