aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/user-menu-mgr.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index 1be4ca9..00ad8a2 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -173,27 +173,18 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self)
users_service_dbus_set_guest_item(self->users_dbus_interface, NULL);
/* Build all of the user switching items */
- if (can_activate == TRUE)
+ if (can_activate)
{
-
- gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface);
- GList * users = NULL;
- users = users_service_dbus_get_user_list (self->users_dbus_interface);
+ /* TODO: This needs to be updated once the ability to query guest session support is available */
+ GList * users = users_service_dbus_get_user_list (self->users_dbus_interface);
const gint user_count = g_list_length(users);
+ const gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface);
+ const gboolean is_guest = guest_enabled && is_this_guest_session();
+ const gboolean other_users_exist = user_count>1 || (is_guest && user_count>0);
+ const gboolean visible = !self->greeter_mode && should_show_user_menu() && other_users_exist;
+ session_dbus_set_user_menu_visibility (self->session_dbus_interface, visible);
- gboolean gsettings_user_menu_is_visible = should_show_user_menu();
-
- if (gsettings_user_menu_is_visible == FALSE || self->greeter_mode){
- session_dbus_set_user_menu_visibility (self->session_dbus_interface,
- FALSE);
- }
- else{
- // This needs to be updated once the ability to query guest session support is available
- session_dbus_set_user_menu_visibility (self->session_dbus_interface,
- guest_enabled || user_count > 1);
- }
-
- // TODO we should really return here if the menu is not going to be shown.
+ /* TODO we should really return here if the menu is not going to be shown. */
DbusmenuMenuitem * switch_menuitem = dbusmenu_menuitem_new ();
dbusmenu_menuitem_property_set (switch_menuitem,