libgda r3239 - in trunk: . doc/C/tmpl libgda libgda/binreloc providers/mysql tests/data-models tests/value-holders



Author: vivien
Date: Mon Oct 13 16:33:12 2008
New Revision: 3239
URL: http://svn.gnome.org/viewvc/libgda?rev=3239&view=rev

Log:
2008-10-13  Vivien Malerba <malerba gnome-db org>

	* libgda/gda-error.[ch]: declare a GDA_TYPE_ERROR by registering a boxed type
	for GError
	* libgda/gda-custom-marshal.[ch]: implement custom marshallers where needed
	* libgda/gda-column.c: moved custom marshaller to libgda/gda-custom-marshal.[ch]
	* libgda/gda-data-proxy.c:
	* libgda/gda-holder.c:
	* libgda/gda-set.c: implemented custom marshallers for the following signals:
	  - GdaSet::validate-set
	  - GdaSet::validate-holder-changed
	  - GdaSet::holder-attr-changed
	  - GdaHolder::attribute-changed
	  - GdaHolder::validate-change
	  - GdaDataProxy::validate-row-changes
	for bug #555905
	* tests/data-models/check_data_proxy.c:
	* tests/value-holders/check_set.c: updated test to check new marshallers
	* libgda/gda-data-model.c: either display a warning or set error when a requested
	method is not implemented
	* libgda/binreloc/gda-binreloc.c: correctly handle the case where the libdir is lib64
	* libgda/gda-statement.c:
	* libgda/gda-data-comparator.c:
	* libgda/gda-data-proxy.c:
	* libgda/gda-custom-marshal.h:
	* libgda/gda-marshal.c:
	* libgda/gda-custom-marshal.c:
	* libgda/gda-set.c:
	* libgda/gda-marshal.h:
	* libgda/gda-threader.c:
	* libgda/Makefile.am:
	* libgda/gda-config.c:
	* libgda/gda-connection.c:
	* libgda/gda-meta-store.c:
	* libgda/gda-holder.c:
	* libgda/gda-column.c:
	* libgda/gda-server-operation.c: renamed gda_marshal* to _gda_marshal* so that these symbols
	are not exported in the final library anymore (now only 853 symbols exported!)
	* providers/mysql/gda-mysql-provider.c: honor the "USERNAME" and "PASSWORD" in
	the auth_string
	* doc/C: doc. update


Added:
   trunk/libgda/gda-custom-marshal.c
   trunk/libgda/gda-custom-marshal.h
   trunk/libgda/gda-error.c
   trunk/libgda/gda-error.h
Modified:
   trunk/ChangeLog
   trunk/doc/C/tmpl/gda-data-model-import.sgml
   trunk/libgda/Makefile.am
   trunk/libgda/binreloc/gda-binreloc.c
   trunk/libgda/gda-column.c
   trunk/libgda/gda-config.c
   trunk/libgda/gda-connection.c
   trunk/libgda/gda-data-comparator.c
   trunk/libgda/gda-data-model.c
   trunk/libgda/gda-data-proxy.c
   trunk/libgda/gda-holder.c
   trunk/libgda/gda-init.c
   trunk/libgda/gda-marshal.list
   trunk/libgda/gda-meta-store.c
   trunk/libgda/gda-server-operation.c
   trunk/libgda/gda-set.c
   trunk/libgda/gda-statement.c
   trunk/libgda/gda-threader.c
   trunk/providers/mysql/gda-mysql-provider.c
   trunk/tests/data-models/check_data_proxy.c
   trunk/tests/value-holders/check_set.c

Modified: trunk/doc/C/tmpl/gda-data-model-import.sgml
==============================================================================
--- trunk/doc/C/tmpl/gda-data-model-import.sgml	(original)
+++ trunk/doc/C/tmpl/gda-data-model-import.sgml	Mon Oct 13 16:33:12 2008
@@ -29,11 +29,8 @@
   <listitem><para>"ENCODING" (string, CVS import only): specifies the character set used in the imported data</para></listitem>
   <listitem><para>"TITLE_AS_FIRST_LINE" (boolean, CVS import only): TRUE to specify that the first line of the 
       imported data contains the column names</para></listitem>
-  <listitem><para>"GDA_TYPE_&lt;col number&gt;" (gda type, CVS import only): specifies the requested GDA type for the column
+  <listitem><para>"G_TYPE_&lt;col number&gt;" (GType, CVS import only): specifies the requested GType type for the column
 	numbered "col number"</para></listitem>
-  <listitem><para>"DBMS_TYPE_&lt;col number&gt;" (string, CVS import only): specifies the requested DBMS type for the column
-	numbered "col number"; if the DBMS type is listed in the dictionary used by the created model, then
-	the GDA type is set in accordance</para></listitem>
 </itemizedlist>
 </para>
 

Modified: trunk/libgda/Makefile.am
==============================================================================
--- trunk/libgda/Makefile.am	(original)
+++ trunk/libgda/Makefile.am	Mon Oct 13 16:33:12 2008
@@ -18,12 +18,12 @@
 	$(BDB_CFLAGS) \
 	$(GIO_CFLAGS) $(GNOMEVFS_CFLAGS)
 
-gda_marshal_built_files = gda-marshal.h gda-marshal.c
+_gda_marshal_built_files = gda-marshal.h gda-marshal.c
 
 gda-marshal.h: gda-marshal.list $(GLIB_GENMARSHAL)
-	$(GLIB_GENMARSHAL) $< --header --prefix=gda_marshal > $@
+	$(GLIB_GENMARSHAL) $< --header --prefix=_gda_marshal > $@
 gda-marshal.c: gda-marshal.list $(GLIB_GENMARSHAL)
-	$(GLIB_GENMARSHAL) $< --body --prefix=gda_marshal > $@
+	$(GLIB_GENMARSHAL) $< --body --prefix=_gda_marshal > $@
 
 gda_headers = \
 	gda-attributes-manager.h \
@@ -89,6 +89,8 @@
 	gda-config.c \
 	gda-connection.c \
 	gda-connection-event.c \
+	gda-custom-marshal.c \
+	gda-custom-marshal.h \
 	gda-data-comparator.c \
 	gda-data-handler.c \
 	gda-data-model-array.c \
@@ -104,6 +106,8 @@
 	gda-data-select.c \
 	gda-data-select-extra.h \
 	gda-easy.c \
+	gda-error.c \
+	gda-error.h \
 	gda-holder.c \
 	gda-init.c \
 	gda-lockable.c \

Modified: trunk/libgda/binreloc/gda-binreloc.c
==============================================================================
--- trunk/libgda/binreloc/gda-binreloc.c	(original)
+++ trunk/libgda/binreloc/gda-binreloc.c	Mon Oct 13 16:33:12 2008
@@ -71,6 +71,7 @@
 	gchar **parts;
 	gint size, i;
 	const gchar *prefix_dir_name = NULL;
+	gint prefix_len = strlen (LIBGDAPREFIX);
 
 #ifdef G_OS_WIN32
 	wchar_t path[MAX_PATH];
@@ -81,48 +82,55 @@
 	case GDA_NO_DIR:
 		break;
 	case GDA_BIN_DIR:
