]> granicus.if.org Git - postgis/commitdiff
If the database settings are incorrect when attempting an import, display the connect...
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 10 Jan 2012 12:28:46 +0000 (12:28 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 10 Jan 2012 12:28:46 +0000 (12:28 +0000)
dialog.

Also a minor bugfix: if the dialog is cancelled by closing the window, ensure that any unset
fields are reset back to blank.

git-svn-id: http://svn.osgeo.org/postgis/trunk@8746 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-gui.c

index 6f9874acfb21423fffed3f14e52a2908ac2ea5d1..2150033db70e1594ad3a59b167b058fedd804632 100644 (file)
@@ -33,6 +33,8 @@
 static void pgui_log_va(const char *fmt, va_list ap);
 static void pgui_seterr_va(const char *fmt, va_list ap);
 
+static void update_conn_ui_from_conn_config(void);
+
 /*
 ** Global variables for GUI only
 */
@@ -936,7 +938,11 @@ pgui_action_import(GtkWidget *widget, gpointer data)
        {
                pgui_seterr(_("Unable to connect to the database - please check your connection settings"));
                pgui_raise_error_dialogue();
-       
+
+               /* Open the connections UI for the user */
+               update_conn_ui_from_conn_config();
+
+               gtk_widget_show_all(GTK_WIDGET(window_conn));
                return;
        }
 
@@ -1520,18 +1526,28 @@ update_conn_ui_from_conn_config(void)
 {
        if (conn->username)
                gtk_entry_set_text(GTK_ENTRY(entry_pg_user), conn->username);
-       
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry_pg_user), "");
+               
        if (conn->password)
                gtk_entry_set_text(GTK_ENTRY(entry_pg_pass), conn->password);
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry_pg_pass), "");
        
        if (conn->host)
                gtk_entry_set_text(GTK_ENTRY(entry_pg_host), conn->host);
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry_pg_host), "");
        
        if (conn->port)
                gtk_entry_set_text(GTK_ENTRY(entry_pg_port), conn->port);
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry_pg_port), "");
        
        if (conn->database)
                gtk_entry_set_text(GTK_ENTRY(entry_pg_db), conn->database);
+       else
+               gtk_entry_set_text(GTK_ENTRY(entry_pg_db), "");
 
        return;
 }
@@ -2319,7 +2335,7 @@ main(int argc, char *argv[])
        pgui_create_about_dialog();
        pgui_create_filechooser_dialog();
        pgui_create_progress_dialog();
-               
+
        /* start the main loop */
        gtk_main();