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.
This commit is contained in:
parent
86f1854edf
commit
0dcf353ac2
2 changed files with 6 additions and 55 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue