ui: Sort profile names
Not all file systems returns a sorted list of filenames, so we need to sort the entries before using the list in the Profile popup and the Manage Profiles dialog. Change-Id: Ic1f2bfa77fb47fb8c406d891aee49b484876b4f7 Reviewed-on: https://code.wireshark.org/review/24615 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
87a8877007
commit
da91020353
22
ui/profile.c
22
ui/profile.c
|
@ -313,6 +313,9 @@ init_profile_list(void)
|
|||
WS_DIR *dir; /* scanned directory */
|
||||
WS_DIRENT *file; /* current file */
|
||||
const gchar *name;
|
||||
GList *local_profiles = NULL;
|
||||
GList *global_profiles = NULL;
|
||||
GList *iter;
|
||||
gchar *profiles_dir, *filename;
|
||||
|
||||
empty_profile_list(TRUE);
|
||||
|
@ -328,7 +331,7 @@ init_profile_list(void)
|
|||
filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name);
|
||||
|
||||
if (test_for_directory(filename) == EISDIR) {
|
||||
/*fl_entry =*/ add_to_profile_list(name, name, PROF_STAT_EXISTS, FALSE, FALSE);
|
||||
local_profiles = g_list_prepend(local_profiles, g_strdup(name));
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
@ -336,6 +339,13 @@ init_profile_list(void)
|
|||
}
|
||||
g_free(profiles_dir);
|
||||
|
||||
local_profiles = g_list_sort(local_profiles, (GCompareFunc)g_ascii_strcasecmp);
|
||||
for (iter = g_list_first(local_profiles); iter; iter = g_list_next(iter)) {
|
||||
name = (gchar *)iter->data;
|
||||
add_to_profile_list(name, name, PROF_STAT_EXISTS, FALSE, FALSE);
|
||||
}
|
||||
g_list_free_full(local_profiles, g_free);
|
||||
|
||||
/* Global profiles */
|
||||
profiles_dir = get_global_profiles_dir();
|
||||
if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) {
|
||||
|
@ -344,8 +354,7 @@ init_profile_list(void)
|
|||
filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name);
|
||||
|
||||
if (test_for_directory(filename) == EISDIR) {
|
||||
/*fl_entry =*/ add_to_profile_list(name, name, PROF_STAT_EXISTS, TRUE, TRUE);
|
||||
/*profile = (profile_def *) fl_entry->data;*/
|
||||
global_profiles = g_list_prepend(global_profiles, g_strdup(name));
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
@ -353,6 +362,13 @@ init_profile_list(void)
|
|||
}
|
||||
g_free(profiles_dir);
|
||||
|
||||
global_profiles = g_list_sort(global_profiles, (GCompareFunc)g_ascii_strcasecmp);
|
||||
for (iter = g_list_first(global_profiles); iter; iter = g_list_next(iter)) {
|
||||
name = (gchar *)iter->data;
|
||||
add_to_profile_list(name, name, PROF_STAT_EXISTS, TRUE, TRUE);
|
||||
}
|
||||
g_list_free_full(global_profiles, g_free);
|
||||
|
||||
/* Make the current list and the edited list equal */
|
||||
copy_profile_list ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue