diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-07-11 11:22:20 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-07-16 09:35:07 -0400 |
commit | 23c5ebafcee720d608d5c8f86c89816686e8d057 (patch) | |
tree | 489d6afcd7e954d3e1e4a3452f9252d2556caba7 /gtk/gtkcellrendererpixbuf.c | |
parent | d8d4eb3faa319fb91b529c4ca9f3114986ea01c8 (diff) | |
download | gtk+-23c5ebafcee720d608d5c8f86c89816686e8d057.tar.gz |
cellrendererpix: set the IMAGE style class when rendering an icon
This way, themes can change symbolic icon colors for views, by using a
.view.image {
}
CSS selector.
https://bugzilla.gnome.org/show_bug.cgi?id=680008
Diffstat (limited to 'gtk/gtkcellrendererpixbuf.c')
-rw-r--r-- | gtk/gtkcellrendererpixbuf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index 5a3d90209f..2e36915585 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -415,12 +415,19 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell, gint calc_width; gint calc_height; gint xpad, ypad; + GtkStyleContext *context; + + context = gtk_widget_get_style_context (widget); + gtk_style_context_save (context); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE); if (!_gtk_icon_helper_get_is_empty (priv->icon_helper)) _gtk_icon_helper_get_size (priv->icon_helper, gtk_widget_get_style_context (widget), &pixbuf_width, &pixbuf_height); + gtk_style_context_restore (context); + if (priv->pixbuf_expander_open) { pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (priv->pixbuf_expander_open)); @@ -516,6 +523,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell, state = gtk_cell_renderer_get_state (cell, widget, flags); gtk_style_context_set_state (context, state); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE); g_object_get (cell, "is-expander", &is_expander, NULL); if (is_expander) |