[geary/mjog/810-goa-startup-freeze] Application.GoaMediator: Fix UI freeze while waiting for auth token




commit e40f0bd526b4acd70e6a9fef90203504aba7fafd
Author: Michael Gratton <mike vee net>
Date:   Sat Aug 29 17:59:26 2020 +1000

    Application.GoaMediator: Fix UI freeze while waiting for auth token
    
    The GOA mediator was using the sync GOA API to access tokens due to
    GNOME/vala#709. That's been fixed for ages, so lets use the async
    versions instead.
    
    That will help prevent the UI freezing when GOA tokens are being updated
    in the background, such as in #810.

 src/client/application/goa-mediator.vala | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/client/application/goa-mediator.vala b/src/client/application/goa-mediator.vala
index 859b792d5..baac0e6e6 100644
--- a/src/client/application/goa-mediator.vala
+++ b/src/client/application/goa-mediator.vala
@@ -50,11 +50,8 @@ public class GoaMediator : Geary.CredentialsMediator, Object {
                                          Geary.ServiceInformation service,
                                          Cancellable? cancellable)
         throws GLib.Error {
-        // XXX have to call the sync version of this since the async
-        // version seems to be broken. See
-        // https://gitlab.gnome.org/GNOME/vala/issues/709
-        this.handle.get_account().call_ensure_credentials_sync(
-            null, cancellable
+        yield this.handle.get_account().call_ensure_credentials(
+            cancellable, null
         );
 
         bool loaded = false;
@@ -62,22 +59,22 @@ public class GoaMediator : Geary.CredentialsMediator, Object {
 
         switch (get_auth_method()) {
         case OAUTH2:
-            this.handle.get_oauth2_based().call_get_access_token_sync(
-                out token, null, cancellable
+            yield this.handle.get_oauth2_based().call_get_access_token(
+                cancellable, out token, null
             );
             break;
 
         case PASSWORD:
             switch (service.protocol) {
             case Geary.Protocol.IMAP:
-                this.handle.get_password_based().call_get_password_sync(
-                    "imap-password", out token, cancellable
+                yield this.handle.get_password_based().call_get_password(
+                    "imap-password", cancellable, out token
                 );
                 break;
 
             case Geary.Protocol.SMTP:
-                this.handle.get_password_based().call_get_password_sync(
-                    "smtp-password", out token, cancellable
+                yield this.handle.get_password_based().call_get_password(
+                    "smtp-password", cancellable, out token
                 );
                 break;
 


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