Blame SOURCES/0001-keyring-Don-t-unregister-the-prompt-when-disabled.patch

4c1248
From 17c5b2b32b99185beb7565856d0bc247b7ba9ed4 Mon Sep 17 00:00:00 2001
4c1248
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
4c1248
Date: Wed, 18 Sep 2013 17:53:26 +0200
4c1248
Subject: [PATCH 1/2] keyring: Don't unregister the prompt when disabled
4c1248
4c1248
gnome-keyring provides a fallback in case our builtin prompt fails
4c1248
to register, so keyring dialogs may still pop up even when they
4c1248
are supposed to be disabled.
4c1248
Instead, keep the prompt registered but cancel requests immediately
4c1248
while disabled.
4c1248
4c1248
https://bugzilla.gnome.org/show_bug.cgi?id=708187
4c1248
---
4c1248
 js/ui/components/keyring.js | 41 ++++++++++++++++++++++++++++++++---------
4c1248
 1 file changed, 32 insertions(+), 9 deletions(-)
4c1248
4c1248
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
4c1248
index 299ecc6..6de3965 100644
4c1248
--- a/js/ui/components/keyring.js
4c1248
+++ b/js/ui/components/keyring.js
4c1248
@@ -221,27 +221,50 @@ const KeyringDialog = new Lang.Class({
4c1248
     },
4c1248
 });
4c1248
 
4c1248
+const KeyringDummyDialog = new Lang.Class({
4c1248
+    Name: 'KeyringDummyDialog',
4c1248
+
4c1248
+    _init: function() {
4c1248
+        this.prompt = new Shell.KeyringPrompt();
4c1248
+        this.prompt.connect('show-password',
4c1248
+                            Lang.bind(this, this._cancelPrompt));
4c1248
+        this.prompt.connect('show-confirm', Lang.bind(this,
4c1248
+                            this._cancelPrompt));
4c1248
+    },
4c1248
+
4c1248
+    _cancelPrompt: function() {
4c1248
+        this.prompt.cancel();
4c1248
+    }
4c1248
+});
4c1248
+
4c1248
 const KeyringPrompter = new Lang.Class({
4c1248
     Name: 'KeyringPrompter',
4c1248
 
4c1248
     _init: function() {
4c1248
         this._prompter = new Gcr.SystemPrompter();
4c1248
-        this._prompter.connect('new-prompt', function(prompter) {
4c1248
-            let dialog = new KeyringDialog();
4c1248
-            return dialog.prompt;
4c1248
-        });
4c1248
+        this._prompter.connect('new-prompt', Lang.bind(this,
4c1248
+            function() {
4c1248
+                let dialog = this._enabled ? new KeyringDialog()
4c1248
+                                           : new KeyringDummyDialog();
4c1248
+                return dialog.prompt;
4c1248
+            }));
4c1248
         this._dbusId = null;
4c1248
+        this._registered = false;
4c1248
+        this._enabled = false;
4c1248
     },
4c1248
 
4c1248
     enable: function() {
4c1248
-        this._prompter.register(Gio.DBus.session);
4c1248
-        this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
4c1248
-                                                 Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT, null, null);
4c1248
+        if (!this._registered) {
4c1248
+            this._prompter.register(Gio.DBus.session);
4c1248
+            this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
4c1248
+                                                     Gio.BusNameOwnerFlags.ALLOW_REPLACEMENT, null, null);
4c1248
+            this._registered = true;
4c1248
+        }
4c1248
+        this._enabled = true;
4c1248
     },
4c1248
 
4c1248
     disable: function() {
4c1248
-        this._prompter.unregister(false);
4c1248
-        Gio.DBus.session.unown_name(this._dbusId);
4c1248
+        this._enabled = false;
4c1248
     }
4c1248
 });
4c1248
 
4c1248
-- 
4c1248
1.8.4.2
4c1248