userMenu: Offer "Switch Session" item on multi-session systems
Since commit 518282e169
, we hide both "Switch User" and "Log out"
on single-user systems. However, if there is more than one session
available, users may still want to get back to the login manager
to change sessions.
Add both "Log out" and "Switch Session" items in that case.
https://bugzilla.gnome.org/show_bug.cgi?id=675802
This commit is contained in:
parent
41a14e808e
commit
ca26347dea
@ -1,6 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const AccountsService = imports.gi.AccountsService;
|
const AccountsService = imports.gi.AccountsService;
|
||||||
|
const GdmGreeter = imports.gi.GdmGreeter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -549,14 +550,20 @@ const UserMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
_updateSwitchUser: function() {
|
_updateSwitchUser: function() {
|
||||||
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
|
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
|
||||||
this._loginScreenItem.actor.visible = allowSwitch &&
|
let multiUser = this._userManager.can_switch() && this._userManager.has_multiple_users;
|
||||||
this._userManager.can_switch() &&
|
let multiSession = GdmGreeter.get_session_ids().length > 1;
|
||||||
this._userManager.has_multiple_users;
|
|
||||||
|
this._loginScreenItem.label.set_text(multiUser ? _("Switch User")
|
||||||
|
: _("Switch Session"));
|
||||||
|
this._loginScreenItem.actor.visible = allowSwitch && (multiUser || multiSession);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLogout: function() {
|
_updateLogout: function() {
|
||||||
let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
|
let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
|
||||||
this._logoutItem.actor.visible = allowLogout && this._userManager.has_multiple_users;
|
let multiUser = this._userManager.has_multiple_users;
|
||||||
|
let multiSession = GdmGreeter.get_session_ids().length > 1;
|
||||||
|
|
||||||
|
this._logoutItem.actor.visible = allowLogout && (multiUser || multiSession);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLockScreen: function() {
|
_updateLockScreen: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user