[geary/mjog/account-command-stacks: 7/27] Application.Controller: Make context class publically accessible



commit 6f98e98a661c4f8d909c62cf04bb519de21efa21
Author: Michael Gratton <mike vee net>
Date:   Sat Oct 5 19:15:47 2019 +1000

    Application.Controller: Make context class publically accessible
    
    Promote AccountContext inner class to be public, document its members
    and provide accessor so other classes can look them up.

 src/client/application/application-controller.vala | 52 +++++++++++++++++++---
 1 file changed, 45 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index bee2b6d1..4621f670 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -34,21 +34,53 @@ public class Application.Controller : Geary.BaseObject {
     }
 
 
-    internal class AccountContext : Geary.BaseObject {
+    /**
+     * Collects objects and state related to a single open account.
+     */
+    public class AccountContext : Geary.BaseObject {
 
+        /** The account for this context. */
         public Geary.Account account { get; private set; }
+
+        /** The account's Inbox folder */
         public Geary.Folder? inbox = null;
+
+        /** The account's email store */
         public Geary.App.EmailStore emails { get; private set; }
+
+        /** The account's contact store */
         public Application.ContactStore contacts { get; private set; }
 
-        public bool authentication_failed = false;
-        public bool authentication_prompting = false;
-        public uint authentication_attempts = 0;
+        /** A cancellable tied to the life-cycle of the account. */
+        public Cancellable cancellable {
+            get; private set; default = new Cancellable();
+        }
 
-        public bool tls_validation_failed = false;
-        public bool tls_validation_prompting = false;
+        /** Determines if the account has an authentication problem. */
+        internal bool authentication_failed {
+            get; private set; default = false;
+        }
+
+        /** Determines if the account is prompting for a pasword. */
+        internal bool authentication_prompting {
+            get; private set; default = false;
+        }
+
+        /** Determines if currently prompting for a password. */
+        internal uint authentication_attempts {
+            get; private set; default = 0;
+        }
+
+        /** Determines if any TLS certificate errors have been seen. */
+        internal bool tls_validation_failed {
+            get; private set; default = false;
+        }
+
+        /** Determines if currently prompting about TLS certificate errors. */
+        internal bool tls_validation_prompting {
+            get; private set; default = false;
+        }
 
-        public Cancellable cancellable { get; private set; default = new Cancellable(); }
 
         public AccountContext(Geary.Account account,
                               Geary.App.EmailStore emails,
@@ -58,6 +90,7 @@ public class Application.Controller : Geary.BaseObject {
             this.contacts = contacts;
         }
 
+        /** Returns the current effective status for the account. */
         public Geary.Account.Status get_effective_status() {
             Geary.Account.Status current = this.account.current_status;
             Geary.Account.Status effective = 0;
@@ -293,6 +326,11 @@ public class Application.Controller : Geary.BaseObject {
         this.expunge_accounts.begin();
     }
 
+    /** Returns a context for an account, if any. */
+    public AccountContext? get_context_for_account(Geary.AccountInformation account) {
+        return this.accounts.get(account);
+    }
+
     /** Un-does the last executed application command, if any. */
     public async void undo() {
         this.commands.undo.begin(


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