PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ update_filename_field_width()

static void update_filename_field_width ( void  )
static

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

References import_file_list_store, IMPORT_FILENAME_COLUMN, import_filename_renderer, and SHAPEFIELDMAXWIDTH.

Referenced by add_loader_file_config_to_list(), and pgui_action_handle_file_remove().

424 {
425  GtkTreeIter iter;
426  gboolean is_valid;
427  gchar *filename;
428  int max_width;
429 
430  /* Loop through the list store to find the maximum length of an entry */
431  max_width = 0;
432  is_valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(import_file_list_store), &iter);
433  while (is_valid)
434  {
435  /* Grab the length of the filename entry in characters */
436  gtk_tree_model_get(GTK_TREE_MODEL(import_file_list_store), &iter, IMPORT_FILENAME_COLUMN, &filename, -1);
437  if (strlen(filename) > max_width)
438  max_width = strlen(filename);
439 
440  /* Get next entry */
441  is_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(import_file_list_store), &iter);
442  }
443 
444  /* Note the layout manager will handle the minimum size for us; we just need to be concerned with
445  making sure we don't exceed a maximum limit */
446  if (max_width > SHAPEFIELDMAXWIDTH)
447  g_object_set(import_filename_renderer, "width-chars", SHAPEFIELDMAXWIDTH, NULL);
448  else
449  g_object_set(import_filename_renderer, "width-chars", -1, NULL);
450 
451  return;
452 }
#define SHAPEFIELDMAXWIDTH
Definition: shp2pgsql-gui.c:30
GtkListStore * import_file_list_store
Definition: shp2pgsql-gui.c:55
GtkCellRenderer * import_filename_renderer
Definition: shp2pgsql-gui.c:57
Here is the caller graph for this function: