libgnomedb r1743 - in trunk: . control-center data extra/demos libgnomedb libgnomedb-extra libgnomedb/data-entries libgnomedb/plugins providers/evolution testing



Author: vivien
Date: Mon Sep 15 18:36:00 2008
New Revision: 1743
URL: http://svn.gnome.org/viewvc/libgnomedb?rev=1743&view=rev

Log:
2008-09-15  Vivien Malerba <malerba gnome-db org>

	* configure.in: applied patch from Cygwin Ports maintainer for bug #541992
	* configure.in: now requires Libgda >= 3.99.4
	* Adaptations to Libgda's API changes
	* libgnomedb/plugins/gnome-db-entry-pict.c: corrected a bug in the initial
	display


Added:
   trunk/data/gnome-db-4.0.png
Removed:
   trunk/gnome-db.png
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/control-center/database-properties-4.0.desktop.in
   trunk/control-center/dsn-config.c
   trunk/data/Makefile.am
   trunk/extra/demos/ddl_queries.c
   trunk/extra/demos/form.c
   trunk/extra/demos/form_pict.c
   trunk/extra/demos/form_rw.c
   trunk/extra/demos/grid.c
   trunk/extra/demos/grid_pict.c
   trunk/extra/demos/grid_rw.c
   trunk/extra/demos/linked_grid_form.c
   trunk/extra/demos/linked_model_param.c
   trunk/libgnomedb-extra/gnome-db-selector-meta.c
   trunk/libgnomedb-extra/gnome-db-selector-part.c
   trunk/libgnomedb-extra/gnome-db-sql-console.c
   trunk/libgnomedb/data-entries/gnome-db-data-cell-renderer-combo.c
   trunk/libgnomedb/data-entries/gnome-db-entry-wrapper.c
   trunk/libgnomedb/gnome-db-basic-form.c
   trunk/libgnomedb/gnome-db-data-import.c
   trunk/libgnomedb/gnome-db-data-store.c
   trunk/libgnomedb/gnome-db-data-widget-info.c
   trunk/libgnomedb/gnome-db-provider-auth-editor.c
   trunk/libgnomedb/gnome-db-provider-spec-editor.c
   trunk/libgnomedb/gnome-db-raw-form.c
   trunk/libgnomedb/gnome-db-raw-grid.c
   trunk/libgnomedb/gnome-db-server-operation.c
   trunk/libgnomedb/plugins/gnome-db-entry-pict.c
   trunk/libgnomedb/utility.c
   trunk/providers/evolution/gda-evolution-provider.c
   trunk/testing/test-dyn-widgets.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Mon Sep 15 18:36:00 2008
@@ -44,7 +44,6 @@
 	samples/SimpleExample/SampleDb.db 
 
 EXTRA_DIST = \
-	gnome-db.png \
 	libgnomedb.spec \
 	intltool-extract.in \
 	intltool-merge.in \
@@ -52,9 +51,6 @@
 	$(example_files) \
 	mkinstalldirs
 
-pixmapdir=$(datadir)/pixmaps/libgnomedb-4.0
-pixmap_DATA=gnome-db.png
-
 pkgconfigdir=$(libdir)/pkgconfig
 pkgconfig_DATA = libgnomedb-4.0.pc libgnomedb-extra-4.0.pc $(GRAPHLIB_PC)
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Sep 15 18:36:00 2008
@@ -146,7 +146,7 @@
 dnl ******************************
 
 GTK_MODULES="gtk+-2.0 >= 2.6.0 gthread-2.0"
-LIBGDA_MODULES="libgda-$GNOMEDB_ABI_MAJOR_VERSION.$GNOMEDB_ABI_MINOR_VERSION >= 3.99.2"
+LIBGDA_MODULES="libgda-$GNOMEDB_ABI_MAJOR_VERSION.$GNOMEDB_ABI_MINOR_VERSION >= 3.99.4"
 LIBGNOMEDB_REQUIRES="$GTK_MODULES $LIBGDA_MODULES"
 PKG_CHECK_MODULES(LIBGNOMEDB, $GTK_MODULES $LIBGDA_MODULES)
 

Modified: trunk/control-center/database-properties-4.0.desktop.in
==============================================================================
--- trunk/control-center/database-properties-4.0.desktop.in	(original)
+++ trunk/control-center/database-properties-4.0.desktop.in	Mon Sep 15 18:36:00 2008
@@ -1,7 +1,7 @@
 [Desktop Entry]
 _Name=Database Access Properties
 _Comment=Configure your database environment
-Icon=gnome-db
+Icon=gnome-db-4.0
 Exec=gnome-database-properties-4.0
 Terminal=0
 Type=Application

Modified: trunk/control-center/dsn-config.c
==============================================================================
--- trunk/control-center/dsn-config.c	(original)
+++ trunk/control-center/dsn-config.c	Mon Sep 15 18:36:00 2008
@@ -204,6 +204,7 @@
 	GdaDataModel *model;
 	GList *selection;
 	gchar *str;
+	const GValue *cvalue;
 
 	priv = g_object_get_data (G_OBJECT (dsn), DSN_CONFIG_DATA);
 	
@@ -215,8 +216,11 @@
 	if (!GDA_IS_DATA_MODEL (model))
 		return;
 
-	str = gda_value_stringify ((GValue *) gda_data_model_get_value_at (model, 0, GPOINTER_TO_INT (selection->data)));
+	cvalue = gda_data_model_get_value_at (model, 0, GPOINTER_TO_INT (selection->data), NULL);
+	if (!cvalue) 
+		return;
 
+	str = gda_value_stringify ((GValue *) cvalue);
 	dsn_properties_dialog (GTK_WINDOW (gtk_widget_get_toplevel (dsn)), str);
 
 	g_list_free (selection);
