[gom] gom: command-builder: use G_ADD_PRIVATE for type definition



commit 568a5c9e44896226babd9acb7318892be4523270
Author: Victor Toso <me victortoso com>
Date:   Mon Feb 17 23:40:59 2020 +0100

    gom: command-builder: 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-command-builder.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gom/gom-command-builder.c b/gom/gom-command-builder.c
index 4fc2723..d4ee21f 100644
--- a/gom/gom-command-builder.c
+++ b/gom/gom-command-builder.c
@@ -24,8 +24,6 @@
 #include "gom-resource-priv.h"
 #include "gom-sorting.h"
 
-G_DEFINE_TYPE(GomCommandBuilder, gom_command_builder, G_TYPE_OBJECT)
-
 struct _GomCommandBuilderPrivate
 {
    GomAdapter *adapter;
@@ -38,6 +36,8 @@ struct _GomCommandBuilderPrivate
    GType m2m_type;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(GomCommandBuilder, gom_command_builder, G_TYPE_OBJECT)
+
 enum
 {
    PROP_0,
@@ -1027,7 +1027,6 @@ gom_command_builder_class_init (GomCommandBuilderClass *klass)
    object_class->finalize = gom_command_builder_finalize;
    object_class->get_property = gom_command_builder_get_property;
    object_class->set_property = gom_command_builder_set_property;
-   g_type_class_add_private(object_class, sizeof(GomCommandBuilderPrivate));
 
    gParamSpecs[PROP_ADAPTER] =
       g_param_spec_object("adapter",
@@ -1115,8 +1114,5 @@ gom_command_builder_class_init (GomCommandBuilderClass *klass)
 static void
 gom_command_builder_init (GomCommandBuilder *builder)
 {
-   builder->priv =
-      G_TYPE_INSTANCE_GET_PRIVATE(builder,
-                                  GOM_TYPE_COMMAND_BUILDER,
-                                  GomCommandBuilderPrivate);
+   builder->priv = gom_command_builder_get_instance_private(builder);
 }


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