-		if (! g_str_has_prefix (LIBGDABIN, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDABIN);
+		tmp = LIBGDABIN;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
 		else
 			prefix_dir_name = "bin";
 		break;
 	case GDA_SBIN_DIR:
-		if (! g_str_has_prefix (LIBGDASBIN, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDASBIN);
+		tmp = LIBGDASBIN;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
 		else
-			prefix_dir_name = "sbin";
+			prefix_dir_name = tmp + prefix_len + 1;
 		break;
 	case GDA_DATA_DIR:
-		if (! g_str_has_prefix (LIBGDADATA, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDADATA);
+		tmp = LIBGDADATA;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
 		else
-			prefix_dir_name = "share";
+			prefix_dir_name = tmp + prefix_len + 1;
 		break;
 	case GDA_LOCALE_DIR:
-		if (! g_str_has_prefix (LIBGDADATA, LIBGDAPREFIX)) {
-			prefix = g_strdup (LIBGDADATA);
+		tmp = LIBGDADATA;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) {
+			prefix = g_strdup (tmp);
 			prefix_dir_name = "locale";
 		}
 		else
 			prefix_dir_name = "share" G_DIR_SEPARATOR_S "locale";
 		break;
 	case GDA_LIB_DIR:
-		if (! g_str_has_prefix (LIBGDALIB, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDALIB);
-		else
-			prefix_dir_name = "lib";		
+		tmp = LIBGDALIB;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
+		else 
+			prefix_dir_name = tmp + prefix_len + 1;
 		break;
 	case GDA_LIBEXEC_DIR:
-		if (! g_str_has_prefix (LIBGDALIBEXEC, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDALIBEXEC);
+		tmp = LIBGDALIBEXEC;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
 		else
-			prefix_dir_name = "libexec";
+			prefix_dir_name = tmp + prefix_len + 1;
 		break;
 	case GDA_ETC_DIR:
-		if (! g_str_has_prefix (LIBGDASYSCONF, LIBGDAPREFIX)) 
-			prefix = g_strdup (LIBGDASYSCONF);
+		tmp = LIBGDASYSCONF;
+		if (! g_str_has_prefix (tmp, LIBGDAPREFIX) || (tmp [prefix_len] != G_DIR_SEPARATOR)) 
+			prefix = g_strdup (tmp);
 		else
-			prefix_dir_name = "etc";
+			prefix_dir_name = tmp + prefix_len + 1;
 		break;
 	}
 

Modified: trunk/libgda/gda-column.c
==============================================================================
--- trunk/libgda/gda-column.c	(original)
+++ trunk/libgda/gda-column.c	Mon Oct 13 16:33:12 2008
@@ -29,6 +29,7 @@
 #include <string.h>
 #include "gda-marshal.h"
 #include <libgda/gda-attributes-manager.h>
+#include <libgda/gda-custom-marshal.h>
 
 #define PARENT_TYPE G_TYPE_OBJECT
 
@@ -68,47 +69,6 @@
 	LAST_SIGNAL
 };
 
-/* marshaller */
-/* This marshaller is hardcoded here because glib-genmarshal does not support
- * GTYPE
- */
-/* VOID:GTYPE,GTYPE */
-static void
-gda_marshal_VOID__GTYPE_GTYPE (GClosure     *closure,
-                               GValue       *return_value G_GNUC_UNUSED,
-                               guint         n_param_values,
-                               const GValue *param_values,
-                               gpointer      invocation_hint G_GNUC_UNUSED,
-                               gpointer      marshal_data)
-{
-  typedef void (*GMarshalFunc_VOID__GTYPE_GTYPE) (gpointer     data1,
-                                              GType         arg_1,
-                                              GType         arg_2,
-                                              gpointer     data2);
-  register GMarshalFunc_VOID__GTYPE_GTYPE callback;
-  register GCClosure *cc = (GCClosure*) closure;
-  register gpointer data1, data2; 
-
-  g_return_if_fail (n_param_values == 3);
-
-  if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-      data1 = closure->data;
-      data2 = g_value_peek_pointer (param_values + 0);
-    }
-  else
-    {
-      data1 = g_value_peek_pointer (param_values + 0);
-      data2 = closure->data;
-    }
-  callback = (GMarshalFunc_VOID__GTYPE_GTYPE) (marshal_data ? marshal_data : cc->callback);
-
-  callback (data1,
-            g_value_get_gtype (param_values + 1),
-            g_value_get_gtype (param_values + 2),
-            data2);
-}
-
 static guint gda_column_signals[LAST_SIGNAL] = {0 , 0};
 
 /* properties */
@@ -144,7 +104,7 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GdaColumnClass, g_type_changed),
 			      NULL, NULL,
-			      gda_marshal_VOID__GTYPE_GTYPE,
+			      _gda_marshal_VOID__GTYPE_GTYPE,
 			      G_TYPE_NONE,
 			      2, G_TYPE_GTYPE, G_TYPE_GTYPE);
 

Modified: trunk/libgda/gda-config.c
==============================================================================
--- trunk/libgda/gda-config.c	(original)
+++ trunk/libgda/gda-config.c	Mon Oct 13 16:33:12 2008
@@ -140,7 +140,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConfigClass, dsn_added),
                               NULL, NULL,
-                              gda_marshal_VOID__POINTER,
+                              _gda_marshal_VOID__POINTER,
                               G_TYPE_NONE, 1, G_TYPE_POINTER);
 	gda_config_signals[DSN_TO_BE_REMOVED] =
                 g_signal_new ("dsn-to-be-removed",
@@ -148,7 +148,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConfigClass, dsn_to_be_removed),
                               NULL, NULL,
-                              gda_marshal_VOID__POINTER,
+                              _gda_marshal_VOID__POINTER,
                               G_TYPE_NONE, 1, G_TYPE_POINTER);
 	gda_config_signals[DSN_REMOVED] =
                 g_signal_new ("dsn-removed",
@@ -156,7 +156,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConfigClass, dsn_removed),
                               NULL, NULL,
-                              gda_marshal_VOID__POINTER,
+                              _gda_marshal_VOID__POINTER,
                               G_TYPE_NONE, 1, G_TYPE_POINTER);
 	gda_config_signals[DSN_CHANGED] =
                 g_signal_new ("dsn-changed",
@@ -164,7 +164,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConfigClass, dsn_changed),
                               NULL, NULL,
-                              gda_marshal_VOID__POINTER,
+                              _gda_marshal_VOID__POINTER,
                               G_TYPE_NONE, 1, G_TYPE_POINTER);
 
 	/* Properties */

Modified: trunk/libgda/gda-connection.c
==============================================================================
--- trunk/libgda/gda-connection.c	(original)
+++ trunk/libgda/gda-connection.c	Mon Oct 13 16:33:12 2008
@@ -145,7 +145,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConnectionClass, conn_opened),
                               NULL, NULL,
-                              gda_marshal_VOID__VOID,
+                              _gda_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
         gda_connection_signals[CONN_TO_CLOSE] =
                 g_signal_new ("conn-to-close",
@@ -153,7 +153,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaConnectionClass, conn_to_close),
                               NULL, NULL,
-                              gda_marshal_VOID__VOID,
+                              _gda_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
         gda_connection_signals[CONN_CLOSED] =    /* runs after user handlers */
                 g_signal_new ("conn-closed",
@@ -161,7 +161,7 @@
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GdaConnectionClass, conn_closed),
                               NULL, NULL,
