[gnome-db] NULL model in list_new_with_model()



The gnome_db_list_new_with_model() function fails if model is NULL. It would simplify the Python bindings to use new_with_model() with an optional model, instead of new(), as the GnomeDbList constructor.

I'm attaching a patch that removes the check. It also strengthens the model validation in set_model().
diff -Naur libgnomedb-1.0.2.orig/libgnomedb/gnome-db-list.c libgnomedb-1.0.2/libgnomedb/gnome-db-list.c
--- libgnomedb-1.0.2.orig/libgnomedb/gnome-db-list.c	2002-03-31 17:53:02.000000000 -0500
+++ libgnomedb-1.0.2/libgnomedb/gnome-db-list.c	2004-01-16 11:28:13.000000000 -0500
@@ -247,8 +247,6 @@
 {
 	GtkWidget *list;
 
-	g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
-
 	list = gnome_db_list_new ();
 	gnome_db_list_set_model (GNOME_DB_LIST (list), model, col);
 
@@ -293,7 +291,7 @@
 	/* fill in our private data model */
 	list->priv->data_model = gda_data_model_list_new ();
 
-	if (model != NULL) {
+	if (GDA_IS_DATA_MODEL (model)) {
 		row_count = gda_data_model_get_n_rows (model);
 		for (n = 0; n < row_count; n++) {
 			const GdaValue *value;


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