libglade's _new() function has a "root" parameter:
http://developer.gnome.org/doc/API/libglade/gladexml.html#GLADE-XML-NEW

This is necessary because libglade otherwise instantiates all the items
in the file. Does GtkBuilder instead only instantiate the objects when
you actually use gtk_builder_get_object()? 


I also think that the memory management of the result of
gtk_builder_get_object() should be made clearer. It was never very clear
for glade_xml_get_widget(), but it's more complicated now that we can
get objects as well as widgets.

For widgets, I guess that it's like this:
1. For child widgets, such as GtkButton, they belong to their parent
containers and will be destroyed by them when the containers are
destroyed, so you don't need to call g_object_unref() or
gtk_widget_destroy().
2. For top-level windows, such as GtkWindow, they should be destroyed
with gtk_widget_destroy() when you are finished with them.

But for objects, I guess that:
3. For objects, such as GtkTreeModel, g_object_unref() should be called.
  This would require that a reference is given when
glade_xml_get_widget() is called a second time, as well as the first
time. This would be inconsistent with other GTK+ API, but it does not
seem sensible to expect the application code to know when the result has
just been instantiated rather than simply returned again.


And it would be nice to know whether the objects are reference/owned at
all by the GtkBuilder instance? For instance, should we expect the
widgets to be destroyed when the GtkBuilder instance is unreferenced? I
guess not, but it should be stated.


-- 
Murray Cumming
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to