[gom] gom: Better warnings for _set_primary_key()



commit cfe86c6a134d1eca7644fb2655213f179cd28aa1
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 26 18:35:29 2014 +0200

    gom: Better warnings for _set_primary_key()
    
    By printing the class name that we're modifying.

 gom/gom-resource.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gom/gom-resource.c b/gom/gom-resource.c
index 47cced8..ccec0d7 100644
--- a/gom/gom-resource.c
+++ b/gom/gom-resource.c
@@ -58,20 +58,22 @@ gom_resource_class_set_primary_key (GomResourceClass *resource_class,
 
    pspec = g_object_class_find_property(G_OBJECT_CLASS(resource_class), primary_key);
    if (!pspec) {
-      g_warning("Property for primary key '%s' isn't declared yet. Are you running 
gom_resource_class_set_primary_key() too early?",
-                primary_key);
+      g_warning("Property for primary key '%s' (class %s) isn't declared yet. Are you running 
gom_resource_class_set_primary_key() too early?",
+                primary_key, G_OBJECT_CLASS_NAME(resource_class));
       return;
    }
 
    if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) {
-      g_warning("Property for primary key '%s' is declared as construct-only. This will not work as 
expected.", primary_key);
+      g_warning("Property for primary key '%s' (class %s) is declared as construct-only. This will not work 
as expected.",
+                primary_key, G_OBJECT_CLASS_NAME(resource_class));
       return;
    }
 
    /* Same check as in has_primary_key() */
    value = g_param_spec_get_default_value (pspec);
    if (value->data[0].v_pointer) {
-      g_warning("Property for primary key '%s' has a non-NULL/non-zero default value. This will not work as 
expected.", primary_key);
+      g_warning("Property for primary key '%s' (class %s) has a non-NULL/non-zero default value. This will 
not work as expected.",
+                primary_key, G_OBJECT_CLASS_NAME(resource_class));
       return;
    }
 


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