[libgda] Added preliminary support for Gda-ui Vala bindings * Added --enable-gdaui-vala switch to build Gda-u



commit 53c9ae5d9a889b610cecd604c9ae077f0c93c732
Author: Daniel Espinosa <esodan gmail com>
Date:   Fri Nov 2 16:14:52 2012 -0600

    Added preliminary support for Gda-ui Vala bindings
    * Added --enable-gdaui-vala switch to build Gda-ui Vala bindings
    * Deprecated gda_data_entry_contents_is_valid method and ::contents-valid signal
    * Added gda_data_entry_validate virtual function to add bindings friendly and
    avoid conflicts with ::contents-valid signal and method.
    * For now Gda-ui Vala bindings don't build because errors on dependent
    Gio-2.0.gir parsing errors. Build depends on Bug 687481.

 configure.ac                 |   18 ++++++++++++++----
 libgda-ui/Gdaui-5.0.metadata |    1 +
 libgda-ui/Makefile.am        |   18 ++++++++++++++++++
 libgda-ui/gdaui-data-entry.c |   41 ++++++++++++++++++++++++++++++++++++++++-
 libgda-ui/gdaui-data-entry.h |    5 +++--
 libgda/libgda-5.0.vapi       |   17 ++++++++++++-----
 6 files changed, 88 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 951a491..51382b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -496,11 +496,20 @@ fi
 
 if test "x$enable_gda_gi" != "xyes" -a "x$enable_vala" = "xyes"
 then
-	AC_MSG_ERROR([Vala bindings is requested but GObject Introspection for GDA is disable. Use --enable-gda-gi])
+	AC_MSG_ERROR([GDA Vala bindings is requested but GObject Introspection for GDA is disable. Use --enable-gda-gi])
 fi
 
+AC_ARG_ENABLE([gdaui-vala],
+    AS_HELP_STRING([--enable-gdaui-vala[=@<:@no/yes@:>@]], [Enable Vala bindings for GDA-UI [default=no]]),
+    [enable_gdaui_vala=$enableval],[enable_gdaui_vala=no])
+if test "x$enable_vala" != "xyes" -a "x$enable_gdaui_vala" = "xyes"
+then
+	AC_MSG_ERROR([Vala bindings for GDA-UI is requested but GDA Vala bindings is disable. Use --enable-vala])
+fi
+AM_CONDITIONAL(ENABLE_GDAUI_VALA, test "x$enable_gdaui_vala" = "xyes")
+
 AC_ARG_ENABLE([vala-extensions],
-    AS_HELP_STRING([--enable-vala-extensions[=@<:@no/auto/yes@:>@]], [Enable utility GObject based extensions written in Vala [default=no]]),
+    AS_HELP_STRING([--enable-vala-extensions[=@<:@no/yes@:>@]], [Enable utility GObject based extensions written in Vala [default=no]]),
     [enable_vala_ext=$enableval],[enable_vala_ext=no])
 
 if test "x$enable_vala" != "xyes" -a "x$enable_vala_ext" = "xyes"
@@ -666,7 +675,7 @@ else
 				AC_MSG_RESULT([Installed SQLite was not compiled with the SQLITE_ENABLE_COLUMN_METADATA, using embedded SQLite])
                 		have_sqlite=no
         		else
-                		AC_MSG_RESULT(Note: using system installed version of SQLite, meta data for functions will not be available)
+                		AC_MSG_RESULT([Note: using system installed version of SQLite, meta data for functions will not be available])
 				have_sqlite=yes
                 		SQLITE_CFLAGS="$SQLITE_CFLAGS -DHAVE_SQLITE"
 				SQLITE_PATH=`pkg-config --variable=libdir sqlite3`
@@ -1008,7 +1017,8 @@ echo "   Building Libxslt extension: `if test x$have_xslt != xno; then echo yes;
 echo "   Building libgda GObject Introspection: `if test x$enable_gda_gi != xno; then echo yes; else echo no; fi`"
 echo "   Building libgda-ui GObject Introspection: `if test x$enable_gdaui_gi != xno; then echo yes; else echo no; fi`"
 echo "   Building Gtk-Doc: `if test x$enable_gtk_doc != xno; then echo yes; else echo no; fi`"
