[gtk+] Make sure icons update on theme change
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Make sure icons update on theme change
- Date: Tue, 5 Jan 2016 03:13:57 +0000 (UTC)
commit f63e8edec68a158910f5f971b5f47cb9b51825cb
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 4 21:22:11 2016 -0500
Make sure icons update on theme change
Gadgets don't connect to style-changed for widget nodes, and
GtkImage uses its widget node for the icon helper. The visible
effect of this is that symbolic icons don't change color when
switching to the dark variant of Adwaita.
Fix this by manually invalidating the icon helper.
gtk/gtkiconhelper.c | 2 +-
gtk/gtkiconhelperprivate.h | 1 +
gtk/gtkimage.c | 10 ++++++++++
3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 3671c5f..73f105f 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -48,7 +48,7 @@ struct _GtkIconHelperPrivate {
G_DEFINE_TYPE_WITH_PRIVATE (GtkIconHelper, gtk_icon_helper, GTK_TYPE_CSS_GADGET)
-static void
+void
gtk_icon_helper_invalidate (GtkIconHelper *self)
{
if (self->priv->rendered_surface != NULL)
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h
index 291fb40..f4bdcd4 100644
--- a/gtk/gtkiconhelperprivate.h
+++ b/gtk/gtkiconhelperprivate.h
@@ -138,6 +138,7 @@ gboolean _gtk_icon_helper_get_force_scale_pixbuf (GtkIconHelper *self);
void _gtk_icon_helper_set_force_scale_pixbuf (GtkIconHelper *self,
gboolean force_scale);
+void gtk_icon_helper_invalidate (GtkIconHelper *self);
G_END_DECLS
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 82f7d7c..703515b 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1915,6 +1915,16 @@ gtk_image_style_updated (GtkWidget *widget)
{
GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = image->priv;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+ if (context)
+ {
+ GtkCssStyleChange *change = gtk_style_context_get_change (context);
+
+ if (change && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_ICON))
+ gtk_icon_helper_invalidate (priv->icon_helper);
+ }
GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]