polkitAgent: Inherit AuthenticationAgent from Shell.PolkitAuthenticationAgent

AuthenticationAgent is just a wrapper of Shell's PolkitAuthenticationAgent, so
instead of using composition we can simply extend the base GObject.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/563
This commit is contained in:
Marco Trevisan (Treviño) 2019-05-28 22:58:35 +02:00 committed by Florian Müllner
parent fc71f8b33a
commit 0ed702d1af

View File

@ -369,19 +369,20 @@ var AuthenticationDialog = GObject.registerClass({
} }
}); });
var AuthenticationAgent = class { var AuthenticationAgent = GObject.registerClass(
constructor() { class AuthenticationAgent extends Shell.PolkitAuthenticationAgent {
_init() {
super._init();
this._currentDialog = null; this._currentDialog = null;
this._handle = null; this.connect('initiate', this._onInitiate.bind(this));
this._native = new Shell.PolkitAuthenticationAgent(); this.connect('cancel', this._onCancel.bind(this));
this._native.connect('initiate', this._onInitiate.bind(this));
this._native.connect('cancel', this._onCancel.bind(this));
this._sessionUpdatedId = 0; this._sessionUpdatedId = 0;
} }
enable() { enable() {
try { try {
this._native.register(); this.register();
} catch (e) { } catch (e) {
log('Failed to register AuthenticationAgent'); log('Failed to register AuthenticationAgent');
} }
@ -389,7 +390,7 @@ var AuthenticationAgent = class {
disable() { disable() {
try { try {
this._native.unregister(); this.unregister();
} catch (e) { } catch (e) {
log('Failed to unregister AuthenticationAgent'); log('Failed to unregister AuthenticationAgent');
} }
@ -439,8 +440,8 @@ var AuthenticationAgent = class {
Main.sessionMode.disconnect(this._sessionUpdatedId); Main.sessionMode.disconnect(this._sessionUpdatedId);
this._sessionUpdatedId = 0; this._sessionUpdatedId = 0;
this._native.complete(dismissed); this.complete(dismissed);
} }
}; });
var Component = AuthenticationAgent; var Component = AuthenticationAgent;