From 0dcf353ac2100a3c9a6f8f1911e6ab43bf579bf1 Mon Sep 17 00:00:00 2001 From: Wolfgang Steitz Date: Wed, 29 Jan 2014 18:00:35 -0800 Subject: [PATCH] Fix unstarred icon's interior from selection color: Closes bgo#714426 This deals with both the star and unread icon, so both are good now. Need to clean up the rest of the conversation list's selection probs, bgo#723265. Also would like to reduce the intensity of the icons, bgo#720771. --- src/client/components/icon-factory.vala | 50 ------------------- .../formatted-conversation-data.vala | 11 ++-- 2 files changed, 6 insertions(+), 55 deletions(-) diff --git a/src/client/components/icon-factory.vala b/src/client/components/icon-factory.vala index 63cc5dc6..1fd9f5b8 100644 --- a/src/client/components/icon-factory.vala +++ b/src/client/components/icon-factory.vala @@ -25,16 +25,7 @@ public class IconFactory { public Gdk.Pixbuf application_icon { get; private set; } public const int UNREAD_ICON_SIZE = 16; - public Gdk.Pixbuf unread { get; private set; } - public Gdk.Pixbuf read { get; private set; } - public Gdk.Pixbuf unread_colored { get; private set; } - public Gdk.Pixbuf read_colored { get; private set; } - public const int STAR_ICON_SIZE = 16; - public Gdk.Pixbuf starred { get; private set; } - public Gdk.Pixbuf unstarred { get; private set; } - public Gdk.Pixbuf starred_colored { get; private set; } - public Gdk.Pixbuf unstarred_colored { get; private set; } private Gtk.IconTheme icon_theme { get; private set; } @@ -53,19 +44,6 @@ public class IconFactory { // Load icons here. application_icon = load("geary", APPLICATION_ICON_SIZE); - unread = load("unread-symbolic", UNREAD_ICON_SIZE); - read = load("read-symbolic", UNREAD_ICON_SIZE); - starred = load("star-symbolic", STAR_ICON_SIZE); - unstarred = load("unstarred-symbolic", STAR_ICON_SIZE); - - Gdk.RGBA gray_color = Gdk.RGBA(); - gray_color.parse(CountBadge.UNREAD_BG_COLOR); - - // Load pre-colored symbolic icons here. - read_colored = load_symbolic_colored("read-symbolic", UNREAD_ICON_SIZE, gray_color); - unread_colored = load_symbolic_colored("unread-symbolic", STAR_ICON_SIZE, gray_color); - starred_colored = load_symbolic_colored("star-symbolic", STAR_ICON_SIZE, gray_color); - unstarred_colored = load_symbolic_colored("unstarred-symbolic", STAR_ICON_SIZE, gray_color); } public void init() { @@ -145,34 +123,6 @@ public class IconFactory { icon_theme.lookup_icon("document-symbolic", size, flags); } - /** - * Loads a symbolic icon into a pixbuf, where the color-key has been switched to the provided - * color, or black if no color is set. - */ - public Gdk.Pixbuf? load_symbolic_colored(string icon_name, int size, Gdk.RGBA? color = null, - Gtk.IconLookupFlags flags = 0) { - Gtk.IconInfo? icon_info = icon_theme.lookup_icon(icon_name, size, flags); - - // Default to black if no color provided. - if (color == null) { - color = Gdk.RGBA(); - color.red = color.green = color.blue = 0.0; - color.alpha = 1.0; - } - - // 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); - } - 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); diff --git a/src/client/conversation-list/formatted-conversation-data.vala b/src/client/conversation-list/formatted-conversation-data.vala index 19bc6138..66447397 100644 --- a/src/client/conversation-list/formatted-conversation-data.vala +++ b/src/client/conversation-list/formatted-conversation-data.vala @@ -336,8 +336,9 @@ public class FormattedConversationData : Geary.BaseObject { // Unread indicator. if (is_unread || hover) { - Gdk.Pixbuf read_icon = is_unread ? IconFactory.instance.unread_colored - : IconFactory.instance.read_colored; + Gdk.Pixbuf read_icon = IconFactory.instance.load_symbolic( + is_unread ? "unread-symbolic" : "read-symbolic", + IconFactory.UNREAD_ICON_SIZE, widget.get_style_context()); Gdk.cairo_set_source_pixbuf(ctx, read_icon, cell_area.x + LINE_SPACING, unread_y); ctx.paint(); } @@ -345,9 +346,9 @@ public class FormattedConversationData : Geary.BaseObject { // Starred indicator. if (is_flagged || hover) { int star_y = cell_area.y + (cell_area.height / 2) + (display_preview ? LINE_SPACING : 0); - - Gdk.Pixbuf starred_icon = is_flagged ? IconFactory.instance.starred_colored - : IconFactory.instance.unstarred_colored; + Gdk.Pixbuf starred_icon = IconFactory.instance.load_symbolic( + is_flagged ? "starred-symbolic" : "unstarred-symbolic", + IconFactory.STAR_ICON_SIZE, widget.get_style_context()); Gdk.cairo_set_source_pixbuf(ctx, starred_icon, cell_area.x + LINE_SPACING, star_y); ctx.paint(); }