'GTK3 on Msys2, deprecated icons removed?

The Problem

Hello,

At my job we are developing a GTK3 application using PyGObject. As we (unfortunately) have to use Windows on our workstations, we are using Msys2+MinGW64 to have access to usual Linux libraries and shells.

Recently, after an Msys update that upgraded package mingw-w64-x86_64-adwaita-icon-theme from version 40.0-1 to 42.0-1, some icons we are using have disappeared, and warnings such as the following popped up all over the place:

(app.py:28152): Gtk-WARNING **: 14:15:37.369: Error loading theme icon 'view-refresh' for stock: Icon 'view-refresh' not present in theme Adwaita

What I have tried

I searched for the missing icons (e.g. view-refresh.png in the Adwaita icon directory, and sure enough, they were removed between the old and the new version.

The pieces of code that ran into this problem are all using the Gtk.STOCK_**** symbolic names which have been depreacted since Gtk 3.10, with the GTK documentation suggesting to use literal icon names instead. So, for example, I replaced the following code:

button = Gtk.Button()
button.set_image(Gtk.image_new_from_stock(Gtk.STOCK_REFRESH, Gtk.IconSize.SMALL_TOOLBAR))

With:

button = Gtk.Button()
button.set_image(Gtk.Image.new_from_icon_name("view-refresh", Gtk.IconSize.SMALL_TOOLBAR))

... but it kind of feels like a step backwards. Is there any cleaner way to implement this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source