-                              gda_marshal_VOID__VOID,
+                              _gda_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
 	gda_connection_signals[DSN_CHANGED] =
 		g_signal_new ("dsn-changed",

Added: trunk/libgda/gda-custom-marshal.c
==============================================================================
--- (empty file)
+++ trunk/libgda/gda-custom-marshal.c	Mon Oct 13 16:33:12 2008
@@ -0,0 +1,268 @@
+/* GDA common library
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      Johannes Schmid
+ *      Vivien Malerba <malerba gnome-db org>
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gda-custom-marshal.h>
+
+
+/* These marshallers are hardcoded here because glib-genmarshal does not support the marshalled types */
+
+void
+_gda_marshal_VOID__GTYPE_GTYPE (GClosure     *closure,
+                               GValue       *return_value G_GNUC_UNUSED,
+                               guint         n_param_values,
+                               const GValue *param_values,
+                               gpointer      invocation_hint G_GNUC_UNUSED,
+                               gpointer      marshal_data)
+{
+	typedef void (*GMarshalFunc_VOID__GTYPE_GTYPE) (gpointer     data1,
+							GType        arg_1,
+							GType        arg_2,
+							gpointer     data2);
+	register GMarshalFunc_VOID__GTYPE_GTYPE callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	
+	g_return_if_fail (n_param_values == 3);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_VOID__GTYPE_GTYPE) (marshal_data ? marshal_data : cc->callback);
+	
+	callback (data1,
+		  g_value_get_gtype (param_values + 1),
+		  g_value_get_gtype (param_values + 2),
+		  data2);
+}
+
+void
+_gda_marshal_ERROR__OBJECT_VALUE (GClosure     *closure,
+				 GValue       *return_value G_GNUC_UNUSED,
+				 guint         n_param_values,
+				 const GValue *param_values,
+				 gpointer      invocation_hint G_GNUC_UNUSED,
+				 gpointer      marshal_data)
+{
+	typedef GError *(*GMarshalFunc_ERROR__OBJECT_VALUE) (gpointer     data1,
+							     gpointer     arg_1,
+							     gpointer     arg_2,
+							     gpointer     data2);
+	register GMarshalFunc_ERROR__OBJECT_VALUE callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	GError *v_return;
+	
+	g_return_if_fail (n_param_values == 3);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_ERROR__OBJECT_VALUE) (marshal_data ? marshal_data : cc->callback);
+	
+	v_return = callback (data1,
+			     g_value_get_object (param_values + 1),
+			     g_value_get_boxed (param_values + 2),
+			     data2);
+	g_value_take_boxed (return_value, v_return);
+}
+
+void
+_gda_marshal_VOID__OBJECT_STRING_VALUE (GClosure     *closure,
+				       GValue       *return_value G_GNUC_UNUSED,
+				       guint         n_param_values,
+				       const GValue *param_values,
+				       gpointer      invocation_hint G_GNUC_UNUSED,
+				       gpointer      marshal_data)
+{
+	typedef void (*GMarshalFunc_VOID__OBJECT_STRING_VALUE) (gpointer     data1,
+								gpointer     arg_1,
+								gpointer     arg_2,
+								gpointer     arg_3,
+								gpointer     data2);
+	register GMarshalFunc_VOID__OBJECT_STRING_VALUE callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	
+	g_return_if_fail (n_param_values == 4);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_VOID__OBJECT_STRING_VALUE) (marshal_data ? marshal_data : cc->callback);
+	
+	callback (data1,
+		  g_value_get_object (param_values + 1),
+		  (gpointer) g_value_get_string (param_values + 2),
+		  g_value_get_boxed (param_values + 3),
+		  data2);
+}
+
+void
+_gda_marshal_ERROR__VOID (GClosure     *closure,
+			 GValue       *return_value G_GNUC_UNUSED,
+			 guint         n_param_values,
+			 const GValue *param_values,
+			 gpointer      invocation_hint G_GNUC_UNUSED,
+			 gpointer      marshal_data)
+{
+	typedef GError *(*GMarshalFunc_ERROR__VOID) (gpointer     data1,
+						     gpointer     data2);
+	register GMarshalFunc_ERROR__VOID callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	GError *v_return;
+	
+	g_return_if_fail (n_param_values == 1);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_ERROR__VOID) (marshal_data ? marshal_data : cc->callback);
+	
+	v_return = callback (data1, data2);
+	g_value_take_boxed (return_value, v_return);	
+}
+
+void
+_gda_marshal_VOID__STRING_VALUE (GClosure     *closure,
+				GValue       *return_value G_GNUC_UNUSED,
+				guint         n_param_values,
+				const GValue *param_values,
+				gpointer      invocation_hint G_GNUC_UNUSED,
+				gpointer      marshal_data)
+{
+	typedef void (*GMarshalFunc_VOID__STRING_VALUE) (gpointer     data1,
+							 gpointer     arg_1,
+							 gpointer     arg_2,
+							 gpointer     data2);
+	register GMarshalFunc_VOID__STRING_VALUE callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	
+	g_return_if_fail (n_param_values == 3);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_VOID__STRING_VALUE) (marshal_data ? marshal_data : cc->callback);
+	
+	callback (data1,
+		  (gpointer) g_value_get_string (param_values + 1),
+		  g_value_get_boxed (param_values + 2),
+		  data2);
+}
+
+void
+_gda_marshal_ERROR__VALUE (GClosure     *closure,
+			  GValue       *return_value G_GNUC_UNUSED,
+			  guint         n_param_values,
+			  const GValue *param_values,
+			  gpointer      invocation_hint G_GNUC_UNUSED,
+			  gpointer      marshal_data)
+{
+	typedef GError *(*GMarshalFunc_ERROR__VALUE) (gpointer     data1,
+						      gpointer     arg_1,
+						      gpointer     data2);
+	register GMarshalFunc_ERROR__VALUE callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	GError *v_return;
+	
+	g_return_if_fail (n_param_values == 2);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_ERROR__VALUE) (marshal_data ? marshal_data : cc->callback);
+	
+	v_return = callback (data1,
+			     g_value_get_boxed (param_values + 1),
+			     data2);
+	g_value_take_boxed (return_value, v_return);
+}
+
+void
+_gda_marshal_ERROR__INT_INT (GClosure     *closure,
+			    GValue       *return_value G_GNUC_UNUSED,
+			    guint         n_param_values,
+			    const GValue *param_values,
+			    gpointer      invocation_hint G_GNUC_UNUSED,
+			    gpointer      marshal_data)
+{
+	typedef GError *(*GMarshalFunc_ERROR__INT_INT) (gpointer     data1,
+							gint         arg_1,
+							gint         arg_2,
+							gpointer     data2);
+	register GMarshalFunc_ERROR__INT_INT callback;
+	register GCClosure *cc = (GCClosure*) closure;
+	register gpointer data1, data2; 
+	GError *v_return;
+	
+	g_return_if_fail (n_param_values == 3);
+	
+	if (G_CCLOSURE_SWAP_DATA (closure)) {
+		data1 = closure->data;
+		data2 = g_value_peek_pointer (param_values + 0);
+	}
+	else {
+		data1 = g_value_peek_pointer (param_values + 0);
+		data2 = closure->data;
+	}
+	callback = (GMarshalFunc_ERROR__INT_INT) (marshal_data ? marshal_data : cc->callback);
+	
+	v_return = callback (data1,
+			     g_value_get_int (param_values + 1),
+			     g_value_get_int (param_values + 2),
+			     data2);
+	g_value_take_boxed (return_value, v_return);	
+}

