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



commit 1db2d149310c3e67a14cb0dc6e23a8b067435a32
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Sep 22 18:57:26 2018 -0500

    gdaui-entry-timestamp: ported to G_DECLARE/G_DEFINE

 libgda-ui/data-entries/gdaui-entry-timestamp.c | 31 +-------------------------
 libgda-ui/data-entries/gdaui-entry-timestamp.h | 17 +-------------
 2 files changed, 2 insertions(+), 46 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-timestamp.c b/libgda-ui/data-entries/gdaui-entry-timestamp.c
index d0dfd5c8f..ce294d959 100644
--- a/libgda-ui/data-entries/gdaui-entry-timestamp.c
+++ b/libgda-ui/data-entries/gdaui-entry-timestamp.c
@@ -27,39 +27,10 @@
 /* 
  * Main static functions 
  */
-static void gdaui_entry_timestamp_class_init (GdauiEntryTimestampClass * class);
-static void gdaui_entry_timestamp_init (GdauiEntryTimestamp * srv);
-/* get a pointer to the parents to be able to call their destructor */
-static GObjectClass  *parent_class = NULL;
-
-GType
-gdaui_entry_timestamp_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static const GTypeInfo info = {
-                       sizeof (GdauiEntryTimestampClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) gdaui_entry_timestamp_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (GdauiEntryTimestamp),
-                       0,
-                       (GInstanceInitFunc) gdaui_entry_timestamp_init,
-                       0
-               };
-       
-               type = g_type_register_static (GDAUI_TYPE_ENTRY_COMMON_TIME, "GdauiEntryTimestamp", &info, 0);
-       }
-       return type;
-}
-
+G_DEFINE_TYPE (GdauiEntryTimestamp, gdaui_entry_timestamp, GDAUI_TYPE_ENTRY_COMMON_TIME)
 static void
 gdaui_entry_timestamp_class_init (GdauiEntryTimestampClass * class)
 {
-       parent_class = g_type_class_peek_parent (class);
 }
 
 static void
diff --git a/libgda-ui/data-entries/gdaui-entry-timestamp.h b/libgda-ui/data-entries/gdaui-entry-timestamp.h
index c5e231647..83de14d32 100644
--- a/libgda-ui/data-entries/gdaui-entry-timestamp.h
+++ b/libgda-ui/data-entries/gdaui-entry-timestamp.h
@@ -26,21 +26,7 @@
 G_BEGIN_DECLS
 
 #define GDAUI_TYPE_ENTRY_TIMESTAMP          (gdaui_entry_timestamp_get_type())
-#define GDAUI_ENTRY_TIMESTAMP(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, 
gdaui_entry_timestamp_get_type(), GdauiEntryTimestamp)
-#define GDAUI_ENTRY_TIMESTAMP_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gdaui_entry_timestamp_get_type 
(), GdauiEntryTimestampClass)
-#define GDAUI_IS_ENTRY_TIMESTAMP(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_entry_timestamp_get_type 
())
-
-
-typedef struct _GdauiEntryTimestamp GdauiEntryTimestamp;
-typedef struct _GdauiEntryTimestampClass GdauiEntryTimestampClass;
-typedef struct _GdauiEntryTimestampPrivate GdauiEntryTimestampPrivate;
-
-
-/* struct for the object's data */
-struct _GdauiEntryTimestamp
-{
-       GdauiEntryCommonTime           object;
-};
+G_DECLARE_DERIVABLE_TYPE (GdauiEntryTimestamp, gdaui_entry_timestamp, GDAUI, ENTRY_TIMESTAMP, 
GdauiEntryCommonTime)
 
 /* struct for the object's class */
 struct _GdauiEntryTimestampClass
@@ -48,7 +34,6 @@ struct _GdauiEntryTimestampClass
        GdauiEntryCommonTimeClass      parent_class;
 };
 
-GType        gdaui_entry_timestamp_get_type        (void) G_GNUC_CONST;
 GtkWidget   *gdaui_entry_timestamp_new             (GdaDataHandler *dh);
 
 


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