GTK4 App in Vala on Windows 7 won't load PNG icons

I’m trying to get Vala with GTK 4 running on my Windows 7 machine. (I’ve been programming for a long time - but I’m new to Vala and GTK.)

I’m having the same exact problem as described in this thread:
Learner having problem with hello gtk eg - Platform - GNOME Discourse

I’ve tried all the suggestions in the thread. I can also get the icon viewer to work on my computer. I didn’t see a solution posted at the end of the thread to the problem - which is basically that GTK4 isn’t loading PNG icons. I tried copying the png DLL from the “gdk-pixbuf-2.0” folder of my MYSYS2 install directory - but that didn’t work. Thanks in advance for any help!

Gdk.Pixbuf.from_file(“images/icon.png”);

That file path may not work on Windows7. I may guess that path separator is something like “\” on old Windows. And maybe try to specify the full path, that is the path from top level directory to your icon. Another idea, maybe old Windows can not process PNG files?

But why windows 7 and GTK? When you really need windows, why not use Windows own GUI. And when you have only a 20 years old computer, than some Linux may work better than that old Windows?

I suggest

Path.buildname ("images", "icon.png");

So that GLib manages the separator itself

1 Like

Could you be suggesting Path.build_filename?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.