List Info

Thread: how to replicate a glade designed window?




how to replicate a glade designed window?
country flaguser name
United States
2008-05-19 17:46:43
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.

Thanks,
Dave
_______________________________________________
Glade-users maillist  -  Glade-userslists.ximian.com

http://lists.ximian.com/mailman/listinfo/glade-users

Re: how to replicate a glade designed window?
user name
2008-05-19 23:28:30
On Mon, May 19, 2008 at 7:46 PM,  <dcottingham00comcast.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
_______________________________________________
Glade-users maillist  -  Glade-userslists.ximian.com

http://lists.ximian.com/mailman/listinfo/glade-users

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )