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



commit 05b33cc1238d4f4460cd3e79df37ffc5f9900972
Author: Victor Toso <me victortoso com>
Date:   Mon Feb 17 23:56:01 2020 +0100

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

 gom/gom-resource-group.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gom/gom-resource-group.c b/gom/gom-resource-group.c
index 97dc44e..b168c70 100644
--- a/gom/gom-resource-group.c
+++ b/gom/gom-resource-group.c
@@ -27,8 +27,6 @@
 #include "gom-resource-group.h"
 #include "gom-sorting.h"
 
-G_DEFINE_TYPE(GomResourceGroup, gom_resource_group, G_TYPE_OBJECT)
-
 struct _GomResourceGroupPrivate
 {
    GomRepository *repository;
@@ -47,6 +45,8 @@ struct _GomResourceGroupPrivate
    GPtrArray *to_write;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(GomResourceGroup, gom_resource_group, G_TYPE_OBJECT)
+
 enum
 {
    PROP_0,
@@ -1007,7 +1007,6 @@ gom_resource_group_class_init (GomResourceGroupClass *klass)
    object_class->finalize = gom_resource_group_finalize;
    object_class->get_property = gom_resource_group_get_property;
    object_class->set_property = gom_resource_group_set_property;
-   g_type_class_add_private(object_class, sizeof(GomResourceGroupPrivate));
 
    gParamSpecs[PROP_COUNT] =
       g_param_spec_uint("count",
@@ -1093,8 +1092,5 @@ gom_resource_group_class_init (GomResourceGroupClass *klass)
 static void
 gom_resource_group_init (GomResourceGroup *group)
 {
-   group->priv =
-      G_TYPE_INSTANCE_GET_PRIVATE(group,
-                                  GOM_TYPE_RESOURCE_GROUP,
-                                  GomResourceGroupPrivate);
+   group->priv = gom_resource_group_get_instance_private(group);
 }


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