UserMenu: don't lock the screen if automatic lock disabled
If automatic lock is disabled in the control center, only lock when explicitly using the Lock menu item, and not for Suspend or Switch user/session. https://bugzilla.gnome.org/show_bug.cgi?id=680231
This commit is contained in:
parent
e01e79d9fb
commit
06262a903e
@ -19,9 +19,11 @@ const PopupMenu = imports.ui.popupMenu;
|
|||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
|
|
||||||
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
|
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';
|
||||||
|
const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
|
||||||
const DISABLE_USER_SWITCH_KEY = 'disable-user-switching';
|
const DISABLE_USER_SWITCH_KEY = 'disable-user-switching';
|
||||||
const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen';
|
const DISABLE_LOCK_SCREEN_KEY = 'disable-lock-screen';
|
||||||
const DISABLE_LOG_OUT_KEY = 'disable-log-out';
|
const DISABLE_LOG_OUT_KEY = 'disable-log-out';
|
||||||
|
const LOCK_ENABLED_KEY = 'lock-enabled';
|
||||||
|
|
||||||
const DIALOG_ICON_SIZE = 64;
|
const DIALOG_ICON_SIZE = 64;
|
||||||
|
|
||||||
@ -438,6 +440,7 @@ const UserMenuButton = new Lang.Class({
|
|||||||
let box = new St.BoxLayout({ name: 'panelUserMenu' });
|
let box = new St.BoxLayout({ name: 'panelUserMenu' });
|
||||||
this.actor.add_actor(box);
|
this.actor.add_actor(box);
|
||||||
|
|
||||||
|
this._screenSaverSettings = new Gio.Settings({ schema: SCREENSAVER_SCHEMA });
|
||||||
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
|
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
|
||||||
|
|
||||||
this._userManager = AccountsService.UserManager.get_default();
|
this._userManager = AccountsService.UserManager.get_default();
|
||||||
@ -774,6 +777,7 @@ const UserMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
_onLoginScreenActivate: function() {
|
_onLoginScreenActivate: function() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
|
if (this._screenSaverSettings.get_boolean(LOCK_ENABLED_KEY))
|
||||||
Main.screenShield.lock(false);
|
Main.screenShield.lock(false);
|
||||||
this._userManager.goto_login_session();
|
this._userManager.goto_login_session();
|
||||||
},
|
},
|
||||||
@ -797,6 +801,7 @@ const UserMenuButton = new Lang.Class({
|
|||||||
this._suspendOrPowerOffItem.state == PopupMenu.PopupAlternatingMenuItemState.DEFAULT) {
|
this._suspendOrPowerOffItem.state == PopupMenu.PopupAlternatingMenuItemState.DEFAULT) {
|
||||||
this._session.ShutdownRemote();
|
this._session.ShutdownRemote();
|
||||||
} else {
|
} else {
|
||||||
|
if (this._screenSaverSettings.get_boolean(LOCK_ENABLED_KEY)) {
|
||||||
let tmpId = Main.screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
|
let tmpId = Main.screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
|
||||||
Main.screenShield.disconnect(tmpId);
|
Main.screenShield.disconnect(tmpId);
|
||||||
|
|
||||||
@ -804,6 +809,9 @@ const UserMenuButton = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
Main.screenShield.lock(true);
|
Main.screenShield.lock(true);
|
||||||
|
} else {
|
||||||
|
this._upClient.suspend_sync(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user