polkitAgent: Drop close() override in favour of closed signal

In case there are any internal ways the dialogue can close itself
without calling its own close() method, it’s probably better to do all
our cleanup on a handler for the `closed` signal instead.

This should introduce no functional changes except ensuring the
polkitAgent cleanup is always done.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/357
This commit is contained in:
Philip Withnall 2019-01-21 18:10:42 +00:00 committed by Florian Müllner
parent 5f223e0bd8
commit ddd1825162

View File

@ -42,6 +42,8 @@ var AuthenticationDialog = new Lang.Class({
this._group.visible = !Main.sessionMode.isLocked; this._group.visible = !Main.sessionMode.isLocked;
}); });
this.connect('closed', this._onDialogClosed.bind(this));
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' }); let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' });
let title = _("Authentication Required"); let title = _("Authentication Required");
@ -176,14 +178,6 @@ var AuthenticationDialog = new Lang.Class({
this._session.initiate(); this._session.initiate();
}, },
close(timestamp) {
this.parent(timestamp);
if (this._sessionUpdatedId)
Main.sessionMode.disconnect(this._sessionUpdatedId);
this._sessionUpdatedId = 0;
},
_ensureOpen() { _ensureOpen() {
// NOTE: ModalDialog.open() is safe to call if the dialog is // NOTE: ModalDialog.open() is safe to call if the dialog is
// already open - it just returns true without side-effects // already open - it just returns true without side-effects
@ -332,6 +326,12 @@ var AuthenticationDialog = new Lang.Class({
this.close(global.get_current_time()); this.close(global.get_current_time());
this._emitDone(true); this._emitDone(true);
}, },
_onDialogClosed() {
if (this._sessionUpdatedId)
Main.sessionMode.disconnect(this._sessionUpdatedId);
this._sessionUpdatedId = 0;
},
}); });
Signals.addSignalMethods(AuthenticationDialog.prototype); Signals.addSignalMethods(AuthenticationDialog.prototype);