aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/users-service.c12
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;