@@ -243,11 +247,14 @@
 	for (list = sel_rows; list; list = list->next) {
 		gchar *dsn;
 		gint *row;
+		const GValue *cvalue;
 		
 		row = gtk_tree_path_get_indices ((GtkTreePath *) list->data);
-		dsn = gda_value_stringify ((GValue *) gda_data_model_get_value_at (model, 0, *row));
-		if (dsn)
+		cvalue = gda_data_model_get_value_at (model, 0, *row, NULL);
+		if (cvalue) {
+			dsn = gda_value_stringify ((GValue *) cvalue);
 			sel_dsn = g_list_prepend (sel_dsn, dsn);
+		}
 		gtk_tree_path_free ((GtkTreePath *) list->data);
 	}
 	g_list_free (sel_rows);

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Mon Sep 15 18:36:00 2008
@@ -70,6 +70,10 @@
 #Mimedir = $(datadir)/mime-info
 #Mime_DATA = libgnomedb.keys libgnomedb.mime
 
+# icons
+iconsdir=$(datadir)/pixmaps
+icons_DATA=gnome-db-4.0.png
+
 # other
 xmldir = $(datadir)/gnome-db-4.0
 xml_DATA = import_encodings.xml server_operation.glade
@@ -84,6 +88,8 @@
 	libgnomedb.keys.in \
 	libgnomedb.mime \
 	import_encodings.xml \
-	server_operation.glade
+	server_operation.glade \
+	gnome-db-4.0.svg \
+	gnome-db-4.0.png
 
 CLEANFILES = libgnomedb.keys libgnomedb-4.0.schemas

Added: trunk/data/gnome-db-4.0.png
==============================================================================
Binary files (empty file) and trunk/data/gnome-db-4.0.png	Mon Sep 15 18:36:00 2008 differ

Modified: trunk/extra/demos/ddl_queries.c
==============================================================================
--- trunk/extra/demos/ddl_queries.c	(original)
+++ trunk/extra/demos/ddl_queries.c	Mon Sep 15 18:36:00 2008
@@ -362,8 +362,11 @@
 			const GValue *value;
 			
 			npath = g_strdup_printf ("%s/%d", root_path, j);
-			value = gda_data_model_get_value_at (node->model, gda_column_get_position  (node->column), j);
-			str = gda_value_stringify (value);
+			value = gda_data_model_get_value_at (node->model, gda_column_get_position  (node->column), j, NULL);
+			if (value)
+				str = gda_value_stringify (value);
+			else
+				str = g_strdup ("Error: could not read data model's value");
 			gtk_text_buffer_insert (tbuffer, &iter, "  * ", -1);
 			gtk_text_buffer_insert_with_tags_by_name (tbuffer, &iter, npath, -1, "opt_pathname", NULL);
 			g_free (npath);

Modified: trunk/extra/demos/form.c
==============================================================================
--- trunk/extra/demos/form.c	(original)
+++ trunk/extra/demos/form.c	Mon Sep 15 18:36:00 2008
@@ -41,7 +41,7 @@
 		
 		/* Create the demo widget */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT * FROM products", NULL, NULL);
-		model = gda_data_model_query_new (demo_cnc, stmt);
+		model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
 		form = gnome_db_form_new (model);
 		g_object_unref (model);

Modified: trunk/extra/demos/form_pict.c
==============================================================================
--- trunk/extra/demos/form_pict.c	(original)
+++ trunk/extra/demos/form_pict.c	Mon Sep 15 18:36:00 2008
@@ -47,10 +47,9 @@
 		
 		/* Create the demo widget */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT id, pict FROM pictures", NULL, NULL);
-		model = gda_data_model_query_new (demo_cnc, stmt);
+		model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
-		gda_data_model_query_compute_modification_queries (GDA_DATA_MODEL_QUERY (model), NULL,
-								   0, NULL);
+		gda_data_model_query_compute_modification_statements (GDA_DATA_MODEL_QUERY (model), NULL);
 		form = gnome_db_form_new (model);
 		g_object_unref (model);
 

Modified: trunk/extra/demos/form_rw.c
==============================================================================
--- trunk/extra/demos/form_rw.c	(original)
+++ trunk/extra/demos/form_rw.c	Mon Sep 15 18:36:00 2008
@@ -44,10 +44,9 @@
 		stmt = gda_sql_parser_parse_string (demo_parser, 
 						    "SELECT ref, category, name, price, wh_stored FROM products", 
 						    NULL, NULL);
-		model = gda_data_model_query_new (demo_cnc, stmt);
+		model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
-		gda_data_model_query_compute_modification_queries (GDA_DATA_MODEL_QUERY (model), NULL,
-								   0, NULL);
+		gda_data_model_query_compute_modification_statements (GDA_DATA_MODEL_QUERY (model), NULL);
 		form = gnome_db_form_new (model);
 		g_object_unref (model);
 

Modified: trunk/extra/demos/grid.c
==============================================================================
--- trunk/extra/demos/grid.c	(original)
+++ trunk/extra/demos/grid.c	Mon Sep 15 18:36:00 2008
@@ -41,7 +41,7 @@
 		
 		/* Create the demo widget */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT * FROM products", NULL, NULL);
-		model = gda_data_model_query_new (demo_cnc, stmt);
+		model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
 		grid = gnome_db_grid_new (model);
 		g_object_unref (model);

Modified: trunk/extra/demos/grid_pict.c
==============================================================================
--- trunk/extra/demos/grid_pict.c	(original)
+++ trunk/extra/demos/grid_pict.c	Mon Sep 15 18:36:00 2008
@@ -47,10 +47,9 @@
 		
 		/* Create the demo widget */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT id, pict FROM pictures", NULL, NULL);
-                model = gda_data_model_query_new (demo_cnc, stmt);
+                model = gda_data_model_query_new (demo_cnc, stmt, NULL);
                 g_object_unref (stmt);
