[Glade-devel] Trivial patch for glade-widget.c commited.

paolo borelli pborelli@katamail.com
Tue, 05 Aug 2003 03:59:20 +0200


On Tue, 2003-08-05 at 00:57, Archit Baweja wrote:
> Here's the patch :-)
> 

I think Joaquin still has some problems with his internet connection so
I don't know if he has the chance to comment... To me the patch looks
good to commit, except some minor nitpicking :)




+	* src/glade-property.c (glade_property_set): when using custom 
+	set_function, copy the GValue for the property. Fixes a couple of bugs.
+

others changelog entries don't have an empty line here

+	* src/glade-widget.c (glade_widget_new_from_node_real): set properties
+	after setting children.
+
 2003-08-04  Archit Baweja  <bighead@users.sourceforge.net>
 
 	* src/glade-widget.c (glade_widget_query_properties): have the buttons
Index: src/glade-property.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-property.c,v
retrieving revision 1.34
diff -u -r1.34 glade-property.c
--- src/glade-property.c	26 Jul 2003 17:21:51 -0000	1.34
+++ src/glade-property.c	4 Aug 2003 22:54:04 -0000
@@ -226,11 +226,14 @@
 	property->loading = TRUE;
 
 	/* if there is a custom set_property use it*/
-	if (property->class->set_function)
+	if (property->class->set_function) {
+		g_value_reset (property->value);
+		g_value_copy (value, property->value);
 		(*property->class->set_function) (G_OBJECT (property->widget->widget),
-						  property->value);
-	else
+						  value);
+	} else {
 		glade_property_set_property (property, value);
+	}
 
 	property->loading = FALSE;
 
The concept is right, but I'd prefer that you just pass "value" to the
set_function instead of "property->value" and move the g_value_reset and
g_value_copy out of the "if" so that you can delete it also from
glade_property_set_property: something like

if (property->class->set_function)
	(*property->class->set_function) (G_OBJECT (property->widget->widget),
					  value);
else
	glade_property_set_property (property, value);

g_value_reset (property->value);
g_value_copy (value, property->value);


The other chunk looks ok to me. Thanks to have tracked this down!

ciao
	paolo