diff options
author | Cody Russell <crussell@canonical.com> | 2009-09-24 01:27:22 -0500 |
---|---|---|
committer | Cody Russell <crussell@canonical.com> | 2009-09-24 01:27:22 -0500 |
commit | 997dd272496ef0071c227448a5320d42e437c421 (patch) | |
tree | 6ae5a77be2d13a9d8822af0a3a8018c2ff86bd6d /src/users-service.c | |
parent | 4b357f8f4e604aa6587929c1993cba1a1b972fe4 (diff) | |
download | ayatana-indicator-session-997dd272496ef0071c227448a5320d42e437c421.tar.gz ayatana-indicator-session-997dd272496ef0071c227448a5320d42e437c421.tar.bz2 ayatana-indicator-session-997dd272496ef0071c227448a5320d42e437c421.zip |
sort users
Diffstat (limited to 'src/users-service.c')
-rw-r--r-- | src/users-service.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/users-service.c b/src/users-service.c index 9e940ed..1fb8d36 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -166,6 +166,16 @@ remove_menu_item (DbusmenuMenuitem *root, gpointer user_data) dbusmenu_menuitem_child_delete (root, child); } +static gint +compare_users_by_username (const gchar *a, + const gchar *b) +{ + UserData *user1 = (UserData *)a; + UserData *user2 = (UserData *)b; + + return g_strcmp0 (user1->user_name, user2->user_name); +} + static void rebuild_items (DbusmenuMenuitem *root, UsersServiceDbus *service) @@ -208,6 +218,8 @@ rebuild_items (DbusmenuMenuitem *root, users = users_service_dbus_get_user_list (service); } + users = g_list_sort (users, (GCompareFunc)compare_users_by_username); + for (u = users; u != NULL; u = g_list_next (u)) { user = u->data; |