-echo "   Building Vala Bindings: `if test x$vapigen_pkg_found != xyes; then echo no; else echo yes; fi`"
+echo "   Building GDA Vala Bindings (--enable-vala): `if test x$vapigen_pkg_found != xyes; then echo no; else echo yes; fi`"
+echo "   Building GDA-UI Vala Bindings: `if test x$enable_gdaui_vala != xyes; then echo no; else echo yes; fi`"
 echo "   Building Vala Extensions: `if test x$enable_vala_ext != xno; then echo yes; else echo no; fi`"
 echo "   Building Vala Documentation: `if test x$enable_vala_doc != xno; then echo yes; else echo no; fi`"
 echo "   Building Building Libgda's associated tools: `if test x$enable_tools = xyes; then echo yes; else echo no; fi`"
diff --git a/libgda-ui/Gdaui-5.0.metadata b/libgda-ui/Gdaui-5.0.metadata
new file mode 100644
index 0000000..b1db090
--- /dev/null
+++ b/libgda-ui/Gdaui-5.0.metadata
@@ -0,0 +1 @@
+# Gda-ui metadata
diff --git a/libgda-ui/Makefile.am b/libgda-ui/Makefile.am
index f33685f..03da35b 100644
--- a/libgda-ui/Makefile.am
+++ b/libgda-ui/Makefile.am
@@ -245,4 +245,22 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(INTROSPECTION_GIRS) $(typelibs_DATA)
 
+if ENABLE_GDAUI_VALA
+
+vapi: libgdaui-5.0.vapi
+
+libgdaui-5.0.vapi: Gdaui-5.0.gir
+	$(VAPIGEN) --metadatadir=$(top_srcdir)/libgda-ui --vapidir=$(top_srcdir)/libgda --girdir=$(top_srcdir)/libgda --library=libgda-ui-5.0 --pkg=libxml-2.0 --pkg=libgda-5.0 Gdaui-5.0.gir
+
+vapidir = $(VAPIGEN_VAPIDIR)
+vapi_DATA=libgdaui-5.0.vapi
+
+EXTRA_DIST += \
+	Gdaui-5.0.metadata \
+        $(vapi_DATA)
+
+CLEANFILES += libgdaui-5.0.vapi
+
+endif
+
 endif
diff --git a/libgda-ui/gdaui-data-entry.c b/libgda-ui/gdaui-data-entry.c
index 3b77401..4981111 100644
--- a/libgda-ui/gdaui-data-entry.c
+++ b/libgda-ui/gdaui-data-entry.c
@@ -29,6 +29,7 @@ enum {
 	STATUS_CHANGED,
 	CONTENTS_VALID,
 	EXPAND_CHANGED,
+	VALIDATE,
 	LAST_SIGNAL
 };
 
@@ -119,6 +120,19 @@ gdaui_data_entry_iface_init (gpointer g_class)
 				      NULL, NULL,
 				      _gdaui_marshal_VOID__VOID,
 				      G_TYPE_NONE, 0);
+		/**
+		 * GdauiDataEntry::contents-valid: (skip)
+		 * @model: the #GdauiDataEntry
+		 * @error: a #GError to set erros to or NULL
+		 *
+		 * Gets emitted when data entered to the #GdaDataEntry widget must be validated.
+		 *
+		 * For bindings use #gdaui_data_entry_validate function.
+		 *
+		 * Returns: TRUE when the data was successfull validated, FALSE otherwise.
+		 *
+		 * Deprecated: 5.2.0
+		 */
 		gdaui_data_entry_signals[CONTENTS_VALID] =
 			g_signal_new ("contents-valid",
 				      GDAUI_TYPE_DATA_ENTRY,
@@ -230,7 +244,7 @@ gdaui_data_entry_get_value (GdauiDataEntry *de)
 }
 
 /**
- * gdaui_data_entry_content_is_valid:
+ * gdaui_data_entry_content_is_valid: (skip)
  * @de: a #GtkWidget object which implements the #GdauiDataEntry interface
  * @error: (allow-none): a place to store an error, or %NULL
  *
@@ -243,6 +257,8 @@ gdaui_data_entry_get_value (GdauiDataEntry *de)
  * Returns: TRUE if @de's contents is valid
  *
  * Since: 4.2
+ *
+ * Deprecated: 5.2
  */
 gboolean
 gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error)
@@ -254,6 +270,29 @@ gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error)
 	return is_valid;
 }
 
