[libgda] gdaui-data-entry: ported to G_DECLARE/G_DEFINE
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] gdaui-data-entry: ported to G_DECLARE/G_DEFINE
- Date: Thu, 20 Sep 2018 17:40:52 +0000 (UTC)
commit 4fca976b2f624692e86a00f99c88ffe5a028f34f
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Sep 20 12:12:14 2018 -0500
gdaui-data-entry: ported to G_DECLARE/G_DEFINE
libgda-ui/data-entries/gdaui-entry-combo.c | 4 +--
libgda-ui/data-entries/gdaui-entry-wrapper.c | 4 +--
libgda-ui/gdaui-data-entry.c | 42 +++++-----------------------
libgda-ui/gdaui-data-entry.h | 14 ++--------
4 files changed, 14 insertions(+), 50 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-combo.c b/libgda-ui/data-entries/gdaui-entry-combo.c
index de4244d1c..f3892e53a 100644
--- a/libgda-ui/data-entries/gdaui-entry-combo.c
+++ b/libgda-ui/data-entries/gdaui-entry-combo.c
@@ -48,7 +48,7 @@ static void real_combo_block_signals (GdauiEntryCombo *wid);
static void real_combo_unblock_signals (GdauiEntryCombo *wid);
/* GdauiDataEntry interface (value must be a GDA_TYPE_LIST) */
-static void gdaui_entry_combo_data_entry_init (GdauiDataEntryIface *iface);
+static void gdaui_entry_combo_data_entry_init (GdauiDataEntryInterface *iface);
static void gdaui_entry_combo_set_value (GdauiDataEntry *de, const GValue * value);
static GValue *gdaui_entry_combo_get_value (GdauiDataEntry *de);
static void gdaui_entry_combo_set_ref_value (GdauiDataEntry *de, const GValue * value);
@@ -133,7 +133,7 @@ gdaui_entry_combo_get_type (void)
}
static void
-gdaui_entry_combo_data_entry_init (GdauiDataEntryIface *iface)
+gdaui_entry_combo_data_entry_init (GdauiDataEntryInterface *iface)
{
iface->set_value_type = NULL;
iface->get_value_type = NULL;
diff --git a/libgda-ui/data-entries/gdaui-entry-wrapper.c b/libgda-ui/data-entries/gdaui-entry-wrapper.c
index a744fbb6e..0800837a1 100644
--- a/libgda-ui/data-entries/gdaui-entry-wrapper.c
+++ b/libgda-ui/data-entries/gdaui-entry-wrapper.c
@@ -45,7 +45,7 @@ static void block_signals (GdauiEntryWrapper *wid);
static void unblock_signals (GdauiEntryWrapper *wid);
/* GdauiDataEntry interface */
-static void gdaui_entry_wrapper_data_entry_init (GdauiDataEntryIface *iface);
+static void gdaui_entry_wrapper_data_entry_init (GdauiDataEntryInterface *iface);
static void gdaui_entry_wrapper_set_value_type (GdauiDataEntry *de, GType type);
static GType gdaui_entry_wrapper_get_value_type (GdauiDataEntry *de);
static void gdaui_entry_wrapper_set_value (GdauiDataEntry *de, const GValue *value);
@@ -126,7 +126,7 @@ gdaui_entry_wrapper_get_type (void)
}
static void
-gdaui_entry_wrapper_data_entry_init (GdauiDataEntryIface *iface)
+gdaui_entry_wrapper_data_entry_init (GdauiDataEntryInterface *iface)
{
iface->set_value_type = gdaui_entry_wrapper_set_value_type;
iface->get_value_type = gdaui_entry_wrapper_get_value_type;
diff --git a/libgda-ui/gdaui-data-entry.c b/libgda-ui/gdaui-data-entry.c
index 737a83277..c4e88bedf 100644
--- a/libgda-ui/gdaui-data-entry.c
+++ b/libgda-ui/gdaui-data-entry.c
@@ -37,6 +37,8 @@ enum {
static gint gdaui_data_entry_signals[LAST_SIGNAL] = { 0, 0, 0, 0, 0 };
static void gdaui_data_entry_iface_init (gpointer g_class);
+G_DEFINE_INTERFACE (GdauiDataEntry, gdaui_data_entry, GTK_TYPE_WIDGET)
+
/* module error */
GQuark gdaui_data_entry_error_quark (void)
{
@@ -46,31 +48,6 @@ GQuark gdaui_data_entry_error_quark (void)
return quark;
}
-GType
-gdaui_data_entry_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo info = {
- sizeof (GdauiDataEntryIface),
- (GBaseInitFunc) gdaui_data_entry_iface_init,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) NULL,
- NULL,
- NULL,
- 0,
- 0,
- (GInstanceInitFunc) NULL,
- 0
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE, "GdauiDataEntry", &info, 0);
- g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
- }
- return type;
-}
-
/* static gboolean */
/* contents_valid_accumulator (G_GNUC_UNUSED GSignalInvocationHint *ihint, */
/* GValue *return_accu, */
@@ -86,16 +63,13 @@ gdaui_data_entry_get_type (void)
/* } */
static void
-gdaui_data_entry_iface_init (gpointer g_class)
+gdaui_data_entry_default_init (GdauiDataEntryInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (! initialized) {
gdaui_data_entry_signals[CONTENTS_MODIFIED] =
g_signal_new ("contents-modified",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiDataEntryIface, contents_modified),
+ G_STRUCT_OFFSET (GdauiDataEntryInterface, contents_modified),
NULL, NULL,
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -103,7 +77,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
g_signal_new ("contents-activated",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiDataEntryIface, contents_activated),
+ G_STRUCT_OFFSET (GdauiDataEntryInterface, contents_activated),
NULL, NULL,
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -111,7 +85,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
g_signal_new ("status-changed",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiDataEntryIface, status_changed),
+ G_STRUCT_OFFSET (GdauiDataEntryInterface, status_changed),
NULL, NULL,
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -119,13 +93,11 @@ gdaui_data_entry_iface_init (gpointer g_class)
g_signal_new ("expand-changed",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiDataEntryIface, expand_changed),
+ G_STRUCT_OFFSET (GdauiDataEntryInterface, expand_changed),
NULL, NULL,
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- initialized = TRUE;
- }
}
/**
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index c29ef93d9..3c88897dc 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -28,14 +28,6 @@
G_BEGIN_DECLS
-#define GDAUI_TYPE_DATA_ENTRY (gdaui_data_entry_get_type())
-#define GDAUI_DATA_ENTRY(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GDAUI_TYPE_DATA_ENTRY,
GdauiDataEntry)
-#define GDAUI_IS_DATA_ENTRY(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GDAUI_TYPE_DATA_ENTRY)
-#define GDAUI_DATA_ENTRY_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDAUI_TYPE_DATA_ENTRY,
GdauiDataEntryIface))
-
-typedef struct _GdauiDataEntry GdauiDataEntry;
-typedef struct _GdauiDataEntryIface GdauiDataEntryIface;
-
/* error reporting */
extern GQuark gdaui_data_entry_error_quark (void);
#define GDAUI_DATA_ENTRY_ERROR gdaui_data_entry_error_quark ()
@@ -46,8 +38,10 @@ typedef enum
GDAUI_DATA_ENTRY_INVALID_DATA_ERROR
} GdauiDataEntryError;
+#define GDAUI_TYPE_DATA_ENTRY (gdaui_data_entry_get_type())
+G_DECLARE_INTERFACE (GdauiDataEntry, gdaui_data_entry, GDAUI, DATA_ENTRY, GtkWidget)
/* struct for the interface */
-struct _GdauiDataEntryIface
+struct _GdauiDataEntryInterface
{
GTypeInterface g_iface;
@@ -117,8 +111,6 @@ struct _GdauiDataEntryIface
-GType gdaui_data_entry_get_type (void) G_GNUC_CONST;
-
void gdaui_data_entry_set_value_type (GdauiDataEntry *de, GType type);
GType gdaui_data_entry_get_value_type (GdauiDataEntry *de);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]