ScreenShield: use session mode to handle the GDM login dialog
Have main.js call .showDialog() when going back from the lock-screen, instead of using the return value of createUnlockDialog to know if the dialog was persistent. _keepDialog is still used as LoginDialog cannot really be destroyed, and cancelling it does not destroy it. https://bugzilla.gnome.org/show_bug.cgi?id=683156
This commit is contained in:
parent
cebd8e14e9
commit
92d8d65543
@ -69,22 +69,9 @@ let _overridesSettings = null;
|
||||
|
||||
let background = null;
|
||||
|
||||
function createGDMLoginDialog(parentActor) {
|
||||
// We do this this here instead of at the top to prevent GDM
|
||||
// related code from getting loaded in normal user sessions
|
||||
const LoginDialog = imports.gdm.loginDialog;
|
||||
|
||||
let loginDialog = new LoginDialog.LoginDialog(parentActor);
|
||||
return [loginDialog, true];
|
||||
}
|
||||
|
||||
function createSessionUnlockDialog(parentActor) {
|
||||
let dialog = new UnlockDialog.UnlockDialog(parentActor);
|
||||
return [dialog, false];
|
||||
}
|
||||
|
||||
function _sessionUpdated() {
|
||||
Meta.keybindings_set_custom_handler('panel-run-dialog', sessionMode.hasRunDialog ? openRunDialog : null);
|
||||
if (sessionMode.isGreeter)
|
||||
screenShield.showDialog();
|
||||
}
|
||||
|
||||
function start() {
|
||||
|
@ -606,7 +606,9 @@ const ScreenShield = new Lang.Class({
|
||||
|
||||
_ensureUnlockDialog: function() {
|
||||
if (!this._dialog) {
|
||||
[this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
|
||||
let constructor = Main.sessionMode.unlockDialog;
|
||||
this._dialog = new constructor(this._lockDialogGroup);
|
||||
this._keepDialog = Main.sessionMode.isGreeter;
|
||||
if (!this._dialog) {
|
||||
// This session mode has no locking capabilities
|
||||
this.unlock();
|
||||
@ -624,7 +626,7 @@ const ScreenShield = new Lang.Class({
|
||||
this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
|
||||
}
|
||||
|
||||
if (this._keepDialog) {
|
||||
if (Main.sessionMode.isGreeter) {
|
||||
// Notify the other components that even though we are showing the
|
||||
// screenshield, we're not in a locked state
|
||||
// (this happens for the gdm greeter)
|
||||
@ -764,12 +766,9 @@ const ScreenShield = new Lang.Class({
|
||||
if (this._hasLockScreen)
|
||||
this._clearLockScreen();
|
||||
|
||||
if (this._keepDialog) {
|
||||
// The dialog must be kept alive,
|
||||
// so immediately go back to it
|
||||
// This will also reset _isLocked
|
||||
this._ensureUnlockDialog();
|
||||
return;
|
||||
if (this._dialog && !this._keepDialog) {
|
||||
this._dialog.destroy();
|
||||
this._dialog = null;
|
||||
}
|
||||
|
||||
this._lightbox.hide();
|
||||
|
@ -19,7 +19,8 @@ const _modes = {
|
||||
hasWorkspaces: false,
|
||||
hasWindows: false,
|
||||
isLocked: false,
|
||||
createUnlockDialog: null,
|
||||
isGreeter: false,
|
||||
unlockDialog: null,
|
||||
components: [],
|
||||
panel: {
|
||||
left: [],
|
||||
@ -30,7 +31,8 @@ const _modes = {
|
||||
|
||||
'gdm': {
|
||||
allowKeybindingsWhenModal: true,
|
||||
createUnlockDialog: Main.createGDMLoginDialog,
|
||||
isGreeter: true,
|
||||
unlockDialog: imports.gdm.loginDialog.LoginDialog,
|
||||
panel: {
|
||||
left: [],
|
||||
center: ['dateMenu'],
|
||||
@ -41,8 +43,9 @@ const _modes = {
|
||||
|
||||
'lock-screen': {
|
||||
isLocked: true,
|
||||
isGreeter: undefined,
|
||||
unlockDialog: undefined,
|
||||
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
|
||||
createUnlockDialog: Main.createSessionUnlockDialog,
|
||||
panel: {
|
||||
left: ['userMenu'],
|
||||
center: [],
|
||||
@ -67,6 +70,8 @@ const _modes = {
|
||||
hasRunDialog: true,
|
||||
hasWorkspaces: true,
|
||||
hasWindows: true,
|
||||
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
|
||||
isLocked: false,
|
||||
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
|
||||
'keyring', 'recorder', 'autorunManager', 'automountManager'],
|
||||
panel: {
|
||||
@ -113,18 +118,14 @@ const SessionMode = new Lang.Class({
|
||||
let params = _modes[this.currentMode];
|
||||
params = Params.parse(params, _modes[DEFAULT_MODE]);
|
||||
|
||||
this._createUnlockDialog = params.createUnlockDialog;
|
||||
delete params.createUnlockDialog;
|
||||
// A simplified version of Lang.copyProperties, handles
|
||||
// undefined as a special case for "no change / inherit from previous mode"
|
||||
for (let prop in params) {
|
||||
if (params[prop] !== undefined)
|
||||
this[prop] = params[prop];
|
||||
}
|
||||
|
||||
Lang.copyProperties(params, this);
|
||||
this.emit('updated');
|
||||
},
|
||||
|
||||
createUnlockDialog: function() {
|
||||
if (this._createUnlockDialog)
|
||||
return this._createUnlockDialog.apply(this, arguments);
|
||||
else
|
||||
return null;
|
||||
},
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(SessionMode.prototype);
|
||||
|
Loading…
Reference in New Issue
Block a user