The normal approach would be to install your images to PREFIX/share/pixmaps/YOUR_APP
. For example Gnumeric installs some .png
files in /usr/share/pixmaps/gnumeric/
.
You can use GResource
to embed binary files (like images) into your executable if you really want to. The glib-compile-resources
command can be added to your build system (see also this question).
You can also use icons from the users icon theme.
You didn't write what component you want to use to display your images, so I'll assume Gtk.Image
here.
Gtk.Image
has several constructors for the purpose of loading the image:
- from_icon_name loads the image from the current icon theme (which is useful to support user themes).
- from_resource loads the image from an embedded
GResource
.
- from_file loads the image from a file.
See the main documentation of Gtk.Image
for more methods. Some other widgets have similar methods to load images (for example toolbar buttons).
You should not use from_stock
any more (There was a stock
system in Gtk+ that is being replaced by freedesktop.org icon schemas).