[libgda] gda-entry-date: ported to G_DECLARE/G_DEFINE



commit 62c94085ffeb5afa2a56c21311f7e350a0fc6500
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Sep 22 15:23:04 2018 -0500

    gda-entry-date: ported to G_DECLARE/G_DEFINE

 libgda-ui/data-entries/gdaui-entry-date.c | 31 +------------------------------
 libgda-ui/data-entries/gdaui-entry-date.h | 18 +-----------------
 2 files changed, 2 insertions(+), 47 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-date.c b/libgda-ui/data-entries/gdaui-entry-date.c
index 8ec1c74b5..434dfbd6a 100644
--- a/libgda-ui/data-entries/gdaui-entry-date.c
+++ b/libgda-ui/data-entries/gdaui-entry-date.c
@@ -27,39 +27,10 @@
 /* 
  * Main static functions 
  */
-static void gdaui_entry_date_class_init (GdauiEntryDateClass * class);
-static void gdaui_entry_date_init (GdauiEntryDate * srv);
-/* get a pointer to the parents to be able to call their destructor */
-static GObjectClass  *parent_class = NULL;
-
-GType
-gdaui_entry_date_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static const GTypeInfo info = {
-                       sizeof (GdauiEntryDateClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) gdaui_entry_date_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (GdauiEntryDate),
-                       0,
-                       (GInstanceInitFunc) gdaui_entry_date_init,
-                       0
-               };
-       
-               type = g_type_register_static (GDAUI_TYPE_ENTRY_COMMON_TIME, "GdauiEntryDate", &info, 0);
-       }
-       return type;
-}
-
+G_DEFINE_TYPE (GdauiEntryDate, gdaui_entry_date, GDAUI_TYPE_ENTRY_COMMON_TIME)
 static void
 gdaui_entry_date_class_init (GdauiEntryDateClass * class)
 {
-       parent_class = g_type_class_peek_parent (class);
 }
 
 static void
diff --git a/libgda-ui/data-entries/gdaui-entry-date.h b/libgda-ui/data-entries/gdaui-entry-date.h
index 88997d410..b2c45148e 100644
--- a/libgda-ui/data-entries/gdaui-entry-date.h
+++ b/libgda-ui/data-entries/gdaui-entry-date.h
@@ -26,29 +26,13 @@
 G_BEGIN_DECLS
 
 #define GDAUI_TYPE_ENTRY_DATE          (gdaui_entry_date_get_type())
-#define GDAUI_ENTRY_DATE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_entry_date_get_type(), 
GdauiEntryDate)
-#define GDAUI_ENTRY_DATE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gdaui_entry_date_get_type (), 
GdauiEntryDateClass)
-#define GDAUI_IS_ENTRY_DATE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_entry_date_get_type ())
-
-
-typedef struct _GdauiEntryDate GdauiEntryDate;
-typedef struct _GdauiEntryDateClass GdauiEntryDateClass;
-typedef struct _GdauiEntryDatePrivate GdauiEntryDatePrivate;
-
-
-/* struct for the object's data */
-struct _GdauiEntryDate
-{
-       GdauiEntryCommonTime           object;
-};
-
+G_DECLARE_DERIVABLE_TYPE(GdauiEntryDate, gdaui_entry_date, GDUI, ENTRY_DATE, GdauiEntryCommonTime)
 /* struct for the object's class */
 struct _GdauiEntryDateClass
 {
        GdauiEntryCommonTimeClass      parent_class;
 };
 
-GType        gdaui_entry_date_get_type        (void) G_GNUC_CONST;
 GtkWidget   *gdaui_entry_date_new             (GdaDataHandler *dh);
 
 


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