Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libglade/ChangeLog,v
retrieving revision 1.336
diff -u -d -p -r1.336 ChangeLog
--- ChangeLog	4 Jan 2006 01:28:06 -0000	1.336
+++ ChangeLog	14 Jan 2006 12:11:39 -0000
@@ -1,3 +1,19 @@
+2006-01-14  Johan Dahlin  <jdahlin@async.com.br>
+
+	* glade/glade-xml.c (glade_xml_set_common_params): 
+	Use weakrefs instead of ::destroy to clean object properties.
+	Only set name and accessibility info for GtkWidget
+	(glade_register_widget): Allow GObjects to be registered
+
+2006-01-06  Johan Dahlin  <jdahlin@async.com.br>
+
+	* examples/sizegroup.glade:
+	* glade/glade-gtk.c: (set_sizegroup), (_glade_init_gtk_widgets):
+	* glade/glade-xml.c: (glade_register_widget),
+	(glade_xml_set_common_params):
+
+	Add support for GtkSizeGroup, add simple example.
+
 2006-01-04  Tor Lillqvist  <tml@novell.com>
 
 	* glade/glade-init.c (DllMain, replace_prefix, get_libdir): Add
Index: glade/glade-xml.c
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-xml.c,v
retrieving revision 1.111
diff -u -d -p -r1.111 glade-xml.c
--- glade/glade-xml.c	29 Nov 2004 11:05:16 -0000	1.111
+++ glade/glade-xml.c	14 Jan 2006 12:11:39 -0000
@@ -888,27 +888,15 @@ glade_xml_destroy_signals(char *key, GLi
 }
 
 static void
-remove_data_func(gpointer key, gpointer value, gpointer user_data)
-{
-    GObject *object = value;
-
-    g_object_set_qdata(object, glade_xml_tree_id, NULL);
-    g_object_set_qdata(object, glade_xml_name_id, NULL);
-}
-
-static void
 glade_xml_finalize(GObject *object)
 {
     GladeXML *self = GLADE_XML(object);
     GladeXMLPrivate *priv = self->priv;
-	
+    
     g_free(self->filename);
     self->filename = NULL;
 
     if (priv) {
-	/* remove data items from all the widgets that are still
-         * live. */
-	g_hash_table_foreach(priv->name_hash, remove_data_func, self);
 	/* strings are owned in the GladeInterface structure */
 	g_hash_table_destroy(priv->name_hash);
 
@@ -1213,7 +1201,7 @@ glade_register_widget(GType type,
     GladeWidgetBuildData *data;
     gpointer old_data;
 
-    g_return_if_fail(g_type_is_a(type, GTK_TYPE_WIDGET));
+    g_return_if_fail(g_type_is_a(type, G_TYPE_OBJECT));
 
     if (glade_build_data_id == 0)
 	glade_build_data_id = g_quark_from_static_string(glade_build_data_key);
@@ -1973,21 +1961,11 @@ glade_xml_handle_internal_child(GladeXML
     glade_xml_set_common_params(self, child, child_info->child);
 }
 
-
 static void
-glade_xml_widget_destroy(GtkObject *object, GladeXML *xml)
+glade_xml_object_weak_notify(gpointer data, GObject *object)
 {
-    gchar *name;
-
-    g_return_if_fail(GTK_IS_OBJECT(object));
-    g_return_if_fail(GLADE_IS_XML(xml));
-
-    name = g_object_get_qdata(G_OBJECT(object), glade_xml_name_id);
-
-    if (!name) return;
-    g_hash_table_remove(xml->priv->name_hash, name);
-    g_object_set_qdata(G_OBJECT(object), glade_xml_tree_id, NULL);
-    g_object_set_qdata(G_OBJECT(object), glade_xml_name_id, NULL);
+    g_object_set_qdata(object, glade_xml_tree_id, NULL);
+    g_object_set_qdata(object, glade_xml_name_id, NULL);
 }
 
 /**
@@ -2015,8 +1993,11 @@ glade_xml_set_common_params(GladeXML *se
     glade_xml_add_signals(self, widget, info);
     glade_xml_add_accels(self, widget, info);
 
-    gtk_widget_set_name(widget, info->name);
-    glade_xml_add_accessibility_info(self, widget, info);
+    if (GTK_IS_WIDGET(widget))
+    {
+        gtk_widget_set_name(widget, info->name);
+        glade_xml_add_accessibility_info(self, widget, info);
+    }
 
     /* store this information as data of the widget. */
     g_object_set_qdata(G_OBJECT(widget), glade_xml_tree_id, self);
@@ -2024,14 +2005,13 @@ glade_xml_set_common_params(GladeXML *se
     /* store widgets in hash table, for easy lookup */
     g_hash_table_insert(self->priv->name_hash, info->name, widget);
 
-    /* set up function to remove widget from GladeXML object's
-     * name_hash on destruction. Use connect_object so the handler is
-     * automatically removed on finalization of the GladeXML
-     * object. */
-    g_signal_connect_object(G_OBJECT(widget), "destroy",
-			    G_CALLBACK(glade_xml_widget_destroy),
-			    G_OBJECT(self), 0);
-
+    /* Reset the object properties in finalize,
+     * name_hash is cleaned in GladeXML's finalize
+     */
+    g_object_weak_ref(G_OBJECT(widget),
+		      (GWeakNotify)glade_xml_object_weak_notify,
+		      NULL);
+    
     /* handle any deferred properties using this widget */
     tmp = self->priv->deferred_props;
     while (tmp) {
