Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libglade/ChangeLog,v
retrieving revision 1.329
diff -r1.329 ChangeLog
0a1,14
> 2004-12-21  Tristan Van Berkom <tvb@cvs.gnome.org>
> 	* glade-init.c: Fix for applications to load properly under win32
> 	  (Ivan Wong <email@ivanwong.info>)
> 
> 	* glade-parser.[ch]: Implement loading of glade files for glade-3
> 	  (Ivan Wong <email@ivanwong.info>)
> 
> 	* glade-xml.c: Non widget fix (This implements non-widgets cleanly
> 	  but does not change function signatures and variable names library wide
> 	  from "GtkWidget *widget" to "GObject *object").
> 
> 	* glade-private.h,glade-xml.c: Implementation of g_module_lookup for
> 	  signal handler user_data arguments.
> 	
Index: doc/tmpl/glade-parser.sgml
===================================================================
RCS file: /cvs/gnome/libglade/doc/tmpl/glade-parser.sgml,v
retrieving revision 1.5
diff -r1.5 glade-parser.sgml
69,76d68
< <!-- ##### STRUCT GladeProperty ##### -->
< <para>
< 
< </para>
< 
< @name: 
< @value: 
< 
85a78
> @lookup: 
Index: doc/tmpl/libglade-unused.sgml
===================================================================
RCS file: /cvs/gnome/libglade/doc/tmpl/libglade-unused.sgml,v
retrieving revision 1.16
diff -r1.16 libglade-unused.sgml
109a110,117
> <!-- ##### STRUCT GladeProperty ##### -->
> <para>
> 
> </para>
> 
> @name: 
> @value: 
> 
Index: glade/glade-init.c
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-init.c,v
retrieving revision 1.19
diff -r1.19 glade-init.c
103c103,109
< 	default_dir = g_build_filename (GLADE_LIBDIR, "libglade", "2.0", NULL);
---
> #ifndef G_OS_WIN32
>         default_dir = g_build_filename (GLADE_LIBDIR, "libglade", "2.0", NULL);
> #else
>         default_dir = g_win32_get_package_installation_subdirectory (NULL,
>                                                                      "libglade-2.0-0.dll",
>                                                                      "/lib/libglade/2.0");
> #endif
Index: glade/glade-parser.c
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-parser.c,v
retrieving revision 1.32
diff -r1.32 glade-parser.c
186c186
< 	state->widget->properties = (GladeProperty *)state->props->data;
---
> 	state->widget->properties = (GladePropInfo *)state->props->data;
193c193
< 	state->widget->atk_props = (GladeProperty *)state->props->data;
---
> 	state->widget->atk_props = (GladePropInfo *)state->props->data;
206c206
< 	    info->properties = (GladeProperty *)state->props->data;
---
> 	    info->properties = (GladePropInfo *)state->props->data;
329a330,331
> 	else if (!strcmp(attrs[i], "lookup"))
> 	    info.lookup = attrs[i+1][0] == 'y';
871c873
<     GladeProperty prop;
---
>     GladePropInfo prop;
914c916
< 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladeProperty));
---
> 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladePropInfo));
941c943
< 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladeProperty));
---
> 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladePropInfo));
1008c1010
< 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladeProperty));
---
> 	    state->props = g_array_new(FALSE, FALSE, sizeof(GladePropInfo));
1324a1327,1328
> 	if (info->signals[i].lookup)
> 	    xmlSetProp(node, "lookup", "yes");
1346c1350
< 	xmlNode *child;
---
> 	xmlNode *child, *packing;
1360c1364,1378
< 	for (k = 0; k < childinfo->n_properties; k++) { 
---
> 	for (j = 0; j < indent + 2; j++)
> 	    xmlNodeAddContent(child, "  ");
> 	dump_widget(child, childinfo->child, indent + 2);
> 	xmlNodeAddContent(child, "\n");
> 
> 	if (childinfo->n_properties)
>         {
>             for (j = 0; j < indent + 2; j++)
> 	        xmlNodeAddContent(child, "  ");
> 	    packing = xmlNewNode(NULL, "packing");
> 	    xmlAddChild(child, packing);
> 	    xmlNodeAddContent(packing, "\n");
>         }
> 
>         for (k = 0; k < childinfo->n_properties; k++) { 
1363,1364c1381,1382
< 	    for (j = 0; j < indent + 2; j++)
< 		xmlNodeAddContent(child, "  ");
---
> 	    for (j = 0; j < indent + 3; j++)
> 		xmlNodeAddContent(packing, "  ");
1366,1369c1384,1387
< 	    xmlSetProp(node, "name", childinfo->properties[i].name);
< 	    xmlNodeSetContent(node, childinfo->properties[i].value);
< 	    xmlAddChild(child, node);
< 	    xmlNodeAddContent(child, "\n");
---
> 	    xmlSetProp(node, "name", childinfo->properties[k].name);
> 	    xmlNodeSetContent(node, childinfo->properties[k].value);
> 	    xmlAddChild(packing, node);
> 	    xmlNodeAddContent(packing, "\n");
1372,1375c1390,1395
< 	for (j = 0; j < indent + 2; j++)
< 	    xmlNodeAddContent(child, "  ");
< 	dump_widget(child, childinfo->child, indent + 2);
< 	xmlNodeAddContent(child, "\n");
---
> 	if (childinfo->n_properties)
>         {
> 	    for (j = 0; j < indent + 2; j++)
> 	        xmlNodeAddContent(packing, "  ");
>             xmlNodeAddContent(child, "\n");
>         }
Index: glade/glade-parser.h
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-parser.h,v
retrieving revision 1.8
diff -r1.8 glade-parser.h
31,32c31,32
< typedef struct _GladeProperty GladeProperty;
< struct _GladeProperty {
---
> typedef struct _GladePropInfo GladePropInfo;
> struct _GladePropInfo {
41c41,42
<     gchar *object; /* NULL if this isn't a connect_object signal */
---
>     gchar *object; /* represents userdata, if lookup is FALSE, then do connect_object with a
>                     * widget looked up by name, otherwise g_module_lookup() */
42a44
>     guint lookup : 1;
73c75
<     GladeProperty *properties;
---
>     GladePropInfo *properties;
76c78
<     GladeProperty *atk_props;
---
>     GladePropInfo *atk_props;
96c98
<     GladeProperty *properties;
---
>     GladePropInfo *properties;
Index: glade/glade-private.h
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-private.h,v
retrieving revision 1.23
diff -r1.23 glade-private.h
66a67
>     gboolean lookup_userdata;
Index: glade/glade-xml.c
===================================================================
RCS file: /cvs/gnome/libglade/glade/glade-xml.c,v
retrieving revision 1.111
diff -r1.111 glade-xml.c
50a51,55
> /* Used for bookkeeping on the name hash */
> typedef struct {
>     gchar    *name;
>     GladeXML *xml;
> } DestroyData;
280,281c285,288
<     if (!g_module_symbol(allsymbols, signal_handler, (gpointer)&func))
< 	g_warning("could not find signal handler '%s'.", signal_handler);
---
>     if (!g_module_symbol(allsymbols,
>                          signal_handler,
>                          ((gpointer *) &func)))
>         g_warning("could not find signal handler '%s'.", signal_handler);
283,304c290,323
< 	for (; signals != NULL; signals = signals->next) {
< 	    GladeSignalData *data = signals->data;
< 	    if (data->connect_object) {
< 		GladeXML *self = glade_get_widget_tree(
< 					GTK_WIDGET(data->signal_object));
< 		GObject *other = g_hash_table_lookup(self->priv->name_hash,
< 						       data->connect_object);
< 
< 		g_signal_connect_object(data->signal_object, data->signal_name,
< 			func, other, (data->signal_after ? G_CONNECT_AFTER : 0)
< 					| G_CONNECT_SWAPPED);
< 	    } else {
< 		/* the signal_data argument is just a string, but may
< 		 * be helpful for someone */
< 		if (data->signal_after)
< 		    g_signal_connect_after(data->signal_object,
< 					   data->signal_name, func, NULL);
< 		else
< 		    g_signal_connect(data->signal_object, data->signal_name,
< 				     func, NULL);
< 	    }
< 	}
---
>         for (; signals != NULL; signals = signals->next) {
>             GladeSignalData *data = signals->data;
>             if (data->connect_object && !data->lookup_userdata) {
>                 GladeXML *self = glade_get_widget_tree
>                     (GTK_WIDGET(data->signal_object));
>                 GObject *other = g_hash_table_lookup(self->priv->name_hash,
>                                                      data->connect_object);
>  
>                 g_signal_connect_object(data->signal_object, data->signal_name,
>                                         func, other, (data->signal_after ? G_CONNECT_AFTER : 0)
>                                         | G_CONNECT_SWAPPED);
>             } else if (data->connect_object && data->lookup_userdata) {
>                 gpointer userdata;
>  
>                 if (!g_module_symbol(allsymbols, data->connect_object, &userdata))
>                     g_warning("could not find user data '%s' for signal handler '%s'.",
>                               data->connect_object, signal_handler);
>                 else if (data->signal_after)
>                     g_signal_connect_after(data->signal_object,
>                                            data->signal_name, func, userdata);
>                 else
>                     g_signal_connect(data->signal_object, data->signal_name,
>                                      func, userdata);
>             } else {
>                 /* the signal_data argument is just a string, but may
>                  * be helpful for someone */
>                 if (data->signal_after)
>                     g_signal_connect_after(data->signal_object,
>                                            data->signal_name, func, NULL);
>                 else
>                     g_signal_connect(data->signal_object, data->signal_name,
>                                      func, NULL);
>             }
>         }
729a749
>         data->lookup_userdata = sig->lookup;
731c751
< 
---
>     
1216c1236
<     g_return_if_fail(g_type_is_a(type, GTK_TYPE_WIDGET));
---
>     g_return_if_fail(g_type_is_a(type, G_TYPE_OBJECT));
1569c1589
<     GladeProperty *prop;
---
>     GladePropInfo *prop;
1672c1692
< 	GladeProperty *prop = tmp->data;
---
> 	GladePropInfo *prop = tmp->data;
1976d1995
< 
1978c1997
< glade_xml_widget_destroy(GtkObject *object, GladeXML *xml)
---
> glade_xml_finalize_notify (DestroyData *dd, GObject *was_an_object)
1980,1990c1999,2003
<     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);
---
>     if (dd->xml) {
>         g_hash_table_remove(dd->xml->priv->name_hash, dd->name);
>     }
>     g_free (dd->name);
>     g_free (dd);
2009a2023
>     DestroyData *dd;
2012c2026
< 
---
>     
2018,2019c2032,2035
<     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);
>     }
2027,2033c2043,2051
<     /* 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);
---
>     /* set up function to remove object from GladeXML object's
>      * name_hash on destruction. Use a weak pointer to ensure
>      * that the GladeXML object isn't accessed after its destruction.
>      */
>     dd        = g_new (DestroyData, 1);
>     dd->name  = g_strdup (info->name);
>     dd->xml   = self;
>     g_object_weak_ref (G_OBJECT (widget), (GWeakNotify)glade_xml_finalize_notify, dd);
>     g_object_add_weak_pointer (G_OBJECT (self), (gpointer *)&(dd->xml));
2071,2075c2089
< 	if (GTK_IS_CONTAINER (widget))
< 	    data->build_children(self, widget, info);
< 	else
< 	    g_warning ("widget %s (%s) has children, but is not a GtkContainer.",
< 		       info->name, g_type_name (G_TYPE_FROM_INSTANCE (widget)));
---
>         data->build_children(self, widget, info);
2078,2079c2092,2094
<     if (visible_id == 0)
< 	visible_id = g_quark_from_static_string("Libglade::visible");
---
>     if (GTK_IS_WIDGET (widget)) {
>         if (visible_id == 0)
>             visible_id = g_quark_from_static_string("Libglade::visible");
2081,2082c2096,2098
<     if (g_object_get_qdata(G_OBJECT(widget), visible_id))
< 	gtk_widget_show(widget);
---
>         if (g_object_get_qdata(G_OBJECT(widget), visible_id))
>             gtk_widget_show(widget);
>     }
