glade3 r1801 - in branches/gnome-2-22: . gladeui
- From: jpu svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1801 - in branches/gnome-2-22: . gladeui
- Date: Thu, 17 Apr 2008 21:37:04 +0100 (BST)
Author: jpu
Date: Thu Apr 17 21:37:04 2008
New Revision: 1801
URL: http://svn.gnome.org/viewvc/glade3?rev=1801&view=rev
Log:
* gladeui/glade-property-class.[ch]: added glade_property_class_compare()
* gladeui/glade-editor-property.c: use new compare function in
glade_editor_property_commit() instead of g_param_values_cmp()
since GBoxed comparison is not well defined.
Fixes bug #528511.
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/gladeui/glade-editor-property.c
branches/gnome-2-22/gladeui/glade-property-class.c
branches/gnome-2-22/gladeui/glade-property-class.h
Modified: branches/gnome-2-22/gladeui/glade-editor-property.c
==============================================================================
--- branches/gnome-2-22/gladeui/glade-editor-property.c (original)
+++ branches/gnome-2-22/gladeui/glade-editor-property.c Thu Apr 17 21:37:04 2008
@@ -150,8 +150,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);
}
Modified: branches/gnome-2-22/gladeui/glade-property-class.c
==============================================================================
--- branches/gnome-2-22/gladeui/glade-property-class.c (original)
+++ branches/gnome-2-22/gladeui/glade-property-class.c Thu Apr 17 21:37:04 2008
@@ -1814,3 +1814,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;
+}
Modified: branches/gnome-2-22/gladeui/glade-property-class.h
==============================================================================
--- branches/gnome-2-22/gladeui/glade-property-class.h (original)
+++ branches/gnome-2-22/gladeui/glade-property-class.h Thu Apr 17 21:37:04 2008
@@ -222,6 +222,9 @@
G_CONST_RETURN gchar *glade_property_class_atk_realname (const gchar *atk_name);
+gint glade_property_class_compare (GladePropertyClass *klass,
+ GValue *value1,
+ GValue *value2);
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]