[Glade-users] Using glade_xml_get_widget more than once on same widget...

Tristan Van Berkom tvb at gnome.org
Wed May 23 10:16:28 EDT 2007


On Wed, 2007-05-23 at 01:19 -0700, beginner.c wrote:
> Can I use glade_xml_get_widget on the same widget but in different functions
> of my app? For example numerous functions in my app need to change the
> current page of a notebook and it would be far easier for each function to
> call glade_xml_get_widget individually to do this.

I recommend you dont do this.

Common "good practice" is:

   xml = glade_xml_new(...);

   /* Here collect all pointers to all the widgets you need */

   /* connect signals possibly by hand or with glade constructs */

   /* get rid of that bloated chunk of unneeded ram here */
   g_object_unref (xml); 

   gtk_main ();

The point here is, the GladeXML object holds a copy of the entire
glade file in structures filled with allocated strings, its big bad
and bloated and should only be used to build your app.

Cheers,
                 -Tristan




More information about the Glade-users mailing list