user-menu: Hide "Switch user" on single user machines

Ignoring remote logins, the "Switch user" action is meaningless for
single user setups. Do not show it in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=657011
This commit is contained in:
Florian Müllner 2011-10-18 20:57:24 +02:00
parent 3dabe645c2
commit dc5d2b83ef

View File

@ -474,6 +474,8 @@ UserMenuButton.prototype = {
this._createSubMenu(); this._createSubMenu();
this._userManager.connect('notify::is-loaded', this._userManager.connect('notify::is-loaded',
Lang.bind(this, this._updateSwitchUser)); Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('notify::has-multiple-users',
Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('user-added', this._userManager.connect('user-added',
Lang.bind(this, this._updateSwitchUser)); Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('user-removed', this._userManager.connect('user-removed',
@ -518,7 +520,9 @@ UserMenuButton.prototype = {
_updateSwitchUser: function() { _updateSwitchUser: function() {
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY); let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
if (allowSwitch && this._userManager.can_switch ()) if (allowSwitch &&
this._userManager.can_switch() &&
this._userManager.has_multiple_users)
this._loginScreenItem.actor.show(); this._loginScreenItem.actor.show();
else else
this._loginScreenItem.actor.hide(); this._loginScreenItem.actor.hide();