From 518282e169a8318f00c5cb406d853ff6e3f2c340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 10 May 2012 13:16:15 +0200 Subject: [PATCH] userMenu: Hide "Log out" item on single user machines Ignoring remote logins, the "Log out" action is meaningless for single user setups. Do not show it in that case. https://bugzilla.gnome.org/show_bug.cgi?id=675802 --- js/ui/userMenu.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js index 93f4dc337..5b46ca801 100644 --- a/js/ui/userMenu.js +++ b/js/ui/userMenu.js @@ -497,13 +497,13 @@ const UserMenuButton = new Lang.Class({ })); this._userManager.connect('notify::is-loaded', - Lang.bind(this, this._updateSwitchUser)); + Lang.bind(this, this._updateMultiUser)); this._userManager.connect('notify::has-multiple-users', - Lang.bind(this, this._updateSwitchUser)); + Lang.bind(this, this._updateMultiUser)); this._userManager.connect('user-added', - Lang.bind(this, this._updateSwitchUser)); + Lang.bind(this, this._updateMultiUser)); this._userManager.connect('user-removed', - Lang.bind(this, this._updateSwitchUser)); + Lang.bind(this, this._updateMultiUser)); this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY, Lang.bind(this, this._updateSwitchUser)); this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, @@ -542,6 +542,11 @@ const UserMenuButton = new Lang.Class({ this._name.set_text(""); }, + _updateMultiUser: function() { + this._updateSwitchUser(); + this._updateLogout(); + }, + _updateSwitchUser: function() { let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY); this._loginScreenItem.actor.visible = allowSwitch && @@ -551,7 +556,7 @@ const UserMenuButton = new Lang.Class({ _updateLogout: function() { let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY); - this._logoutItem.actor.visible = allowLogout; + this._logoutItem.actor.visible = allowLogout && this._userManager.has_multiple_users; }, _updateLockScreen: function() {