PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ update_filename_field_width()

static void update_filename_field_width ( void  )
static

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

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