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
This commit is contained in:
@ -111,6 +111,7 @@ gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
|
|||||||
priv->icon_helper = _gtk_icon_helper_new ();
|
priv->icon_helper = _gtk_icon_helper_new ();
|
||||||
_gtk_icon_helper_set_force_scale_pixbuf (priv->icon_helper, TRUE);
|
_gtk_icon_helper_set_force_scale_pixbuf (priv->icon_helper, TRUE);
|
||||||
priv->icon_size = GTK_ICON_SIZE_MENU;
|
priv->icon_size = GTK_ICON_SIZE_MENU;
|
||||||
|
priv->follow_state = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -237,6 +238,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
|
|||||||
* according to the #GtkCellRendererState.
|
* according to the #GtkCellRendererState.
|
||||||
*
|
*
|
||||||
* Since: 2.8
|
* Since: 2.8
|
||||||
|
*
|
||||||
|
* Deprecated: 3.16: Cell renderers always follow state.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_FOLLOW_STATE,
|
PROP_FOLLOW_STATE,
|
||||||
@ -244,8 +247,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
|
|||||||
P_("Follow State"),
|
P_("Follow State"),
|
||||||
P_("Whether the rendered pixbuf should be "
|
P_("Whether the rendered pixbuf should be "
|
||||||
"colorized according to the state"),
|
"colorized according to the state"),
|
||||||
FALSE,
|
TRUE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkCellRendererPixbuf:gicon:
|
* GtkCellRendererPixbuf:gicon:
|
||||||
@ -516,7 +519,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
|||||||
GdkRectangle draw_rect;
|
GdkRectangle draw_rect;
|
||||||
gboolean is_expander;
|
gboolean is_expander;
|
||||||
gint xpad, ypad;
|
gint xpad, ypad;
|
||||||
GtkStateFlags state;
|
|
||||||
GtkIconHelper *icon_helper = NULL;
|
GtkIconHelper *icon_helper = NULL;
|
||||||
|
|
||||||
gtk_cell_renderer_pixbuf_get_size (cell, widget, (GdkRectangle *) cell_area,
|
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);
|
context = gtk_widget_get_style_context (widget);
|
||||||
gtk_style_context_save (context);
|
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);
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
|
||||||
|
|
||||||
g_object_get (cell, "is-expander", &is_expander, NULL);
|
g_object_get (cell, "is-expander", &is_expander, NULL);
|
||||||
|
Reference in New Issue
Block a user