[gnome-db] Path that implements gnome_db_combo_set_model



gnome_db_combo_set_model is empty. Here's a patch to implement it.

Ok to commit?

-- 
Gonzalo Paniagua Javier <gonzalo gnome-db org>
http://www.gnome-db.org/~gonzalo/



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomedb/ChangeLog,v
retrieving revision 1.261
diff -u -r1.261 ChangeLog
--- ChangeLog	24 Nov 2003 23:25:45 -0000	1.261
+++ ChangeLog	28 Nov 2003 15:36:49 -0000
@@ -1,3 +1,7 @@
+2003-11-28  Gonzalo Paniagua Javier <gonzalo gnome-db org>
+
+	* libgnomedb/gnome-db-combo.c: implemented gnome_db_combo_set_model.
+
 2003-11-24  Rodrigo Moya <rodrigo gnome-db org>
 
 	Released 1.1.0
Index: libgnomedb/gnome-db-combo.c
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-combo.c,v
retrieving revision 1.2
diff -u -r1.2 gnome-db-combo.c
--- libgnomedb/gnome-db-combo.c	15 Jan 2002 02:19:03 -0000	1.2
+++ libgnomedb/gnome-db-combo.c	28 Nov 2003 15:36:49 -0000
@@ -194,4 +194,25 @@
 void
 gnome_db_combo_set_model (GnomeDbCombo *combo, GdaDataModel *model, gint col)
 {
+	GList *list = NULL;
+	gint rows, i;
+	const GdaValue *value;
+
+	g_return_if_fail (GNOME_DB_IS_COMBO (combo));
+	g_return_if_fail (GDA_IS_DATA_MODEL (model));
+	g_return_if_fail (col >= 0 && col < gda_data_model_get_n_columns (model));
+
+	rows = gda_data_model_get_n_rows (model);
+	if (rows == 0)
+		return;
+
+	for (i = 0; i < rows; i++) {
+		value = gda_data_model_get_value_at (model, col, i);
+		list = g_list_append (list, gda_value_stringify (value));
+	}
+
+	gtk_combo_set_popdown_strings (GTK_COMBO (combo), list);
+	g_list_foreach (list, (GFunc) g_free, NULL);
+	g_list_free (list);
 }
+


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