[geary/wip/rework-password-prompting: 2/5] Remove now-unused prompting code from Mediator implementations



commit 30b55a031383fb8e26bbe0cf50dcbdc8c98aa49e
Author: Michael Gratton <mike vee net>
Date:   Wed Mar 6 22:53:00 2019 +1100

    Remove now-unused prompting code from Mediator implementations

 src/client/application/geary-controller.vala |  2 +-
 src/client/application/goa-mediator.vala     | 11 -------
 src/client/application/secret-mediator.vala  | 45 +---------------------------
 3 files changed, 2 insertions(+), 56 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index a4fee38b..891605ea 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -332,7 +332,7 @@ public class GearyController : Geary.BaseObject {
 
         SecretMediator? libsecret = null;
         try {
-            libsecret = yield new SecretMediator(this.application, cancellable);
+            libsecret = yield new SecretMediator(cancellable);
         } catch (GLib.Error err) {
             error("Error opening libsecret: %s", err.message);
         }
diff --git a/src/client/application/goa-mediator.vala b/src/client/application/goa-mediator.vala
index 40a41078..859b792d 100644
--- a/src/client/application/goa-mediator.vala
+++ b/src/client/application/goa-mediator.vala
@@ -94,17 +94,6 @@ public class GoaMediator : Geary.CredentialsMediator, Object {
         return loaded;
     }
 
-    public virtual async bool prompt_token(Geary.AccountInformation account,
-                                           Geary.ServiceInformation service,
-                                           GLib.Cancellable? cancellable)
-        throws GLib.Error {
-        // XXX Open a dialog that says "Click here to change your GOA
-        // password" or "GOA credentials need renewing" or
-        // something. Connect to the GOA service and wait until we
-        // hear that needs attention is no longer true.
-        return false;
-    }
-
     private Geary.Credentials.Method get_auth_method() throws GLib.Error {
         if (this.handle.get_oauth2_based() != null) {
             return Geary.Credentials.Method.OAUTH2;
diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala
index ca380753..3fa56a9b 100644
--- a/src/client/application/secret-mediator.vala
+++ b/src/client/application/secret-mediator.vala
@@ -35,14 +35,9 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
         null
     );
 
-    private GearyApplication application;
-    private Geary.Nonblocking.Mutex dialog_mutex = new Geary.Nonblocking.Mutex();
 
-
-    public async SecretMediator(GearyApplication application,
-                                GLib.Cancellable? cancellable)
+    public async SecretMediator(GLib.Cancellable? cancellable)
         throws GLib.Error {
-        this.application = application;
         yield check_unlocked(cancellable);
     }
 
@@ -70,44 +65,6 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
         return loaded;
     }
 
-    public virtual async bool prompt_token(Geary.AccountInformation account,
-                                           Geary.ServiceInformation service,
-                                           GLib.Cancellable? cancellable)
-        throws GLib.Error {
-        if (service.credentials != null) {
-            // to prevent multiple dialogs from popping up at the same
-            // time, use a nonblocking mutex to serialize the code
-            int token = yield dialog_mutex.claim_async(null);
-
-            // Ensure main window present to the window
-            this.application.present();
-
-            PasswordDialog password_dialog = new PasswordDialog(
-                this.application.get_active_window(),
-                account,
-                service
-            );
-            bool result = password_dialog.run();
-
-            dialog_mutex.release(ref token);
-
-            if (result) {
-                // password_dialog.password should never be null at this
-                // point. It will only be null when password_dialog.run()
-                // returns false, in which case we have already returned.
-                service.credentials = service.credentials.copy_with_token(
-                    password_dialog.password
-                );
-                service.remember_password = password_dialog.remember_password;
-
-                yield update_token(account, service, cancellable);
-
-                account.changed();
-            }
-        }
-        return true;
-    }
-
     public async void update_token(Geary.AccountInformation account,
                                    Geary.ServiceInformation service,
                                    Cancellable? cancellable)


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