[libgda] gdaui-data-selector: ported to G_DECLARE/G_DEFINE
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] gdaui-data-selector: ported to G_DECLARE/G_DEFINE
- Date: Wed, 12 Sep 2018 11:54:44 +0000 (UTC)
commit ecafa393cc8fdf2d7a3d58c6cd0a81e00dadc2fd
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Sep 10 17:23:15 2018 -0500
gdaui-data-selector: ported to G_DECLARE/G_DEFINE
libgda-ui/gdaui-cloud.c | 4 ++--
libgda-ui/gdaui-combo.c | 4 ++--
libgda-ui/gdaui-data-selector.c | 39 ++++-----------------------------------
libgda-ui/gdaui-data-selector.h | 13 +++----------
libgda-ui/gdaui-form.c | 4 ++--
libgda-ui/gdaui-grid.c | 4 ++--
libgda-ui/gdaui-raw-form.c | 4 ++--
libgda-ui/gdaui-raw-grid.c | 4 ++--
8 files changed, 19 insertions(+), 57 deletions(-)
---
diff --git a/libgda-ui/gdaui-cloud.c b/libgda-ui/gdaui-cloud.c
index e1c735b07..82457a95b 100644
--- a/libgda-ui/gdaui-cloud.c
+++ b/libgda-ui/gdaui-cloud.c
@@ -38,7 +38,7 @@ static void gdaui_cloud_get_property (GObject *object,
GParamSpec *pspec);
/* GdauiDataSelector interface */
-static void gdaui_cloud_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_cloud_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *cloud_selector_get_model (GdauiDataSelector *iface);
static void cloud_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *cloud_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -137,7 +137,7 @@ gdaui_cloud_class_init (GdauiCloudClass *klass)
}
static void
-gdaui_cloud_selector_init (GdauiDataSelectorIface *iface)
+gdaui_cloud_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = cloud_selector_get_model;
iface->set_model = cloud_selector_set_model;
diff --git a/libgda-ui/gdaui-combo.c b/libgda-ui/gdaui-combo.c
index 927ced87b..a44673814 100644
--- a/libgda-ui/gdaui-combo.c
+++ b/libgda-ui/gdaui-combo.c
@@ -57,7 +57,7 @@ static void gdaui_combo_get_preferred_width (GtkWidget *widget,
gint *natural_size);
/* GdauiDataSelector interface */
-static void gdaui_combo_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_combo_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *combo_selector_get_model (GdauiDataSelector *iface);
static void combo_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *combo_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -101,7 +101,7 @@ gdaui_combo_class_init (GdauiComboClass *klass)
}
static void
-gdaui_combo_selector_init (GdauiDataSelectorIface *iface)
+gdaui_combo_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = combo_selector_get_model;
iface->set_model = combo_selector_set_model;
diff --git a/libgda-ui/gdaui-data-selector.c b/libgda-ui/gdaui-data-selector.c
index 84efb0f9d..6522593a9 100644
--- a/libgda-ui/gdaui-data-selector.c
+++ b/libgda-ui/gdaui-data-selector.c
@@ -35,51 +35,20 @@ enum
static gint gdaui_data_selector_signals[LAST_SIGNAL] = { 0 };
-static void gdaui_data_selector_iface_init (gpointer g_class);
-
-GType
-gdaui_data_selector_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo info = {
- sizeof (GdauiDataSelectorIface),
- (GBaseInitFunc) gdaui_data_selector_iface_init,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) NULL,
- NULL,
- NULL,
- 0,
- 0,
- (GInstanceInitFunc) NULL,
- 0
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE, "GdauiDataSelector", &info, 0);
- g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
- }
- return type;
-}
-
+G_DEFINE_INTERFACE(GdauiDataSelector, gdaui_data_selector, G_TYPE_OBJECT)
static void
-gdaui_data_selector_iface_init (G_GNUC_UNUSED gpointer g_class)
+gdaui_data_selector_default_init (GdauiDataSelectorInterface *iface)
{
- static gboolean initialized = FALSE;
-
- if (! initialized) {
- gdaui_data_selector_signals[SELECTION_CHANGED] =
+ gdaui_data_selector_signals[SELECTION_CHANGED] =
g_signal_new ("selection-changed",
GDAUI_TYPE_DATA_SELECTOR,
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiDataSelectorIface, selection_changed),
+ G_STRUCT_OFFSET (GdauiDataSelectorInterface, selection_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
0);
- initialized = TRUE;
- }
}
/**
diff --git a/libgda-ui/gdaui-data-selector.h b/libgda-ui/gdaui-data-selector.h
index 86b238a69..e0ca98eae 100644
--- a/libgda-ui/gdaui-data-selector.h
+++ b/libgda-ui/gdaui-data-selector.h
@@ -29,15 +29,9 @@
G_BEGIN_DECLS
#define GDAUI_TYPE_DATA_SELECTOR (gdaui_data_selector_get_type())
-#define GDAUI_DATA_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GDAUI_TYPE_DATA_SELECTOR,
GdauiDataSelector)
-#define GDAUI_IS_DATA_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GDAUI_TYPE_DATA_SELECTOR)
-#define GDAUI_DATA_SELECTOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDAUI_TYPE_DATA_SELECTOR,
GdauiDataSelectorIface))
-
-typedef struct _GdauiDataSelectorIface GdauiDataSelectorIface;
-typedef struct _GdauiDataSelector GdauiDataSelector;
-
+G_DECLARE_INTERFACE (GdauiDataSelector, gdaui_data_selector, GDAUI, DATA_SELECTOR, GObject)
/* struct for the interface */
-struct _GdauiDataSelectorIface
+struct _GdauiDataSelectorInterface
{
GTypeInterface g_iface;
@@ -52,6 +46,7 @@ struct _GdauiDataSelectorIface
/* signals */
void (* selection_changed) (GdauiDataSelector *iface);
+ gpointer padding[12];
};
/**
@@ -73,8 +68,6 @@ struct _GdauiDataSelectorIface
* the gdaui_data_selector_get_model() method.
*/
-GType gdaui_data_selector_get_type (void) G_GNUC_CONST;
-
GdaDataModel *gdaui_data_selector_get_model (GdauiDataSelector *iface);
void gdaui_data_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
GArray *gdaui_data_selector_get_selected_rows (GdauiDataSelector *iface);
diff --git a/libgda-ui/gdaui-form.c b/libgda-ui/gdaui-form.c
index 580ad5cca..35683f70e 100644
--- a/libgda-ui/gdaui-form.c
+++ b/libgda-ui/gdaui-form.c
@@ -52,7 +52,7 @@ static gboolean gdaui_form_widget_set_write_mode (GdauiDataProxy *iface,
static GdauiDataProxyWriteMode gdaui_form_widget_get_write_mode (GdauiDataProxy *iface);
/* GdauiDataSelector interface */
-static void gdaui_form_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_form_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *gdaui_form_selector_get_model (GdauiDataSelector *iface);
static void gdaui_form_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *gdaui_form_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -130,7 +130,7 @@ gdaui_form_widget_init (GdauiDataProxyInterface *iface)
}
static void
-gdaui_form_selector_init (GdauiDataSelectorIface *iface)
+gdaui_form_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = gdaui_form_selector_get_model;
iface->set_model = gdaui_form_selector_set_model;
diff --git a/libgda-ui/gdaui-grid.c b/libgda-ui/gdaui-grid.c
index b26098352..5750b7e1c 100644
--- a/libgda-ui/gdaui-grid.c
+++ b/libgda-ui/gdaui-grid.c
@@ -51,7 +51,7 @@ static gboolean gdaui_grid_widget_set_write_mode (GdauiDataProxy *iface,
static GdauiDataProxyWriteMode gdaui_grid_widget_get_write_mode (GdauiDataProxy *iface);
/* GdauiDataSelector interface */
-static void gdaui_grid_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_grid_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *gdaui_grid_selector_get_model (GdauiDataSelector *iface);
static void gdaui_grid_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *gdaui_grid_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -94,7 +94,7 @@ gdaui_grid_widget_init (GdauiDataProxyInterface *iface)
}
static void
-gdaui_grid_selector_init (GdauiDataSelectorIface *iface)
+gdaui_grid_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = gdaui_grid_selector_get_model;
iface->set_model = gdaui_grid_selector_set_model;
diff --git a/libgda-ui/gdaui-raw-form.c b/libgda-ui/gdaui-raw-form.c
index 7943b6741..d16b75fe6 100644
--- a/libgda-ui/gdaui-raw-form.c
+++ b/libgda-ui/gdaui-raw-form.c
@@ -61,7 +61,7 @@ static gboolean gdaui_raw_form_widget_set_write_mode (GdauiDataProxy *ifa
static GdauiDataProxyWriteMode gdaui_raw_form_widget_get_write_mode (GdauiDataProxy *iface);
/* GdauiDataSelector interface */
-static void gdaui_raw_form_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_raw_form_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *gdaui_raw_form_selector_get_model (GdauiDataSelector *iface);
static void gdaui_raw_form_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *gdaui_raw_form_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -107,7 +107,7 @@ gdaui_raw_form_widget_init (GdauiDataProxyInterface *iface)
}
static void
-gdaui_raw_form_selector_init (GdauiDataSelectorIface *iface)
+gdaui_raw_form_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = gdaui_raw_form_selector_get_model;
iface->set_model = gdaui_raw_form_selector_set_model;
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index 2058d0b25..13b7fb691 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -75,7 +75,7 @@ static gboolean gdaui_raw_grid_widget_set_write_mode (GdauiDataProxy *ifa
static GdauiDataProxyWriteMode gdaui_raw_grid_widget_get_write_mode (GdauiDataProxy *iface);
/* GdauiDataSelector interface */
-static void gdaui_raw_grid_selector_init (GdauiDataSelectorIface *iface);
+static void gdaui_raw_grid_selector_init (GdauiDataSelectorInterface *iface);
static GdaDataModel *gdaui_raw_grid_selector_get_model (GdauiDataSelector *iface);
static void gdaui_raw_grid_selector_set_model (GdauiDataSelector *iface, GdaDataModel *model);
static GArray *gdaui_raw_grid_selector_get_selected_rows (GdauiDataSelector *iface);
@@ -227,7 +227,7 @@ gdaui_raw_grid_widget_init (GdauiDataProxyInterface *iface)
}
static void
-gdaui_raw_grid_selector_init (GdauiDataSelectorIface *iface)
+gdaui_raw_grid_selector_init (GdauiDataSelectorInterface *iface)
{
iface->get_model = gdaui_raw_grid_selector_get_model;
iface->set_model = gdaui_raw_grid_selector_set_model;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]