[gdm/gnome-2-30] Sort user list by number of sessions too
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-30] Sort user list by number of sessions too
- Date: Fri, 11 Jun 2010 17:08:20 +0000 (UTC)
commit 8b0c3288a07c2563e913ee611206de296e94a9fa
Author: William Jon McCann <jmccann redhat com>
Date: Fri Jun 11 12:39:57 2010 -0400
Sort user list by number of sessions too
We first sort by login frequency but it is useful to
pop currently logged in users to the top of the rest.
gui/simple-greeter/gdm-user.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index a83076b..cc9bfa1 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/gdm-user.c
@@ -360,6 +360,8 @@ gdm_user_collate (GdmUser *user1,
const char *str2;
gulong num1;
gulong num2;
+ guint len1;
+ guint len2;
g_return_val_if_fail (GDM_IS_USER (user1), 0);
g_return_val_if_fail (GDM_IS_USER (user2), 0);
@@ -375,6 +377,18 @@ gdm_user_collate (GdmUser *user1,
return 1;
}
+
+ len1 = g_list_length (user1->sessions);
+ len2 = g_list_length (user2->sessions);
+
+ if (len1 > len2) {
+ return -1;
+ }
+
+ if (len1 < len2) {
+ return 1;
+ }
+
/* if login frequency is equal try names */
if (user1->real_name != NULL) {
str1 = user1->real_name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]