summaryrefslogtreecommitdiff
path: root/gtk/gtkimage.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-04-21 12:11:15 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-04-22 19:30:48 -0400
commit679863af4fe9e1c93d8da0e4fed72ed810a19c54 (patch)
treed182e04ebe95a5491984cb001bc5c54cf74fec12 /gtk/gtkimage.c
parenta59cb5dfa6a1456d2e590d10880389b44fa3d275 (diff)
downloadgtk+-679863af4fe9e1c93d8da0e4fed72ed810a19c54.tar.gz
image: Invalidate icon helper when icon theme changes
This is necessary to drop the cached image.
Diffstat (limited to 'gtk/gtkimage.c')
-rw-r--r--gtk/gtkimage.c15
1 files changed, 15 insertions, 0 deletions
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