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



commit 269598babac74c6ff1060c30fd5078e83388403a
Author: Victor Toso <me victortoso com>
Date:   Mon Feb 17 23:38:08 2020 +0100

    gom: adapter: 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-adapter.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gom/gom-adapter.c b/gom/gom-adapter.c
index f3fae36..e413688 100644
--- a/gom/gom-adapter.c
+++ b/gom/gom-adapter.c
@@ -22,8 +22,6 @@
 #include "gom-command.h"
 #include "gom-error.h"
 
-G_DEFINE_TYPE(GomAdapter, gom_adapter, G_TYPE_OBJECT)
-
 struct _GomAdapterPrivate
 {
    sqlite3 *db;
@@ -31,6 +29,8 @@ struct _GomAdapterPrivate
    GAsyncQueue *queue;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(GomAdapter, gom_adapter, G_TYPE_OBJECT)
+
 typedef enum {
    ASYNC_CMD_TYPE_OPEN,
    ASYNC_CMD_TYPE_READ,
@@ -506,7 +506,6 @@ gom_adapter_class_init (GomAdapterClass *klass)
 
    object_class = G_OBJECT_CLASS(klass);
    object_class->finalize = gom_adapter_finalize;
-   g_type_class_add_private(object_class, sizeof(GomAdapterPrivate));
 }
 
 /**
@@ -518,8 +517,5 @@ gom_adapter_class_init (GomAdapterClass *klass)
 static void
 gom_adapter_init (GomAdapter *adapter)
 {
-   adapter->priv =
-      G_TYPE_INSTANCE_GET_PRIVATE(adapter,
-                                  GOM_TYPE_ADAPTER,
-                                  GomAdapterPrivate);
+   adapter->priv = gom_adapter_get_instance_private(adapter);
 }


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