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;
|
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() {
|
function _sessionUpdated() {
|
||||||
Meta.keybindings_set_custom_handler('panel-run-dialog', sessionMode.hasRunDialog ? openRunDialog : null);
|
if (sessionMode.isGreeter)
|
||||||
|
screenShield.showDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
|
@ -606,7 +606,9 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
_ensureUnlockDialog: function() {
|
_ensureUnlockDialog: function() {
|
||||||
if (!this._dialog) {
|
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) {
|
if (!this._dialog) {
|
||||||
// This session mode has no locking capabilities
|
// This session mode has no locking capabilities
|
||||||
this.unlock();
|
this.unlock();
|
||||||
@ -624,7 +626,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
|
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
|
// Notify the other components that even though we are showing the
|
||||||
// screenshield, we're not in a locked state
|
// screenshield, we're not in a locked state
|
||||||
// (this happens for the gdm greeter)
|
// (this happens for the gdm greeter)
|
||||||
@ -764,12 +766,9 @@ const ScreenShield = new Lang.Class({
|
|||||||
if (this._hasLockScreen)
|
if (this._hasLockScreen)
|
||||||
this._clearLockScreen();
|
this._clearLockScreen();
|
||||||
|
|
||||||
if (this._keepDialog) {
|
if (this._dialog && !this._keepDialog) {
|
||||||
// The dialog must be kept alive,
|
this._dialog.destroy();
|
||||||
// so immediately go back to it
|
this._dialog = null;
|
||||||
// This will also reset _isLocked
|
|
||||||
this._ensureUnlockDialog();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._lightbox.hide();
|
this._lightbox.hide();
|
||||||
|
@ -19,7 +19,8 @@ const _modes = {
|
|||||||
hasWorkspaces: false,
|
hasWorkspaces: false,
|
||||||
hasWindows: false,
|
hasWindows: false,
|
||||||
isLocked: false,
|
isLocked: false,
|
||||||
createUnlockDialog: null,
|
isGreeter: false,
|
||||||
|
unlockDialog: null,
|
||||||
components: [],
|
components: [],
|
||||||
panel: {
|
panel: {
|
||||||
left: [],
|
left: [],
|
||||||
@ -30,7 +31,8 @@ const _modes = {
|
|||||||
|
|
||||||
'gdm': {
|
'gdm': {
|
||||||
allowKeybindingsWhenModal: true,
|
allowKeybindingsWhenModal: true,
|
||||||
createUnlockDialog: Main.createGDMLoginDialog,
|
isGreeter: true,
|
||||||
|
unlockDialog: imports.gdm.loginDialog.LoginDialog,
|
||||||
panel: {
|
panel: {
|
||||||
left: [],
|
left: [],
|
||||||
center: ['dateMenu'],
|
center: ['dateMenu'],
|
||||||
@ -41,8 +43,9 @@ const _modes = {
|
|||||||
|
|
||||||
'lock-screen': {
|
'lock-screen': {
|
||||||
isLocked: true,
|
isLocked: true,
|
||||||
|
isGreeter: undefined,
|
||||||
|
unlockDialog: undefined,
|
||||||
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
|
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
|
||||||
createUnlockDialog: Main.createSessionUnlockDialog,
|
|
||||||
panel: {
|
panel: {
|
||||||
left: ['userMenu'],
|
left: ['userMenu'],
|
||||||
center: [],
|
center: [],
|
||||||
@ -67,6 +70,8 @@ const _modes = {
|
|||||||
hasRunDialog: true,
|
hasRunDialog: true,
|
||||||
hasWorkspaces: true,
|
hasWorkspaces: true,
|
||||||
hasWindows: true,
|
hasWindows: true,
|
||||||
|
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
|
||||||
|
isLocked: false,
|
||||||
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
|
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
|
||||||
'keyring', 'recorder', 'autorunManager', 'automountManager'],
|
'keyring', 'recorder', 'autorunManager', 'automountManager'],
|
||||||
panel: {
|
panel: {
|
||||||
@ -113,18 +118,14 @@ const SessionMode = new Lang.Class({
|
|||||||
let params = _modes[this.currentMode];
|
let params = _modes[this.currentMode];
|
||||||
params = Params.parse(params, _modes[DEFAULT_MODE]);
|
params = Params.parse(params, _modes[DEFAULT_MODE]);
|
||||||
|
|
||||||
this._createUnlockDialog = params.createUnlockDialog;
|
// A simplified version of Lang.copyProperties, handles
|
||||||
delete params.createUnlockDialog;
|
// 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');
|
this.emit('updated');
|
||||||
},
|
}
|
||||||
|
|
||||||
createUnlockDialog: function() {
|
|
||||||
if (this._createUnlockDialog)
|
|
||||||
return this._createUnlockDialog.apply(this, arguments);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
Signals.addSignalMethods(SessionMode.prototype);
|
Signals.addSignalMethods(SessionMode.prototype);
|
||||||
|
Loading…
Reference in New Issue
Block a user