void on_app_activate()
{
// Load the GtkBuilder file and instantiate its widgets:
auto refBuilder = Gtk::Builder::create();
try
{
refBuilder->add_from_resource("/velsd/eu/q2/gui/q2.ui");
:
** (q2:40727): CRITICAL **: 11:39:18.060:
unhandled exception (type Glib::Error) in signal handler:
domain: g-resource-error-quark
code : 0
what : The resource at “/velsd/eu/q2/gui/q2.ui” does not exist
You’re making a GResource bundle (why?), which means you have to do something like Gio.Resource.load + Gio.resources_register to then access the resources the usual way.
I told you what’s wrong with your version: you’re compiling the resources into a bundle (as opposed to compiling them into your executable directly, which is what C/C++ applications typically do), but you’re never loading that bundle at runtime.
which finally started to work after I understood a privileges issue and solved it from the command line
cd /home/danny/prog/bron/gcc/q2/build/meson.run.linux.x86_64.Local
meson install
ninja: Entering directory `/home/danny/prog/bron/gcc/q2/build/meson.run.linux.x86_64.Local'
ninja: no work to do.
Installing /home/danny/prog/bron/gcc/q2/src/gui/q2.ui to /usr/local/share/q2
Installation failed due to insufficient permissions.
Attempt to use /usr/bin/X11/sudo to gain elevated privileges? [y/n] y
Installing /home/danny/prog/bron/gcc/q2/src/gui/q2.ui to /usr/local/share/q2
Well, now you’re no longer using resources (as in GResource), you’re now installing a file and just using that. That works, too.
What I was saying is that you should either:
Instead of making a resource bundle, just compile the resources directly into your program. To do that, remove gresource_bundle (and also install, install_dir) from your gnome.compile_resources invocation.
Alternatively, if you insist on making a resource bundle, you should load the bundle, by calling Gio.Resource.load, then Gio.resources_register in your application code.