+/**
+ * gdaui_data_entry_validate:
+ * @de: a #GtkWidget object which implements the #GdauiDataEntry interface
+ * @error: (allow-none): a place to store an erro, or %NULL
+ *
+ * Tests the validity of @de's contents. This function must be overrided by implementators.
+ *
+ * Default implementation returns TRUE.
+ *
+ * Returns: TRUE if @de's contents is valid
+ *
+ * Since: 5.2
+ */
+gboolean
+gdaui_data_entry_validate (GdauiDataEntry *de, GError **error)
+{
+	g_return_val_if_fail (GDAUI_IS_DATA_ENTRY (de), FALSE);
+
+	if (GDAUI_DATA_ENTRY_GET_IFACE (de)->validate)
+		(GDAUI_DATA_ENTRY_GET_IFACE (de)->validate) (de, error);
+	else
+		return TRUE;
+}
 
 /**
  * gdaui_data_entry_set_reference_value:
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index 06f4b75..bb0ef1b 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -77,12 +77,12 @@ struct _GdauiDataEntryIface
 
 	void            (*set_unknown_color)     (GdauiDataEntry *de, gdouble red, gdouble green,
 						  gdouble blue, gdouble alpha);
-
+	/* New Validating mecanism */
+	gboolean				(*validate)						 	 (GdauiDataEntry* de, GError **error);
 	/*< private >*/
 	/* Padding for future expansion */
         void (*_gdaui_reserved2) (void);
         void (*_gdaui_reserved3) (void);
-        void (*_gdaui_reserved4) (void);
 };
 
 /**
@@ -122,6 +122,7 @@ GType           gdaui_data_entry_get_value_type         (GdauiDataEntry *de);
 void            gdaui_data_entry_set_value              (GdauiDataEntry *de, const GValue *value);
 GValue         *gdaui_data_entry_get_value              (GdauiDataEntry *de);
 gboolean        gdaui_data_entry_content_is_valid       (GdauiDataEntry *de, GError **error);
+gboolean        gdaui_data_entry_validate				        (GdauiDataEntry *de, GError **error);
 void            gdaui_data_entry_set_reference_value    (GdauiDataEntry *de, const GValue *value);
 const GValue   *gdaui_data_entry_get_reference_value    (GdauiDataEntry *de);
 void            gdaui_data_entry_set_reference_current  (GdauiDataEntry *de);
diff --git a/libgda/libgda-5.0.vapi b/libgda/libgda-5.0.vapi
index 2fe30fe..1939522 100644
--- a/libgda/libgda-5.0.vapi
+++ b/libgda/libgda-5.0.vapi
@@ -258,11 +258,6 @@ namespace Gda {
 		[NoAccessorMethod]
 		public string basedir { owned get; construct; }
 	}
-	[CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_dsn_list_get_type ()")]
-	public class DataModelDsnList : GLib.Object, Gda.DataModel {
-		[CCode (has_construct_function = false)]
-		protected DataModelDsnList ();
-	}
 	[CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_import_get_type ()")]
 	public class DataModelImport : GLib.Object, Gda.DataModel {
 		[CCode (has_construct_function = false)]
@@ -289,6 +284,8 @@ namespace Gda {
 		[CCode (has_construct_function = false)]
 		protected DataModelIter ();
 		public static GLib.Quark error_quark ();
+		[Deprecated (since = "5.2")]
+		public int get_column_for_param (Gda.Holder param);
 		public unowned Gda.Holder get_holder_for_field (int col);
 		public int get_row ();
 		public unowned GLib.Value? get_value_at (int col);
@@ -517,6 +514,7 @@ namespace Gda {
 		public static GLib.Quark error_quark ();
 		public void force_invalid ();
 		public void force_invalid_e (owned GLib.Error? error);
+		public string get_alphanum_id ();
 		public GLib.Value get_attribute (string attribute);
 		public unowned Gda.Holder get_bind ();
 		public GLib.Value get_default_value ();
@@ -627,6 +625,7 @@ namespace Gda {
 		public static GLib.Quark error_quark ();
 		public GLib.SList<weak Gda.MetaDbObject> get_all_db_objects ();
 		public Gda.MetaDbObject get_db_object (GLib.Value? catalog, GLib.Value? schema, GLib.Value name);
+		public bool load_from_xml_file (string? catalog, string? schema, string xml_spec_file) throws GLib.Error;
 		public bool sort_db_objects (Gda.MetaSortType sort_type) throws GLib.Error;
 		[NoAccessorMethod]
 		public uint features { get; construct; }
@@ -1272,6 +1271,14 @@ namespace Gda {
 		public weak GLib.ObjectClass parent_class;
 	}
 	[CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)]
+	public struct DataModelDsnList {
+		public weak GLib.Object object;
+	}
+	[CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)]
+	public struct DataModelDsnListClass {
+		public weak GLib.ObjectClass object_class;
+	}
+	[CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)]
 	public struct Diff {
 		public Gda.DiffType type;
 		public int old_row;



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