PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ update_loader_config_globals_from_options_ui()

static void update_loader_config_globals_from_options_ui ( SHPLOADERCONFIG config)
static

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

References checkbutton_loader_options_autoindex, checkbutton_loader_options_dbfonly, checkbutton_loader_options_dumpformat, checkbutton_loader_options_forceint, checkbutton_loader_options_geography, checkbutton_loader_options_preservecase, checkbutton_loader_options_simplegeoms, shp_loader_config::createindex, shp_loader_config::dump_format, shp_loader_config::encoding, entry_options_encoding, shp_loader_config::forceint4, free(), shp_loader_config::geo_col, shp_loader_config::geography, GEOGRAPHY_DEFAULT, GEOMETRY_DEFAULT, shp_loader_config::quoteidentifiers, shp_loader_config::readshape, and shp_loader_config::simple_geometries.

Referenced by pgui_set_loader_configs_from_options_ui().

533 {
534  const char *entry_encoding = gtk_entry_get_text(GTK_ENTRY(entry_options_encoding));
535  gboolean preservecase = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_preservecase));
536  gboolean forceint = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_forceint));
537  gboolean createindex = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_autoindex));
538  gboolean dbfonly = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_dbfonly));
539  gboolean dumpformat = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_dumpformat));
540  gboolean geography = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_geography));
541  gboolean simplegeoms = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_simplegeoms));
542 
543  if (geography)
544  {
545  config->geography = 1;
546 
547  if (config->geo_col)
548  free(config->geo_col);
549 
550  config->geo_col = strdup(GEOGRAPHY_DEFAULT);
551  }
552  else
553  {
554  config->geography = 0;
555 
556  if (config->geo_col)
557  free(config->geo_col);
558 
559  config->geo_col = strdup(GEOMETRY_DEFAULT);
560  }
561 
562  /* Encoding */
563  if (entry_encoding && strlen(entry_encoding) > 0)
564  {
565  if (config->encoding)
566  free(config->encoding);
567 
568  config->encoding = strdup(entry_encoding);
569  }
570 
571  /* Preserve case */
572  if (preservecase)
573  config->quoteidentifiers = 1;
574  else
575  config->quoteidentifiers = 0;
576 
577  /* No long integers in table */
578  if (forceint)
579  config->forceint4 = 1;
580  else
581  config->forceint4 = 0;
582 
583  /* Create spatial index after load */
584  if (createindex)
585  config->createindex = 1;
586  else
587  config->createindex = 0;
588 
589  /* Read the .shp file, don't ignore it */
590  if (dbfonly)
591  {
592  config->readshape = 0;
593 
594  /* There will be no spatial column so don't create a spatial index */
595  config->createindex = 0;
596  }
597  else
598  config->readshape = 1;
599 
600  /* Use COPY rather than INSERT format */
601  if (dumpformat)
602  config->dump_format = 1;
603  else
604  config->dump_format = 0;
605 
606  /* Simple geometries only */
607  if (simplegeoms)
608  config->simple_geometries = 1;
609  else
610  config->simple_geometries = 0;
611 
612  return;
613 }
static GtkWidget * checkbutton_loader_options_preservecase
static GtkWidget * checkbutton_loader_options_dumpformat
static GtkWidget * checkbutton_loader_options_geography
#define GEOGRAPHY_DEFAULT
static GtkWidget * checkbutton_loader_options_forceint
#define GEOMETRY_DEFAULT
static GtkWidget * entry_options_encoding
static GtkWidget * checkbutton_loader_options_simplegeoms
static GtkWidget * checkbutton_loader_options_dbfonly
void free(void *)
static GtkWidget * checkbutton_loader_options_autoindex
Here is the call graph for this function:
Here is the caller graph for this function: