Skip to content

Commit

Permalink
If the database settings are incorrect when attempting an import, dis…
Browse files Browse the repository at this point in the history
…play the connection settings

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
  • Loading branch information
Mark Cave-Ayland committed Jan 10, 2012
1 parent cb79aa5 commit 580aa50
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions loader/shp2pgsql-gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 580aa50

Please sign in to comment.