[libgda] gdaui-entry-time: ported to G_DECLARE/G_DEFINE



commit 06d6966051926f26766d52dd9901c8d4b739283c
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Sep 22 16:45:13 2018 -0500

    gdaui-entry-time: ported to G_DECLARE/G_DEFINE

 libgda-ui/data-entries/gdaui-entry-time.c | 34 +++----------------------------
 libgda-ui/data-entries/gdaui-entry-time.h | 18 +---------------
 2 files changed, 4 insertions(+), 48 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-time.c b/libgda-ui/data-entries/gdaui-entry-time.c
index 63f549aa3..5c8268a83 100644
--- a/libgda-ui/data-entries/gdaui-entry-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-time.c
@@ -24,42 +24,14 @@
 #include <gdk/gdkkeysyms.h>
 #include <string.h>
 
-/* 
+G_DEFINE_TYPE (GdauiEntryTime, gdaui_entry_time, GDAUI_TYPE_ENTRY_COMMON_TIME)
+
+/*
  * Main static functions 
  */
-static void gdaui_entry_time_class_init (GdauiEntryTimeClass * class);
-static void gdaui_entry_time_init (GdauiEntryTime * srv);
-/* get a pointer to the parents to be able to call their destructor */
-static GObjectClass  *parent_class = NULL;
-
-GType
-gdaui_entry_time_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static const GTypeInfo info = {
-                       sizeof (GdauiEntryTimeClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) gdaui_entry_time_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (GdauiEntryTime),
-                       0,
-                       (GInstanceInitFunc) gdaui_entry_time_init,
-                       0
-               };
-       
-               type = g_type_register_static (GDAUI_TYPE_ENTRY_COMMON_TIME, "GdauiEntryTime", &info, 0);
-       }
-       return type;
-}
-
 static void
 gdaui_entry_time_class_init (GdauiEntryTimeClass * class)
 {
-       parent_class = g_type_class_peek_parent (class);
 }
 
 static void
diff --git a/libgda-ui/data-entries/gdaui-entry-time.h b/libgda-ui/data-entries/gdaui-entry-time.h
index a41eb09b1..38e04437f 100644
--- a/libgda-ui/data-entries/gdaui-entry-time.h
+++ b/libgda-ui/data-entries/gdaui-entry-time.h
@@ -26,29 +26,13 @@
 G_BEGIN_DECLS
 
 #define GDAUI_TYPE_ENTRY_TIME          (gdaui_entry_time_get_type())
-#define GDAUI_ENTRY_TIME(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_entry_time_get_type(), 
GdauiEntryTime)
-#define GDAUI_ENTRY_TIME_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gdaui_entry_time_get_type (), 
GdauiEntryTimeClass)
-#define GDAUI_IS_ENTRY_TIME(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_entry_time_get_type ())
-
-
-typedef struct _GdauiEntryTime GdauiEntryTime;
-typedef struct _GdauiEntryTimeClass GdauiEntryTimeClass;
-typedef struct _GdauiEntryTimePrivate GdauiEntryTimePrivate;
-
-
-/* struct for the object's data */
-struct _GdauiEntryTime
-{
-       GdauiEntryCommonTime           object;
-};
-
+G_DECLARE_DERIVABLE_TYPE (GdauiEntryTime, gdaui_entry_time, GDAUI, ENTRY_TIME, GdauiEntryCommonTime)
 /* struct for the object's class */
 struct _GdauiEntryTimeClass
 {
        GdauiEntryCommonTimeClass      parent_class;
 };
 
-GType        gdaui_entry_time_get_type        (void) G_GNUC_CONST;
 GtkWidget   *gdaui_entry_time_new             (GdaDataHandler *dh);
 
 


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