Re: [gnome-db] Patch - cvs HEAD - gnome_db_combo.[ch]



Use this patch 

The previous patch is wrong.

On Wed, Dec 17, 2003 at 06:29:09PM +0100, Stephane Wirtel wrote:
>> This patch add a new function in the API of gnome_db_combo.
>> 
>> Now it's possible to create a new gnome_db_combo widget with a model.
>> 
>> GtkWidget *gnome_db_combo_new_with_model(GdaDataModel *model, gint col);
>> This function works on my laptop : Gentoo 1.4 - gcc 3.3.2 - libgnomedb
>> 1.0.2 && gnome-2.4.1

---end quoted text---
Index: gnome-db-combo.c
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-combo.c,v
retrieving revision 1.4
diff -u -r1.4 gnome-db-combo.c
--- gnome-db-combo.c	29 Nov 2003 15:39:58 -0000	1.4
+++ gnome-db-combo.c	17 Dec 2003 18:21:12 -0000
@@ -185,6 +185,32 @@
 	return GTK_WIDGET (combo);
 }
 
+/**
+ * gnome_db_combo_new_with_model
+ * @model: a #GdaDataModel object.
+ * @col: the column in the model to be shown.
+ *
+ * Create a new GnomeDbCombo widget with a model.
+ *
+ * Returns: the newly-created widget.
+ */
+GtkWidget *
+gnome_db_combo_new_with_model (GdaDataModel *model, gint col)
+{
+	GnomeDbCombo *combo;
+	
+	g_return_val_if_fail (model == NULL || GDA_IS_DATA_MODEL (model), NULL);
+	g_return_val_if_fail (col >= 0, NULL);
+
+	combo = gnome_db_combo_new();
+	if (combo != NULL) {
+		gnome_db_combo_set_model (GNOME_DB_COMBO (combo), GDA_DATA_MODEL (model), col);
+	}
+
+	return GTK_WIDGET (combo);
+}
+
+
 static void
 model_changed_cb (GdaDataModel *model, gpointer user_data)
 {
Index: gnome-db-combo.h
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-combo.h,v
retrieving revision 1.1
diff -u -r1.1 gnome-db-combo.h
--- gnome-db-combo.h	13 Jan 2002 19:11:55 -0000	1.1
+++ gnome-db-combo.h	17 Dec 2003 18:21:12 -0000
@@ -49,6 +49,7 @@
 
 GType      gnome_db_combo_get_type (void);
 GtkWidget *gnome_db_combo_new (void);
+GtkWidget *gnome_db_combo_new_with_model (GdaDataModel *model, gint pos);
 void       gnome_db_combo_set_model (GnomeDbCombo *combo, GdaDataModel *model, gint pos);
 
 G_END_DECLS


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