[gom] gom: resource: use G_ADD_PRIVATE for type definition



commit feb9e661b19372efa45975330cb3b6d3c44ed6cb
Author: Victor Toso <me victortoso com>
Date:   Mon Feb 17 23:31:45 2020 +0100

    gom: resource: use G_ADD_PRIVATE for type definition
    
    The G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE call was moved as it needs to
    know the storage size of private structure.

 gom/gom-resource.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gom/gom-resource.c b/gom/gom-resource.c
index f0c5d6a..0e86bae 100644
--- a/gom/gom-resource.c
+++ b/gom/gom-resource.c
@@ -28,14 +28,14 @@
 #include "gom-resource-priv.h"
 #include "reserved-keywords.h"
 
-G_DEFINE_ABSTRACT_TYPE(GomResource, gom_resource, G_TYPE_OBJECT)
-
 struct _GomResourcePrivate
 {
    GomRepository *repository;
    gboolean       is_from_table;
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GomResource, gom_resource, G_TYPE_OBJECT)
+
 enum
 {
    PROP_0,
@@ -1094,7 +1094,6 @@ gom_resource_class_init (GomResourceClass *klass)
    object_class->get_property = gom_resource_get_property;
    object_class->set_property = gom_resource_set_property;
    object_class->constructed = gom_resource_constructed;
-   g_type_class_add_private(object_class, sizeof(GomResourcePrivate));
 
    gParamSpecs[PROP_REPOSITORY] =
       g_param_spec_object("repository",
@@ -1115,10 +1114,7 @@ gom_resource_class_init (GomResourceClass *klass)
 static void
 gom_resource_init (GomResource *resource)
 {
-   resource->priv =
-      G_TYPE_INSTANCE_GET_PRIVATE(resource,
-                                  GOM_TYPE_RESOURCE,
-                                  GomResourcePrivate);
+   resource->priv = gom_resource_get_instance_private(resource);
 }
 
 gboolean


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