keyring: Inherit KeyringPrompter from Gcr.SystemPrompter
Keyring is just a simple wrapper to a Gcr.SystemPrompter object, so use inheritance instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/563
This commit is contained in:
parent
0ed702d1af
commit
5944a1e74b
@ -232,10 +232,11 @@ var KeyringDummyDialog = class {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var KeyringPrompter = class {
|
var KeyringPrompter = GObject.registerClass(
|
||||||
constructor() {
|
class KeyringPrompter extends Gcr.SystemPrompter {
|
||||||
this._prompter = new Gcr.SystemPrompter();
|
_init() {
|
||||||
this._prompter.connect('new-prompt', () => {
|
super._init();
|
||||||
|
this.connect('new-prompt', () => {
|
||||||
let dialog = this._enabled
|
let dialog = this._enabled
|
||||||
? new KeyringDialog()
|
? new KeyringDialog()
|
||||||
: new KeyringDummyDialog();
|
: new KeyringDummyDialog();
|
||||||
@ -250,7 +251,7 @@ var KeyringPrompter = class {
|
|||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
if (!this._registered) {
|
if (!this._registered) {
|
||||||
this._prompter.register(Gio.DBus.session);
|
this.register(Gio.DBus.session);
|
||||||
this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
|
this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
|
||||||
Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT, null, null);
|
Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT, null, null);
|
||||||
this._registered = true;
|
this._registered = true;
|
||||||
@ -261,10 +262,10 @@ var KeyringPrompter = class {
|
|||||||
disable() {
|
disable() {
|
||||||
this._enabled = false;
|
this._enabled = false;
|
||||||
|
|
||||||
if (this._prompter.prompting)
|
if (this.prompting)
|
||||||
this._currentPrompt.cancel();
|
this._currentPrompt.cancel();
|
||||||
this._currentPrompt = null;
|
this._currentPrompt = null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
var Component = KeyringPrompter;
|
var Component = KeyringPrompter;
|
||||||
|
Loading…
Reference in New Issue
Block a user