PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void update_filename_field_width ( void  )
static

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

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

Here is the caller graph for this function: