mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-09-24 00:04:33 -04:00
added glade_property_class_compare()
* 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. svn path=/trunk/; revision=1800
This commit is contained in:
parent
bae179208a
commit
7fd3d8fcc7
@ -1,3 +1,12 @@
|
||||
2008-04-17 Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2008-04-16 Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
|
||||
* gladeui/glade-widget.c: make glade_widget_build_object() do not apply
|
||||
|
@ -101,8 +101,8 @@ glade_editor_property_commit (GladeEditorProperty *eprop,
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -1578,3 +1578,45 @@ glade_property_class_void_value (GladePropertyClass *klass,
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -214,6 +214,9 @@ gboolean glade_property_class_match (GladePropertyC
|
||||
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__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user