[seahorse] Bug 596583 - Fix property bindings when using enums
- From: Adam Schreiber <sadam src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seahorse] Bug 596583 - Fix property bindings when using enums
- Date: Sun, 4 Oct 2009 21:28:41 +0000 (UTC)
commit 457ebc5a23fe88a777e4b7f1238cbe557d6d9ff2
Author: Bastien Nocera <hadess hadess net>
Date: Sun Oct 4 17:27:46 2009 -0400
Bug 596583 - Fix property bindings when using enums
The enums won't ever get to the G_TYPE_ENUM case because they're
sub-classes of G_TYPE_ENUM. Check whether the value holds an enum
instead and manually check for equality.
common/seahorse-bind.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/common/seahorse-bind.c b/common/seahorse-bind.c
index b25f20b..c5d567e 100644
--- a/common/seahorse-bind.c
+++ b/common/seahorse-bind.c
@@ -108,15 +108,6 @@ value_equal (const GValue *a, const GValue *b)
else
retval = FALSE;
break;
- case G_TYPE_ENUM:
- /* this is somewhat bogus. */
- if (g_value_get_enum (a) < g_value_get_enum (b))
- retval = FALSE;
- else if (g_value_get_enum (a) == g_value_get_enum (b))
- retval = TRUE;
- else
- retval = FALSE;
- break;
case G_TYPE_FLAGS:
/* this is even more bogus. */
if (g_value_get_flags (a) < g_value_get_flags (b))
@@ -162,8 +153,12 @@ value_equal (const GValue *a, const GValue *b)
retval = (g_value_get_object (a) == g_value_get_object (b));
break;
default:
- /* Default case is not equal */
- retval = FALSE;
+ if (G_VALUE_HOLDS_ENUM (a)) {
+ retval = (g_value_get_enum (a) == g_value_get_enum (b));
+ } else {
+ /* Default case is not equal */
+ retval = FALSE;
+ }
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]