[gnome-shell] keyring: Inherit KeyringPrompter from Gcr.SystemPrompter



commit 5944a1e74b0fbfc0df84bfd628bdf328e02c286d
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Tue May 28 23:07:51 2019 +0200

    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

 js/ui/components/keyring.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
index 429fbce80d..c80d042f95 100644
--- a/js/ui/components/keyring.js
+++ b/js/ui/components/keyring.js
@@ -232,10 +232,11 @@ var KeyringDummyDialog = class {
     }
 };
 
-var KeyringPrompter = class {
-    constructor() {
-        this._prompter = new Gcr.SystemPrompter();
-        this._prompter.connect('new-prompt', () => {
+var KeyringPrompter = GObject.registerClass(
+class KeyringPrompter extends Gcr.SystemPrompter {
+    _init() {
+        super._init();
+        this.connect('new-prompt', () => {
             let dialog = this._enabled
                 ? new KeyringDialog()
                 : new KeyringDummyDialog();
@@ -250,7 +251,7 @@ var KeyringPrompter = class {
 
     enable() {
         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',
                                                      Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT, null, null);
             this._registered = true;
@@ -261,10 +262,10 @@ var KeyringPrompter = class {
     disable() {
         this._enabled = false;
 
-        if (this._prompter.prompting)
+        if (this.prompting)
             this._currentPrompt.cancel();
         this._currentPrompt = null;
     }
-};
+});
 
 var Component = KeyringPrompter;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]