PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ pgui_create_connection_window()

static void pgui_create_connection_window ( )
static

Definition at line 3223 of file shp2pgsql-gui.c.

3224{
3225 /* Default text width */
3226 static int text_width = 12;
3227
3228 /* Vbox container */
3229 GtkWidget *vbox;
3230
3231 /* Reusable label handle */
3232 GtkWidget *label;
3233
3234 /* PgSQL section */
3235 GtkWidget *frame_pg, *table_pg;
3236
3237 /* OK button */
3238 GtkWidget *button_okay;
3239
3240 /* Create the main top level window with a 10px border */
3241 window_conn = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3242 gtk_container_set_border_width(GTK_CONTAINER(window_conn), 10);
3243 gtk_window_set_title(GTK_WINDOW(window_conn), _("PostGIS connection"));
3244 gtk_window_set_position(GTK_WINDOW(window_conn), GTK_WIN_POS_CENTER);
3245 gtk_window_set_modal(GTK_WINDOW(window_conn), TRUE);
3246
3247 /* Use a vbox as the base container */
3248 vbox = gtk_vbox_new(FALSE, 15);
3249
3250 /*
3251 ** PostGIS info in a table
3252 */
3253 frame_pg = gtk_frame_new(_("PostGIS Connection"));
3254 table_pg = gtk_table_new(5, 3, TRUE);
3255 gtk_container_set_border_width (GTK_CONTAINER (table_pg), 8);
3256 gtk_table_set_col_spacings(GTK_TABLE(table_pg), 7);
3257 gtk_table_set_row_spacings(GTK_TABLE(table_pg), 3);
3258
3259 /* User name row */
3260 label = gtk_label_new(_("Username:"));
3261 entry_pg_user = gtk_entry_new();
3262 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 0, 1 );
3263 gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_user, 1, 3, 0, 1 );
3264
3265 /* Password row */
3266 label = gtk_label_new(_("Password:"));
3267 entry_pg_pass = gtk_entry_new();
3268 gtk_entry_set_visibility( GTK_ENTRY(entry_pg_pass), FALSE);
3269 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 1, 2 );
3270 gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_pass, 1, 3, 1, 2 );
3271
3272 /* Host and port row */
3273 label = gtk_label_new(_("Server Host:"));
3274 entry_pg_host = gtk_entry_new();
3275 gtk_entry_set_width_chars(GTK_ENTRY(entry_pg_host), text_width);
3276 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 2, 3 );
3277 gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_host, 1, 2, 2, 3 );
3278
3279 entry_pg_port = gtk_entry_new();
3280 gtk_entry_set_width_chars(GTK_ENTRY(entry_pg_port), 8);
3281 gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_port, 2, 3, 2, 3 );
3282
3283 /* Database row */
3284 label = gtk_label_new(_("Database:"));
3285 entry_pg_db = gtk_entry_new();
3286 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 3, 4 );
3287 gtk_table_attach_defaults(GTK_TABLE(table_pg), entry_pg_db, 1, 3, 3, 4 );
3288
3289 /* Add table into containing frame */
3290 gtk_container_add(GTK_CONTAINER(frame_pg), table_pg);
3291
3292 /* Add frame into containing vbox */
3293 gtk_container_add(GTK_CONTAINER(window_conn), vbox);
3294
3295 /* Add the vbox into the window */
3296 gtk_container_add(GTK_CONTAINER(vbox), frame_pg);
3297
3298 /* Create a simple "OK" button for the dialog */
3299 button_okay = gtk_button_new_with_label(_("OK"));
3300 gtk_container_add(GTK_CONTAINER(vbox), button_okay);
3301 g_signal_connect(G_OBJECT(button_okay), "clicked", G_CALLBACK(pgui_action_connection_okay), NULL);
3302
3303 /* Hook the delete event so we don't destroy the dialog (only hide it) if cancelled */
3304 gtk_signal_connect(GTK_OBJECT(window_conn), "delete_event", GTK_SIGNAL_FUNC(pgui_event_popup_delete), NULL);
3305
3306 return;
3307}
#define TRUE
Definition dbfopen.c:73
#define FALSE
Definition dbfopen.c:72
static GtkWidget * entry_pg_port
static gint pgui_event_popup_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
static GtkWidget * entry_pg_host
static GtkWidget * entry_pg_user
static GtkWidget * entry_pg_db
static GtkWidget * entry_pg_pass
static GtkWidget * window_conn
static void pgui_action_connection_okay(GtkWidget *widget, gpointer data)
#define _(String)
Definition shpcommon.h:24

References _, entry_pg_db, entry_pg_host, entry_pg_pass, entry_pg_port, entry_pg_user, FALSE, pgui_action_connection_okay(), pgui_event_popup_delete(), TRUE, and window_conn.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function: