[seahorse] Gkr: ItemAdd: Attempt to unlock keyring



commit 7eaf5b3b65dbeb585ef5e3109f5fa2d87efb5bd7
Author: Anukul Sangwan <anukulsangwan icloud com>
Date:   Sat Sep 1 07:36:24 2018 +0530

    Gkr: ItemAdd: Attempt to unlock keyring

 gkr/gkr-item-add.vala | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/gkr/gkr-item-add.vala b/gkr/gkr-item-add.vala
index a1c1255c..f130c5ac 100644
--- a/gkr/gkr-item-add.vala
+++ b/gkr/gkr-item-add.vala
@@ -87,6 +87,22 @@ public class Seahorse.Gkr.ItemAdd : Gtk.Dialog {
         Secret.Collection collection;
         this.item_keyring_combo.model.get(iter, 1, out collection, -1);
 
+        var keyring = (Keyring) collection;
+        var cancellable = new Cancellable();
+        var interaction = new Interaction(this);
+
+        keyring.unlock.begin(interaction, cancellable, (obj, res) => {
+            try {
+                if (keyring.unlock.end(res)) {
+                    create_secret(collection);
+                }
+            } catch (Error e) {
+                Util.show_error(this, _("Couldn’t unlock"), e.message);
+            }
+        });
+    }
+
+    private void create_secret(Secret.Collection collection) {
         var secret = new Secret.Value(this.password_entry.text, -1, "text/plain");
         var cancellable = Dialog.begin_request(this);
         var attributes = new HashTable<string, string>(GLib.str_hash, GLib.str_equal);


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