-                gda_data_model_query_compute_modification_queries (GDA_DATA_MODEL_QUERY (model), NULL,
-                                                                   0, NULL);
+                gda_data_model_query_compute_modification_statements (GDA_DATA_MODEL_QUERY (model), NULL);
 		grid = gnome_db_grid_new (model);
 		g_object_unref (model);
 

Modified: trunk/extra/demos/grid_rw.c
==============================================================================
--- trunk/extra/demos/grid_rw.c	(original)
+++ trunk/extra/demos/grid_rw.c	Mon Sep 15 18:36:00 2008
@@ -42,10 +42,9 @@
 		
 		/* Create the demo widget */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT ref, category, name, price, wh_stored FROM products", NULL, NULL);
-		model = gda_data_model_query_new (demo_cnc, stmt);
+		model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
-		gda_data_model_query_compute_modification_queries (GDA_DATA_MODEL_QUERY (model), NULL,
-                                                                   0, NULL);
+		gda_data_model_query_compute_modification_statements (GDA_DATA_MODEL_QUERY (model), NULL);
 		grid = gnome_db_grid_new (model);
 		g_object_unref (model);
 

Modified: trunk/extra/demos/linked_grid_form.c
==============================================================================
--- trunk/extra/demos/linked_grid_form.c	(original)
+++ trunk/extra/demos/linked_grid_form.c	Mon Sep 15 18:36:00 2008
@@ -42,7 +42,7 @@
 		g_signal_handlers_block_by_func (other,
 						 G_CALLBACK (iter_row_changed_cb),
 						 data);
-		gda_data_model_iter_set_at_row (other, row);
+		gda_data_model_iter_move_at_row (other, row);
 		g_signal_handlers_unblock_by_func (other,
 						   G_CALLBACK (iter_row_changed_cb),
 						   data);
@@ -103,14 +103,13 @@
 						    "SELECT c.id, c.name, c.default_served_by as \"SalesRep\""
 						    "FROM customers c "
 						    "LEFT JOIN salesrep s ON (s.id=c.default_served_by)", NULL, NULL);
-		cust_model = gda_data_model_query_new (demo_cnc, stmt);
+		cust_model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
-		gda_data_model_query_compute_modification_queries (GDA_DATA_MODEL_QUERY (cust_model), NULL,
-								   0, NULL);
+		gda_data_model_query_compute_modification_statements (GDA_DATA_MODEL_QUERY (cust_model), NULL);
 			  
 		/* create a data model for the salesrep */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT id, name FROM salesrep", NULL, NULL);
-		sr_model = gda_data_model_query_new (demo_cnc, stmt);
+		sr_model = gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
 
 		/* create grid widget */

Modified: trunk/extra/demos/linked_model_param.c
==============================================================================
--- trunk/extra/demos/linked_model_param.c	(original)
+++ trunk/extra/demos/linked_model_param.c	Mon Sep 15 18:36:00 2008
@@ -49,7 +49,7 @@
 
 		/* create a data model for the salesrep */
 		stmt = gda_sql_parser_parse_string (demo_parser, "SELECT id, name FROM salesrep", NULL, NULL);
-		sr_model = gda_data_model_query_new (demo_cnc, stmt);
+		sr_model = (GdaDataModel*) gda_data_model_query_new (demo_cnc, stmt, NULL);
 		g_object_unref (stmt);
 		
 		/* create a data model for the customers, and get a list of parameters */
@@ -59,9 +59,9 @@
 						"LEFT JOIN salesrep s ON (s.id=c.default_served_by) "
 						"WHERE s.id = ##/*name:'SalesRep' type:gint descr:'Sales person'*/ "
 						    "OR s.id IS NULL", NULL, NULL);
-		cust_model = gda_data_model_query_new (demo_cnc, stmt);
+		gda_statement_get_parameters (stmt, &params, NULL);
+		cust_model = (GdaDataModel*) gda_data_model_query_new (demo_cnc, stmt, params);
 		g_object_unref (stmt);
-		params = gda_data_model_query_get_parameter_list (GDA_DATA_MODEL_QUERY (cust_model));
 
 		/* restrict the c.default_served_by field in the grid to be within the sr_model */
 		param = gda_set_get_holder (params, "SalesRep");

Modified: trunk/libgnomedb-extra/gnome-db-selector-meta.c
==============================================================================
--- trunk/libgnomedb-extra/gnome-db-selector-meta.c	(original)
+++ trunk/libgnomedb-extra/gnome-db-selector-meta.c	Mon Sep 15 18:36:00 2008
@@ -468,10 +468,10 @@
 			GdkPixbuf *funcpixbuf = NULL;
 			if (!pixbuf && mpart->priv->pix_func) 
 				funcpixbuf = (mpart->priv->pix_func) 
-					(gda_data_model_get_value_at (model, mpart->priv->pix_func_col, i));
+					(gda_data_model_get_value_at (model, mpart->priv->pix_func_col, i, NULL));
 
-			value = gda_data_model_get_value_at (model, 0, i); 
-			if (value) {
+			value = gda_data_model_get_value_at (model, 0, i, NULL); 
+			if (value && !gda_value_is_null (value)) {
 				if (!dh)
 					dh = gda_get_default_handler (G_VALUE_TYPE (value));
 				str = gda_data_handler_get_str_from_value (dh, value);
@@ -546,7 +546,7 @@
 		if (model) {
 			GdaDataModelIter *iter;
 			iter = g_object_get_data (G_OBJECT (model), "_iter");
-			if (gda_data_model_iter_set_at_row (iter, row))
+			if (gda_data_model_iter_move_at_row (iter, row))
 				return (GdaSet*) iter;
 		}
 	}

Modified: trunk/libgnomedb-extra/gnome-db-selector-part.c
==============================================================================
--- trunk/libgnomedb-extra/gnome-db-selector-part.c	(original)
+++ trunk/libgnomedb-extra/gnome-db-selector-part.c	Mon Sep 15 18:36:00 2008
@@ -182,10 +182,10 @@
 									   gda_holder_get_id (holder),
 									   store, parent_iter);
 				if (cvalue)
