[geary/wip/minor-cleanup: 1/3] Fix build warning



commit b88278c2af2e98fefa89c3a9c9dac50438e18677
Author: Michael Gratton <mike vee net>
Date:   Wed Aug 28 09:58:15 2019 +1000

    Fix build warning

 src/client/application/geary-application.vala | 10 +++-------
 src/engine/api/geary-engine.vala              |  5 +++++
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index d9dab358..944f1a76 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -721,10 +721,7 @@ public class GearyApplication : Gtk.Application {
                 this.controller = yield new Application.Controller(
                     this, this.controller_cancellable
                 );
-
-                if (this.engine.get_accounts().size == 0) {
-                    first_run = true;
-                }
+                first_run = !this.engine.has_accounts;
             }
             this.controler_mutex.release(ref mutex_token);
         } catch (Error err) {
@@ -733,10 +730,9 @@ public class GearyApplication : Gtk.Application {
 
         if (first_run) {
             yield show_accounts();
-            if (this.engine.get_accounts().size == 0) {
+            if (!this.engine.has_accounts) {
                 // No accounts were added after showing the accounts
-                // editor, accounts editor, so nothing else to do but
-                // exit.
+                // editor, so nothing else to do but exit.
                 quit();
             }
         }
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 7d8231e8..71243002 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -47,6 +47,11 @@ public class Geary.Engine : BaseObject {
     }
 
 
+    /** Determines if any accounts have been added to this instance. */
+    public bool has_accounts {
+        get { return this.accounts != null && !this.accounts.is_empty; }
+    }
+
     /** Location of the directory containing shared resource files. */
     public File? resource_dir { get; private set; default = null; }
 


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