[libgda] gdaui-set: ported to G_DECLARE/G_DEFINE



commit 41d00d4e761a870d41bdffad541ae9f5f0879b56
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Sep 19 23:05:07 2018 -0500

    gdaui-set: ported to G_DECLARE/G_DEFINE

 libgda-ui/gdaui-set.c | 22 +++++++++-------------
 libgda-ui/gdaui-set.h | 23 +++--------------------
 2 files changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/libgda-ui/gdaui-set.c b/libgda-ui/gdaui-set.c
index 1d5c79319..397549424 100644
--- a/libgda-ui/gdaui-set.c
+++ b/libgda-ui/gdaui-set.c
@@ -455,8 +455,6 @@ gdaui_set_source_set_ref_columns (GdauiSetSource *s, gint *columns, gint n_colum
        }
 }
 
-static void gdaui_set_class_init (GdauiSetClass * class);
-static void gdaui_set_init (GdauiSet *wid);
 static void gdaui_set_dispose (GObject *object);
 
 static void gdaui_set_set_property (GObject *object,
@@ -589,20 +587,18 @@ gdaui_set_dispose (GObject *object)
         set = GDAUI_SET (object);
         GdauiSetPrivate *priv = gdaui_set_get_instance_private (set);
 
-        if (priv) {
-                if (priv->set) {
-                        g_signal_handlers_disconnect_by_func (G_OBJECT (priv->set),
-                                                              G_CALLBACK 
(wrapped_set_public_data_changed_cb), set);
-                        g_signal_handlers_disconnect_by_func (G_OBJECT (priv->set),
-                                                              G_CALLBACK 
(wrapped_set_source_model_changed_cb), set);
+        if (priv->set) {
+                g_signal_handlers_disconnect_by_func (G_OBJECT (priv->set),
+                                                      G_CALLBACK (wrapped_set_public_data_changed_cb), set);
+                g_signal_handlers_disconnect_by_func (G_OBJECT (priv->set),
+                                                      G_CALLBACK (wrapped_set_source_model_changed_cb), set);
 
-                        g_object_unref (priv->set);
-                        priv->set = NULL;
-                }
-
-               clean_public_data (set);
+                g_object_unref (priv->set);
+                priv->set = NULL;
         }
 
+        clean_public_data (set);
+
         /* for the parent class */
         G_OBJECT_CLASS (gdaui_set_parent_class)->dispose (object);
 }
diff --git a/libgda-ui/gdaui-set.h b/libgda-ui/gdaui-set.h
index 5035aa388..f5a018b1f 100644
--- a/libgda-ui/gdaui-set.h
+++ b/libgda-ui/gdaui-set.h
@@ -26,16 +26,6 @@
 
 G_BEGIN_DECLS
 
-#define GDAUI_TYPE_SET          (gdaui_set_get_type())
-#define GDAUI_SET(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_set_get_type(), GdauiSet)
-#define GDAUI_SET_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gdaui_set_get_type (), GdauiSetClass)
-#define GDAUI_IS_SET(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_set_get_type ())
-
-
-typedef struct _GdauiSet      GdauiSet;
-typedef struct _GdauiSetClass GdauiSetClass;
-typedef struct _GdauiSetPriv  GdauiSetPriv;
-
 typedef struct _GdauiSetGroup GdauiSetGroup;
 typedef struct _GdauiSetSource GdauiSetSource;
 
@@ -68,14 +58,8 @@ gint*             gdaui_set_source_get_ref_columns    (GdauiSetSource *s);
 void              gdaui_set_source_set_ref_columns    (GdauiSetSource *s, gint *columns, gint n_columns);
 
 
-/* struct for the object's data */
-/**
- * GdauiSet:
- */
-struct _GdauiSet
-{
-       GObject         object;
-};
+#define GDAUI_TYPE_SET          (gdaui_set_get_type())
+G_DECLARE_DERIVABLE_TYPE (GdauiSet, gdaui_set, GDAUI, SET, GObject)
 
 /* struct for the object's class */
 struct _GdauiSetClass
@@ -85,10 +69,9 @@ struct _GdauiSetClass
        void             (*source_model_changed)  (GdauiSet *set, GdauiSetSource *source);
 };
 
-/* 
+/*
  * Generic widget's methods 
  */
-GType             gdaui_set_get_type            (void) G_GNUC_CONST;
 GdauiSet         *gdaui_set_new                 (GdaSet *set);
 GdauiSetGroup    *gdaui_set_get_group           (GdauiSet *dbset, GdaHolder *holder);
 GSList           *gdaui_set_get_sources         (GdauiSet *set);


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