-					gda_holder_set_value (holder, cvalue);
+					gda_holder_set_value (holder, cvalue, NULL);
 			}
-		if (!gda_set_is_valid (params)) {
-			g_warning (_("GnomeDbSelectorPart object requires parameters which cannot be obtained"));
+		if (!gda_set_is_valid (params, NULL)) {
+			g_warning (_("GnomeDbSelectorPart object requires parameters which cannot be obtained or are invalid"));
 			return;
 		}
 	}

Modified: trunk/libgnomedb-extra/gnome-db-sql-console.c
==============================================================================
--- trunk/libgnomedb-extra/gnome-db-sql-console.c	(original)
+++ trunk/libgnomedb-extra/gnome-db-sql-console.c	Mon Sep 15 18:36:00 2008
@@ -519,7 +519,7 @@
 	GtkWidget *parent_window;
 	gint result;
 
-	if (!context || gda_set_is_valid (context)) 
+	if (!context || gda_set_is_valid (context, NULL)) 
 		return GTK_RESPONSE_ACCEPT;
 	
 	parent_window = gtk_widget_get_toplevel (GTK_WIDGET (console));

Modified: trunk/libgnomedb/data-entries/gnome-db-data-cell-renderer-combo.c
==============================================================================
--- trunk/libgnomedb/data-entries/gnome-db-data-cell-renderer-combo.c	(original)
+++ trunk/libgnomedb/data-entries/gnome-db-data-cell-renderer-combo.c	Mon Sep 15 18:36:00 2008
@@ -312,7 +312,7 @@
 							
 							value = gda_data_model_get_value_at (datacell->priv->source->data_model,
 											     datacell->priv->source->shown_cols_index [i],
-											     row);
+											     row, NULL);
 							dsplay_values = g_list_append (dsplay_values, (GValue *) value);
 						}
 						str = render_text_to_display_from_values (dsplay_values);
@@ -406,7 +406,7 @@
 			g_free (str);
 		}
 		else
-			g_string_append (string, " ");
+			g_string_append (string, " ? ");
 
 		list = g_list_next (list);
 	}

Modified: trunk/libgnomedb/data-entries/gnome-db-entry-wrapper.c
==============================================================================
--- trunk/libgnomedb/data-entries/gnome-db-entry-wrapper.c	(original)
+++ trunk/libgnomedb/data-entries/gnome-db-entry-wrapper.c	Mon Sep 15 18:36:00 2008
@@ -529,7 +529,7 @@
 		changed = ! mgwrap->priv->real_class->value_is_equal_to (mgwrap, value);
 	else {
 		evalue = gnome_db_entry_wrapper_get_value (iface);
-		if (! gda_value_compare_ext ((GValue *) value, evalue))
+		if (! gda_value_differ ((GValue *) value, evalue))
 			changed = FALSE;
 		if (evalue)
 			gda_value_free (evalue);

Modified: trunk/libgnomedb/gnome-db-basic-form.c
==============================================================================
--- trunk/libgnomedb/gnome-db-basic-form.c	(original)
+++ trunk/libgnomedb/gnome-db-basic-form.c	Mon Sep 15 18:36:00 2008
@@ -705,8 +705,7 @@
 			g_signal_connect (entry, "destroy", G_CALLBACK (entry_destroyed_cb), form);
 
 			/* connect to the parameter's changes */
-			plist = group->nodes;
-			while (plist) {
+			for (plist = group->nodes; plist; plist = plist->next) {
 				GdaHolder *param;
 
 				param = GDA_SET_NODE (plist->data)->holder;
@@ -716,7 +715,6 @@
                                                                               G_CALLBACK (parameter_changed_cb), 
 									      entry);
                                 i++;
-				plist = g_slist_next (plist);
 			}
 			gnome_db_data_entry_set_attributes (GNOME_DB_DATA_ENTRY (entry),
 							    nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
@@ -1015,15 +1013,17 @@
 		if ((!value || gda_value_is_null (value)) &&
 		    (attr & GDA_VALUE_ATTR_IS_DEFAULT))
 			gda_holder_set_value_to_default (param);
-		else
-			gda_holder_set_value (param, value);
+		else if (gda_holder_set_value (param, value, NULL)) {
 #ifdef debug_signal
-		g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
+			g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
 #endif
-		g_signal_emit (G_OBJECT (form), gnome_db_basic_form_signals[PARAM_CHANGED], 0, param, TRUE);
+			g_signal_emit (G_OBJECT (form), gnome_db_basic_form_signals[PARAM_CHANGED], 0, param, TRUE);
 #ifdef debug_signal
-		g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
+			g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
 #endif
+		}
+		else
+			TO_IMPLEMENT;
 		gda_value_free (value);
 	}
 	else { /* multiple parameters */
@@ -1052,15 +1052,18 @@
 
 			/* parameter's value */
 			param = GDA_SET_NODE (params->data)->holder;
-			gda_holder_set_value (param, (GValue *)(list->data));
+			if (gda_holder_set_value (param, (GValue *)(list->data), NULL)) {
 #ifdef debug_signal
-			g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
+				g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
 #endif
-			g_signal_emit (G_OBJECT (form), gnome_db_basic_form_signals[PARAM_CHANGED], 
-				       0, param, TRUE);
+				g_signal_emit (G_OBJECT (form), gnome_db_basic_form_signals[PARAM_CHANGED], 
+					       0, param, TRUE);
 #ifdef debug_signal
-			g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
+				g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
 #endif
+			}
+			else
+				TO_IMPLEMENT;
 			form->priv->forward_param_updates = TRUE;
 
 			list = g_slist_next (list);
@@ -1262,7 +1265,7 @@
 	g_return_val_if_fail (form && GNOME_DB_IS_BASIC_FORM (form), FALSE);
 	g_return_val_if_fail (form->priv, FALSE);
 
-	return gda_set_is_valid (form->priv->set);
+	return gda_set_is_valid (form->priv->set, NULL);
 }
 
 /**

Modified: trunk/libgnomedb/gnome-db-data-import.c
==============================================================================
--- trunk/libgnomedb/gnome-db-data-import.c	(original)
+++ trunk/libgnomedb/gnome-db-data-import.c	Mon Sep 15 18:36:00 2008
@@ -365,10 +365,11 @@
 			psep = gda_holder_new (G_TYPE_STRING);
 			g_object_set_data (G_OBJECT (psep), "name", "SEPARATOR");
 			if (sepno != SEP_OTHER)
-				gda_holder_set_value_str (psep, NULL, sep);
+				gda_holder_set_value_str (psep, NULL, sep, NULL);
 			else
 				gda_holder_set_value_str (psep, NULL,
-							  gtk_entry_get_text (GTK_ENTRY (import->priv->sep_other_entry)));
+							  gtk_entry_get_text (GTK_ENTRY (import->priv->sep_other_entry)),
+							  NULL);
 			break;
 		}
 	}
@@ -387,7 +388,7 @@
 			GdaHolder *h;
 			h = g_object_new (GDA_TYPE_HOLDER, "id", "ENCODING", "g-type", G_TYPE_STRING, NULL);
 			
-			gda_holder_set_value (h, (GValue *) values->data);
+			gda_holder_set_value (h, (GValue *) values->data, NULL);
 			gda_set_add_holder (options, h);
 			g_object_unref (h);
 			g_slist_free (values);

Modified: trunk/libgnomedb/gnome-db-data-store.c
==============================================================================
--- trunk/libgnomedb/gnome-db-data-store.c	(original)
+++ trunk/libgnomedb/gnome-db-data-store.c	Mon Sep 15 18:36:00 2008
@@ -729,24 +729,18 @@
 		proxy_col = (column < model_nb_cols) ? column : column - model_nb_cols;
 		tmp = gda_data_model_get_value_at ((GdaDataModel*) store->priv->proxy, 
 						   proxy_col, 
-						   GPOINTER_TO_INT (iter->user_data));
+						   GPOINTER_TO_INT (iter->user_data), NULL);
 		
 		rettype = data_store_get_column_type (tree_model, column);
 		
 		if (rettype == G_TYPE_POINTER)
 			g_value_set_pointer (value, (gpointer) tmp);
+		else if (tmp)
+			g_value_copy (tmp, value);
 		else {
-			if (tmp)
-				g_value_copy (tmp, value);
-			else
-				if (rettype == G_TYPE_UINT)
-					g_value_set_uint (value, 0);
-				else if (rettype == G_TYPE_BOOLEAN)
-					g_value_set_boolean (value, FALSE);
-				else if (rettype == G_TYPE_INT)
-					g_value_set_int (value, 0);
-				else
-					g_assert_not_reached ();
+			/* FIXME: we have an error here but I don't know how to report it. */
+			TO_IMPLEMENT;
+			gda_value_set_null (value);
 		}
 	}
 

