Creating widgets using GtkBuilder

Posted by user72943 on Ask Ubuntu See other posts from Ask Ubuntu or by user72943
Published on 2012-07-01T22:17:18Z Indexed on 2012/07/02 15:24 UTC
Read the original article Hit count: 259

I am using Glade to design a Box with widgets and then load these widgets into my UI at run-time. To create each Box with widgets at run-time, I create a new GtkBuilder, call add_from_string passing in the text from the .ui file Glade creates, and then use the object returned from get_object("box1") in the UI. I know I could create the widgets with code, but for now, I'd like to use the .ui files Glade creates. It seems inefficient though to instantiate a new GtkBuilder object and the wasted Window object for every Box I want to create. Is there a more efficient method to load .ui files without creating a new GtkWidget object and wasted Window object?

Thanks, Vance

© Ask Ubuntu or respective owner

Related posts about application-development

Related posts about gtk3