Added: trunk/libgda/gda-custom-marshal.h
==============================================================================
--- (empty file)
+++ trunk/libgda/gda-custom-marshal.h	Mon Oct 13 16:33:12 2008
@@ -0,0 +1,97 @@
+/* GDA common library
+ * Copyright (C) 2008 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      Johannes Schmid
+ *      Vivien Malerba <malerba gnome-db org>
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDA_CUSTOM_MARSHAL_H__
+#define __GDA_CUSTOM_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* VOID:GTYPE,GTYPE */
+void
+_gda_marshal_VOID__GTYPE_GTYPE (GClosure     *closure,
+                               GValue       *return_value G_GNUC_UNUSED,
+                               guint         n_param_values,
+                               const GValue *param_values,
+                               gpointer      invocation_hint G_GNUC_UNUSED,
+                               gpointer      marshal_data);
+
+/* ERROR:OBJECT,VALUE */
+void
+_gda_marshal_ERROR__OBJECT_VALUE (GClosure     *closure,
+				 GValue       *return_value G_GNUC_UNUSED,
+				 guint         n_param_values,
+				 const GValue *param_values,
+				 gpointer      invocation_hint G_GNUC_UNUSED,
+				 gpointer      marshal_data);
+
+/* VOID:OBJECT,STRING,VALUE */
+void
+_gda_marshal_VOID__OBJECT_STRING_VALUE (GClosure     *closure,
+				       GValue       *return_value G_GNUC_UNUSED,
+				       guint         n_param_values,
+				       const GValue *param_values,
+				       gpointer      invocation_hint G_GNUC_UNUSED,
+				       gpointer      marshal_data);
+
+/* ERROR:VOID */
+void
+_gda_marshal_ERROR__VOID (GClosure     *closure,
+			 GValue       *return_value G_GNUC_UNUSED,
+			 guint         n_param_values,
+			 const GValue *param_values,
+			 gpointer      invocation_hint G_GNUC_UNUSED,
+			 gpointer      marshal_data);
+
+
+/* VOID:STRING,VALUE */
+void
+_gda_marshal_VOID__STRING_VALUE (GClosure     *closure,
+				GValue       *return_value G_GNUC_UNUSED,
+				guint         n_param_values,
+				const GValue *param_values,
+				gpointer      invocation_hint G_GNUC_UNUSED,
+				gpointer      marshal_data);
+
+/* ERROR:VALUE */
+void
+_gda_marshal_ERROR__VALUE (GClosure     *closure,
+			  GValue       *return_value G_GNUC_UNUSED,
+			  guint         n_param_values,
+			  const GValue *param_values,
+			  gpointer      invocation_hint G_GNUC_UNUSED,
+			  gpointer      marshal_data);
+
+/* ERROR:INT,INT */
+void
+_gda_marshal_ERROR__INT_INT (GClosure     *closure,
+			    GValue       *return_value G_GNUC_UNUSED,
+			    guint         n_param_values,
+			    const GValue *param_values,
+			    gpointer      invocation_hint G_GNUC_UNUSED,
+			    gpointer      marshal_data);
+
+G_END_DECLS
+
+#endif

Modified: trunk/libgda/gda-data-comparator.c
==============================================================================
--- trunk/libgda/gda-data-comparator.c	(original)
+++ trunk/libgda/gda-data-comparator.c	Mon Oct 13 16:33:12 2008
@@ -144,7 +144,7 @@
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GdaDataComparatorClass, diff_computed),
                               diff_computed_accumulator, NULL,
-                              gda_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
+                              _gda_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
 
 	class->diff_computed = m_diff_computed;
 

Modified: trunk/libgda/gda-data-model.c
==============================================================================
--- trunk/libgda/gda-data-model.c	(original)
+++ trunk/libgda/gda-data-model.c	Mon Oct 13 16:33:12 2008
@@ -371,6 +371,7 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_get_n_columns) (model);
 	else {
 		/* method not supported */
+		g_warning ("%s() method not supported\n", __FUNCTION__);
 		return -1;
 	}
 }
@@ -399,6 +400,7 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_describe_column) (model, col);
 	else {
 		/* method not supported */
+		g_warning ("%s() method not supported\n", __FUNCTION__);
 		return NULL;
 	}
 }
@@ -693,6 +695,8 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_set_values) (model, row, values, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support setting values"));
 		return FALSE;
 	}
 }
@@ -745,6 +749,8 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_append_values) (model, values, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support row append"));
 		return -1;
 	}
 }
@@ -774,6 +780,8 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_append_row) (model, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support row append"));
 		return -1;
 	}
 }
@@ -804,6 +812,8 @@
 		return (GDA_DATA_MODEL_GET_CLASS (model)->i_remove_row) (model, row, error);
 	else {
 		/* method not supported */
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_FEATURE_NON_SUPPORTED_ERROR,
+			     _("Data model does not support row removal"));
 		return FALSE;
 	}
 }

Modified: trunk/libgda/gda-data-proxy.c
==============================================================================
--- trunk/libgda/gda-data-proxy.c	(original)
+++ trunk/libgda/gda-data-proxy.c	Mon Oct 13 16:33:12 2008
@@ -38,6 +38,8 @@
 #include <sql-parser/gda-sql-parser.h>
 #include <sql-parser/gda-sql-statement.h>
 #include <sql-parser/gda-statement-struct-util.h>
+#include <libgda/gda-custom-marshal.h>
+#include <libgda/gda-error.h>
 
 /* 
  * Main static functions 
@@ -524,8 +526,8 @@
 {
 	GError *error;
 
-        error = g_value_get_pointer (handler_return); 
-        g_value_set_pointer (return_accu, error);
+        error = g_value_get_boxed (handler_return); 
+        g_value_set_boxed (return_accu, error);
 
         return error ? FALSE : TRUE; /* stop signal if 'thisvalue' is FALSE */
 }
@@ -550,7 +552,7 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaDataProxyClass, row_delete_changed),
                               NULL, NULL,
-			      gda_marshal_VOID__INT_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_BOOLEAN);
+			      _gda_marshal_VOID__INT_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_BOOLEAN);
 	gda_data_proxy_signals [SAMPLE_SIZE_CHANGED] =
 		g_signal_new ("sample-size-changed",
                               G_TYPE_FROM_CLASS (object_class),
@@ -564,28 +566,28 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaDataProxyClass, sample_changed),
                               NULL, NULL,
-			      gda_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+			      _gda_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
 	gda_data_proxy_signals [VALIDATE_ROW_CHANGES] =
 		g_signal_new ("validate-row-changes",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GdaDataProxyClass, validate_row_changes),
                               validate_row_changes_accumulator, NULL,
-                              gda_marshal_POINTER__INT_INT, G_TYPE_POINTER, 2, G_TYPE_INT, G_TYPE_INT);
+                              _gda_marshal_ERROR__INT_INT, GDA_TYPE_ERROR, 2, G_TYPE_INT, G_TYPE_INT);
 	gda_data_proxy_signals [ROW_CHANGES_APPLIED] =
 		g_signal_new ("row-changes-applied",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaDataProxyClass, row_changes_applied),
                               NULL, NULL,
