[gtk/fix-icontheme-invalidation: 3/5] image: Invalidate icon helper when icon theme changes



commit 9efcd3f420de2c5ecee3c5b7734bf7357bd4f450
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 21 12:11:15 2020 -0400

    image: Invalidate icon helper when icon theme changes
    
    This is necessary to drop the cached image.

 gtk/gtkimage.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index c4ee1642cb..92523ab970 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -110,6 +110,8 @@ static void gtk_image_measure (GtkWidget      *widget,
 
 static void gtk_image_css_changed          (GtkWidget    *widget,
                                             GtkCssStyleChange *change);
+static void gtk_image_system_setting_changed (GtkWidget        *widget,
+                                              GtkSystemSetting  seting);
 static void gtk_image_finalize             (GObject      *object);
 
 static void gtk_image_set_property         (GObject      *object,
@@ -157,6 +159,7 @@ gtk_image_class_init (GtkImageClass *class)
   widget_class->measure = gtk_image_measure;
   widget_class->unrealize = gtk_image_unrealize;
   widget_class->css_changed = gtk_image_css_changed;
+  widget_class->system_setting_changed = gtk_image_system_setting_changed;
   widget_class->grab_focus = gtk_widget_grab_focus_none;
   widget_class->focus = gtk_widget_focus_none;
 
@@ -1264,6 +1267,18 @@ gtk_image_css_changed (GtkWidget         *widget,
   image->baseline_align = 0.0;
 }
 
+static void
+gtk_image_system_setting_changed (GtkWidget        *widget,
+                                  GtkSystemSetting  setting)
+{
+  GtkImage *image = GTK_IMAGE (widget);
+
+  if (setting == GTK_SYSTEM_SETTING_ICON_THEME)
+    gtk_icon_helper_invalidate (image->icon_helper);
+
+  GTK_WIDGET_CLASS (gtk_image_parent_class)->system_setting_changed (widget, setting);
+}
+
 /**
  * gtk_image_set_pixel_size:
  * @image: a #GtkImage


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]