Modified: trunk/libgnomedb/gnome-db-data-widget-info.c
==============================================================================
--- trunk/libgnomedb/gnome-db-data-widget-info.c	(original)
+++ trunk/libgnomedb/gnome-db-data-widget-info.c	Mon Sep 15 18:36:00 2008
@@ -471,7 +471,7 @@
 	    (value <= gda_data_model_get_n_rows (GDA_DATA_MODEL (info->priv->proxy))))
 		row = value - 1;
 
-	gda_data_model_iter_set_at_row (gnome_db_data_widget_get_current_data (info->priv->data_widget), row);
+	gda_data_model_iter_move_at_row (gnome_db_data_widget_get_current_data (info->priv->data_widget), row);
 }
 
 #define BLOCK_SPIN (g_signal_handlers_block_by_func (G_OBJECT (info->priv->row_spin), \

Modified: trunk/libgnomedb/gnome-db-provider-auth-editor.c
==============================================================================
--- trunk/libgnomedb/gnome-db-provider-auth-editor.c	(original)
+++ trunk/libgnomedb/gnome-db-provider-auth-editor.c	Mon Sep 15 18:36:00 2008
@@ -408,7 +408,7 @@
 					
 					param = gda_set_get_holder (dset, name);
 					if (param)
-						if (gda_holder_set_value_str (param, NULL, value))
+						if (gda_holder_set_value_str (param, NULL, value, NULL))
 							params_set = g_slist_prepend (params_set, param);
 				}
 			}

Modified: trunk/libgnomedb/gnome-db-provider-spec-editor.c
==============================================================================
--- trunk/libgnomedb/gnome-db-provider-spec-editor.c	(original)
+++ trunk/libgnomedb/gnome-db-provider-spec-editor.c	Mon Sep 15 18:36:00 2008
@@ -141,7 +141,7 @@
 
 						param = gda_set_get_holder (dset, name);
 						if (param)
-							if (gda_holder_set_value_str (param, NULL, value))
+							if (gda_holder_set_value_str (param, NULL, value, NULL))
 								params_set = g_slist_prepend (params_set, param);
 					}
 				}
@@ -154,7 +154,7 @@
 		while (0 && list) {
 			if (!params_set || !g_slist_find (params_set, list->data)) {
 				/* empty parameter */
-				gda_holder_set_value (GDA_HOLDER (list->data), NULL);
+				gda_holder_set_value (GDA_HOLDER (list->data), NULL, NULL);
 			}
 			list = g_slist_next (list);
 		}