-			      gda_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+			      _gda_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
 	gda_data_proxy_signals [FILTER_CHANGED] = 
 		g_signal_new ("filter-changed",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaDataProxyClass, filter_changed),
                               NULL, NULL,
-			      gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
+			      _gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
 	klass->row_delete_changed = NULL;
 	klass->sample_size_changed = NULL;

Added: trunk/libgda/gda-error.c
==============================================================================
--- (empty file)
+++ trunk/libgda/gda-error.c	Mon Oct 13 16:33:12 2008
@@ -0,0 +1,39 @@
+/*
+ * gda-error.c
+ * Copyright (C) 2007 Sebastien Granjoux  <seb sfo free fr>
+ *               2008 Vivien Malerba <malerba gnome-db org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "gda-error.h"
+
+GType
+gda_error_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static GStaticMutex registering = G_STATIC_MUTEX_INIT;
+		g_static_mutex_lock (&registering);
+                if (type == 0)
+			type = g_boxed_type_register_static ("GDaError",
+							     (GBoxedCopyFunc) g_error_copy,
+							     (GBoxedFreeFunc) g_error_free);
+		g_static_mutex_unlock (&registering);
+	}
+
+	return type;
+}

Added: trunk/libgda/gda-error.h
==============================================================================
--- (empty file)
+++ trunk/libgda/gda-error.h	Mon Oct 13 16:33:12 2008
@@ -0,0 +1,35 @@
+/*
+ * gda-error.h
+ * Copyright (C) 2007 Sebastien Granjoux  <seb sfo free fr>
+ *               2008 Vivien Malerba <malerba gnome-db org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef __GDA_ERROR_H__
+#define __GDA_ERROR_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* Boxed type for GError will not be done in GLib see bug #300610 */
+
+#define GDA_TYPE_ERROR		(gda_error_get_type())
+
+GType   gda_error_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif

Modified: trunk/libgda/gda-holder.c
==============================================================================
--- trunk/libgda/gda-holder.c	(original)
+++ trunk/libgda/gda-holder.c	Mon Oct 13 16:33:12 2008
@@ -29,6 +29,8 @@
 #include "gda-util.h"
 #include <libgda.h>
 #include <libgda/gda-attributes-manager.h>
+#include <libgda/gda-custom-marshal.h>
+#include <libgda/gda-error.h>
 
 /* 
  * Main static functions 
@@ -149,10 +151,10 @@
 {
 	GError *error;
 
-	error = g_value_get_pointer (handler_return);
-	g_value_set_pointer (return_accu, error);
+	error = g_value_get_boxed (handler_return);
+	g_value_set_boxed (return_accu, error);
 
-	return error ? FALSE : TRUE; /* stop signal if 'thisvalue' is FALSE */
+	return error ? FALSE : TRUE; /* stop signal if error has been set */
 }
 
 static GError *
@@ -180,22 +182,22 @@
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaHolderClass, source_changed),
                               NULL, NULL,
-                              gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
+                              _gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
 	gda_holder_signals[CHANGED] =
                 g_signal_new ("changed",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaHolderClass, changed),
                               NULL, NULL,
-                              gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
+                              _gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
 	gda_holder_signals[ATT_CHANGED] =
                 g_signal_new ("attribute-changed",
                               G_TYPE_FROM_CLASS (object_class),
                               G_SIGNAL_RUN_FIRST,
                               G_STRUCT_OFFSET (GdaHolderClass, att_changed),
                               NULL, NULL,
-                              gda_marshal_VOID__STRING_POINTER, G_TYPE_NONE, 2, 
-			      G_TYPE_STRING, G_TYPE_POINTER);
+                              _gda_marshal_VOID__STRING_VALUE, G_TYPE_NONE, 2, 
+			      G_TYPE_STRING, G_TYPE_VALUE);
 
 	/**
 	 * GdaHolder::before-change:
@@ -214,7 +216,7 @@
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GdaHolderClass, validate_change),
                               validate_change_accumulator, NULL,
-                              gda_marshal_POINTER__POINTER, G_TYPE_POINTER, 1, G_TYPE_POINTER);
+                              _gda_marshal_ERROR__VALUE, GDA_TYPE_ERROR, 1, G_TYPE_VALUE);
 
         class->changed = NULL;
         class->source_changed = NULL;

Modified: trunk/libgda/gda-init.c
==============================================================================
--- trunk/libgda/gda-init.c	(original)
+++ trunk/libgda/gda-init.c	Mon Oct 13 16:33:12 2008
@@ -27,6 +27,7 @@
 
 #include <libgda/binreloc/gda-binreloc.h>
 #include <sql-parser/gda-sql-parser.h>
+#include <libgda/gda-error.h>
 
 /* global variables */
 xmlDtdPtr       gda_array_dtd = NULL;
@@ -102,6 +103,8 @@
 	g_assert (type);
 	type = GDA_TYPE_TIMESTAMP;
 	g_assert (type);
+	type = GDA_TYPE_ERROR;
+	g_assert (type);
 
 	/* acquire locale */
 	gda_numeric_locale = setlocale (LC_NUMERIC, NULL);

Modified: trunk/libgda/gda-marshal.list
==============================================================================
--- trunk/libgda/gda-marshal.list	(original)
+++ trunk/libgda/gda-marshal.list	Mon Oct 13 16:33:12 2008
@@ -37,11 +37,5 @@
 VOID:INT,BOXED,BOXED
 VOID:INT,BOOLEAN
 VOID:STRING,INT
-VOID:ENUM,POINTER
-POINTER:INT,INT
-POINTER:VOID
 POINTER:POINTER
 BOOLEAN:POINTER
-POINTER:OBJECT,POINTER
-VOID:STRING,POINTER
-VOID:OBJECT,STRING,POINTER

Modified: trunk/libgda/gda-meta-store.c
==============================================================================
--- trunk/libgda/gda-meta-store.c	(original)
+++ trunk/libgda/gda-meta-store.c	Mon Oct 13 16:33:12 2008
@@ -352,7 +352,7 @@
 		G_SIGNAL_RUN_LAST,
 		G_STRUCT_OFFSET (GdaMetaStoreClass, suggest_update),
 		suggest_update_accumulator, NULL,
-		gda_marshal_POINTER__POINTER, G_TYPE_POINTER,
+		_gda_marshal_POINTER__POINTER, G_TYPE_POINTER,
 		1, G_TYPE_POINTER);
 	gda_meta_store_signals[META_CHANGED] =
 		g_signal_new ("meta-changed",
@@ -360,7 +360,7 @@
 		G_SIGNAL_RUN_FIRST,
 		G_STRUCT_OFFSET (GdaMetaStoreClass, meta_changed),
 		NULL, NULL,
-		gda_marshal_VOID__POINTER, G_TYPE_NONE,
+		_gda_marshal_VOID__POINTER, G_TYPE_NONE,
 		1, G_TYPE_POINTER);
 	gda_meta_store_signals[META_RESET] =
 		g_signal_new ("meta-reset",
@@ -368,7 +368,7 @@
 		G_SIGNAL_RUN_FIRST,
 		G_STRUCT_OFFSET (GdaMetaStoreClass, meta_reset),
 		NULL, NULL,
-		gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
+		_gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
 	
 	klass->suggest_update = m_suggest_update;
 	klass->meta_changed = NULL;

Modified: trunk/libgda/gda-server-operation.c
==============================================================================
--- trunk/libgda/gda-server-operation.c	(original)
+++ trunk/libgda/gda-server-operation.c	Mon Oct 13 16:33:12 2008
@@ -144,7 +144,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaServerOperationClass, seq_item_added),
 			      NULL, NULL,
