PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ pgui_create_tablechooser_dialog()

static void pgui_create_tablechooser_dialog ( )
static

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

2792 {
2793  GtkWidget *vbox_tree, *table_progress;
2794  GtkWidget *sw, *label;
2795  GtkTreeSelection *chooser_selection;
2796 
2797  /* Create the main top level window with a 10px border */
2798  dialog_tablechooser = gtk_dialog_new_with_buttons(_("Table selection"), GTK_WINDOW(window_main),
2799  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
2800 
2801  gtk_container_set_border_width(GTK_CONTAINER(dialog_tablechooser), 10);
2802  gtk_window_set_position(GTK_WINDOW(dialog_tablechooser), GTK_WIN_POS_CENTER);
2803 
2804  vbox_tree = gtk_dialog_get_content_area(GTK_DIALOG(dialog_tablechooser));
2805 
2806  /* Setup a model */
2807  chooser_table_list_store = gtk_list_store_new(TABLECHOOSER_N_COLUMNS,
2808  G_TYPE_STRING,
2809  G_TYPE_STRING,
2810  GTK_TYPE_TREE_MODEL,
2811  G_TYPE_STRING,
2812  G_TYPE_INT);
2813 
2814  /* Because we want to do selective filtering on the treeview content, we now implement a GtkTreeModel
2815  filter on top of the original tree model */
2816  chooser_filtered_table_list_store = (GtkListStore *)gtk_tree_model_filter_new(GTK_TREE_MODEL(chooser_table_list_store), NULL);
2817  gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(chooser_filtered_table_list_store),
2818  (GtkTreeModelFilterVisibleFunc)table_chooser_visibility_func, NULL, NULL);
2819 
2820  /* Create the view and such */
2821  chooser_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(chooser_filtered_table_list_store));
2822  chooser_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(chooser_tree));
2823  gtk_tree_selection_set_mode(chooser_selection, GTK_SELECTION_MULTIPLE);
2824 
2825  /* Make the tree view in a scrollable window */
2826  sw = gtk_scrolled_window_new(NULL, NULL);
2827  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
2828  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
2829  gtk_widget_set_size_request(sw, 320, 240);
2830 
2831  gtk_box_pack_start(GTK_BOX(vbox_tree), sw, FALSE, FALSE, 10);
2832  gtk_container_add(GTK_CONTAINER(sw), chooser_tree);
2833 
2834  /* Schema Field */
2835  chooser_schema_renderer = gtk_cell_renderer_text_new();
2836  g_object_set(chooser_schema_renderer, "editable", TRUE, NULL);
2837  g_signal_connect(G_OBJECT(chooser_schema_renderer), "edited", G_CALLBACK(pgui_action_handle_loader_edit), NULL);
2838  chooser_schema_column = gtk_tree_view_column_new_with_attributes(_("Schema"),
2840  "text",
2842  NULL);
2843  g_object_set(chooser_schema_column, "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
2844  gtk_tree_view_append_column(GTK_TREE_VIEW(chooser_tree), chooser_schema_column);
2845 
2846  /* Table Field */
2847  chooser_table_renderer = gtk_cell_renderer_text_new();
2848  g_object_set(chooser_table_renderer, "editable", FALSE, NULL);
2849  g_signal_connect(G_OBJECT(chooser_table_renderer), "edited", G_CALLBACK(pgui_action_handle_loader_edit), NULL);
2850  chooser_table_column = gtk_tree_view_column_new_with_attributes(_("Table"),
2852  "text",
2854  NULL);
2855  g_object_set(chooser_table_column, "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
2856  gtk_tree_view_append_column(GTK_TREE_VIEW(chooser_tree), chooser_table_column);
2857 
2858  /* Create table to hold the tick-box and text */
2859  table_progress = gtk_table_new(1, 2, FALSE);
2860  gtk_container_set_border_width (GTK_CONTAINER (table_progress), 0);
2861  gtk_table_set_row_spacings(GTK_TABLE(table_progress), 0);
2862  gtk_table_set_col_spacings(GTK_TABLE(table_progress), 0);
2863 
2864  checkbutton_chooser_geoonly = gtk_check_button_new();
2865  gtk_table_attach(GTK_TABLE(table_progress), checkbutton_chooser_geoonly, 0, 1, 0, 1, GTK_SHRINK, GTK_FILL, 0, 0);
2866  label = gtk_label_new(_("Only show tables with geo columns"));
2867  gtk_table_attach(GTK_TABLE(table_progress), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
2868  g_signal_connect(G_OBJECT(checkbutton_chooser_geoonly), "toggled", G_CALLBACK(pgui_action_chooser_toggle_show_geocolumn), NULL);
2869  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_chooser_geoonly), TRUE);
2870 
2871  /* Attach table to the vbox */
2872  gtk_box_pack_start(GTK_BOX(vbox_tree), table_progress, FALSE, FALSE, 10);
2873 
2874  return;
2875 }
#define TRUE
Definition: dbfopen.c:169
#define FALSE
Definition: dbfopen.c:168
GtkCellRenderer * chooser_schema_renderer
static GtkWidget * dialog_tablechooser
GtkTreeViewColumn * chooser_schema_column
GtkListStore * chooser_table_list_store
GtkListStore * chooser_filtered_table_list_store
@ TABLECHOOSER_TABLE_COLUMN
@ TABLECHOOSER_SCHEMA_COLUMN
@ TABLECHOOSER_N_COLUMNS
#define gtk_dialog_get_content_area(dialog)
Definition: shp2pgsql-gui.c:41
static GtkWidget * checkbutton_chooser_geoonly
GtkCellRenderer * chooser_table_renderer
static gboolean table_chooser_visibility_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
static void pgui_action_handle_loader_edit(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer column)
static GtkWidget * window_main
Definition: shp2pgsql-gui.c:50
GtkWidget * chooser_tree
GtkTreeViewColumn * chooser_table_column
static void pgui_action_chooser_toggle_show_geocolumn(GtkToggleButton *togglebutton, gpointer user_data)
#define _(String)
Definition: shpcommon.h:24

References _, checkbutton_chooser_geoonly, chooser_filtered_table_list_store, chooser_schema_column, chooser_schema_renderer, chooser_table_column, chooser_table_list_store, chooser_table_renderer, chooser_tree, dialog_tablechooser, FALSE, gtk_dialog_get_content_area, pgui_action_chooser_toggle_show_geocolumn(), pgui_action_handle_loader_edit(), table_chooser_visibility_func(), TABLECHOOSER_N_COLUMNS, TABLECHOOSER_SCHEMA_COLUMN, TABLECHOOSER_TABLE_COLUMN, TRUE, and window_main.

Referenced by main().

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