[libgda] GI: make GdaProviderInfo introspectable
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] GI: make GdaProviderInfo introspectable
- Date: Wed, 10 Oct 2018 14:16:22 +0000 (UTC)
commit d631ff56a9e219a4c43b330c38a064f576f3e1e6
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Oct 10 09:15:01 2018 -0500
GI: make GdaProviderInfo introspectable
libgda/gda-config.c | 28 ++++++++++++++++++++++++++++
libgda/gda-config.h | 47 +++++++++++++++++++++++++----------------------
2 files changed, 53 insertions(+), 22 deletions(-)
---
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index a5526f377..10ef21be9 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -260,6 +260,34 @@ gda_dsn_info_equal (const GdaDsnInfo *dsn1, const GdaDsnInfo *dsn2)
return dsn2 ? FALSE : TRUE;
}
+/* GdaProviderInfo definitions */
+GdaProviderInfo*
+gda_provider_info_copy (GdaProviderInfo *src)
+{
+ GdaProviderInfo *dst = g_new0(GdaProviderInfo, 1);
+ dst->id = g_strdup (src->id);
+ dst->location = g_strdup (src->location);
+ dst->description = g_strdup (src->description);
+ dst->dsn_params = gda_set_copy (src->dsn_params);
+ dst->auth_params = gda_set_copy (src->auth_params);
+ dst->icon_id = g_strdup (src->icon_id);
+}
+
+void
+gda_provider_info_free (GdaProviderInfo *info)
+{
+ g_free (info->id);
+ g_free (info->location);
+ g_free (info->description);
+ g_object_unref (info->dsn_params);
+ g_object_unref (info->auth_params);
+ g_free (info->icon_id);
+ g_free (info);
+}
+
+G_DEFINE_BOXED_TYPE (GdaProviderInfo, gda_provider_info, gda_provider_info_copy, gda_provider_info_free)
+
+/* GdaInternalProvider */
typedef struct {
GdaProviderInfo pinfo;
GModule *handle;
diff --git a/libgda/gda-config.h b/libgda/gda-config.h
index 71f53a080..8e0d62916 100644
--- a/libgda/gda-config.h
+++ b/libgda/gda-config.h
@@ -40,7 +40,6 @@ G_BEGIN_DECLS
typedef struct _GdaConfigPrivate GdaConfigPrivate;
typedef struct _GdaDsnInfo GdaDsnInfo;
-typedef struct _GdaProviderInfo GdaProviderInfo;
/* error reporting */
extern GQuark gda_config_error_quark (void);
@@ -98,7 +97,7 @@ gboolean gda_dsn_info_equal (const GdaDsnInfo *dsn1, const GdaDsnInf
*
* This structure holds the information associated to a database provider as discovered by Libgda.
*/
-struct _GdaProviderInfo {
+typedef struct {
gchar *id;
gchar *location;
gchar *description;
@@ -112,29 +111,12 @@ struct _GdaProviderInfo {
gpointer _gda_reserved2;
gpointer _gda_reserved3;
gpointer _gda_reserved4;
-};
+} GdaProviderInfo;
-struct _GdaConfig {
- GObject object;
- GdaConfigPrivate *priv;
-};
+#define GDA_TYPE_PROVIDER_INFO (gda_provider_info_get_type ())
-struct _GdaConfigClass {
- GObjectClass object_class;
+GType gda_provider_info_get_type (void) G_GNUC_CONST;
- /* signals */
- void (*dsn_added) (GdaConfig *conf, GdaDsnInfo *new_dsn);
- void (*dsn_to_be_removed) (GdaConfig *conf, GdaDsnInfo *old_dsn);
- void (*dsn_removed) (GdaConfig *conf, GdaDsnInfo *old_dsn);
- void (*dsn_changed) (GdaConfig *conf, GdaDsnInfo *dsn);
-
- /*< private >*/
- /* Padding for future expansion */
- void (*_gda_reserved1) (void);
- void (*_gda_reserved2) (void);
- void (*_gda_reserved3) (void);
- void (*_gda_reserved4) (void);
-};
/**
* SECTION:gda-config
@@ -179,6 +161,27 @@ struct _GdaConfigClass {
* gtk_init() calls setlocale().
*/
+struct _GdaConfig {
+ GObject object;
+ GdaConfigPrivate *priv;
+};
+
+struct _GdaConfigClass {
+ GObjectClass object_class;
+
+ /* signals */
+ void (*dsn_added) (GdaConfig *conf, GdaDsnInfo *new_dsn);
+ void (*dsn_to_be_removed) (GdaConfig *conf, GdaDsnInfo *old_dsn);
+ void (*dsn_removed) (GdaConfig *conf, GdaDsnInfo *old_dsn);
+ void (*dsn_changed) (GdaConfig *conf, GdaDsnInfo *dsn);
+
+ /*< private >*/
+ /* Padding for future expansion */
+ void (*_gda_reserved1) (void);
+ void (*_gda_reserved2) (void);
+ void (*_gda_reserved3) (void);
+ void (*_gda_reserved4) (void);
+};
GType gda_config_get_type (void) G_GNUC_CONST;
GdaConfig* gda_config_get (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]