aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-02 11:48:18 -0600
committerTed Gould <ted@gould.cx>2010-03-02 11:48:18 -0600
commit40ef68c195d63a7d19e1ad237fc7ebed00c9c0c2 (patch)
tree4c1d8e9997f69082e3f5ce586f502dfe929a6710
parent206f1003cad828ca2465088ea3fbf73b1a6a4c97 (diff)
downloadayatana-indicator-session-40ef68c195d63a7d19e1ad237fc7ebed00c9c0c2.tar.gz
ayatana-indicator-session-40ef68c195d63a7d19e1ad237fc7ebed00c9c0c2.tar.bz2
ayatana-indicator-session-40ef68c195d63a7d19e1ad237fc7ebed00c9c0c2.zip
Making it so that count is not a global and just calculated from the list.
-rw-r--r--src/session-service.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/session-service.c b/src/session-service.c
index eeb88a9..30c14cf 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -68,8 +68,6 @@ static UsersServiceDbus *dbus_interface = NULL;
static DbusmenuMenuitem *lock_menuitem = NULL;
static DbusmenuMenuitem *switch_menuitem = NULL;
-static gint count;
-
static DbusmenuMenuitem * root_menuitem = NULL;
static GMainLoop * mainloop = NULL;
static DBusGProxy * up_main_proxy = NULL;
@@ -473,8 +471,9 @@ rebuild_items (DbusmenuMenuitem *root,
GList * users = NULL;
users = users_service_dbus_get_user_list (service);
+ guint user_count = g_list_length(users);
- if (count > MINIMUM_USERS && count < MAXIMUM_USERS)
+ if (user_count > MINIMUM_USERS && user_count < MAXIMUM_USERS)
{
users = g_list_sort (users, (GCompareFunc)compare_users_by_username);
@@ -563,8 +562,6 @@ user_added (UsersServiceDbus *service,
{
DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
- count++;
-
rebuild_items (root, service);
}
@@ -577,8 +574,6 @@ user_removed (UsersServiceDbus *service,
{
DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
- count--;
-
rebuild_items (root, service);
}
@@ -590,8 +585,6 @@ create_items (DbusmenuMenuitem *root,
{
g_return_if_fail (IS_USERS_SERVICE_DBUS (service));
- count = users_service_dbus_get_user_count (service);
-
rebuild_items (root, service);
}