[Glade-users] why using libglade is better...

Christopher Cramer crayc@greatjustice.org
Mon, 18 Oct 2004 11:23:00 -0700


On Mon, Oct 18, 2004 at 01:29:12PM -0400, Tristan Van Berkom wrote:
> If you want to re-create the popups every time you use them then you'll
> need to seperate them into seperate glade files, this way you will gain
> on RAM but loose on CPU (because your program will have to reload the
> glade file every time for your popup).

You don't actually need to put them into a separate file to be able to
recreate them. What I do is put them all in the same file, and only load
the widget (the main app window, a dialog window, etc.) that I need,
using the root argument to glade_xml_new().

The documentation for glade_xml_new() says, "Note also that the XML
parse tree is cached to speed up creating another GladeXML object for
the same file", so it shouldn't actually have to reload the glade file
for every popup. It certainly seems to me that the startup (when it loads
the main app window from the glade file) is quite a bit slower than the
popup creation, although I haven't profiled it.

-- 
Christopher Cramer <crayc@greatjustice.org>
On résiste à l'invasion des armées; on ne résiste pas à l'invasion
des idées. -- Victor Hugo