[libgda] gdaui-provider-selector: remove private from public API



commit 399b9496dc7944c70529f9938175a5b6b2792507
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Sep 10 09:32:54 2018 -0500

    gdaui-provider-selector: remove private from public API

 libgda-ui/gdaui-provider-selector.c | 58 ++++---------------------------------
 libgda-ui/gdaui-provider-selector.h | 19 +++---------
 2 files changed, 10 insertions(+), 67 deletions(-)
---
diff --git a/libgda-ui/gdaui-provider-selector.c b/libgda-ui/gdaui-provider-selector.c
index 32bd245ac..872e12104 100644
--- a/libgda-ui/gdaui-provider-selector.c
+++ b/libgda-ui/gdaui-provider-selector.c
@@ -23,17 +23,14 @@
 #include <libgda-ui/gdaui-provider-selector.h>
 #include <libgda-ui/gdaui-combo.h>
 
-struct _GdauiProviderSelectorPrivate {
+typedef struct {
        gint dummy;
-};
+} GdauiProviderSelectorPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GdauiProviderSelector, gdaui_provider_selector, GDAUI_TYPE_COMBO)
 
-static void gdaui_provider_selector_class_init (GdauiProviderSelectorClass *klass);
-static void gdaui_provider_selector_init       (GdauiProviderSelector *selector,
-                                               GdauiProviderSelectorClass *klass);
-static void gdaui_provider_selector_finalize   (GObject *object);
 static void gdaui_provider_selector_show       (GtkWidget *widget);
 
-static GObjectClass *parent_class = NULL;
 
 /* column to display */
 static gint cols[] = {0};
@@ -60,7 +57,7 @@ gdaui_provider_selector_show (GtkWidget *widget)
        GdauiProviderSelector *selector;
 
        selector = (GdauiProviderSelector *) widget;
-       GTK_WIDGET_CLASS (parent_class)->show (widget);
+       GTK_WIDGET_CLASS (gdaui_provider_selector_parent_class)->show (widget);
        g_value_set_string (tmpval = gda_value_new (G_TYPE_STRING), "SQLite");
        list = g_slist_append (NULL, tmpval);
        _gdaui_combo_set_selected_ext (GDAUI_COMBO (selector), list, cols);
@@ -77,58 +74,15 @@ gdaui_provider_selector_class_init (GdauiProviderSelectorClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->finalize = gdaui_provider_selector_finalize;
        GTK_WIDGET_CLASS (klass)->show = gdaui_provider_selector_show;
 }
 
 static void
-gdaui_provider_selector_init (GdauiProviderSelector *selector,
-                             G_GNUC_UNUSED GdauiProviderSelectorClass *klass)
+gdaui_provider_selector_init (GdauiProviderSelector *selector)
 {
-       g_return_if_fail (GDAUI_IS_PROVIDER_SELECTOR (selector));
-
-       selector->priv = g_new0 (GdauiProviderSelectorPrivate, 1);
        show_providers (selector);
 }
 
-static void
-gdaui_provider_selector_finalize (GObject *object)
-{
-       GdauiProviderSelector *selector = (GdauiProviderSelector *) object;
-
-       g_return_if_fail (GDAUI_IS_PROVIDER_SELECTOR (selector));
-
-       g_free (selector->priv);
-       selector->priv = NULL;
-
-       parent_class->finalize (object);
-}
-
-GType
-gdaui_provider_selector_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static const GTypeInfo info = {
-                       sizeof (GdauiProviderSelectorClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) gdaui_provider_selector_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (GdauiProviderSelector),
-                       0,
-                       (GInstanceInitFunc) gdaui_provider_selector_init,
-                       0
-               };
-               type = g_type_register_static (GDAUI_TYPE_COMBO, "GdauiProviderSelector", &info, 0);
-       }
-       return type;
-}
-
 /**
  * gdaui_provider_selector_new:
  *
diff --git a/libgda-ui/gdaui-provider-selector.h b/libgda-ui/gdaui-provider-selector.h
index 8060ec0ed..3af16afea 100644
--- a/libgda-ui/gdaui-provider-selector.h
+++ b/libgda-ui/gdaui-provider-selector.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2018 Daniel Espinosa <esodan gmail com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,22 +26,11 @@
 G_BEGIN_DECLS
 
 #define GDAUI_TYPE_PROVIDER_SELECTOR            (gdaui_provider_selector_get_type())
-#define GDAUI_PROVIDER_SELECTOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, 
GDAUI_TYPE_PROVIDER_SELECTOR, GdauiProviderSelector))
-#define GDAUI_PROVIDER_SELECTOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, 
GDAUI_TYPE_PROVIDER_SELECTOR, GdauiProviderSelectorClass))
-#define GDAUI_IS_PROVIDER_SELECTOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, 
GDAUI_TYPE_PROVIDER_SELECTOR))
-#define GDAUI_IS_PROVIDER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GDAUI_TYPE_PROVIDER_SELECTOR))
-
-typedef struct _GdauiProviderSelector        GdauiProviderSelector;
-typedef struct _GdauiProviderSelectorClass   GdauiProviderSelectorClass;
-typedef struct _GdauiProviderSelectorPrivate GdauiProviderSelectorPrivate;
-
-struct _GdauiProviderSelector {
-       GdauiCombo                    parent;
-       GdauiProviderSelectorPrivate *priv;
-};
+G_DECLARE_DERIVABLE_TYPE (GdauiProviderSelector, gdaui_provider_selector, GDAUI, PROVIDER_SELECTOR, 
GdauiCombo)
 
 struct _GdauiProviderSelectorClass {
-       GdauiComboClass               parent_class;
+       GdauiComboClass     parent_class;
+       gpointer            padding[12];
 };
 
 /**
@@ -52,7 +42,6 @@ struct _GdauiProviderSelectorClass {
  * @see_also:
  */
 
-GType              gdaui_provider_selector_get_type         (void) G_GNUC_CONST;
 GtkWidget         *gdaui_provider_selector_new              (void);
 
 GdaServerProvider *gdaui_provider_selector_get_provider_obj (GdauiProviderSelector *selector);


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