PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void pgui_create_tablechooser_dialog ( )
static

Definition at line 2784 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: