diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-06-04 16:34:36 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-06-04 16:34:36 -0500 |
commit | 4877d7f2fe6e91315d9723b91da84e614781cddb (patch) | |
tree | d2d4aa91a53a85defd2095c06b6a606f2e973173 /src | |
parent | dcc37782d3ef7f5d469661de69a33a4c78258c9b (diff) | |
download | ayatana-indicator-session-4877d7f2fe6e91315d9723b91da84e614781cddb.tar.gz ayatana-indicator-session-4877d7f2fe6e91315d9723b91da84e614781cddb.tar.bz2 ayatana-indicator-session-4877d7f2fe6e91315d9723b91da84e614781cddb.zip |
In user_menu_mgr_rebuild_items(), simplify the logic behind the visiblity rules
Diffstat (limited to 'src')
-rw-r--r-- | src/user-menu-mgr.c | 27 |
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, |