[totem] icon-helpers: Use the theme's foreground color to render the symbolics
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] icon-helpers: Use the theme's foreground color to render the symbolics
- Date: Sun, 7 Dec 2014 17:10:10 +0000 (UTC)
commit fd9b1d9d0c6f02a4c4868c8f227c3d4f97ccaf3c
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Nov 26 20:28:29 2014 +0100
icon-helpers: Use the theme's foreground color to render the symbolics
https://bugzilla.gnome.org/show_bug.cgi?id=740776
src/icon-helpers.c | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/icon-helpers.c b/src/icon-helpers.c
index d1d8541..08d556a 100644
--- a/src/icon-helpers.c
+++ b/src/icon-helpers.c
@@ -315,16 +315,29 @@ load_icon (Totem *totem,
int size,
gboolean with_border)
{
+ GApplication *app;
GdkScreen *screen;
+ GIcon *icon;
+ GList *windows;
+ GtkIconInfo *info;
GtkIconTheme *theme;
- GdkPixbuf *icon, *ret;
+ GtkStyleContext *context;
+ GdkPixbuf *pixbuf, *ret;
guchar *pixels;
int rowstride;
int x, y;
+ app = g_application_get_default ();
+ windows = gtk_application_get_windows (GTK_APPLICATION (app));
+ if (windows == NULL)
+ return NULL;
+
+ icon = g_themed_icon_new (name);
screen = gdk_screen_get_default ();
theme = gtk_icon_theme_get_for_screen (screen);
- icon = gtk_icon_theme_load_icon (theme, name, size, 0, NULL);
+ info = gtk_icon_theme_lookup_by_gicon (theme, icon, size, GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
+ context = gtk_widget_get_style_context (GTK_WIDGET (windows->data));
+ pixbuf = gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL);
ret = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
TRUE,
@@ -352,12 +365,14 @@ load_icon (Totem *totem,
}
/* Put the icon in the middle */
- gdk_pixbuf_copy_area (icon, 0, 0,
- gdk_pixbuf_get_width (icon), gdk_pixbuf_get_height (icon),
+ gdk_pixbuf_copy_area (pixbuf, 0, 0,
+ gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
ret,
- (THUMB_SEARCH_SIZE - gdk_pixbuf_get_width (icon)) / 2,
- (THUMB_SEARCH_HEIGHT - gdk_pixbuf_get_height (icon)) / 2);
+ (THUMB_SEARCH_SIZE - gdk_pixbuf_get_width (pixbuf)) / 2,
+ (THUMB_SEARCH_HEIGHT - gdk_pixbuf_get_height (pixbuf)) / 2);
+ g_object_unref (pixbuf);
+ g_object_unref (info);
g_object_unref (icon);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]