PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ pgui_create_main_window()

static void pgui_create_main_window ( const SHPCONNECTIONCONFIG conn)
static

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

3311 {
3312  /* Main widgets */
3313  GtkWidget *vbox_main, *vbox_loader, *vbox_dumper;
3314 
3315  /* PgSQL section */
3316  GtkWidget *frame_pg, *import_list_frame, *export_list_frame, *frame_log;
3317  GtkWidget *button_pg_conn;
3318 
3319  /* Notebook */
3320  GtkWidget *notebook;
3321 
3322  /* Button section */
3323  GtkWidget *loader_hbox_buttons, *loader_button_options, *loader_button_import, *loader_button_cancel, *loader_button_about;
3324  GtkWidget *dumper_hbox_buttons, *dumper_button_options, *dumper_button_export, *dumper_button_cancel, *dumper_button_about;
3325 
3326  /* Log section */
3327  GtkWidget *scrolledwindow_log;
3328 
3329  /* Create the main top level window with a 10px border */
3330  window_main = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3331  gtk_container_set_border_width(GTK_CONTAINER(window_main), 10);
3332  gtk_window_set_title(GTK_WINDOW(window_main), _("PostGIS Shapefile Import/Export Manager"));
3333  gtk_window_set_position(GTK_WINDOW(window_main), GTK_WIN_POS_CENTER_ALWAYS);
3334  gtk_window_set_resizable(GTK_WINDOW(window_main), FALSE);
3335 
3336  /* Open it a bit wider so that both the label and title show up */
3337  gtk_window_set_default_size(GTK_WINDOW(window_main), 180, 500);
3338 
3339  /* Connect the destroy event of the window with our pgui_quit function
3340  * When the window is about to be destroyed we get a notification and
3341  * stop the main GTK loop
3342  */
3343  g_signal_connect(G_OBJECT(window_main), "destroy", G_CALLBACK(pgui_quit), NULL);
3344 
3345  /* Connection row */
3346  frame_pg = gtk_frame_new(_("PostGIS Connection"));
3347 
3348  /* Test button row */
3349  button_pg_conn = gtk_button_new_with_label(_("View connection details..."));
3350  g_signal_connect(G_OBJECT(button_pg_conn), "clicked", G_CALLBACK(pgui_action_connection_details), NULL);
3351  gtk_container_set_border_width(GTK_CONTAINER(button_pg_conn), 10);
3352  gtk_container_add(GTK_CONTAINER(frame_pg), button_pg_conn);
3353 
3354  /*
3355  * GTK Notebook for selecting import/export
3356  */
3357  notebook = gtk_notebook_new();
3358 
3359  /*
3360  ** Shape file selector
3361  */
3362  import_list_frame = gtk_frame_new(_("Import List"));
3363  pgui_create_import_file_table(import_list_frame);
3364 
3365  /*
3366  ** Row of action buttons
3367  */
3368  loader_hbox_buttons = gtk_hbox_new(TRUE, 15);
3369  gtk_container_set_border_width (GTK_CONTAINER (loader_hbox_buttons), 0);
3370 
3371  /* Create the buttons themselves */
3372  loader_button_options = gtk_button_new_with_label(_("Options..."));
3373  loader_button_import = gtk_button_new_with_label(_("Import"));
3374  loader_button_cancel = gtk_button_new_with_label(_("Cancel"));
3375  loader_button_about = gtk_button_new_with_label(_("About"));
3376 
3377  /* Add actions to the buttons */
3378  g_signal_connect (G_OBJECT (loader_button_import), "clicked", G_CALLBACK (pgui_action_import), NULL);
3379  g_signal_connect (G_OBJECT (loader_button_options), "clicked", G_CALLBACK (pgui_action_loader_options_open), NULL);
3380  g_signal_connect (G_OBJECT (loader_button_cancel), "clicked", G_CALLBACK (pgui_action_cancel), NULL);
3381  g_signal_connect (G_OBJECT (loader_button_about), "clicked", G_CALLBACK (pgui_action_about_open), NULL);
3382 
3383  /* And insert the buttons into the hbox */
3384  gtk_box_pack_start(GTK_BOX(loader_hbox_buttons), loader_button_options, TRUE, TRUE, 0);
3385  gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_cancel, TRUE, TRUE, 0);
3386  gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_about, TRUE, TRUE, 0);
3387  gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_import, TRUE, TRUE, 0);
3388 
3389  /*
3390  ** Table selector
3391  */
3392  export_list_frame = gtk_frame_new(_("Export List"));
3393  pgui_create_export_table_table(export_list_frame);
3394 
3395  /*
3396  ** Row of action buttons
3397  */
3398  dumper_hbox_buttons = gtk_hbox_new(TRUE, 15);
3399  gtk_container_set_border_width (GTK_CONTAINER (dumper_hbox_buttons), 0);
3400 
3401  /* Create the buttons themselves */
3402  dumper_button_options = gtk_button_new_with_label(_("Options..."));
3403  dumper_button_export = gtk_button_new_with_label(_("Export"));
3404  dumper_button_cancel = gtk_button_new_with_label(_("Cancel"));
3405  dumper_button_about = gtk_button_new_with_label(_("About"));
3406 
3407  /* Add actions to the buttons */
3408  g_signal_connect (G_OBJECT (dumper_button_export), "clicked", G_CALLBACK (pgui_action_export), NULL);
3409  g_signal_connect (G_OBJECT (dumper_button_options), "clicked", G_CALLBACK (pgui_action_dumper_options_open), NULL);
3410  g_signal_connect (G_OBJECT (dumper_button_cancel), "clicked", G_CALLBACK (pgui_action_cancel), NULL);
3411  g_signal_connect (G_OBJECT (dumper_button_about), "clicked", G_CALLBACK (pgui_action_about_open), NULL);
3412 
3413  /* And insert the buttons into the hbox */
3414  gtk_box_pack_start(GTK_BOX(dumper_hbox_buttons), dumper_button_options, TRUE, TRUE, 0);
3415  gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_cancel, TRUE, TRUE, 0);
3416  gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_about, TRUE, TRUE, 0);
3417  gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_export, TRUE, TRUE, 0);
3418 
3419  /*
3420  ** Log window
3421  */
3422  frame_log = gtk_frame_new(_("Log Window"));
3423  gtk_container_set_border_width (GTK_CONTAINER (frame_log), 0);
3424  gtk_widget_set_size_request(frame_log, -1, 200);
3425  textview_log = gtk_text_view_new();
3426  textbuffer_log = gtk_text_buffer_new(NULL);
3427  scrolledwindow_log = gtk_scrolled_window_new(NULL, NULL);
3428  gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolledwindow_log), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
3429  gtk_text_view_set_buffer(GTK_TEXT_VIEW(textview_log), textbuffer_log);
3430  gtk_container_set_border_width (GTK_CONTAINER (textview_log), 5);
3431  gtk_text_view_set_editable(GTK_TEXT_VIEW(textview_log), FALSE);
3432  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview_log), FALSE);
3433  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview_log), GTK_WRAP_WORD);
3434  gtk_container_add (GTK_CONTAINER (scrolledwindow_log), textview_log);
3435  gtk_container_add (GTK_CONTAINER (frame_log), scrolledwindow_log);
3436 
3437  /*
3438  ** Main window
3439  */
3440  vbox_main = gtk_vbox_new(FALSE, 10);
3441  gtk_container_set_border_width (GTK_CONTAINER (vbox_main), 0);
3442 
3443  /* Add the loader frames into the notebook page */
3444  vbox_loader = gtk_vbox_new(FALSE, 10);
3445  gtk_container_set_border_width(GTK_CONTAINER(vbox_loader), 10);
3446 
3447  gtk_box_pack_start(GTK_BOX(vbox_loader), import_list_frame, FALSE, TRUE, 0);
3448  gtk_box_pack_start(GTK_BOX(vbox_loader), loader_hbox_buttons, FALSE, FALSE, 0);
3449  gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_loader, gtk_label_new(_("Import")));
3450 
3451  /* Add the dumper frames into the notebook page */
3452  vbox_dumper = gtk_vbox_new(FALSE, 10);
3453  gtk_container_set_border_width(GTK_CONTAINER(vbox_dumper), 10);
3454 
3455  gtk_box_pack_start(GTK_BOX(vbox_dumper), export_list_frame, FALSE, TRUE, 0);
3456  gtk_box_pack_start(GTK_BOX(vbox_dumper), dumper_hbox_buttons, FALSE, FALSE, 0);
3457  gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_dumper, gtk_label_new(_("Export")));
3458 
3459  /* Add the frames into the main vbox */
3460  gtk_box_pack_start(GTK_BOX(vbox_main), frame_pg, FALSE, TRUE, 0);
3461  gtk_box_pack_start(GTK_BOX(vbox_main), notebook, FALSE, TRUE, 0);
3462  gtk_box_pack_start(GTK_BOX(vbox_main), frame_log, TRUE, TRUE, 0);
3463 
3464  /* and insert the vbox into the main window */
3465  gtk_container_add(GTK_CONTAINER(window_main), vbox_main);
3466 
3467  /* make sure that everything, window and label, are visible */
3468  gtk_widget_show_all(window_main);
3469 
3470  return;
3471 }
#define TRUE
Definition: dbfopen.c:73
#define FALSE
Definition: dbfopen.c:72
static void pgui_action_connection_details(GtkWidget *widget, gpointer data)
static GtkTextBuffer * textbuffer_log
Definition: shp2pgsql-gui.c:55
static void pgui_action_import(GtkWidget *widget, gpointer data)
static void pgui_action_export(GtkWidget *widget, gpointer data)
static void pgui_create_export_table_table(GtkWidget *export_list_frame)
static GtkWidget * textview_log
Definition: shp2pgsql-gui.c:54
static void pgui_action_about_open()
static void pgui_action_loader_options_open(GtkWidget *widget, gpointer data)
static void pgui_quit(GtkWidget *widget, gpointer data)
static void pgui_action_dumper_options_open(GtkWidget *widget, gpointer data)
static GtkWidget * window_main
Definition: shp2pgsql-gui.c:52
static void pgui_action_cancel(GtkWidget *widget, gpointer data)
static void pgui_create_import_file_table(GtkWidget *import_list_frame)
#define _(String)
Definition: shpcommon.h:24

References _, FALSE, pgui_action_about_open(), pgui_action_cancel(), pgui_action_connection_details(), pgui_action_dumper_options_open(), pgui_action_export(), pgui_action_import(), pgui_action_loader_options_open(), pgui_create_export_table_table(), pgui_create_import_file_table(), pgui_quit(), textbuffer_log, textview_log, TRUE, and window_main.

Referenced by main().

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