[gnome-db] Patch for mergeant



Hi there!

This prevents mergeant from trying to connect again using previous
parameters if the last attempt to connect failed, thus allowing the user
to fix username and/or password.

Vivien, is this correct or is there a better way to achieve it?

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



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/mergeant/ChangeLog,v
retrieving revision 1.102
diff -u -r1.102 ChangeLog
--- ChangeLog	19 Jan 2003 12:07:56 -0000	1.102
+++ ChangeLog	19 Jan 2003 14:44:50 -0000
@@ -1,3 +1,11 @@
+2003-01-19  Gonzalo Paniagua Javier <gonzalo gnome-db org>
+
+	* src/conf-manager.h: added 'last_failed' field.
+	* src/interface_cb.c:
+	(sql_conn_open_cb): don't connect automatically if the last attempt
+	failed.
+	(options_config_cb): fixed typo.
+
 2003-01-19  Christian Neumair  <chris gnome-de org>
 
 	* data/.cvsignore: Added.
Index: src/conf-manager.h
===================================================================
RCS file: /cvs/gnome/mergeant/src/conf-manager.h,v
retrieving revision 1.9
diff -u -r1.9 conf-manager.h
--- src/conf-manager.h	11 Jan 2003 03:09:00 -0000	1.9
+++ src/conf-manager.h	19 Jan 2003 14:44:50 -0000
@@ -138,6 +138,9 @@
 
 	/* configuration listener id */
 	guint                config_listener;
+
+	/* flag to indicate that last connection attempt failed */
+	gboolean             last_failed;
 };
 
 /* struct for the object's class */
Index: src/interface_cb.c
===================================================================
RCS file: /cvs/gnome/mergeant/src/interface_cb.c,v
retrieving revision 1.28
diff -u -r1.28 interface_cb.c
--- src/interface_cb.c	17 Jan 2003 18:59:51 -0000	1.28
+++ src/interface_cb.c	19 Jan 2003 14:44:51 -0000
@@ -69,7 +69,7 @@
 {
 	gchar *str;
 
-	if (*(conf->srv->gda_datasource->str)) {
+	if (!conf->last_failed && *(conf->srv->gda_datasource->str)) {
 		/* we check if we have a password or not; if not, ask for one, except if we 
 		   have already entered it into the gnome-db login dialog */
 		if (conf->user_name && !conf->conn_open_requested &&
@@ -147,8 +147,10 @@
 
 		}
 		server_access_open_connect (conf->srv);
+		conf->last_failed = (conf->srv->cnc == NULL);
 	}
 	else {
+		conf->last_failed = FALSE;
 		conf->conn_open_requested = TRUE;
 		options_config_cb (NULL, conf);
 	}
@@ -359,7 +361,7 @@
 
                 if (conf->user_name)
                         g_free (conf->user_name);
-                conf->user_name = g_strdup (conf->srv->gda_datasource->str);
+                conf->user_name = g_strdup (conf->srv->user_name->str);
                 if (conf->user_passwd)
                         g_free (conf->user_passwd);
                 conf->user_passwd = g_strdup (conf->srv->password->str);


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