Before I start, I know of the existence of GResource
, however I'm using gtkmm (C++), and I'm not sure if GResource works with C++. I can't find anything along the lines Glib::GResource
, and I've been looking for a while.
Anyway, I'm writing a GUI using Gtkmm, and I want to pack the .glade file which I load within the executable, so that the executable can be run without having to have a file next to it. I'm not sure that I completely understand how GResources work, and I can't find any clear instructions anywhere.
So, using Gtkmm, how would I pack a .glade file inside my executable?
update: I've found this. (Gio::Resource), which sounds hopeful, but no documentation.
I've made some more research and found this tutorial and this documentation. Looks like what you need is Gio::Resource::lookup_data_global
. Below is C
version of my answer.
When something in glib world lacks documentation, it's time to read documentation for c. In short: with the help of glib-compile-resources and a simple xml file you build a .c
file, which can be compiled into your application. After that you can use g_resources_lookup_data
(resourceS, it's important) to load data.