gtk_style_context_reset_widgets() should reload icon theme
GNOME Mines allows to change the theme of its board. A Mines theme is composed of two things:
- a CSS file that will be used for theming, as the board is a GtkGrid subclass, with inside it some GtkButton-subclass (Tile) objects;
- a list of SVG files, that are loaded in the GtkIconTheme (add_search_path() first, then a replacement of the previously added path), and then used by the CSS file using
background-image: -gtk-icontheme('name-of-the-icon');
declarations.
The current Gtk3 code uses a is working correctly (even when removing some old code for manually cleaning things).gdk_window_invalidate_rect()
call to ensure the widgets are “really” redrawn completely when the theme is changed, with all images reloaded
In Gtk4, I cannot find such a method: the gtk_style_context_reset_widgets()
call cleans the CSS properties, but not the CSS image cache, so the icons are not updated; just hovering the Tile widgets with cursor cleans things of course (as the GtkIconTheme is updated).
So, I think that gtk_style_context_reset_widgets()
should clean the CSS image cache and reload images from the GtkIconTheme. Or, are there other ways to do that in Gtk4?