Modified: trunk/libgnomedb/gnome-db-raw-form.c
==============================================================================
--- trunk/libgnomedb/gnome-db-raw-form.c	(original)
+++ trunk/libgnomedb/gnome-db-raw-form.c	Mon Sep 15 18:36:00 2008
@@ -44,7 +44,7 @@
 
 static void gnome_db_raw_form_initialize (GnomeDbRawForm *form, GtkWidget *layout, GHashTable *box_widgets);
 
-static gboolean iter_row_to_change_cb (GdaDataModelIter *iter, gint row, GnomeDbRawForm *form);
+static GError *iter_validate_set_cb (GdaDataModelIter *iter, GnomeDbRawForm *form);
 static void iter_row_changed_cb (GdaDataModelIter *iter, gint row, GnomeDbRawForm *form);
 static void proxy_changed_cb (GdaDataProxy *proxy, GnomeDbRawForm *form);
 static void proxy_reset_cb (GdaDataProxy *proxy, GnomeDbRawForm *form);
@@ -302,7 +302,7 @@
 			g_signal_handlers_disconnect_by_func (form->priv->iter,
 							      G_CALLBACK (iter_row_changed_cb), form);
 			g_signal_handlers_disconnect_by_func (form->priv->iter,
-							      G_CALLBACK (iter_row_to_change_cb), form);
+							      G_CALLBACK (iter_validate_set_cb), form);
 			g_object_unref (form->priv->iter);
 			form->priv->iter = NULL;
 		}
@@ -353,7 +353,7 @@
 				g_signal_handlers_disconnect_by_func (form->priv->iter,
 								      G_CALLBACK (iter_row_changed_cb), form);
 				g_signal_handlers_disconnect_by_func (form->priv->iter,
-								      G_CALLBACK (iter_row_to_change_cb), form);
+								      G_CALLBACK (iter_validate_set_cb), form);
 
 				g_object_unref (G_OBJECT (form->priv->iter));
 				form->priv->iter = NULL;
@@ -381,10 +381,10 @@
 				form->priv->model = gda_data_proxy_get_proxied_model (form->priv->proxy);
 
 				form->priv->iter = gda_data_model_create_iter ((GdaDataModel *) form->priv->proxy);
-				gda_data_model_iter_set_at_row (form->priv->iter, 0);
+				gda_data_model_iter_move_at_row (form->priv->iter, 0);
 
-				g_signal_connect (form->priv->iter, "row_to_change",
-						  G_CALLBACK (iter_row_to_change_cb), form);
+				g_signal_connect (form->priv->iter, "validate-set",
+						  G_CALLBACK (iter_validate_set_cb), form);
 				g_signal_connect (form->priv->iter, "row_changed",
 						  G_CALLBACK (iter_row_changed_cb), form);
 
@@ -434,27 +434,30 @@
         }	
 }
 
-static gboolean
-iter_row_to_change_cb (GdaDataModelIter *iter, gint row, GnomeDbRawForm *form)
+static GError *
+iter_validate_set_cb (GdaDataModelIter *iter, GnomeDbRawForm *form)
 {
-	gboolean allow_change = TRUE;
-	if (row >= 0) {
-		if (form->priv->write_mode >= GNOME_DB_DATA_WIDGET_WRITE_ON_ROW_CHANGE) {
-			/* write back the current row */
-			if (gda_data_proxy_row_has_changed (form->priv->proxy, row)) {
-				GError *error = NULL;
-				if (!gda_data_proxy_apply_row_changes (form->priv->proxy, row, &error)) {
-					allow_change = gnome_db_utility_display_error_with_keep_or_discard_choice ((GnomeDbDataWidget *) form, 
-													  error);
-					if (allow_change)
-						gda_data_proxy_cancel_row_changes (form->priv->proxy, row, -1);
-					g_error_free (error);
-				}
+	GError *error = NULL;
+	gint row = gda_data_model_iter_get_row (iter);
+	
+	if (row < 0)
+		return NULL;
+
+	if ((form->priv->write_mode >= GNOME_DB_DATA_WIDGET_WRITE_ON_ROW_CHANGE) &&
+		/* write back the current row */
+	    gda_data_proxy_row_has_changed (form->priv->proxy, row) &&
+	    !gda_data_proxy_apply_row_changes (form->priv->proxy, row, &error)) {
+		if (gnome_db_utility_display_error_with_keep_or_discard_choice ((GnomeDbDataWidget *) form, 
+										error)) {
+			gda_data_proxy_cancel_row_changes (form->priv->proxy, row, -1);
+			if (error) {
+				g_error_free (error);
+				error = NULL;
 			}
 		}
 	}
 	
-	return allow_change;
+	return error;
 }
 
 static void
@@ -505,7 +508,7 @@
 {
 	if (gda_data_model_get_n_rows (GDA_DATA_MODEL (form->priv->proxy)) != 0)
 		if (gda_data_model_iter_get_row (form->priv->iter) == -1)
-			gda_data_model_iter_set_at_row (form->priv->iter, row > 0 ? row - 1 : 0);
+			gda_data_model_iter_move_at_row (form->priv->iter, row > 0 ? row - 1 : 0);
 }
 
 /*
@@ -578,7 +581,7 @@
 	GSList *list;
 
 	if (form->priv->write_mode >= GNOME_DB_DATA_WIDGET_WRITE_ON_ROW_CHANGE) 
-		if (! gda_data_model_iter_can_be_moved (form->priv->iter))
+		if (! gda_set_is_valid (GDA_SET (form->priv->iter), NULL))
 			return;
 
 	/* append a row in the proxy */
@@ -590,7 +593,7 @@
 		return;
 	}
 
-	g_assert (gda_data_model_iter_set_at_row (form->priv->iter, newrow));
+	g_assert (gda_data_model_iter_move_at_row (form->priv->iter, newrow));
 
 	/* set parameters to their default values */
 	list = GDA_SET (form->priv->iter)->holders;
@@ -666,7 +669,7 @@
 					      actually succedded the commit 
 					      => we need to come back to that row
 					   */
-				gda_data_model_iter_set_at_row (form->priv->iter, row);
+				gda_data_model_iter_move_at_row (form->priv->iter, row);
 		}
 	}
 	else
