File glade3-crash-editing-combo-items.patch of Package glade3

--- trunk/gladeui/glade-editor-property.c	2008/04/12 05:45:03	1796
+++ trunk/gladeui/glade-editor-property.c	2008/04/17 20:29:33	1800
@@ -101,8 +101,8 @@
 	/* If the value was denied by a verify function, we'll have to
 	 * reload the real value.
 	 */
-	if (g_param_values_cmp (eprop->property->klass->pspec,
-				eprop->property->value, value) != 0)
+	if (glade_property_class_compare (eprop->property->klass,
+					  eprop->property->value, value) != 0)
 		GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->load (eprop, eprop->property);
 }
 
--- trunk/gladeui/glade-property-class.c	2008/04/12 05:45:03	1796
+++ trunk/gladeui/glade-property-class.c	2008/04/17 20:29:33	1800
@@ -1578,3 +1578,45 @@
 
 	return FALSE;
 }
+
+/**
+ * glade_property_class_compare:
+ * @klass: a #GladePropertyClass
+ * @value1: a GValue of correct type for @klass
+ * @value2: a GValue of correct type for @klass
+ *
+ * Compares value1 with value2 according to @klass.
+ *
+ * Returns: -1, 0 or +1, if value1 is found to be less than,
+ * equal to or greater than value2, respectively.
+ */
+gint
+glade_property_class_compare (GladePropertyClass *klass,
+			      GValue             *value1,
+			      GValue             *value2)
+{
+	gint retval;
+	
+	g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), -1);
+	
+	/* GLib does not know how to compare a boxed real value */
+	if (G_PARAM_SPEC_BOXED (klass->pspec))
+	{
+		gchar *val1, *val2;
+		
+		val1 = glade_property_class_make_string_from_gvalue (klass, value1),
+		val2 = glade_property_class_make_string_from_gvalue (klass, value2);
+
+		if (val1 && val2)
+			retval = strcmp (val1, val2);
+		else
+			retval = val1 - val2;
+		
+		g_free (val1);
+		g_free (val2);
+	}
+	else
+		retval = g_param_values_cmp (klass->pspec, value1, value2);
+	
+	return retval;
+}
--- trunk/gladeui/glade-property-class.h	2008/04/12 05:45:03	1796
+++ trunk/gladeui/glade-property-class.h	2008/04/17 20:29:33	1800
@@ -214,6 +214,9 @@
 gboolean            glade_property_class_void_value              (GladePropertyClass *klass,
 								  GValue             *value);
 
+gint                glade_property_class_compare                 (GladePropertyClass *klass,
+								  GValue             *value1,
+								  GValue             *value2);
 G_END_DECLS
 
 #endif /* __GLADE_PROPERTY_CLASS_H__ */
openSUSE Build Service is sponsored by