ScreenShield: consolidate code that handles dialog cancellation

This way we ensure the same behavior everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=701731
This commit is contained in:
Giovanni Campagna 2013-06-08 19:04:36 +02:00
parent 1b8580f12b
commit b16ee1a3a6

View File

@ -591,6 +591,21 @@ const ScreenShield = new Lang.Class({
}
},
_maybeCancelDialog: function() {
if (!this._dialog)
return;
this._dialog.cancel();
if (this._isGreeter) {
// LoginDialog.cancel() will grab the key focus
// on its own, so ensure it stays on lock screen
// instead
this._lockScreenGroup.grab_key_focus();
} else {
this._dialog = null;
}
},
_becomeModal: function() {
if (this._isModal)
return true;
@ -746,13 +761,7 @@ const ScreenShield = new Lang.Class({
onCompleteScope: this,
});
// If we have a unlock dialog, cancel it
if (this._dialog) {
this._dialog.cancel();
if (!this._isGreeter) {
this._dialog = null;
}
}
this._maybeCancelDialog();
}
},
@ -760,12 +769,7 @@ const ScreenShield = new Lang.Class({
if (status != GnomeSession.PresenceStatus.IDLE)
return;
if (this._dialog) {
this._dialog.cancel();
if (!this._isGreeter) {
this._dialog = null;
}
}
this._maybeCancelDialog();
if (this._lightbox.actor.visible ||
this._isActive) {