PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pgui_create_export_table_table()

static void pgui_create_export_table_table ( GtkWidget *  export_list_frame)
static

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

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