[libgda] provider-meta: added 'connection' abstract property
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] provider-meta: added 'connection' abstract property
- Date: Mon, 20 Aug 2018 21:01:58 +0000 (UTC)
commit d2cbe4d12067c4fbd4a09f21e3dcb7a663ef25b0
Author: Daniel Espinosa <esodan gmail com>
Date: Mon Aug 20 11:29:51 2018 -0500
provider-meta: added 'connection' abstract property
libgda/gda-provider-meta.c | 36 +++++++++++++++++++++++++++++++++++-
libgda/gda-provider-meta.h | 3 +++
2 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/libgda/gda-provider-meta.c b/libgda/gda-provider-meta.c
index 4af15a0e4..3f005eea0 100644
--- a/libgda/gda-provider-meta.c
+++ b/libgda/gda-provider-meta.c
@@ -17,11 +17,45 @@
* Boston, MA 02110-1301, USA.
*/
#include <libgda/gda-provider-meta.h>
+#include <libgda/gda-connection.h>
+
+enum {
+ PROP_CONNECTION = 1,
+ N_PROPERTIES
+};
+
+static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
G_DEFINE_INTERFACE(GdaProviderMeta, gda_provider_meta, G_TYPE_OBJECT)
static void
-gda_provider_meta_default_init (GdaProviderMetaInterface *iface) {}
+gda_provider_meta_default_init (GdaProviderMetaInterface *iface) {
+
+ obj_properties[PROP_CONNECTION] =
+ g_param_spec_object ("connection",
+ "Connection",
+ "Connection to database to get metadata from",
+ GDA_TYPE_CONNECTION,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE);
+
+ g_object_interface_install_property (iface,
+ obj_properties[PROP_CONNECTION]);
+}
+
+/**
+ * gda_provider_meta_get_connection:
+ * @prov:
+ *
+ * Returns: (transfer full): a #GdaConnection used by this object.
+ */
+GdaConnection*
+gda_provider_meta_get_connection (GdaProviderMeta *prov) {
+ g_return_val_if_fail (prov, NULL);
+ g_return_val_if_fail (GDA_IS_PROVIDER_META (prov), NULL);
+ GdaConnection *cnc = NULL;
+ g_object_get (G_OBJECT(prov), "connection", &cnc, NULL);
+ return cnc;
+}
/* _builtin_data_types */
/**
diff --git a/libgda/gda-provider-meta.h b/libgda/gda-provider-meta.h
index e6bfb9ea7..7f7d10ad0 100644
--- a/libgda/gda-provider-meta.h
+++ b/libgda/gda-provider-meta.h
@@ -229,6 +229,9 @@ struct _GdaProviderMetaInterface
gpointer padding[12];
};
+
+GdaConnection *gda_provider_meta_get_connection (GdaProviderMeta *prov);
+
/* _builtin_data_types */
GdaDataModel *gda_provider_meta_btypes (GdaProviderMeta *prov,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]