[gnome-bluetooth] Fix property bindings when using enums
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Fix property bindings when using enums
- Date: Mon, 28 Sep 2009 10:32:16 +0000 (UTC)
commit 830f1e6bdf92e6c2b84969b9a9a4b5ead267b8ef
Author: Bastien Nocera <hadess hadess net>
Date: Mon Sep 28 11:20:44 2009 +0100
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.
https://bugzilla.gnome.org/show_bug.cgi?id=596583
lib/seahorse-bind.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/lib/seahorse-bind.c b/lib/seahorse-bind.c
index b25f20b..139c163 100644
--- a/lib/seahorse-bind.c
+++ b/lib/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]