summaryrefslogtreecommitdiff
path: root/gtk/gtkicontheme.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-11-24 21:28:42 -0500
committerCarlos Garnacho <carlosg@gnome.org>2010-12-04 15:39:45 +0100
commitbbca96044e931638acc75b954b30482cc2571703 (patch)
treeb28784d64f82e952be52c186e9bc7f70b183a8d4 /gtk/gtkicontheme.c
parentab0a8fc17f91a18ecca64c50f41bed7e1a8ce4fb (diff)
downloadgtk+-bbca96044e931638acc75b954b30482cc2571703.tar.gz
Fix memory handling when dealing with colors
Diffstat (limited to 'gtk/gtkicontheme.c')
-rw-r--r--gtk/gtkicontheme.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 2211020c4f..1b6f1e5986 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3274,8 +3274,10 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
{
GdkPixbuf *pixbuf;
GdkRGBA *color = NULL;
+ GdkRGBA rgba;
gchar *css_fg, *css_success;
gchar *css_warning, *css_error;
+ GtkStateFlags state;
if (!icon_info->filename ||
!g_str_has_suffix (icon_info->filename, "-symbolic.svg"))
@@ -3288,7 +3290,9 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
if (was_symbolic)
*was_symbolic = TRUE;
- if (gtk_style_context_lookup_color (context, "color", color))
+ state = gtk_style_context_get_state (context);
+ gtk_style_context_get (context, state, "color", &color, NULL);
+ if (color)
{
css_fg = gdk_rgba_to_css (color);
gdk_rgba_free (color);
@@ -3296,23 +3300,14 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
css_success = css_warning = css_error = NULL;
- if (gtk_style_context_lookup_color (context, "success_color", color))
- {
- css_success = gdk_rgba_to_css (color);
- gdk_rgba_free (color);
- }
+ if (gtk_style_context_lookup_color (context, "success_color", &rgba))
+ css_success = gdk_rgba_to_css (&rgba);
- if (gtk_style_context_lookup_color (context, "warning_color", color))
- {
- css_warning = gdk_rgba_to_css (color);
- gdk_rgba_free (color);
- }
+ if (gtk_style_context_lookup_color (context, "warning_color", &rgba))
+ css_warning = gdk_rgba_to_css (&rgba);
- if (gtk_style_context_lookup_color (context, "error_color", color))
- {
- css_error = gdk_rgba_to_css (color);
- gdk_rgba_free (color);
- }
+ if (gtk_style_context_lookup_color (context, "error_color", &rgba))
+ css_error = gdk_rgba_to_css (&rgba);
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
css_fg, css_success,