Re: how to "dynamically unload" interfaces with libglade
- From: Roger Leigh <rleigh whinlatter ukfsn org>
- To: Yiannis <odysseus lost gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: how to "dynamically unload" interfaces with libglade
- Date: Fri, 14 Oct 2005 19:16:41 +0100
Yiannis <odysseus lost gmail com> writes:
GladeXML *Xml1, *Xml2;
Xml1 = glade_xml_new("foo.glade", NULL, NULL);
Xml2 = glade_xml_new("bar.glade", NULL, NULL);
At some point I want to destroy and unreference Xml2... What is the
"proper" way to do so? Using g_object_unref??
Yes. For example, in an object finaliser (my mainwindow contains the
GladeXML object):
static void
cse_mainwindow_finalize (CseMainwindow *window)
{
g_return_if_fail(CSE_IS_MAINWINDOW(window));
/* Free the Glade XML interface description. */
if (window->xml)
{
g_object_unref(G_OBJECT(window->xml));
window->xml = NULL;
}
[...]
GObjectClass *parent_object_class = G_OBJECT_CLASS(parent_class);
if (parent_object_class->finalize)
parent_object_class->finalize(G_OBJECT(window));
}
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]