-			      gda_marshal_VOID__STRING_INT, G_TYPE_NONE,
+			      _gda_marshal_VOID__STRING_INT, G_TYPE_NONE,
 			      2, G_TYPE_STRING, G_TYPE_INT);
 	gda_server_operation_signals[SEQUENCE_ITEM_REMOVE] =
 		g_signal_new ("sequence-item-remove",
@@ -152,7 +152,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaServerOperationClass, seq_item_remove),
 			      NULL, NULL,
-			      gda_marshal_VOID__STRING_INT, G_TYPE_NONE,
+			      _gda_marshal_VOID__STRING_INT, G_TYPE_NONE,
 			      2, G_TYPE_STRING, G_TYPE_INT);
 
 	klass->seq_item_added = NULL;

Modified: trunk/libgda/gda-set.c
==============================================================================
--- trunk/libgda/gda-set.c	(original)
+++ trunk/libgda/gda-set.c	Mon Oct 13 16:33:12 2008
@@ -35,6 +35,8 @@
 #include "gda-connection.h"
 #include "gda-server-provider.h"
 #include "gda-util.h"
+#include <libgda/gda-custom-marshal.h>
+#include <libgda/gda-error.h>
 
 extern xmlDtdPtr gda_paramlist_dtd;
 extern gchar *gda_lang_locale;
@@ -199,16 +201,16 @@
 
 static gboolean
 validate_accumulator (GSignalInvocationHint *ihint,
-				  GValue *return_accu,
-				  const GValue *handler_return,
-				  gpointer data)
+		      GValue *return_accu,
+		      const GValue *handler_return,
+		      gpointer data)
 {
 	GError *error;
 
-	error = g_value_get_pointer (handler_return);
-	g_value_set_pointer (return_accu, error);
+	error = g_value_get_boxed (handler_return);
+	g_value_set_boxed (return_accu, error);
 
-	return error ? FALSE : TRUE; /* stop signal if 'thisvalue' is FALSE */
+	return error ? FALSE : TRUE; /* stop signal if an error has been set */
 }
 
 static GError *
@@ -236,7 +238,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaSetClass, holder_changed),
 			      NULL, NULL,
-			      gda_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
+			      _gda_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
 			      GDA_TYPE_HOLDER);
 
 	/**
@@ -257,8 +259,8 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GdaSetClass, validate_holder_change),
 			      validate_accumulator, NULL,
-			      gda_marshal_POINTER__OBJECT_POINTER, G_TYPE_POINTER, 2,
-			      GDA_TYPE_HOLDER, G_TYPE_POINTER);
+			      _gda_marshal_ERROR__OBJECT_VALUE, GDA_TYPE_ERROR, 2,
+			      GDA_TYPE_HOLDER, G_TYPE_VALUE);
 	/**
 	 * GdaSet::validate-set:
 	 * @set: the object which received the signal
@@ -275,22 +277,22 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GdaSetClass, validate_set),
 			      validate_accumulator, NULL,
-			      gda_marshal_POINTER__VOID, G_TYPE_POINTER, 0);
+			      _gda_marshal_ERROR__VOID, GDA_TYPE_ERROR, 0);
 	gda_set_signals[HOLDER_ATTR_CHANGED] =
 		g_signal_new ("holder-attr-changed",
 			      G_TYPE_FROM_CLASS (object_class),
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaSetClass, holder_attr_changed),
 			      NULL, NULL,
-			      gda_marshal_VOID__OBJECT_STRING_POINTER, G_TYPE_NONE, 3,
-			      GDA_TYPE_HOLDER, G_TYPE_STRING, G_TYPE_POINTER);
+			      _gda_marshal_VOID__OBJECT_STRING_VALUE, G_TYPE_NONE, 3,
+			      GDA_TYPE_HOLDER, G_TYPE_STRING, G_TYPE_VALUE);
 	gda_set_signals[PUBLIC_DATA_CHANGED] =
 		g_signal_new ("public-data-changed",
 			      G_TYPE_FROM_CLASS (object_class),
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaSetClass, public_data_changed),
 			      NULL, NULL,
-			      gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
+			      _gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
 	class->holder_changed = NULL;
 	class->validate_holder_change = m_validate_holder_change;
@@ -1358,42 +1360,32 @@
 gda_set_is_valid (GdaSet *set, GError **error)
 {
 	GSList *holders;
-	gboolean retval = TRUE;
 
 	g_return_val_if_fail (GDA_IS_SET (set), FALSE);
 	g_return_val_if_fail (set->priv, FALSE);
 
-	for (holders = set->holders; holders && retval; holders = g_slist_next (holders)) {
+	for (holders = set->holders; holders; holders = holders->next) {
 		if (!gda_holder_is_valid ((GdaHolder*) holders->data)) {
 			g_set_error (error, GDA_SET_ERROR, GDA_SET_INVALID_ERROR,
-			     _("One or more values are invalid"));
-			retval = FALSE;
+				     _("One or more values are invalid"));
+			return FALSE;
 		}
-		
-		if (retval) {
-		/* signal the holder validate-set */
-			GError *lerror = NULL;
+	}
+
+	/* signal the holder validate-set */
+	GError *lerror = NULL;
 #ifdef GDA_DEBUG_signal
-			g_print (">> 'VALIDATE_SET' from %s\n", __FUNCTION__);
+	g_print (">> 'VALIDATE_SET' from %s\n", __FUNCTION__);
 #endif
-			g_signal_emit (G_OBJECT (set), gda_set_signals[VALIDATE_SET], 0, &lerror);
+	g_signal_emit (G_OBJECT (set), gda_set_signals[VALIDATE_SET], 0, &lerror);
 #ifdef GDA_DEBUG_signal
-			g_print ("<< 'VALIDATE_SET' from %s\n", __FUNCTION__);
-#endif
-			if (lerror) {
-				g_propagate_error (error, lerror);
-				retval = FALSE;
-			}
-		}
-
-#ifdef GDA_DEBUG_NO
-		g_print ("== HOLDER %p: valid= %d, value=%s\n", holders->data, gda_holder_is_valid (GDA_HOLDER (holders->data)),
-			 gda_holder_get_value (GDA_HOLDER (holders->data)) ?
-			 gda_value_stringify (gda_holder_get_value (GDA_HOLDER (holders->data))) : "Null");
+	g_print ("<< 'VALIDATE_SET' from %s\n", __FUNCTION__);
 #endif
+	if (lerror) {
+		g_propagate_error (error, lerror);
+		return FALSE;
 	}
