[libgda] gda-xa-transaction: ported to G_DEFINE*



commit 075cbcd0ee3ade8b2f91060ae786951b9773c2cf
Author: Daniel Espinosa <esodan gmail com>
Date:   Fri Sep 14 14:20:27 2018 -0500

    gda-xa-transaction: ported to G_DEFINE*

 libgda/gda-xa-transaction.c | 38 ++------------------------------------
 1 file changed, 2 insertions(+), 36 deletions(-)
---
diff --git a/libgda/gda-xa-transaction.c b/libgda/gda-xa-transaction.c
index fb2f1cec4..47dea1c6b 100644
--- a/libgda/gda-xa-transaction.c
+++ b/libgda/gda-xa-transaction.c
@@ -46,16 +46,13 @@ static void gda_xa_transaction_get_property (GObject *object,
                                             GParamSpec *pspec);
 
 
-static GObjectClass* parent_class = NULL;
-
 typedef struct  {
        GdaXaTransactionId  xid;
        GHashTable         *cnc_hash; /* key = cnc, value = branch qualifier as a GdaBinary */
        GList              *cnc_list;
        GdaConnection      *non_xa_cnc; /* connection which does not support distributed transaction (also in 
@cnc_list) */
 } GdaXaTransactionPrivate;
-#define gda_xa_transaction_get_instance_private(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, 
GDA_TYPE_XA_TRANSACTION, GdaXaTransactionPrivate)
-
+G_DEFINE_TYPE_WITH_PRIVATE (GdaXaTransaction, gda_xa_transaction, G_TYPE_OBJECT)
 /* properties */
 enum
 {
@@ -74,10 +71,6 @@ gda_xa_transaction_class_init (GdaXaTransactionClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       parent_class = g_type_class_peek_parent (klass);
-
-       g_type_class_add_private (object_class, sizeof(GdaXaTransactionPrivate));
-
        object_class->dispose = gda_xa_transaction_dispose;
 
 
@@ -132,7 +125,7 @@ gda_xa_transaction_dispose (GObject *object)
        }
 
        /* chain to parent class */
-       parent_class->dispose (object);
+       G_OBJECT_CLASS (gda_xa_transaction_parent_class)->dispose (object);
 }
 
 static void
@@ -223,33 +216,6 @@ GQuark gda_xa_transaction_error_quark (void)
         return quark;
 }
 
-GType
-gda_xa_transaction_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static GMutex registering;
-               static GTypeInfo info = {
-                       sizeof (GdaXaTransactionClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) gda_xa_transaction_class_init,
-                       NULL, NULL,
-                       sizeof (GdaXaTransaction),
-                       0,
-                       (GInstanceInitFunc) gda_xa_transaction_init,
-                       0
-               };
-               g_mutex_lock (&registering);
-               if (type == 0)
-                       type = g_type_register_static (G_TYPE_OBJECT, "GdaXaTransaction", &info, 0);
-               g_mutex_unlock (&registering);
-       }
-
-       return type;
-}
-
 /**
  * gda_xa_transaction_new:
  * @format: a format ID


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