[gom] gom: Fix has_primary_key() return value



commit 72ce70e3bccb07d94b0a1a3aa962b75a01d952d3
Author: Bastien Nocera <hadess hadess net>
Date:   Wed May 14 13:56:20 2014 +0200

    gom: Fix has_primary_key() return value
    
    The has_primary_key() function was actually returning FALSE if the
    resource had a primary set, the opposite of what we expected.

 gom/gom-resource.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gom/gom-resource.c b/gom/gom-resource.c
index ed11173..f5982f9 100644
--- a/gom/gom-resource.c
+++ b/gom/gom-resource.c
@@ -531,7 +531,7 @@ has_primary_key (GomResource *resource)
 
    g_value_init(&value, pspec->value_type);
    g_object_get_property(G_OBJECT(resource), klass->primary_key, &value);
-   ret = !value.data[0].v_pointer;
+   ret = !!value.data[0].v_pointer;
    g_value_unset(&value);
 
    return ret;
@@ -560,7 +560,7 @@ gom_resource_do_save (GomResource  *resource,
                           "adapter", adapter,
                           NULL);
 
-   is_insert = has_primary_key(resource);
+   is_insert = !has_primary_key(resource);
 
    do {
       types = g_slist_prepend(types, GINT_TO_POINTER(resource_type));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]