[geary] Fix MainWindow not appearing when no passwords stored in keyring.



commit b7ffd8242ff2ad14135b874e6a89f466d56ba63e
Author: Michael James Gratton <mike vee net>
Date:   Mon Nov 6 19:21:18 2017 +1100

    Fix MainWindow not appearing when no passwords stored in keyring.
    
    Fixes problem introduced by commit 157a109e.
    
    * src/client/application/secret-mediator.vala (SecretMediator): Recreate
      SCHEMA_COMPAT_NETWORK schema object locally since using a CCcodr attr
      doesn't seem to work.

 src/client/application/secret-mediator.vala |   28 ++++++++++++++++++--------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala
index 7fd3e45..61731a2 100644
--- a/src/client/application/secret-mediator.vala
+++ b/src/client/application/secret-mediator.vala
@@ -20,13 +20,23 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
         null
     );
 
+    // See Bug 697681
+    private static Secret.Schema compat_schema = new Secret.Schema(
+        "org.gnome.keyring.NetworkPassword",
+        Secret.SchemaFlags.NONE,
+        "user", Secret.SchemaAttributeType.STRING,
+        "domain", Secret.SchemaAttributeType.STRING,
+        "object", Secret.SchemaAttributeType.STRING,
+        "protocol", Secret.SchemaAttributeType.STRING,
+        "port", Secret.SchemaAttributeType.INTEGER,
+        "server", Secret.SchemaAttributeType.STRING,
+        "authtype", Secret.SchemaAttributeType.STRING,
+        null
+    );
+
     private GearyApplication instance;
     private Geary.Nonblocking.Mutex dialog_mutex = new Geary.Nonblocking.Mutex();
 
-    // See Bug 697681
-    [CCode (cheader_filename = "libsecret/secret.h", cname = "SECRET_SCHEMA_COMPAT_NETWORK")]
-    private Secret.Schema SCHEMA_COMPAT_NETWORK;
-
 
     public SecretMediator(GearyApplication instance) {
         this.instance = instance;
@@ -81,13 +91,13 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
         // Remove legacy formats
         // <= 0.11
         yield Secret.password_clear(
-            SCHEMA_COMPAT_NETWORK,
+            compat_schema,
             cancellable,
             "user", get_legacy_user(service, account.primary_mailbox.address)
         );
         // <= 0.6
         yield Secret.password_clear(
-            SCHEMA_COMPAT_NETWORK,
+            compat_schema,
             cancellable,
             "user", get_legacy_user(service, credentials.user)
          );
@@ -231,7 +241,7 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
     throws Error {
         // <= 0.11
         string? password = yield Secret.password_lookup(
-            SCHEMA_COMPAT_NETWORK,
+            compat_schema,
             cancellable,
             "user", get_legacy_user(service, account.primary_mailbox.address)
         );
@@ -241,7 +251,7 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
             Geary.Credentials creds = get_credentials(service, account);
             string user = get_legacy_user(service, creds.user);
             password = yield Secret.password_lookup(
-                SCHEMA_COMPAT_NETWORK,
+                compat_schema,
                 cancellable,
                 "user", user
             );
@@ -249,7 +259,7 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
             // Clear the old password
             if (password != null) {
                 yield Secret.password_clear(
-                    SCHEMA_COMPAT_NETWORK,
+                    compat_schema,
                     cancellable,
                     "user", user
                 );


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