[Glade-users] how to replicate a glade designed window?
Tristan Van Berkom
tristan.van.berkom at gmail.com
Tue May 20 00:28:30 EDT 2008
On Mon, May 19, 2008 at 7:46 PM, <dcottingham00 at comcast.net> wrote:
> Suppose I have used glade to design a window for displaying a view, but I want my application to be able to fire up multiple of these windows at the same time, each showing this kind of view of a different object instance. I confess I cannot figure out how to do this. It seems you'd need to somehow clone the whole widget tree.
>
> Can someone take pity on me and explain how this is done? This has to be a really elementary question, but I can't find the answer.
Just do something like this:
for (i = 0...items) {
xml = glade_xml_new (...);
if ((widgets[i] = glade_xml_get_widget (...)) == NULL)
error ();
/* Here you need to deal with the limitation of having to use a
GtkWindow toplevel,
* so assuming its a normal widget you'll have to do something like this:
*/
toplevel = glade_xml_get_widget (...);
g_object_ref (widgets[i]);
gtk_container_remove (widget from the toplevel);
gtk_widget_destroy (the toplevel);
/* and always dont forget to not leek the GladeXML */
g_object_unref (xml);
}
Note that in the GtkBuilder api you can do exactly the same.
Cheers,
-Tristan
More information about the Glade-users
mailing list