[Glade-users] [glade-users] Using a global variable for GladeXML object?



When I create my applications using glade, I create and use the gladeXML 
object in an initialize function and store all references to widgets I 
will need later in a structure declared in main(). I pass the necessary 
widgets to callbacks, and then I call g_object_unref() on the gladeXML 
object and return. I do this mainly because I try to avoid global 
variables because that's what I learned somewhere along the way.

I see that a lot of people simply declare the gladeXML object as a 
global variable and use glade_xml_get_widget whenever they need to 
access a widget throughout their code.

I'm curious as to what people's thoughts are on this? Is there a 
"conventional" way? Are there major drawbacks to the latter?
 

- Micah Carrick
  Freelance Developer
  http://www.micahcarrick.com | http://www.gtkforums.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]