PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void pgui_create_export_table_table ( GtkWidget *  export_list_frame)
static

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

References _, add_table_button, export_filename_column, EXPORT_FILENAME_COLUMN, export_filename_renderer, export_geom_column, export_geom_column_combo, export_geom_column_renderer, EXPORT_GEOMETRY_COLUMN, EXPORT_GEOMETRY_LISTSTORE_COLUMN, EXPORT_N_COLUMNS, export_remove_column, export_remove_renderer, export_schema_column, EXPORT_SCHEMA_COLUMN, export_schema_renderer, export_table_column, EXPORT_TABLE_COLUMN, export_table_list_store, export_table_renderer, export_tree, FALSE, pgui_action_handle_dumper_edit(), pgui_action_handle_loader_edit(), pgui_action_handle_table_geocol_combo(), pgui_action_handle_table_remove(), pgui_action_open_table_dialog(), TABLECHOOSER_GEOCOL_COMBO_TEXT, and TRUE.

Referenced by pgui_create_main_window().

3074 {
3075  GtkWidget *vbox_tree;
3076  GtkWidget *sw;
3077  gint *column_indexes;
3078 
3079  gtk_container_set_border_width (GTK_CONTAINER (export_list_frame), 0);
3080 
3081  vbox_tree = gtk_vbox_new(FALSE, 15);
3082  gtk_container_set_border_width(GTK_CONTAINER(vbox_tree), 5);
3083  gtk_container_add(GTK_CONTAINER(export_list_frame), vbox_tree);
3084 
3085  /* Setup a model */
3086  export_table_list_store = gtk_list_store_new(EXPORT_N_COLUMNS,
3087  G_TYPE_POINTER,
3088  G_TYPE_STRING,
3089  G_TYPE_STRING,
3090  G_TYPE_STRING,
3091  GTK_TYPE_TREE_MODEL,
3092  G_TYPE_STRING,
3093  G_TYPE_BOOLEAN);
3094 
3095  /* Create the view and such */
3096  export_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(export_table_list_store));
3097 
3098  /* GTK has a slightly brain-dead API in that you can't directly find
3099  the column being used by a GtkCellRenderer when using the same
3100  callback to handle multiple fields; hence we manually store this
3101  information here and pass a pointer to the column index into
3102  the signal handler */
3103  column_indexes = g_malloc(sizeof(gint) * EXPORT_N_COLUMNS);
3104 
3105  /* Make the tree view in a scrollable window */
3106  sw = gtk_scrolled_window_new(NULL, NULL);
3107  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
3108  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
3109  gtk_widget_set_size_request(sw, -1, 150);
3110 
3111  gtk_box_pack_start(GTK_BOX(vbox_tree), sw, TRUE, TRUE, 0);
3112  gtk_container_add(GTK_CONTAINER (sw), export_tree);
3113 
3114  /* Place the "Add Table" button below the list view */
3115  add_table_button = gtk_button_new_with_label(_("Add Table"));
3116  gtk_container_add (GTK_CONTAINER (vbox_tree), add_table_button);
3117 
3118  /* Schema Field */
3119  export_schema_renderer = gtk_cell_renderer_text_new();
3120  g_object_set(export_schema_renderer, "editable", FALSE, NULL);
3121  column_indexes[EXPORT_SCHEMA_COLUMN] = EXPORT_SCHEMA_COLUMN;
3122  g_signal_connect(G_OBJECT(export_schema_renderer), "edited", G_CALLBACK(pgui_action_handle_loader_edit), &column_indexes[EXPORT_SCHEMA_COLUMN]);
3123  export_schema_column = gtk_tree_view_column_new_with_attributes(_("Schema"),
3125  "text",
3127  NULL);
3128  g_object_set(export_schema_column, "resizable", TRUE, "expand", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
3129  gtk_tree_view_append_column(GTK_TREE_VIEW(export_tree), export_schema_column);
3130 
3131  /* Table Field */
3132  export_table_renderer = gtk_cell_renderer_text_new();
3133  g_object_set(export_table_renderer, "editable", FALSE, NULL);
3134  column_indexes[EXPORT_TABLE_COLUMN] = EXPORT_TABLE_COLUMN;
3135  g_signal_connect(G_OBJECT(export_table_renderer), "edited", G_CALLBACK(pgui_action_handle_loader_edit), &column_indexes[EXPORT_TABLE_COLUMN]);
3136  export_table_column = gtk_tree_view_column_new_with_attributes(_("Table"),
3138  "text",
3140  NULL);
3141  g_object_set(export_table_column, "resizable", TRUE, "expand", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
3142  gtk_tree_view_append_column(GTK_TREE_VIEW(export_tree), export_table_column);
3143 
3144  /* Geo column field */
3145  export_geom_column_combo = gtk_combo_box_new();
3146  export_geom_column_renderer = gtk_cell_renderer_combo_new();
3147  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(export_geom_column_combo),
3149  g_object_set(export_geom_column_renderer,
3150  "editable", TRUE,
3151  "has-entry", FALSE,
3152  "text-column", TABLECHOOSER_GEOCOL_COMBO_TEXT,
3153  NULL);
3154  export_geom_column = gtk_tree_view_column_new_with_attributes(_("Geo Column"),
3156  "model",
3158  "text",
3160  NULL);
3161  g_object_set(export_geom_column, "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
3162  gtk_tree_view_append_column(GTK_TREE_VIEW(export_tree), export_geom_column);
3163  g_signal_connect (G_OBJECT(export_geom_column_renderer), "changed", G_CALLBACK(pgui_action_handle_table_geocol_combo), NULL);
3164 
3165  /* Filename Field */
3166  export_filename_renderer = gtk_cell_renderer_text_new();
3167  g_object_set(export_filename_renderer, "editable", TRUE, NULL);
3169  g_signal_connect(G_OBJECT(export_filename_renderer), "edited", G_CALLBACK(pgui_action_handle_dumper_edit), &column_indexes[EXPORT_FILENAME_COLUMN]);
3170  export_filename_column = gtk_tree_view_column_new_with_attributes(_("Filename"),
3172  "text",
3174  NULL);
3175  g_object_set(export_filename_column, "resizable", TRUE, "expand", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_AUTOSIZE, NULL);
3176  gtk_tree_view_append_column(GTK_TREE_VIEW(export_tree), export_filename_column);
3177 
3178  /* Remove Field */
3179  export_remove_renderer = gtk_cell_renderer_toggle_new();
3180  g_object_set(export_remove_renderer, "activatable", TRUE, NULL);
3181  g_signal_connect(G_OBJECT(export_remove_renderer), "toggled", G_CALLBACK (pgui_action_handle_table_remove), NULL);
3182  export_remove_column = gtk_tree_view_column_new_with_attributes("Rm",
3183  export_remove_renderer, NULL);
3184  g_object_set(export_remove_column, "resizable", TRUE, "expand", FALSE, "fixed-width", 64, "sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL);
3185  gtk_tree_view_append_column(GTK_TREE_VIEW(export_tree), export_remove_column);
3186 
3187  g_signal_connect (G_OBJECT (add_table_button), "clicked", G_CALLBACK (pgui_action_open_table_dialog), NULL);
3188 }
GtkWidget * export_geom_column_combo
Definition: shp2pgsql-gui.c:81
static void pgui_action_handle_loader_edit(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer column)
#define _(String)
Definition: shpcommon.h:24
GtkTreeViewColumn * export_geom_column
Definition: shp2pgsql-gui.c:90
GtkCellRenderer * export_geom_column_renderer
Definition: shp2pgsql-gui.c:84
static void pgui_action_handle_dumper_edit(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer column)
GtkCellRenderer * export_table_renderer
Definition: shp2pgsql-gui.c:83
GtkTreeViewColumn * export_table_column
Definition: shp2pgsql-gui.c:89
GtkCellRenderer * export_filename_renderer
Definition: shp2pgsql-gui.c:85
GtkCellRenderer * export_remove_renderer
Definition: shp2pgsql-gui.c:86
GtkCellRenderer * export_schema_renderer
Definition: shp2pgsql-gui.c:82
GtkTreeViewColumn * export_filename_column
Definition: shp2pgsql-gui.c:91
GtkTreeViewColumn * export_remove_column
Definition: shp2pgsql-gui.c:92
static void pgui_action_open_table_dialog(GtkWidget *widget, gpointer data)
#define FALSE
Definition: dbfopen.c:168
static GtkWidget * add_table_button
Definition: shp2pgsql-gui.c:94
GtkListStore * export_table_list_store
Definition: shp2pgsql-gui.c:79
static void pgui_action_handle_table_geocol_combo(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter, gpointer user_data)
GtkWidget * export_tree
Definition: shp2pgsql-gui.c:80
GtkTreeViewColumn * export_schema_column
Definition: shp2pgsql-gui.c:88
static void pgui_action_handle_table_remove(GtkCellRendererToggle *renderer, gchar *path, gpointer user_data)
#define TRUE
Definition: dbfopen.c:169

Here is the call graph for this function:

Here is the caller graph for this function: