aboutsummaryrefslogtreecommitdiff
path: root/src/users-service.c
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2009-09-24 01:21:50 -0500
committerCody Russell <crussell@canonical.com>2009-09-24 01:21:50 -0500
commit7f7ed7fe0e23a4d4f044fda7cc201f4e474a6e17 (patch)
treeb1de20976e08e894b8d69a0012d06cebe66d73b5 /src/users-service.c
parent3427b4a7054aa66f1aaa20aed56ad445aecd5ec4 (diff)
downloadayatana-indicator-session-7f7ed7fe0e23a4d4f044fda7cc201f4e474a6e17.tar.gz
ayatana-indicator-session-7f7ed7fe0e23a4d4f044fda7cc201f4e474a6e17.tar.bz2
ayatana-indicator-session-7f7ed7fe0e23a4d4f044fda7cc201f4e474a6e17.zip
don't load all the users unless needed
Diffstat (limited to 'src/users-service.c')
-rw-r--r--src/users-service.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/users-service.c b/src/users-service.c
index 9dbf218..9f240da 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -37,8 +37,6 @@
#include "users-service-dbus.h"
#define GUEST_SESSION_LAUNCHER "/usr/share/gdm/guest-session/guest-session-launch"
-#define MINIMUM_USERS 1
-#define MAXIMUM_USERS 7
typedef struct _ActivateData ActivateData;
struct _ActivateData
@@ -193,6 +191,23 @@ rebuild_items (DbusmenuMenuitem *root,
if (count > 1 && count < 7)
{
+ if (count > MINIMUM_USERS && count < MAXIMUM_USERS)
+ {
+ if (users != NULL)
+ {
+ GList *l = NULL;
+
+ for (l = users; l != NULL; l = l->next)
+ {
+ users = g_list_delete_link (users, l);
+ }
+
+ users = NULL;
+ }
+
+ users = users_service_dbus_get_user_list (service);
+ }
+
for (u = users; u != NULL; u = g_list_next (u))
{
user = u->data;
@@ -222,7 +237,6 @@ user_added (UsersServiceDbus *service,
{
DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
- users = g_list_append (users, user);
count++;
rebuild_items (root, service);
@@ -235,7 +249,6 @@ user_removed (UsersServiceDbus *service,
{
DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
- users = g_list_remove (users, user);
count--;
rebuild_items (root, service);
@@ -248,7 +261,7 @@ create_items (DbusmenuMenuitem *root,
g_return_if_fail (IS_USERS_SERVICE_DBUS (service));
count = users_service_dbus_get_user_count (service);
- if (count > 1 && count < 7)
+ if (count > MINIMUM_USERS && count < MAXIMUM_USERS)
{
users = users_service_dbus_get_user_list (service);
}