[geary/wip/conversation-polish: 3/26] Fix offline status with multiple accounts



commit 4c9c387adb09a58418eaa5c337dcd718fc93f57c
Author: Michael Gratton <mike vee net>
Date:   Thu Jan 24 18:48:30 2019 +1100

    Fix offline status with multiple accounts

 src/client/application/geary-controller.vala | 19 ++++++++++++++-----
 src/engine/api/geary-client-service.vala     |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 6091a2a1..f3ef50fa 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -688,15 +688,23 @@ public class GearyController : Geary.BaseObject {
     }
 
     private void update_account_status() {
-        Geary.Account.Status effective_status = 0;
+        // Start off assuming all accounts are online and error free
+        // (i.e. no status issues to indicate) and proceed until
+        // proven incorrect.
+        Geary.Account.Status effective_status = ONLINE;
         bool has_auth_error = false;
         bool has_cert_error = false;
         Geary.Account? service_problem_source = null;
         foreach (AccountContext context in this.accounts.values) {
-            effective_status |= context.get_effective_status();
-            if (effective_status.has_service_problem() &&
-                service_problem_source == null) {
-                service_problem_source = context.account;
+            Geary.Account.Status status = context.get_effective_status();
+            if (!status.is_online()) {
+                effective_status &= ~Geary.Account.Status.ONLINE;
+            }
+            if (status.has_service_problem()) {
+                effective_status |= SERVICE_PROBLEM;
+                if (service_problem_source == null) {
+                    service_problem_source = context.account;
+                }
             }
             has_auth_error |= context.authentication_failed;
             has_cert_error |= context.tls_validation_failed;
@@ -898,6 +906,7 @@ public class GearyController : Geary.BaseObject {
 
         main_window.folder_list.set_user_folders_root_name(account, _("Labels"));
         display_main_window_if_ready();
+        update_account_status();
     }
 
     // Returns true if the caller should try opening the account again
diff --git a/src/engine/api/geary-client-service.vala b/src/engine/api/geary-client-service.vala
index afd4d298..25d8da19 100644
--- a/src/engine/api/geary-client-service.vala
+++ b/src/engine/api/geary-client-service.vala
@@ -311,6 +311,8 @@ public abstract class Geary.ClientService : BaseObject {
         this.is_running = true;
         if (this.remote.connectivity.is_reachable.is_certain()) {
             became_reachable();
+        } else if (this.remote.connectivity.is_reachable.is_impossible()) {
+            this.current_status = UNREACHABLE;
         } else {
             this.remote.connectivity.check_reachable.begin();
         }


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