@@ -902,7 +905,7 @@
 	}
 
 	if (oldrow != row)
-		gda_data_model_iter_set_at_row (form->priv->iter, row);
+		gda_data_model_iter_move_at_row (form->priv->iter, row);
 }
 
 /*

Modified: trunk/libgnomedb/gnome-db-raw-grid.c
==============================================================================
--- trunk/libgnomedb/gnome-db-raw-grid.c	(original)
+++ trunk/libgnomedb/gnome-db-raw-grid.c	Mon Sep 15 18:36:00 2008
@@ -52,7 +52,7 @@
 static void proxy_reset_cb (GdaDataProxy *proxy, GnomeDbRawGrid *grid);
 static void paramlist_public_data_changed_cb (GdaSet *paramlist, GnomeDbRawGrid *grid);
 static void paramlist_param_plugin_changed_cb (GdaSet *paramlist, GdaHolder *param, GnomeDbRawGrid *grid);
-static gboolean iter_row_to_change_cb (GdaDataModelIter *iter, gint row, GnomeDbRawGrid *grid);
+static GError *iter_validate_set_cb (GdaDataModelIter *iter, GnomeDbRawGrid *grid);
 static void iter_row_changed_cb (GdaDataModelIter *iter, gint row, GnomeDbRawGrid *grid);
 
 /* GnomeDbDataWidget interface */
@@ -398,8 +398,8 @@
 
 				g_signal_connect (grid->priv->iter, "row_changed",
 						  G_CALLBACK (iter_row_changed_cb), grid);
-				g_signal_connect (grid->priv->iter, "row_to_change",
-						  G_CALLBACK (iter_row_to_change_cb), grid);
+				g_signal_connect (grid->priv->iter, "validate-set",
+						  G_CALLBACK (iter_validate_set_cb), grid);
 
 				gda_data_model_iter_invalidate_contents (grid->priv->iter);
 							
@@ -1158,7 +1158,7 @@
 					      actually succedded the commit 
 					      => we need to come back to that row
 					   */
-				gda_data_model_iter_set_at_row (grid->priv->iter, row);
+				gda_data_model_iter_move_at_row (grid->priv->iter, row);
 		}
 	}
 	else