-
-	return retval;
+	return TRUE;
 }
 
 /**

Modified: trunk/libgda/gda-statement.c
==============================================================================
--- trunk/libgda/gda-statement.c	(original)
+++ trunk/libgda/gda-statement.c	Mon Oct 13 16:33:12 2008
@@ -138,7 +138,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaStatementClass, checked),
 			      NULL, NULL,
-			      gda_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE,
+			      _gda_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE,
 			      2, GDA_TYPE_CONNECTION, G_TYPE_BOOLEAN);
 
 	klass->reset = NULL;

Modified: trunk/libgda/gda-threader.c
==============================================================================
--- trunk/libgda/gda-threader.c	(original)
+++ trunk/libgda/gda-threader.c	Mon Oct 13 16:33:12 2008
@@ -106,7 +106,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaThreaderClass, finished),
 			      NULL, NULL,
-			      gda_marshal_VOID__UINT_POINTER, G_TYPE_NONE,
+			      _gda_marshal_VOID__UINT_POINTER, G_TYPE_NONE,
 			      2, G_TYPE_UINT, G_TYPE_POINTER);
 	gda_threader_signals[CANCELLED] =
 		g_signal_new ("cancelled",
@@ -114,7 +114,7 @@
 			      G_SIGNAL_RUN_FIRST,
 			      G_STRUCT_OFFSET (GdaThreaderClass, cancelled),
 			      NULL, NULL,
-			      gda_marshal_VOID__UINT_POINTER, G_TYPE_NONE,
+			      _gda_marshal_VOID__UINT_POINTER, G_TYPE_NONE,
 			      2, G_TYPE_UINT, G_TYPE_POINTER);
 	class->finished = NULL;
 	class->cancelled = NULL;

Modified: trunk/providers/mysql/gda-mysql-provider.c
==============================================================================
--- trunk/providers/mysql/gda-mysql-provider.c	(original)
+++ trunk/providers/mysql/gda-mysql-provider.c	Mon Oct 13 16:33:12 2008
@@ -516,8 +516,12 @@
 	host = gda_quark_list_find (params, "HOST");
 
 	const gchar *user, *password;
-	user = gda_quark_list_find (params, "USER");
-	password = gda_quark_list_find (params, "PASSWORD");
+	user = gda_quark_list_find (auth, "USERNAME");
+	if (!user)
+		user = gda_quark_list_find (params, "USERNAME");
+	password = gda_quark_list_find (auth, "PASSWORD");
+	if (!password)
+		password = gda_quark_list_find (params, "PASSWORD");
 
 	const gchar *port, *unix_socket, *use_ssl, *compress;
 	port = gda_quark_list_find (params, "PORT");

Modified: trunk/tests/data-models/check_data_proxy.c
==============================================================================
--- trunk/tests/data-models/check_data_proxy.c	(original)
+++ trunk/tests/data-models/check_data_proxy.c	Mon Oct 13 16:33:12 2008
@@ -10,6 +10,7 @@
 
 #define CHECK_EXTRA_INFO
 /*#undef CHECK_EXTRA_INFO*/
+static gboolean do_test_signal (void);
 static gboolean do_test_common_read (GdaDataModel *proxy);
 static gboolean do_test_read_direct_1 (void);
 static gboolean do_test_read_direct_2 (void);
@@ -57,6 +58,9 @@
         g_setenv ("GDA_TOP_SRC_DIR", TOP_SRC_DIR, TRUE);
 	gda_init ();
 
+	if (!do_test_signal ())
+		number_failed ++;
+
 	prepend_null_row = FALSE;
 	defer_sync  = FALSE;
 	if (!do_test_read_direct_1 ())
@@ -133,6 +137,117 @@
 	return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
+static GError *
+validate_row_changes (GdaDataProxy *proxy, gint row, gint proxied_row, gchar *token)
+{
+	const GValue *cvalue;
+	/* refuse if population < 100 */
+	
+	cvalue = gda_data_model_get_value_at ((GdaDataModel*) proxy, 2, row, NULL);
+	g_assert (cvalue);
+	if (G_VALUE_TYPE (cvalue) == GDA_TYPE_NULL)
+		return NULL;
+	else {
+		gint pop;
+		pop = g_value_get_int (cvalue);
+		if (pop < 100) {
+			GError *error = NULL;
+			g_set_error (&error, 0, 0,
+				     "Population is too small");
+			return error;
+		}
+		else
+			return NULL;
+	}
+}
+
+static gboolean
+do_test_signal (void)
+{
+#define FILE "city.csv"
+	gchar *file;
+	GdaDataModel *import, *proxy, *rw_model;
+	GSList *errors;
+	GdaSet *options;
+	GValue *value;
+	GError *lerror = NULL;
+
+	file = g_build_filename (CHECK_FILES, "tests", "data-models", FILE, NULL);
+	options = gda_set_new_inline (2, 
+				      "TITLE_AS_FIRST_LINE", G_TYPE_BOOLEAN, TRUE,
+				      "G_TYPE_2", G_TYPE_GTYPE, G_TYPE_INT);
+	import = gda_data_model_import_new_file (file, TRUE, options);
+	g_free (file);
+	g_object_unref (options);
+
+	if ((errors = gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (import)))) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: Could not load file '%s'\n", FILE);
+#endif
+		g_object_unref (import);
+		return FALSE;
+	}
+
+	rw_model = (GdaDataModel*) gda_data_model_array_copy_model (import, NULL);
+	g_assert (rw_model);
+	g_object_unref (import);
+	proxy = g_object_new (GDA_TYPE_DATA_PROXY, "model", rw_model, "sample-size", 0, NULL);
+	if (!proxy) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: Could not create GdaDataProxy\n");
+#endif
+		return FALSE;
+	}
+
+	g_signal_connect (G_OBJECT (proxy), "validate_row_changes",
+			  G_CALLBACK (validate_row_changes), "Token");
+
+	/**/
+	g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 23);
+	g_assert (gda_data_model_set_value_at (proxy, 2, 5, value, NULL));
+	g_value_set_int (value, 100);
+	g_assert (gda_data_model_set_value_at (proxy, 2, 3, value, NULL));
+	gda_value_free (value);
+
+	if (gda_data_proxy_apply_all_changes (GDA_DATA_PROXY (proxy), &lerror)) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: gda_data_proxy_apply_all_changes() should have failed\n");
+#endif
+		return FALSE; 
+	}
+	if (!lerror) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: returned error should not be NULL\n");
+#endif
+		return FALSE; 
+	}
+	if (strcmp (lerror->message, "Population is too small")) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: returned error message should be 'Population is too small', and got '%s'\n", 
+			 lerror->message);
+#endif
+		return FALSE; 
+	}
+	g_error_free (lerror);
+
+	/**/
+	g_assert (gda_data_proxy_cancel_all_changes (GDA_DATA_PROXY (proxy)));
+	g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 123);
+	g_assert (gda_data_model_set_value_at (proxy, 2, 5, value, NULL));
+	gda_value_free (value);
+	if (!gda_data_proxy_apply_all_changes (GDA_DATA_PROXY (proxy), &lerror)) {
+#ifdef CHECK_EXTRA_INFO
+		g_print ("ERROR: gda_data_proxy_apply_all_changes() should not have failed, error: %s\n",
+			 lerror && lerror->message ? lerror->message : "No detail");
+#endif
+		return FALSE; 
+	}
+
+	g_object_unref (proxy);
+	g_object_unref (rw_model);
+
+	return TRUE;
+}
 
 static gboolean
 do_test_read_direct_1 ()

