GNOME Bugzilla – Bug 743341
GtkImage does not correctly reflect icon theme changes.
Last modified: 2015-01-27 04:09:12 UTC
In docs I see that: /** * gtk_image_new_from_gicon: * @icon: an icon * @size: (type int): a stock icon size * * Creates a #GtkImage displaying an icon from the current icon theme. * If the icon name isn’t known, a “broken image” icon will be * displayed instead. If the current icon theme is changed, the icon * will be updated appropriately. * * Returns: a new #GtkImage displaying the themed icon * * Since: 2.14 **/ but icon will be updated only after user interacts with it. To update icon theme accordingly, I need to use: g_signal_connect_swapped(gtk_icon_theme_get_default(),"changed",G_CALLBACK(on_theme_changed),img); static void on_theme_changed(GtkWidget *img, GObject *object) { int size = gtk_image_get_pixel_size(GTK_IMAGE(img)); GIcon* icon; gtk_image_get_gicon(GTK_IMAGE(img),&icon,NULL); gtk_image_set_from_gicon(GTK_IMAGE(img),&icon,GTK_ICON_SIZE_INVALID); gtk_image_set_pixel_size(GTK_IMAGE(img),size); }
commit 11d70f1ac30dd491d9d8dac9b9e2c31cee073cc9 Author: Benjamin Otte <otte@redhat.com> Date: Tue Jan 27 00:25:05 2015 +0100 css: Add a -gtk-icon-theme CSS property The property is useless to set (it only allows 'initial', 'inherit' and 'unset' as values), but it is used to track changes to the icon theme. And as such, it can ensure that widgets can track when they need to reload icons. https://bugzilla.gnome.org/show_bug.cgi?id=743341