17 #include "../postgis_config.h" 30 #define GUI_RCSID "shp2pgsql-gui $Revision: 15521 $" 31 #define SHAPEFIELDMAXWIDTH 60 39 #if !GTK_CHECK_VERSION(2, 14, 0) 40 #if !defined(gtk_dialog_get_content_area) 41 #define gtk_dialog_get_content_area(dialog) GTK_DIALOG(dialog)->vbox 207 #define GUIMSG_LINE_MAXLEN 256 237 gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(
textview_log), &iter, 0.0,
TRUE, 0.0, 1.0);
240 while (gtk_events_pending())
241 gtk_main_iteration();
282 GtkWidget *dialog, *label;
285 dialog = gtk_dialog_new_with_buttons(
_(
"Error"), GTK_WINDOW(
window_main),
286 GTK_DIALOG_MODAL & GTK_DIALOG_NO_SEPARATOR & GTK_DIALOG_DESTROY_WITH_PARENT,
287 GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
288 gtk_dialog_set_has_separator(GTK_DIALOG(dialog),
FALSE );
289 gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
290 gtk_container_set_border_width(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), 15);
291 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
292 gtk_widget_show_all(dialog);
293 gtk_dialog_run(GTK_DIALOG(dialog));
294 gtk_widget_destroy(dialog);
304 PGresult *
res = NULL;
305 ExecStatusType status;
310 if ( ! sql )
return 0;
313 status = PQresultStatus(res);
317 if ( ! ( status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK ) )
320 if ( status == PGRES_NONFATAL_ERROR )
327 snprintf(sql_trunc, 255,
"%s", sql);
328 pgui_logf(
"Failed SQL begins: \"%s\"", sql_trunc);
342 PGresult *
res = NULL;
343 ExecStatusType status;
348 if ( ! sql )
return 0;
351 status = PQresultStatus(res);
355 if ( status != PGRES_COPY_IN )
358 snprintf(sql_trunc, 255,
"%s", sql);
359 pgui_logf(
"Failed SQL begins: \"%s\"", sql_trunc);
373 char line_trunc[256];
377 if ( ! line )
return 0;
383 snprintf(line_trunc, 255,
"%s", line);
384 pgui_logf(
"Failed row begins: \"%s\"", line_trunc);
406 if ( rollback ) errmsg =
"Roll back the copy.";
438 if (strlen(filename) > max_width)
439 max_width = strlen(filename);
463 char *connection_string = NULL;
464 char *connection_sanitized = NULL;
473 connection_sanitized = strdup(connection_string);
475 pgui_logf(
"Connecting: %s", connection_sanitized);
476 free(connection_sanitized);
482 free(connection_string);
490 free(connection_string);
504 gtk_widget_hide(GTK_WIDGET(widget));
564 if (entry_encoding && strlen(entry_encoding) > 0)
569 config->
encoding = strdup(entry_encoding);
670 PGresult *result, *geocol_result;
671 GtkTreeIter iter, geocol_iter;
672 GtkListStore *dumper_geocol_combo_list;
673 char *connection_string, *sql_form, *query, *schema, *table, *geocol_query, *geocol_name=NULL;
683 query =
"SELECT tableoids.oid, n.nspname, tableoids.relname, COALESCE((SELECT 1 from pg_attribute WHERE attrelid = tableoids.oid AND atttypid IN (SELECT oid FROM pg_type WHERE typname in ('geometry', 'geography')) LIMIT 1), 0) hasgeo FROM (SELECT c.oid, c.relname, c.relnamespace FROM pg_class c WHERE c.relkind IN ('r', 'v', 'm', 'f','p') AND c.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname NOT ILIKE 'pg_%' AND nspname <> 'information_schema')) tableoids, pg_namespace n WHERE tableoids.relnamespace = n.oid ORDER BY n.nspname, tableoids.relname";
691 for (i = 0; i < PQntuples(result); i++)
698 schema = PQgetvalue(result, i, PQfnumber(result,
"nspname"));
699 table = PQgetvalue(result, i, PQfnumber(result,
"relname"));
701 sql_form =
"SELECT n.nspname, c.relname, a.attname FROM pg_class c, pg_namespace n, pg_attribute a WHERE c.relnamespace = n.oid AND n.nspname = '%s' AND c.relname = '%s' AND a.attrelid = c.oid AND a.atttypid IN (SELECT oid FROM pg_type WHERE typname in ('geometry', 'geography'))";
703 geocol_query =
malloc(strlen(sql_form) + strlen(schema) + strlen(table) + 1);
704 sprintf(geocol_query, sql_form, schema, table);
714 if (PQntuples(geocol_result) > 0)
717 for (j = 0; j < PQntuples(geocol_result); j++)
719 geocol_name = PQgetvalue(geocol_result, j, PQfnumber(geocol_result,
"attname"));
722 gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter,
723 TABLECHOOSER_GEOCOL_COMBO_TEXT, geocol_name,
733 gtk_list_store_set(dumper_geocol_combo_list, &geocol_iter,
734 TABLECHOOSER_GEOCOL_COMBO_TEXT,
_(
"(None)"),
739 PQclear(geocol_result);
745 hasgeo = atoi(PQgetvalue(result, i, PQfnumber(result,
"hasgeo")));
806 if (keep_fieldname_case)
884 if (response == GTK_RESPONSE_OK)
900 char *table_start, *table_end;
906 memcpy(loader_file_config, global_loader_config,
sizeof(
SHPLOADERCONFIG));
914 loader_file_config->
shp_file = strdup(filename);
917 table_start = loader_file_config->
shp_file + strlen(loader_file_config->
shp_file);
918 while (*table_start !=
'/' && *table_start !=
'\\' && table_start > loader_file_config->
shp_file)
925 table_end = loader_file_config->
shp_file + strlen(loader_file_config->
shp_file);
926 while (*table_end !=
'.' && table_end > loader_file_config->
shp_file && table_end > table_start )
930 loader_file_config->
table =
malloc(table_end - table_start + 1);
931 memcpy(loader_file_config->
table, table_start, table_end - table_start);
932 loader_file_config->
table[table_end - table_start] =
'\0';
935 for (i = 0; i < table_end - table_start; i++)
937 if (isupper(loader_file_config->
table[i]) != 0)
938 loader_file_config->
table[i] = tolower(loader_file_config->
table[i]);
942 loader_file_config->
schema = strdup(
"public");
950 return loader_file_config;
1021 gchar *schema, *table, *geocol;
1027 memcpy(dumper_table_config, global_dumper_config,
sizeof(
SHPDUMPERCONFIG));
1038 dumper_table_config->
schema = strdup(schema);
1039 dumper_table_config->
table = strdup(table);
1042 dumper_table_config->
shp_file = strdup(table);
1044 if (hasgeo && geocol)
1049 return dumper_table_config;
1058 GtkListStore *geocol_liststore;
1070 if (chooser_liststore)
1073 gtk_tree_model_get(GTK_TREE_MODEL(chooser_liststore), chooser_iter,
1111 switch (dbf_fieldtype)
1115 if (!strcmp(pg_fieldtype,
"varchar"))
1121 if (!strcmp(pg_fieldtype,
"date"))
1127 if (!strcmp(pg_fieldtype,
"int2") || !strcmp(pg_fieldtype,
"int4") || !strcmp(pg_fieldtype,
"numeric"))
1133 if (!strcmp(pg_fieldtype,
"float8") || !strcmp(pg_fieldtype,
"numeric"))
1139 if (!strcmp(pg_fieldtype,
"boolean"))
1153 ExecStatusType status;
1156 char *pg_fieldname, *pg_fieldtype;
1160 status = PQresultStatus(result);
1161 if (status == PGRES_TUPLES_OK)
1163 ntuples = PQntuples(result);
1165 switch (config->
opt)
1189 pgui_seterr(
_(
"ERROR: Destination table %s.%s could not be found for appending"), config->
schema, config->
table);
1208 for (j = 0; j < ntuples; j++)
1210 pg_fieldname = PQgetvalue(result, j, PQfnumber(result,
"field"));
1211 pg_fieldtype = PQgetvalue(result, j, PQfnumber(result,
"type"));
1220 pgui_logf(
_(
"Warning: DBF Field '%s' is not compatible with PostgreSQL column '%s' in %s.%s"), state->
field_names[i], pg_fieldname, config->
schema, config->
table);
1229 pgui_logf(
_(
"Warning: DBF Field '%s' within file %s could not be matched to a column within table %s.%s"),
1243 pgui_seterr(
_(
"ERROR: unable to process validation response from remote server"));
1286 if (response == GTK_RESPONSE_OK)
1299 GSList *filename_list, *filename_item;
1309 filename_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(
dialog_filechooser));
1311 filename_item = g_slist_nth(filename_list, 0);
1312 while (filename_item)
1315 filename = g_slist_nth_data(filename_item, 0);
1321 filename_item = g_slist_next(filename_item);
1325 g_slist_free(filename_list);
1335 GtkTreeSelection *chooser_selection;
1336 GtkTreeModel *model;
1337 GList *selected_rows_list, *selected_row;
1339 GtkTreePath *tree_path;
1344 pgui_seterr(
_(
"Unable to connect to the database - please check your connection settings"));
1363 chooser_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
chooser_tree));
1365 selected_rows_list = gtk_tree_selection_get_selected_rows(chooser_selection, &model);
1366 selected_row = g_list_first(selected_rows_list);
1367 while (selected_row)
1370 tree_path = (GtkTreePath *)g_list_nth_data(selected_row, 0);
1371 gtk_tree_model_get_iter(model, &iter, tree_path);
1378 selected_row = g_list_next(selected_row);
1382 g_list_foreach(selected_row, (GFunc)gtk_tree_path_free, NULL);
1383 g_list_free(selected_row);
1422 char *sql_form, *query, *connection_string, *progress_shapefile = NULL;
1427 char *header, *footer, *record;
1433 pgui_seterr(
_(
"ERROR: You haven't specified any files to import"));
1443 pgui_seterr(
_(
"Unable to connect to the database - please check your connection settings"));
1460 sql_form =
"SELECT a.attnum, a.attname AS field, t.typname AS type, a.attlen AS length, a.atttypmod AS precision FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE c.relname = '%s' AND n.nspname = '%s' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.relnamespace = n.oid ORDER BY a.attnum";
1471 query =
malloc(strlen(sql_form) + strlen(loader_file_config->
schema) + strlen(loader_file_config->
table) + 1);
1472 sprintf(query, sql_form, loader_file_config->
table, loader_file_config->
schema);
1507 pgui_logf(
"\n==============================");
1508 pgui_logf(
"Importing with configuration: %s, %s, %s, %s, mode=%c, dump=%d, simple=%d, geography=%d, index=%d, shape=%d, srid=%d", loader_file_config->
table, loader_file_config->
schema, loader_file_config->
geo_col, loader_file_config->
shp_file, loader_file_config->
opt, loader_file_config->
dump_format, loader_file_config->
simple_geometries, loader_file_config->
geography, loader_file_config->
createindex, loader_file_config->
readshape, loader_file_config->
sr_id);
1519 gtk_widget_set_sensitive(widget,
FALSE);
1522 while (gtk_events_pending())
1523 gtk_main_iteration();
1535 goto import_cleanup;
1539 for (i = strlen(loader_file_config->
shp_file); i >= 0
1540 && loader_file_config->
shp_file[i - 1] !=
'\\' && loader_file_config->
shp_file[i - 1] !=
'/'; i--);
1542 progress_shapefile =
malloc(strlen(loader_file_config->
shp_file));
1543 strcpy(progress_shapefile, &loader_file_config->
shp_file[i]);
1549 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), 0.0);
1566 goto import_cleanup;
1575 goto import_cleanup;
1581 int records_per_tick = (numrecords / 200) - 1;
1583 if ( records_per_tick < 1 )
1584 records_per_tick = 1;
1596 goto import_cleanup;
1604 goto import_cleanup;
1608 for (i = 0; i < numrecords &&
is_running; i++)
1623 pgui_logf(
_(
"Import failed on record number %d"), i);
1631 goto import_cleanup;
1645 pgui_logf(
_(
"Import failed on record number %d"), i);
1660 if ( i % records_per_tick == 0 )
1661 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), (
float)i / numrecords);
1664 while (gtk_events_pending())
1665 gtk_main_iteration();
1672 goto import_cleanup;
1675 if (PQresultStatus(result) != PGRES_COMMAND_OK)
1679 goto import_cleanup;
1694 goto import_cleanup;
1700 gtk_label_set_text(GTK_LABEL(
label_progress),
_(
"Creating spatial index..."));
1703 while (gtk_events_pending())
1704 gtk_main_iteration();
1712 goto import_cleanup;
1733 if (progress_shapefile)
1734 free(progress_shapefile);
1744 gtk_widget_set_sensitive(widget,
TRUE);
1747 gtk_widget_hide(widget);
1748 gtk_widget_show(widget);
1754 while (gtk_events_pending())
1755 gtk_main_iteration();
1758 free(connection_string);
1771 char *output_shapefile, *orig_shapefile;
1775 int ret, success =
FALSE, i = 0;
1781 pgui_seterr(
_(
"ERROR: You haven't specified any tables to export"));
1791 pgui_seterr(
_(
"Unable to connect to the database - please check your connection settings"));
1821 pgui_logf(
"\n==============================");
1822 pgui_logf(
"Exporting with configuration: %s, %s, %s", dumper_table_config->
table, dumper_table_config->
schema, dumper_table_config->
shp_file);
1829 gtk_widget_set_sensitive(widget,
FALSE);
1832 while (gtk_events_pending())
1833 gtk_main_iteration();
1840 orig_shapefile = dumper_table_config->
shp_file;
1841 output_shapefile =
malloc(strlen(folder_path) + strlen(dumper_table_config->
shp_file) + 2);
1842 strcpy(output_shapefile, folder_path);
1843 strcat(output_shapefile, G_DIR_SEPARATOR_S);
1844 strcat(output_shapefile, dumper_table_config->
shp_file);
1846 dumper_table_config->
shp_file = output_shapefile;
1855 goto export_cleanup;
1860 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), 0.0);
1875 goto export_cleanup;
1885 while (gtk_events_pending())
1886 gtk_main_iteration();
1905 goto export_cleanup;
1913 while (gtk_events_pending())
1914 gtk_main_iteration();
1942 dumper_table_config->
shp_file = orig_shapefile;
1956 gtk_widget_set_sensitive(widget,
TRUE);
1959 gtk_widget_hide(widget);
1960 gtk_widget_show(widget);
1966 while (gtk_events_pending())
1967 gtk_main_iteration();
1980 char *filename = NULL;
1982 GError *error = NULL;
1990 filename = g_filename_from_uri(uri, &hostname, &error);
1993 if (filename == NULL)
1995 pgui_logf(
_(
"Unable to process filename: %s\n"), error->message);
1996 g_error_free(error);
2013 gchar *schema, *table, *geo_col, *srid;
2024 if (loader_file_config->
schema)
2027 loader_file_config->
schema = strdup(schema);
2030 if (loader_file_config->
table)
2033 loader_file_config->
table = strdup(table);
2036 if (loader_file_config->
geo_col)
2039 loader_file_config->
geo_col = strdup(geo_col);
2042 loader_file_config->
sr_id = atoi(srid);
2058 GtkSelectionData *selection_data,
2059 guint info, guint t, gpointer
data)
2063 if (selection_data->data == NULL)
2065 pgui_logf(
_(
"Unable to process drag data."));
2069 p = (
char*)selection_data->data;
2076 while (g_ascii_isspace(*p))
2080 while (*q && (*q !=
'\n') && (*q !=
'\r'))
2087 while (q > p && g_ascii_isspace(*q))
2096 p = strchr(p,
'\n');
2109 GtkTreeIter *new_iter,
2135 loader_file_config->
opt =
'a';
2143 loader_file_config->
opt =
'd';
2147 loader_file_config->
opt =
'p';
2151 loader_file_config->
opt =
'c';
2183 if (strlen(new_text) == 0)
2187 columnindex = *(gint *)column;
2201 pgui_logf(
"Invalid SRID requiring more than %d digits: %d",
MAXLEN, loader_file_config->
sr_id);
2251 gchar *schema, *table, *geo_col, *filename;
2262 if (dumper_table_config->
schema)
2265 dumper_table_config->
schema = strdup(schema);
2268 if (dumper_table_config->
table)
2271 dumper_table_config->
table = strdup(table);
2283 dumper_table_config->
shp_file = strdup(filename);
2291 GtkTreeIter *new_iter,
2297 GtkListStore *model;
2320 dumper_table_config->
geo_col_name = strdup(geocol_name);
2342 if (strlen(new_text) == 0)
2346 columnindex = *(gint *)column;
2431 conn->
host = strdup(text);
2440 conn->
port = strdup(text);
2444 text = gtk_entry_get_text(GTK_ENTRY(
entry_pg_db));
2475 if (conn->
port && strlen(conn->
port))
2477 for (i = 0; i < strlen(conn->
port); i++)
2479 if (!isdigit(conn->
port[i]))
2481 pgui_seterr(
_(
"The connection port must be numeric!"));
2493 char *ptr = strstr(connection_string,
"password");
2497 while ( *ptr !=
'\'' && *ptr !=
'\0' )
2531 pgui_seterr(
_(
"Unable to connect to the database - please check your connection settings"));
2550 const char *authors[] =
2552 "Paul Ramsey <pramsey@cleverelephant.ca>",
2553 "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>",
2554 "Mark Leslie <mark.s.leslie@gmail.com>",
2561 gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(
dialog_about),
_(
"PostGIS Shapefile Import/Export Manager"));
2563 gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(
dialog_about),
"http://postgis.net/");
2564 gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(
dialog_about), authors);
2570 GtkFileFilter *file_filter_shape;
2574 GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
2577 file_filter_shape = gtk_file_filter_new();
2578 gtk_file_filter_add_pattern(GTK_FILE_FILTER(file_filter_shape),
"*.shp");
2579 gtk_file_filter_set_name(GTK_FILE_FILTER(file_filter_shape),
_(
"Shape Files (*.shp)"));
2580 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(
dialog_filechooser), file_filter_shape);
2583 file_filter_shape = gtk_file_filter_new();
2584 gtk_file_filter_add_pattern(GTK_FILE_FILTER(file_filter_shape),
"*.dbf");
2585 gtk_file_filter_set_name(GTK_FILE_FILTER(file_filter_shape),
_(
"DBF Files (*.dbf)"));
2586 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(
dialog_filechooser), file_filter_shape);
2597 GtkFileFilter *file_filter_shape;
2601 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
2604 file_filter_shape = gtk_file_filter_new();
2605 gtk_file_filter_add_pattern(GTK_FILE_FILTER(file_filter_shape),
"*.shp");
2606 gtk_file_filter_set_name(GTK_FILE_FILTER(file_filter_shape),
_(
"Shape Files (*.shp)"));
2610 file_filter_shape = gtk_file_filter_new();
2611 gtk_file_filter_add_pattern(GTK_FILE_FILTER(file_filter_shape),
"*.dbf");
2612 gtk_file_filter_set_name(GTK_FILE_FILTER(file_filter_shape),
_(
"DBF Files (*.dbf)"));
2621 GtkWidget *vbox_progress, *table_progress;
2623 dialog_progress = gtk_dialog_new_with_buttons(
_(
"Working..."), GTK_WINDOW(
window_main), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
2631 gtk_box_set_spacing(GTK_BOX(vbox_progress), 15);
2634 table_progress = gtk_table_new(2, 1,
TRUE);
2635 gtk_container_set_border_width (GTK_CONTAINER (table_progress), 12);
2636 gtk_table_set_row_spacings(GTK_TABLE(table_progress), 5);
2637 gtk_table_set_col_spacings(GTK_TABLE(table_progress), 10);
2641 gtk_table_attach_defaults(GTK_TABLE(table_progress),
label_progress, 0, 1, 0, 1);
2645 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(
progress), GTK_PROGRESS_LEFT_TO_RIGHT);
2646 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), 0.0);
2647 gtk_table_attach_defaults(GTK_TABLE(table_progress),
progress, 0, 1, 1, 2);
2650 gtk_box_pack_start(GTK_BOX(vbox_progress), table_progress,
FALSE,
FALSE, 0);
2664 GtkWidget *align = gtk_alignment_new(alignment, 0.5, 0.0, 1.0);
2665 GtkWidget *label = gtk_label_new(str);
2666 gtk_table_attach_defaults(GTK_TABLE(table), align, 1, 3, row, row + 1);
2667 gtk_container_add(GTK_CONTAINER (align), label);
2673 GtkWidget *table_options;
2674 GtkWidget *align_options_center;
2675 static int text_width = 12;
2677 dialog_loader_options = gtk_dialog_new_with_buttons(
_(
"Import Options"), GTK_WINDOW(
window_main), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
2683 table_options = gtk_table_new(7, 3,
TRUE);
2684 gtk_container_set_border_width (GTK_CONTAINER (table_options), 12);
2685 gtk_table_set_row_spacings(GTK_TABLE(table_options), 5);
2686 gtk_table_set_col_spacings(GTK_TABLE(table_options), 10);
2695 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2696 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 1, 2 );
2701 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2702 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 2, 3 );
2707 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2708 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 3, 4 );
2713 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2714 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 4, 5 );
2719 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 );
2720 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 5, 6 );
2725 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2726 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 6, 7 );
2731 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2732 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 7, 8 );
2746 GtkWidget *table_options;
2747 GtkWidget *align_options_center;
2749 dialog_dumper_options = gtk_dialog_new_with_buttons(
_(
"Export Options"), GTK_WINDOW(
window_main), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
2755 table_options = gtk_table_new(3, 3,
TRUE);
2756 gtk_container_set_border_width (GTK_CONTAINER (table_options), 12);
2757 gtk_table_set_row_spacings(GTK_TABLE(table_options), 5);
2758 gtk_table_set_col_spacings(GTK_TABLE(table_options), 10);
2762 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2763 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 0, 1 );
2768 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2769 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 1, 2 );
2774 align_options_center = gtk_alignment_new( 0.5, 0.5, 0.0, 1.0 );
2775 gtk_table_attach_defaults(GTK_TABLE(table_options), align_options_center, 0, 1, 2, 3 );
2793 GtkWidget *vbox_tree, *table_progress;
2794 GtkWidget *sw, *label;
2795 GtkTreeSelection *chooser_selection;
2799 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
2810 GTK_TYPE_TREE_MODEL,
2822 chooser_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
chooser_tree));
2823 gtk_tree_selection_set_mode(chooser_selection, GTK_SELECTION_MULTIPLE);
2826 sw = gtk_scrolled_window_new(NULL, NULL);
2827 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
2828 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
2829 gtk_widget_set_size_request(sw, 320, 240);
2831 gtk_box_pack_start(GTK_BOX(vbox_tree), sw,
FALSE,
FALSE, 10);
2859 table_progress = gtk_table_new(1, 2,
FALSE);
2860 gtk_container_set_border_width (GTK_CONTAINER (table_progress), 0);
2861 gtk_table_set_row_spacings(GTK_TABLE(table_progress), 0);
2862 gtk_table_set_col_spacings(GTK_TABLE(table_progress), 0);
2866 label = gtk_label_new(
_(
"Only show tables with geo columns"));
2867 gtk_table_attach(GTK_TABLE(table_progress), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 5, 0);
2872 gtk_box_pack_start(GTK_BOX(vbox_tree), table_progress,
FALSE,
FALSE, 10);
2885 GtkWidget *vbox_tree;
2888 gint *column_indexes;
2890 gtk_container_set_border_width (GTK_CONTAINER (import_list_frame), 0);
2892 vbox_tree = gtk_vbox_new(
FALSE, 15);
2893 gtk_container_set_border_width(GTK_CONTAINER(vbox_tree), 5);
2894 gtk_container_add(GTK_CONTAINER(import_list_frame), vbox_tree);
2918 sw = gtk_scrolled_window_new(NULL, NULL);
2919 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
2920 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN);
2921 gtk_widget_set_size_request(sw, -1, 150);
2923 gtk_box_pack_start(GTK_BOX(vbox_tree), sw,
TRUE,
TRUE, 0);
2924 gtk_container_add(GTK_CONTAINER (sw),
import_tree);
2938 IMPORT_FILENAME_COLUMN,
2951 IMPORT_SCHEMA_COLUMN,
2964 IMPORT_TABLE_COLUMN,
2977 IMPORT_GEOMETRY_COLUMN,
3055 GtkTargetEntry drop_types[] =
3057 {
"text/uri-list", 0, 0}
3060 gint n_drop_types =
sizeof(drop_types)/
sizeof(drop_types[0]);
3062 GTK_DEST_DEFAULT_ALL,
3063 drop_types, n_drop_types,
3065 g_signal_connect(G_OBJECT(
import_tree),
"drag_data_received",
3076 GtkWidget *vbox_tree;
3078 gint *column_indexes;
3080 gtk_container_set_border_width (GTK_CONTAINER (export_list_frame), 0);
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);
3092 GTK_TYPE_TREE_MODEL,
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);
3112 gtk_box_pack_start(GTK_BOX(vbox_tree), sw,
TRUE,
TRUE, 0);
3113 gtk_container_add(GTK_CONTAINER (sw),
export_tree);
3127 EXPORT_SCHEMA_COLUMN,
3140 EXPORT_TABLE_COLUMN,
3174 EXPORT_FILENAME_COLUMN,
3195 static int text_width = 12;
3204 GtkWidget *frame_pg, *table_pg;
3207 GtkWidget *button_okay;
3210 window_conn = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3211 gtk_container_set_border_width(GTK_CONTAINER(
window_conn), 10);
3212 gtk_window_set_title(GTK_WINDOW(
window_conn),
_(
"PostGIS connection"));
3213 gtk_window_set_position(GTK_WINDOW(
window_conn), GTK_WIN_POS_CENTER);
3217 vbox = gtk_vbox_new(
FALSE, 15);
3222 frame_pg = gtk_frame_new(
_(
"PostGIS Connection"));
3223 table_pg = gtk_table_new(5, 3,
TRUE);
3224 gtk_container_set_border_width (GTK_CONTAINER (table_pg), 8);
3225 gtk_table_set_col_spacings(GTK_TABLE(table_pg), 7);
3226 gtk_table_set_row_spacings(GTK_TABLE(table_pg), 3);
3229 label = gtk_label_new(
_(
"Username:"));
3231 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 0, 1 );
3232 gtk_table_attach_defaults(GTK_TABLE(table_pg),
entry_pg_user, 1, 3, 0, 1 );
3235 label = gtk_label_new(
_(
"Password:"));
3238 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 1, 2 );
3239 gtk_table_attach_defaults(GTK_TABLE(table_pg),
entry_pg_pass, 1, 3, 1, 2 );
3242 label = gtk_label_new(
_(
"Server Host:"));
3244 gtk_entry_set_width_chars(GTK_ENTRY(
entry_pg_host), text_width);
3245 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 2, 3 );
3246 gtk_table_attach_defaults(GTK_TABLE(table_pg),
entry_pg_host, 1, 2, 2, 3 );
3250 gtk_table_attach_defaults(GTK_TABLE(table_pg),
entry_pg_port, 2, 3, 2, 3 );
3253 label = gtk_label_new(
_(
"Database:"));
3255 gtk_table_attach_defaults(GTK_TABLE(table_pg), label, 0, 1, 3, 4 );
3256 gtk_table_attach_defaults(GTK_TABLE(table_pg),
entry_pg_db, 1, 3, 3, 4 );
3259 gtk_container_add(GTK_CONTAINER(frame_pg), table_pg);
3262 gtk_container_add(GTK_CONTAINER(
window_conn), vbox);
3265 gtk_container_add(GTK_CONTAINER(vbox), frame_pg);
3268 button_okay = gtk_button_new_with_label(
_(
"OK"));
3269 gtk_container_add(GTK_CONTAINER(vbox), button_okay);
3282 GtkWidget *vbox_main, *vbox_loader, *vbox_dumper;
3285 GtkWidget *frame_pg, *import_list_frame, *export_list_frame, *frame_log;
3286 GtkWidget *button_pg_conn;
3289 GtkWidget *notebook;
3292 GtkWidget *loader_hbox_buttons, *loader_button_options, *loader_button_import, *loader_button_cancel, *loader_button_about;
3293 GtkWidget *dumper_hbox_buttons, *dumper_button_options, *dumper_button_export, *dumper_button_cancel, *dumper_button_about;
3296 GtkWidget *scrolledwindow_log;
3299 window_main = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3300 gtk_container_set_border_width(GTK_CONTAINER(
window_main), 10);
3301 gtk_window_set_title(GTK_WINDOW(
window_main),
_(
"PostGIS Shapefile Import/Export Manager"));
3302 gtk_window_set_position(GTK_WINDOW(
window_main), GTK_WIN_POS_CENTER_ALWAYS);
3306 gtk_window_set_default_size(GTK_WINDOW(
window_main), 180, 500);
3315 frame_pg = gtk_frame_new(
_(
"PostGIS Connection"));
3318 button_pg_conn = gtk_button_new_with_label(
_(
"View connection details..."));
3320 gtk_container_set_border_width(GTK_CONTAINER(button_pg_conn), 10);
3321 gtk_container_add(GTK_CONTAINER(frame_pg), button_pg_conn);
3326 notebook = gtk_notebook_new();
3331 import_list_frame = gtk_frame_new(
_(
"Import List"));
3337 loader_hbox_buttons = gtk_hbox_new(
TRUE, 15);
3338 gtk_container_set_border_width (GTK_CONTAINER (loader_hbox_buttons), 0);
3341 loader_button_options = gtk_button_new_with_label(
_(
"Options..."));
3342 loader_button_import = gtk_button_new_with_label(
_(
"Import"));
3343 loader_button_cancel = gtk_button_new_with_label(
_(
"Cancel"));
3344 loader_button_about = gtk_button_new_with_label(
_(
"About"));
3347 g_signal_connect (G_OBJECT (loader_button_import),
"clicked", G_CALLBACK (
pgui_action_import), NULL);
3349 g_signal_connect (G_OBJECT (loader_button_cancel),
"clicked", G_CALLBACK (
pgui_action_cancel), NULL);
3353 gtk_box_pack_start(GTK_BOX(loader_hbox_buttons), loader_button_options,
TRUE,
TRUE, 0);
3354 gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_cancel,
TRUE,
TRUE, 0);
3355 gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_about,
TRUE,
TRUE, 0);
3356 gtk_box_pack_end(GTK_BOX(loader_hbox_buttons), loader_button_import,
TRUE,
TRUE, 0);
3361 export_list_frame = gtk_frame_new(
_(
"Export List"));
3367 dumper_hbox_buttons = gtk_hbox_new(
TRUE, 15);
3368 gtk_container_set_border_width (GTK_CONTAINER (dumper_hbox_buttons), 0);
3371 dumper_button_options = gtk_button_new_with_label(
_(
"Options..."));
3372 dumper_button_export = gtk_button_new_with_label(
_(
"Export"));
3373 dumper_button_cancel = gtk_button_new_with_label(
_(
"Cancel"));
3374 dumper_button_about = gtk_button_new_with_label(
_(
"About"));
3377 g_signal_connect (G_OBJECT (dumper_button_export),
"clicked", G_CALLBACK (
pgui_action_export), NULL);
3379 g_signal_connect (G_OBJECT (dumper_button_cancel),
"clicked", G_CALLBACK (
pgui_action_cancel), NULL);
3383 gtk_box_pack_start(GTK_BOX(dumper_hbox_buttons), dumper_button_options,
TRUE,
TRUE, 0);
3384 gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_cancel,
TRUE,
TRUE, 0);
3385 gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_about,
TRUE,
TRUE, 0);
3386 gtk_box_pack_end(GTK_BOX(dumper_hbox_buttons), dumper_button_export,
TRUE,
TRUE, 0);
3391 frame_log = gtk_frame_new(
_(
"Log Window"));
3392 gtk_container_set_border_width (GTK_CONTAINER (frame_log), 0);
3393 gtk_widget_set_size_request(frame_log, -1, 200);
3396 scrolledwindow_log = gtk_scrolled_window_new(NULL, NULL);
3397 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolledwindow_log), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
3399 gtk_container_set_border_width (GTK_CONTAINER (
textview_log), 5);
3402 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(
textview_log), GTK_WRAP_WORD);
3403 gtk_container_add (GTK_CONTAINER (scrolledwindow_log),
textview_log);
3404 gtk_container_add (GTK_CONTAINER (frame_log), scrolledwindow_log);
3409 vbox_main = gtk_vbox_new(
FALSE, 10);
3410 gtk_container_set_border_width (GTK_CONTAINER (vbox_main), 0);
3413 vbox_loader = gtk_vbox_new(
FALSE, 10);
3414 gtk_container_set_border_width(GTK_CONTAINER(vbox_loader), 10);
3416 gtk_box_pack_start(GTK_BOX(vbox_loader), import_list_frame,
FALSE,
TRUE, 0);
3417 gtk_box_pack_start(GTK_BOX(vbox_loader), loader_hbox_buttons,
FALSE,
FALSE, 0);
3418 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_loader, gtk_label_new(
_(
"Import")));
3421 vbox_dumper = gtk_vbox_new(
FALSE, 10);
3422 gtk_container_set_border_width(GTK_CONTAINER(vbox_dumper), 10);
3424 gtk_box_pack_start(GTK_BOX(vbox_dumper), export_list_frame,
FALSE,
TRUE, 0);
3425 gtk_box_pack_start(GTK_BOX(vbox_dumper), dumper_hbox_buttons,
FALSE,
FALSE, 0);
3426 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_dumper, gtk_label_new(
_(
"Export")));
3429 gtk_box_pack_start(GTK_BOX(vbox_main), frame_pg,
FALSE,
TRUE, 0);
3430 gtk_box_pack_start(GTK_BOX(vbox_main), notebook,
FALSE,
TRUE, 0);
3431 gtk_box_pack_start(GTK_BOX(vbox_main), frame_log,
TRUE,
TRUE, 0);
3434 gtk_container_add(GTK_CONTAINER(
window_main), vbox_main);
3445 printf(
"RCSID: %s RELEASE: %s\n",
S2P_RCSID, POSTGIS_VERSION);
3446 printf(
"USAGE: shp2pgsql-gui [options]\n");
3447 printf(
"OPTIONS:\n");
3448 printf(
" -U <username>\n");
3449 printf(
" -W <password>\n");
3450 printf(
" -h <host>\n");
3451 printf(
" -p <port>\n");
3452 printf(
" -d <database>\n");
3453 printf(
" -? Display this help screen\n");
3462 setlocale (LC_ALL,
"");
3463 bindtextdomain (PACKAGE, PGSQL_LOCALEDIR);
3464 textdomain (PACKAGE);
3482 conn->
host = strdup(
"localhost");
3483 conn->
port = strdup(
"5432");
3485 while ((c =
pgis_getopt(argc, argv,
"U:p:W:d:h:")) != -1)
3507 free(global_loader_config);
3513 gtk_init(&argc, &argv);
3531 free(global_loader_config);
static int connection_test(void)
static GtkWidget * window_main
GtkTreeViewColumn * import_geom_column
GtkWidget * export_geom_column_combo
int ShpLoaderGetSQLFooter(SHPLOADERSTATE *state, char **strfooter)
GtkTreeViewColumn * chooser_schema_column
static void pgui_create_options_dialog_add_label(GtkWidget *table, const char *str, gfloat alignment, int row)
static GtkWidget * entry_pg_db
static int pgui_copy_write(const char *line)
static void pgui_create_export_table_table(GtkWidget *export_list_frame)
GtkWidget * loader_mode_combo
static void pgui_action_dumper_options_close(GtkWidget *widget, gint response, gpointer data)
#define SHAPEFIELDMAXWIDTH
static GtkWidget * entry_pg_host
static GtkWidget * checkbutton_loader_options_preservecase
static void pgui_action_loader_options_close(GtkWidget *widget, gint response, gpointer data)
static int pgui_validate_connection()
static void pgui_create_tablechooser_dialog()
GtkCellRenderer * chooser_schema_renderer
GtkTreeViewColumn * import_mode_column
int ShpLoaderOpenShape(SHPLOADERSTATE *state)
GtkTreeViewColumn * import_filename_column
static int validate_remote_loader_columns(SHPLOADERCONFIG *config, PGresult *result)
static void pgui_action_handle_loader_edit(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer column)
int ShpDumperOpenTable(SHPDUMPERSTATE *state)
#define SHPLOADERRECISNULL
static SHPDUMPERCONFIG * create_new_table_config(GtkTreeIter *iter)
static GtkWidget * checkbutton_loader_options_dumpformat
GtkTreeViewColumn * export_geom_column
static int pgui_exec(const char *sql)
static void pgui_create_about_dialog(void)
static void pgui_logf(const char *fmt,...)
static GtkWidget * checkbutton_chooser_geoonly
GtkCellRenderer * import_schema_renderer
static void pgui_action_open_file_dialog(GtkWidget *widget, gpointer data)
GtkTreeViewColumn * import_schema_column
#define SHPLOADERRECDELETED
GtkCellRenderer * export_geom_column_renderer
static void pgui_action_handle_file_remove(GtkCellRendererToggle *renderer, gchar *path, gpointer user_data)
static void pgui_action_handle_file_drop(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint t, gpointer data)
static void pgui_create_progress_dialog()
#define POSTGIS_LIB_VERSION
static void pgui_seterr_va(const char *fmt, va_list ap)
static void update_filename_field_width(void)
int ShpLoaderGenerateShapeRow(SHPDUMPERSTATE *state)
int ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
GtkListStore * loader_mode_combo_list
static void update_loader_file_config_from_listview_iter(GtkTreeIter *iter, SHPLOADERCONFIG *loader_file_config)
SHPDUMPERSTATE * ShpDumperCreate(SHPDUMPERCONFIG *config)
int ShpDumperCloseTable(SHPDUMPERSTATE *state)
GtkCellRenderer * import_table_renderer
static GtkWidget * dialog_folderchooser
static GtkWidget * progress
static void update_dumper_table_config_from_listview_iter(GtkTreeIter *iter, SHPDUMPERCONFIG *dumper_table_config)
static SHPLOADERCONFIG * global_loader_config
static GtkWidget * checkbutton_loader_options_geography
static gint pgui_event_popup_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
void set_dumper_config_defaults(SHPDUMPERCONFIG *config)
static void pgui_set_dumper_configs_from_options_ui()
static SHPCONNECTIONCONFIG * conn
static void pgui_action_handle_dumper_edit(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer column)
static GtkWidget * dialog_filechooser
void ShpLoaderDestroy(SHPLOADERSTATE *state)
#define GEOGRAPHY_DEFAULT
static void pgui_action_cancel(GtkWidget *widget, gpointer data)
static GtkWidget * entry_pg_port
static void update_dumper_config_globals_from_options_ui(SHPDUMPERCONFIG *config)
static SHPLOADERCONFIG * create_new_file_config(const char *filename)
static GtkWidget * checkbutton_dumper_options_keep_fieldname_case
static void pgui_seterr(const char *fmt,...)
static gint pgui_action_progress_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
int main(int argc, char *argv[])
GtkCellRenderer * import_srid_renderer
GtkCellRenderer * export_table_renderer
static GtkWidget * checkbutton_loader_options_forceint
static GtkWidget * checkbutton_dumper_options_unescapedattrs
GtkTreeViewColumn * export_table_column
void set_loader_config_defaults(SHPLOADERCONFIG *config)
GtkTreeViewColumn * import_table_column
static int pgui_copy_start(const char *sql)
static void process_single_uri(char *uri)
GtkCellRenderer * chooser_table_renderer
GtkCellRenderer * export_filename_renderer
int ShpLoaderGetRecordCount(SHPLOADERSTATE *state)
GtkTreeViewColumn * import_remove_column
static void pgui_action_connection_okay(GtkWidget *widget, gpointer data)
static void pgui_action_handle_tree_combo(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter, gpointer user_data)
static void pgui_create_loader_options_dialog()
static void add_loader_file_config_to_list(SHPLOADERCONFIG *loader_file_config)
static void pgui_action_loader_options_open(GtkWidget *widget, gpointer data)
static GtkWidget * entry_options_encoding
SHPCONNECTIONCONFIG * conn
SHPLOADERSTATE * ShpLoaderCreate(SHPLOADERCONFIG *config)
static volatile int is_running
#define GUIMSG_LINE_MAXLEN
static GtkWidget * dialog_tablechooser
static GtkWidget * checkbutton_loader_options_simplegeoms
static void pgui_action_import(GtkWidget *widget, gpointer data)
static void pgui_quit(GtkWidget *widget, gpointer data)
char * ShpDumperGetConnectionStringFromConn(SHPCONNECTIONCONFIG *conn)
GtkCellRenderer * export_remove_renderer
static GtkWidget * dialog_loader_options
static SHPDUMPERCONFIG * global_dumper_config
static void pgui_action_about_open()
static void pgui_create_main_window(const SHPCONNECTIONCONFIG *conn)
static void pgui_create_dumper_options_dialog()
static void pgui_create_folderchooser_dialog(void)
static gboolean table_chooser_visibility_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
GtkCellRenderer * export_schema_renderer
GtkCellRenderer * import_geom_column_renderer
static void pgui_action_connection_details(GtkWidget *widget, gpointer data)
static void pgui_sanitize_connection_string(char *connection_string)
GtkTreeViewColumn * import_srid_column
GtkTreeViewColumn * export_filename_column
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
void ShpDumperDestroy(SHPDUMPERSTATE *state)
static GtkWidget * add_file_button
static int valid_connection
GtkTreeViewColumn * export_remove_column
static GtkWidget * entry_pg_user
static void update_table_chooser_from_database()
GtkListStore * import_file_list_store
static void update_loader_config_globals_from_options_ui(SHPLOADERCONFIG *config)
static int validate_shape_column_against_pg_column(int dbf_fieldtype, char *pg_fieldtype)
int ShpDumperGetRecordCount(SHPDUMPERSTATE *state)
static void pgui_action_progress_cancel(GtkDialog *dialog, gint response_id, gpointer user_data)
char message[SHPLOADERMSGLEN]
static void pgui_create_filechooser_dialog(void)
GtkTreeViewColumn * chooser_table_column
static GtkWidget * checkbutton_loader_options_dbfonly
static void pgui_action_open_table_dialog(GtkWidget *widget, gpointer data)
static void update_conn_ui_from_conn_config(void)
static void pgui_create_connection_window()
static void pgui_action_dumper_options_open(GtkWidget *widget, gpointer data)
static GtkWidget * add_table_button
static GtkWidget * label_progress
GtkListStore * export_table_list_store
static void pgui_set_loader_configs_from_options_ui()
static void pgui_action_handle_table_geocol_combo(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter, gpointer user_data)
static void pgui_action_export(GtkWidget *widget, gpointer data)
static GtkWidget * dialog_dumper_options
GtkCellRenderer * import_remove_renderer
static void update_conn_config_from_conn_ui(void)
static void update_options_ui_from_dumper_config_globals(void)
#define gtk_dialog_get_content_area(dialog)
int ShpLoaderGetSQLCopyStatement(SHPLOADERSTATE *state, char **strheader)
GtkCellRenderer * import_filename_renderer
int ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strrecord)
static GtkWidget * window_conn
static void free_loader_config(SHPLOADERCONFIG *config)
static void free_dumper_config(SHPDUMPERCONFIG *config)
static void pgui_raise_error_dialogue(void)
int ShpDumperConnectDatabase(SHPDUMPERSTATE *state)
static GtkWidget * checkbutton_loader_options_autoindex
static char pgui_errmsg[GUIMSG_LINE_MAXLEN+1]
static int pgui_copy_end(const int rollback)
static PGconn * pg_connection
static void pgui_log_va(const char *fmt, va_list ap)
static GtkWidget * dialog_progress
int pgis_getopt(int argc, char **argv, char *opts)
char message[SHPDUMPERMSGLEN]
static GtkWidget * checkbutton_dumper_options_includegid
GtkTreeViewColumn * export_schema_column
static GtkWidget * entry_pg_pass
char * shapetypename(int num)
static void add_dumper_table_config_to_list(SHPDUMPERCONFIG *dumper_table_config, GtkListStore *chooser_liststore, GtkTreeIter *chooser_iter)
static void pgui_action_handle_table_remove(GtkCellRendererToggle *renderer, gchar *path, gpointer user_data)
GtkListStore * chooser_filtered_table_list_store
static void pgui_action_chooser_toggle_show_geocolumn(GtkToggleButton *togglebutton, gpointer user_data)
static GtkWidget * textview_log
static void pgui_create_import_file_table(GtkWidget *import_list_frame)
GtkCellRenderer * import_mode_renderer
GtkListStore * chooser_table_list_store
static GtkTextBuffer * textbuffer_log
static GtkWidget * dialog_about
static void update_options_ui_from_loader_config_globals(void)