From d2881d901bc057328d4096bb86830198816fd1a2 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 14 Mar 2015 15:41:34 +0100 Subject: [PATCH] cellrendererpixbuf: Always follow state Applications forget to set the follow-state property and then some themes used a style where normal symbolic icons have the same color as prelit or selected backgrounds and that suddenly made icons invisible and who wants that? https://bugzilla.gnome.org/show_bug.cgi?id=746201 --- gtk/gtkcellrendererpixbuf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index 54acb1a5b6..7151fc9827 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -111,6 +111,7 @@ gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf) priv->icon_helper = _gtk_icon_helper_new (); _gtk_icon_helper_set_force_scale_pixbuf (priv->icon_helper, TRUE); priv->icon_size = GTK_ICON_SIZE_MENU; + priv->follow_state = TRUE; } static void @@ -237,6 +238,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class) * according to the #GtkCellRendererState. * * Since: 2.8 + * + * Deprecated: 3.16: Cell renderers always follow state. */ g_object_class_install_property (object_class, PROP_FOLLOW_STATE, @@ -244,8 +247,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class) P_("Follow State"), P_("Whether the rendered pixbuf should be " "colorized according to the state"), - FALSE, - GTK_PARAM_READWRITE)); + TRUE, + GTK_PARAM_READWRITE | G_PARAM_DEPRECATED)); /** * GtkCellRendererPixbuf:gicon: @@ -516,7 +519,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell, GdkRectangle draw_rect; gboolean is_expander; gint xpad, ypad; - GtkStateFlags state; GtkIconHelper *icon_helper = NULL; gtk_cell_renderer_pixbuf_get_size (cell, widget, (GdkRectangle *) cell_area, @@ -537,12 +539,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell, context = gtk_widget_get_style_context (widget); gtk_style_context_save (context); - state = gtk_cell_renderer_get_state (cell, widget, flags); - - if (!priv->follow_state) - state &= ~(GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED); - - 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);