PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ pgui_create_tablechooser_dialog()

static void pgui_create_tablechooser_dialog ( )
static

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

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().

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