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