[gnome-db] libgnomedb: new dsn druid can overwrite existing dsns



Hi,

I found a bug in libgnomedb.  If you create a new DSN with
gnome-database-properties when an existing DSN is already registered
under the same name, it will overwrite the existing DSN with the new one
(which is IMHO an unexpected behavior).

The following patch fixes this.  BTW I couldn't find any entry in
bugzilla which matches this bug.

Cheers,

-- 
{ "Laurent" => "http://lrz.samika.net"; }
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomedb/ChangeLog,v
retrieving revision 1.257
diff -u -r1.257 ChangeLog
--- ChangeLog	12 Oct 2003 16:52:21 -0000	1.257
+++ ChangeLog	28 Oct 2003 12:36:16 -0000
@@ -1,3 +1,8 @@
+2003-10-28  Laurent Sansonetti <laurent datarescue be> 
+
+	* libgnomedb/gnome-db-dsn-config-druid.c (general_next_pressed_cb):
+	dont create a new dsn if an existing one has the same name.
+
 2003-10-12  Rodrigo Moya <rodrigo gnome-db org>
 
 	Fixes #123173
Index: libgnomedb/gnome-db-dsn-config-druid.c
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-dsn-config-druid.c,v
retrieving revision 1.23
diff -u -r1.23 gnome-db-dsn-config-druid.c
--- libgnomedb/gnome-db-dsn-config-druid.c	4 Jul 2003 15:55:02 -0000	1.23
+++ libgnomedb/gnome-db-dsn-config-druid.c	28 Oct 2003 12:36:17 -0000
@@ -174,6 +174,7 @@
 			 GtkWidget *druid_widget,
 			 gpointer user_data)
 {
+	GdaDataSourceInfo *dsn_info;
 	GdaProviderInfo *prov_info;
 	GList *l;
 	gint i;
@@ -187,6 +188,14 @@
 	name = gtk_entry_get_text (GTK_ENTRY (druid->priv->general_name));
 	if (!name || strlen (name) < 1) {
 		gnome_db_show_error (_("You must enter a name for the new data source"));
+		gtk_widget_grab_focus (druid->priv->general_name);
+		return TRUE;
+	}
+
+	dsn_info = gnome_db_config_find_data_source (name);
+	if (dsn_info != NULL) {
+		gnome_db_config_free_data_source_info (dsn_info);
+		gnome_db_show_error (_("An existing data source is already registered under the same name"));
 		gtk_widget_grab_focus (druid->priv->general_name);
 		return TRUE;
 	}


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