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

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

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

Here is the call graph for this function:

Here is the caller graph for this function: