aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/users-service.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/src/users-service.c b/src/users-service.c
index 1fb8d36..51c6c5d 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -183,6 +183,9 @@ rebuild_items (DbusmenuMenuitem *root,
DbusmenuMenuitem *mi = NULL;
GList *u;
UserData *user;
+ gboolean can_activate;
+
+ can_activate = users_service_dbus_can_activate_session (service);
dbusmenu_menuitem_foreach (root, remove_menu_item, NULL);
@@ -191,55 +194,58 @@ rebuild_items (DbusmenuMenuitem *root,
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL);
dbusmenu_menuitem_child_append(root, mi);
- if (check_guest_session ())
+ if (can_activate == TRUE)
{
- mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Guest Session"));
- dbusmenu_menuitem_child_append (root, mi);
- g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_guest_session), NULL);
- }
+ if (check_guest_session ())
+ {
+ mi = dbusmenu_menuitem_new ();
+ dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Guest Session"));
+ dbusmenu_menuitem_child_append (root, mi);
+ g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_guest_session), NULL);
+ }
- if (count > 1 && count < 7)
- {
- if (count > MINIMUM_USERS && count < MAXIMUM_USERS)
+ if (count > 1 && count < 7)
{
- if (users != NULL)
+ if (count > MINIMUM_USERS && count < MAXIMUM_USERS)
{
- GList *l = NULL;
-
- for (l = users; l != NULL; l = l->next)
+ if (users != NULL)
{
- users = g_list_delete_link (users, l);
+ GList *l = NULL;
+
+ for (l = users; l != NULL; l = l->next)
+ {
+ users = g_list_delete_link (users, l);
+ }
+
+ users = NULL;
}
- users = NULL;
+ users = users_service_dbus_get_user_list (service);
}
- users = users_service_dbus_get_user_list (service);
- }
+ users = g_list_sort (users, (GCompareFunc)compare_users_by_username);
- users = g_list_sort (users, (GCompareFunc)compare_users_by_username);
+ for (u = users; u != NULL; u = g_list_next (u))
+ {
+ user = u->data;
- for (u = users; u != NULL; u = g_list_next (u))
- {
- user = u->data;
+ user->service = service;
- user->service = service;
+ mi = dbusmenu_menuitem_new ();
+ dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, user->real_name);
+ dbusmenu_menuitem_child_append (root, mi);
+ g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_user_session), user);
+ }
+ }
+ if (check_new_session ())
+ {
mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, user->real_name);
+ dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session..."));
dbusmenu_menuitem_child_append (root, mi);
- g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_user_session), user);
+ g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL);
}
}
-
- if (check_new_session ())
- {
- mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session..."));
- dbusmenu_menuitem_child_append (root, mi);
- g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL);
- }
}
static void