Modified: trunk/tests/value-holders/check_set.c
==============================================================================
--- trunk/tests/value-holders/check_set.c	(original)
+++ trunk/tests/value-holders/check_set.c	Mon Oct 13 16:33:12 2008
@@ -25,12 +25,16 @@
 static gboolean test1 (GError **error);
 static gboolean test2 (GError **error);
 static gboolean test3 (GError **error);
+static gboolean test4 (GError **error);
+static gboolean test5 (GError **error);
 
 GHashTable *data;
 TestFunc tests[] = {
 	test1,
 	test2,
-	test3
+	test3,
+	test4,
+	test5
 };
 
 int 
@@ -186,6 +190,7 @@
 	GdaHolder *h;
 	GValue *value;
 	const GValue *cvalue;
+	GError *lerror = NULL;
 
 	set = gda_set_new_inline (3, 
 				  "H1", G_TYPE_STRING, "A string",
@@ -197,12 +202,25 @@
 
 	h = gda_set_get_holder (set, "H2");
 	g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 333);
-	if (gda_holder_set_value (h, value, NULL)) {
+	if (gda_holder_set_value (h, value, &lerror)) {
 		g_set_error (error, 0, 0,
 			     "gda_holder_set_value() should have been refused and failed");
 		return FALSE;
 	}
 	gda_value_free (value);
+	if (!lerror) {
+		g_set_error (error, 0, 0,
+			     "Returned GError should not be NULL");
+		return FALSE;
+	}
+	if (strcmp (lerror->message, "GdaHolder change refused!")) {
+		g_set_error (error, 0, 0,
+			     "Returned GError's message is wrong, should be 'GdaHolder change refused!' and is '%s'",
+			     lerror->message);
+		return FALSE;
+	}
+	g_error_free (lerror);
+	lerror = NULL;
 
 	/***/
 	g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 1234);
@@ -234,6 +252,137 @@
 }
 
 /*
+ * "holder-attr-changed" signal test
+ */
+static gboolean
+test4 (GError **error)
+{
+	GdaSet *set;
+	GdaHolder *h;
+	GValue *value;
+	
+	set = gda_set_new_inline (3, 
+				  "H1", G_TYPE_STRING, "A string",
+				  "H2", G_TYPE_STRING, "1234",
+				  "H3", G_TYPE_CHAR, 'r');
+	emitted_signals_monitor_set (set);
+	emitted_signals_reset ();
+
+	h = gda_set_get_holder (set, "H1");
+	if (!h) {
+		g_set_error (error, 0, 0,
+			     "Could not find GdaHolder H1");
+		return FALSE;
+	}
+	g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "Hello!");
+	gda_holder_set_attribute (h, "MyAttr", value);
+	gda_value_free (value);
+
+	if (!emitted_signals_find (set, "holder-attr-changed", error))
+		return FALSE;
+
+	return TRUE;
+}
+
+/*
+ * "validate-change" signal
+ */
+static GError *
+t5_validate_change (GdaSet *set, gchar *token)
+{
+	GdaHolder *h3, *h2;
+	const GValue *v2, *v3;
+	g_assert (!strcmp (token, "MyToken2"));
+
+	/* validate only if h2==125 and h3=='d' */
+	h2 = gda_set_get_holder (set, "H2");
+	h3 = gda_set_get_holder (set, "H3");
+	g_assert (h2 && h3);
+
+	v2 = gda_holder_get_value (h2);
+	v3 = gda_holder_get_value (h3);
+
+	if (v2 && (G_VALUE_TYPE (v2) == G_TYPE_INT) &&
+	    v3 && (G_VALUE_TYPE (v3) == G_TYPE_CHAR) &&
+	    (g_value_get_int (v2) == 125) &&
+	    (g_value_get_char (v3) == 'd')) {
+		g_print ("GdaSet change accepted\n");
+		return NULL;
+	}
+	else {
+		GError *error = NULL;
+		g_print ("GdaSet change refused\n");
+		g_set_error (&error, 0, 0,
+			     "GdaSet change refused!");
+		return error;
+	}
+}
+
+static gboolean
+test5 (GError **error)
+{
+	GdaSet *set;
+	GdaHolder *h;
+	GValue *value;
+	GError *lerror = NULL;
+
+	set = gda_set_new_inline (3, 
+				  "H1", G_TYPE_STRING, "A string",
+				  "H2", G_TYPE_INT, 1234,
+				  "H3", G_TYPE_CHAR, 'r');
+
+	g_signal_connect (G_OBJECT (set), "validate-set",
+			  G_CALLBACK (t5_validate_change), "MyToken2");
+
+	if (gda_set_is_valid (set, &lerror)) {
+		g_set_error (error, 0, 0,
+			     "gda_set_is_valid() should have returned FALSE");
+		return FALSE;
+	}
+
+	if (!lerror) {
+		g_set_error (error, 0, 0,
+			     "Returned GError should not be NULL");
+		return FALSE;
+	}
+	if (strcmp (lerror->message, "GdaSet change refused!")) {
+		g_set_error (error, 0, 0,
+			     "Returned GError's message is wrong, should be 'GdaHolder change refused!' and is '%s'",
+			     lerror->message);
+		return FALSE;
+	}
+	g_error_free (lerror);
+	lerror = NULL;
+
+	/**/
+	h = gda_set_get_holder (set, "H2");
+	g_value_set_int ((value = gda_value_new (G_TYPE_INT)), 125);
+	if (!gda_holder_set_value (h, value, NULL)) {
+		g_set_error (error, 0, 0,
+			     "gda_holder_set_value() should not have failed");
+		return FALSE;
+	}
+	gda_value_free (value);
+
+	h = gda_set_get_holder (set, "H3");
+	g_value_set_char ((value = gda_value_new (G_TYPE_CHAR)), 'd');
+	if (!gda_holder_set_value (h, value, NULL)) {
+		g_set_error (error, 0, 0,
+			     "gda_holder_set_value() should not have failed");
+		return FALSE;
+	}
+	gda_value_free (value);
+
+	if (!gda_set_is_valid (set, error)) 
+		return FALSE;
+
+	g_object_unref (set);
+
+	return TRUE;
+}
+
+
+/*
  * Signals testing
  */
 static void
@@ -303,6 +452,17 @@
 }
 
 static void
+set_3_cb (GObject *obj, GdaHolder *holder, const gchar *attr_name, const GValue *value, gchar *sig_name)
+{
+	EmittedSignal *es;
+	es = g_new0 (EmittedSignal, 1);
+	es->obj = obj;
+	es->signal_name = sig_name;
+	es->holder = holder;
+	emitted_signal_add (es);
+}
+
+static void
 set_1_cb (GObject *obj, GdaHolder *holder, gchar *sig_name)
 {
 	EmittedSignal *es;
@@ -329,10 +489,8 @@
 {
 	g_signal_connect (G_OBJECT (set), "holder-changed",
 			  G_CALLBACK (set_1_cb), "holder-changed");
-	g_signal_connect (G_OBJECT (set), "holder-plugin-changed",
-			  G_CALLBACK (set_1_cb), "holder-plugin-changed");
 	g_signal_connect (G_OBJECT (set), "holder-attr-changed",
-			  G_CALLBACK (set_1_cb), "holder-attr-changed");
+			  G_CALLBACK (set_3_cb), "holder-attr-changed");
 	g_signal_connect (G_OBJECT (set), "public-data-changed",
 			  G_CALLBACK (set_0_cb), "public-data-changed");
 }



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