@@ -1880,7 +1880,7 @@
 		has_selection = gtk_tree_selection_get_selected (selection, &model, &iter) ? 1 : 0;
 
 	if (has_selection == 1) {
-		if (!gda_data_model_iter_set_at_row (grid->priv->iter, 
+		if (!gda_data_model_iter_move_at_row (grid->priv->iter, 
 						     gnome_db_data_store_get_row_from_iter (grid->priv->store, 
 											    &iter))) {
 			/* selection changing is refused, return to the current selected row */
@@ -1895,7 +1895,7 @@
 	else {
 		/* render all the parameters invalid, and make the iter point to row -1 */
 		gda_data_model_iter_invalidate_contents (grid->priv->iter);
-		gda_data_model_iter_set_at_row (grid->priv->iter, -1);
+		gda_data_model_iter_move_at_row (grid->priv->iter, -1);
 	}
 
 #ifdef debug_signal
@@ -2149,27 +2149,30 @@
 	paramlist_public_data_changed_cb (paramlist, grid);
 }
 
-static gboolean
-iter_row_to_change_cb (GdaDataModelIter *iter, gint row, GnomeDbRawGrid *grid)
+static GError *
+iter_validate_set_cb (GdaDataModelIter *iter, GnomeDbRawGrid *grid)
 {
-	gboolean allow_change = TRUE;
-	if (row >= 0) {
-		if (grid->priv->write_mode >= GNOME_DB_DATA_WIDGET_WRITE_ON_ROW_CHANGE) {
-			/* write back the current row */
-			if (gda_data_proxy_row_has_changed (grid->priv->proxy, row)) {
-				GError *error = NULL;
-				if (!gda_data_proxy_apply_row_changes (grid->priv->proxy, row, &error)) {
-					allow_change = gnome_db_utility_display_error_with_keep_or_discard_choice ((GnomeDbDataWidget *) grid, 
-													  error);
-					if (allow_change)
-						gda_data_proxy_cancel_row_changes (grid->priv->proxy, row, -1);
-					g_error_free (error);
-				}
+GError *error = NULL;
+	gint row = gda_data_model_iter_get_row (iter);
+	
+	if (row < 0)
+		return NULL;
+
+	if ((grid->priv->write_mode >= GNOME_DB_DATA_WIDGET_WRITE_ON_ROW_CHANGE) &&
+		/* write back the current row */
+	    gda_data_proxy_row_has_changed (grid->priv->proxy, row) &&
+	    !gda_data_proxy_apply_row_changes (grid->priv->proxy, row, &error)) {
+		if (gnome_db_utility_display_error_with_keep_or_discard_choice ((GnomeDbDataWidget *) grid, 
+										error)) {
+			gda_data_proxy_cancel_row_changes (grid->priv->proxy, row, -1);
+			if (error) {
+				g_error_free (error);
+				error = NULL;
 			}
 		}
 	}
 	
-	return allow_change;
+	return error;	
 }
 
 static void
@@ -2296,7 +2299,7 @@
 		g_signal_handlers_disconnect_by_func (grid->priv->iter,
 						      G_CALLBACK (iter_row_changed_cb), grid);
 		g_signal_handlers_disconnect_by_func (grid->priv->iter,
-						      G_CALLBACK (iter_row_to_change_cb), grid);
+						      G_CALLBACK (iter_validate_set_cb), grid);
 		g_object_unref (grid->priv->iter);
 		grid->priv->iter = NULL;
 	}

Modified: trunk/libgnomedb/gnome-db-server-operation.c
==============================================================================
--- trunk/libgnomedb/gnome-db-server-operation.c	(original)
+++ trunk/libgnomedb/gnome-db-server-operation.c	Mon Sep 15 18:36:00 2008
@@ -1245,7 +1245,7 @@
 {
 	g_signal_handlers_block_by_func (G_OBJECT (iter2),
 					 G_CALLBACK (create_table_grid_fields_iter_row_changed_cb), iter1);
-	gda_data_model_iter_set_at_row (iter2, row);
+	gda_data_model_iter_move_at_row (iter2, row);
 	g_signal_handlers_unblock_by_func (G_OBJECT (iter2),
 					   G_CALLBACK (create_table_grid_fields_iter_row_changed_cb), iter1);
 }

Modified: trunk/libgnomedb/plugins/gnome-db-entry-pict.c
==============================================================================
--- trunk/libgnomedb/plugins/gnome-db-entry-pict.c	(original)
+++ trunk/libgnomedb/plugins/gnome-db-entry-pict.c	Mon Sep 15 18:36:00 2008
@@ -211,6 +211,12 @@
 static gboolean event_cb (GtkWidget *button, GdkEvent *event, GnomeDbEntryPict *mgpict);
 static void size_allocate_cb (GtkWidget *wid, GtkAllocation *allocation, GnomeDbEntryPict *mgpict);
 
+static void
+realize_cb (GnomeDbEntryPict *mgpict, GnomeDbEntryWrapper *mgwrap)
+{
+	display_image (mgpict, NULL, NULL, NULL);
+}
+
 static GtkWidget *
 create_entry (GnomeDbEntryWrapper *mgwrap)
 {
@@ -258,6 +264,9 @@
 
 	display_image (mgpict, NULL, GTK_STOCK_MISSING_IMAGE, _("No data to display"));
 
+	g_signal_connect (G_OBJECT (mgpict), "realize",
+			  G_CALLBACK (realize_cb), mgwrap);
+
 	return vbox;
 }
 
@@ -407,11 +416,11 @@
 	if (notice || notice_msg) {
 		gtk_label_set_text (GTK_LABEL (mgpict->priv->notice), notice ? notice : notice_msg);
 		gtk_widget_show (mgpict->priv->notice);
+		g_free (notice_msg);
 	}
-	else  
+	else 
 		gtk_widget_hide (mgpict->priv->notice);
 
-	g_free (notice_msg);
 	common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu), mgpict->priv->editable, &(mgpict->priv->bindata));
 	gtk_widget_queue_resize ((GtkWidget *) mgpict);
 }

Modified: trunk/libgnomedb/utility.c
==============================================================================
--- trunk/libgnomedb/utility.c	(original)
+++ trunk/libgnomedb/utility.c	Mon Sep 15 18:36:00 2008
@@ -338,7 +338,7 @@
 									  key_values, cols_index);
 				if (row >= 0) {
 					value = gda_data_model_get_value_at (GDA_DATA_MODEL (source->data_model),
-									     col, row);
+									     col, row, NULL);
 					retval = g_list_append (retval, (GValue *) value);
 				}
 				else {

Modified: trunk/providers/evolution/gda-evolution-provider.c
==============================================================================
--- trunk/providers/evolution/gda-evolution-provider.c	(original)
+++ trunk/providers/evolution/gda-evolution-provider.c	Mon Sep 15 18:36:00 2008
@@ -255,7 +255,7 @@
 		gchar *table_name;
 		GdaDataModel *table;
 
-		table_name = g_value_get_string (gda_data_model_get_value_at (tables, 0, r));
+		table_name = g_value_get_string (gda_data_model_get_value_at (tables, 0, r, NULL));
 		table = gda_evolution_connection_get_table (cnc, table_name);
 		if (table != NULL)
 			gda_data_model_filter_sql_add_source (GDA_DATA_MODEL_FILTER_SQL (select),

Modified: trunk/testing/test-dyn-widgets.c
==============================================================================
--- trunk/testing/test-dyn-widgets.c	(original)
+++ trunk/testing/test-dyn-widgets.c	Mon Sep 15 18:36:00 2008
@@ -718,9 +718,10 @@
 	if (GDA_IS_STATEMENT (stmt) && (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_SELECT)) {
 		GdaSet *dset;
 		
-		model = gda_data_model_query_new (config->cnc, stmt);
-		dset = gda_data_model_query_get_parameter_list (GDA_DATA_MODEL_QUERY (model));
-		if (dset && !gda_set_is_valid (dset)) {
+		if (! gda_statement_get_parameters (stmt, &dset, NULL))
+			return NULL;
+
+		if (dset && !gda_set_is_valid (dset, NULL)) {
 			GtkWidget *dlg;
 			gint status;
 			gchar *str;
@@ -731,19 +732,11 @@
 			g_free (str);
 			status = gtk_dialog_run (GTK_DIALOG (dlg));
 			gtk_widget_destroy (dlg);
-			if (status == GTK_RESPONSE_REJECT) {
-				g_object_unref (model);
-				model = NULL;
-			}
-		}
-		if (model) {
-			GError *error = NULL;
-			if (!gda_data_model_query_refresh (GDA_DATA_MODEL_QUERY (model), &error)) {
-				g_warning ("Can't refresh GdaDataModelQuery data model: %s\n",
-					   error && error->message ? error->message : _("Unknown error"));
-				g_error_free (error);
-			}
+			if (status == GTK_RESPONSE_REJECT) 
+				return NULL;
 		}
+
+		model = (GdaDataModel*) gda_data_model_query_new (config->cnc, stmt, dset);
 	}
 
 	return model;



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