I have the following file structure:
.
├── resources.gresource
├── resources.xml
├── texty.py
└── texty.svg
The resources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/texty">
<file>texty.svg</file>
</gresource>
</gresources>
Compiled using:
glib-compile-resources resources.xml --target=resources.gresource
...and registered in the texty.py init function:
resources = Gio.Resource.load('./resources.gresource')
Gio.resources_register(resources)
Retrieved like this it works:
image = Gtk.Image.new_from_resource('/texty/texty.svg')
box.append(image)
...but not in the AboutDialog code:
about_dialog = Adw.AboutDialog.new()
about_dialog.set_application_name("texty")
about_dialog.set_application_icon("/texty/texty.svg")
about_dialog.present()
I get a 'broken image' displayed. No errors. This works in C-code. Is there something different I need do in python? I tried using a png with the same result.