ScreenShield: move lock status handling to use session mode

Have distinct session modes for the lock screen and the unlock dialog,
and rework the logic in ScreenShield to have the lock-screen mode stack
onto the unlock-dialog mode (where applicable)

https://bugzilla.gnome.org/show_bug.cgi?id=682542
This commit is contained in:
Giovanni Campagna
2012-08-26 16:53:08 +02:00
parent 09e3aed770
commit 8cf9baa132
4 changed files with 76 additions and 58 deletions

View File

@ -18,6 +18,7 @@ const _modes = {
hasRunDialog: false,
hasWorkspaces: false,
hasWindows: false,
hasNotifications: false,
isLocked: false,
isGreeter: false,
isPrimary: false,
@ -32,6 +33,7 @@ const _modes = {
'gdm': {
allowKeybindingsWhenModal: true,
hasNotifications: true,
isGreeter: true,
isPrimary: true,
unlockDialog: imports.gdm.loginDialog.LoginDialog,
@ -46,7 +48,6 @@ const _modes = {
'lock-screen': {
isLocked: true,
isGreeter: undefined,
unlockDialog: undefined,
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
panel: {
@ -56,6 +57,17 @@ const _modes = {
},
},
'unlock-dialog': {
isLocked: true,
unlockDialog: undefined,
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
panel: {
left: ['userMenu'],
center: [],
right: ['a11y', 'keyboard', 'lockScreen']
},
},
'initial-setup': {
isPrimary: true,
components: ['keyring'],
@ -74,9 +86,10 @@ const _modes = {
hasRunDialog: true,
hasWorkspaces: true,
hasWindows: true,
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
hasNotifications: true,
isLocked: false,
isPrimary: true,
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
'keyring', 'recorder', 'autorunManager', 'automountManager'],
panel: {
@ -118,6 +131,13 @@ const SessionMode = new Lang.Class({
this._sync();
},
switchMode: function(to) {
if (this.currentMode == to)
return;
this._modeStack[this._modeStack.length - 1] = to;
this._sync();
},
get currentMode() {
return this._modeStack[this._modeStack.length - 1];
},