GTK4 AboutDialog logo

I’ve mostly converted myapp from Glade/GTK3+ to GTK4, but I’ve spent a lot of time unsuccessfully trying to add the logo to the AboutDialog.

The documentation suggests it needs to be a “paintable” object. I can make a paintable object and add it, but it doesn’t seem possible to add the image file to the paintable object. I’ve probably misunderstood something fundamental here.

dialogue = Gtk.AboutDialog()
paintable = Gdk.Paintable.new_empty(200, 100)
dialogue = Gtk.AboutDialog(logo = paintable)
# get an image
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale('/home/chris/myapp.png', 5000, 2000, True)
image = Gtk.Image()
image.set_from_pixbuf(pixbuf)
# now need to set 'paintable' to a pixbuf or image.

Alternatively I have seen an example which just sets it to an existing icon - but that doesn’t work.

dialogue.set_logo_icon_name('com.github.appmaker.myapp.png')

This should work. Are you sure your image is in the right location?

1 Like

You need to remove the .png extension, and you need to make sure you follow the instructions on how to set up named theme icons: Themed Icons - GNOME Developer Documentation

1 Like

Thanks, it’s not as complicated as I thought from reading the documentation.

Thanks, you’re right about the extension. I’ve been caught out by this before because Flatpak expects extensions but the .desktop file doesn’t.