Skip to content

Commit

Permalink
Merge pull request #13 from nemomobile/sort-mode-list
Browse files Browse the repository at this point in the history
[usb-moded] Sort modes alphabetically when reading. JB#15436
  • Loading branch information
philippedeswert committed Mar 11, 2014
2 parents dd4731b + 9284309 commit fd75451
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/usb_moded-dyn-config.c
Expand Up @@ -62,6 +62,14 @@ void free_mode_list(GList *modelist)
}
}

static gint compare_modes(gconstpointer a, gconstpointer b)
{
struct mode_list_elem *aa = (struct mode_list_elem *)a;
struct mode_list_elem *bb = (struct mode_list_elem *)b;

return g_strcmp0(aa->mode_name, bb->mode_name);
}

GList *read_mode_list(int diag)
{
GDir *confdir;
Expand Down Expand Up @@ -93,6 +101,8 @@ GList *read_mode_list(int diag)
}
else
log_debug("Mode confdir open failed or file is incomplete/invalid.\n");

g_list_sort (modelist, compare_modes);
return(modelist);
}

Expand Down

0 comments on commit fd75451

Please sign in to comment.