I’m trying to define a module interface where a .so file holds part of a UI as a resource and I would like to provide a container for it (like a GtkBox or Notebook page) and have gtk_builder_new_from_resource or add_from_resource build the user interface inside that container. Is that possible? I know I could add child widgets one by one but that is a bit intimidating, especially since I would like to have it as an open interface. The XML approach is somewhat nice (after a while at least).
GObject *main_widget = gtk_builder_get_object("main_widget"); gtk_box_append(some_box, GTK_WIDGET(main_widget));
gtk_builder_get_object needs GtkBuilder* as a parameter, so that needs to be created first from builder_add_ or builder_new_. But I got something similar to work (working on a guess what exactly gtk_builder actually does) with builder_add_from_resource and then append to a box.
My problem is now that I would really like to bind the library (.so) that defines the interface with G_MODULE_BIND_LOCAL because that lets me define some predefined names to set it all up in the main program (like letting the .so provide some ID or maybe even a widget later) but then the callbacks inside the library (.so) are not visible from the main application.
Right now, I am trying to work through attribute((constructor)) on_load() and a global variable but that’s somewhat ugly.
Is there some linker magick that I am missing?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.