[geary/mjog/email-templates: 2/17] Application.AccountContext: Break out unto standalone source file



commit 2392361f6af9b869317f2d6ac6d1bc4a03987116
Author: Michael Gratton <mike vee net>
Date:   Thu Apr 2 14:01:03 2020 +1100

    Application.AccountContext: Break out unto standalone source file

 po/POTFILES.in                                     |   1 +
 .../application/application-account-context.vala   | 102 +++++++++++++++++++++
 src/client/application/application-controller.vala |  96 -------------------
 src/client/meson.build                             |   1 +
 4 files changed, 104 insertions(+), 96 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2c283f31..111e658b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,7 @@ src/client/accounts/accounts-editor-row.vala
 src/client/accounts/accounts-editor-servers-pane.vala
 src/client/accounts/accounts-manager.vala
 src/client/accounts/accounts-signature-web-view.vala
+src/client/application/application-account-context.vala
 src/client/application/application-attachment-manager.vala
 src/client/application/application-avatar-store.vala
 src/client/application/application-certificate-manager.vala
diff --git a/src/client/application/application-account-context.vala 
b/src/client/application/application-account-context.vala
new file mode 100644
index 00000000..28a6ed1c
--- /dev/null
+++ b/src/client/application/application-account-context.vala
@@ -0,0 +1,102 @@
+/*
+ * Copyright © 2020 Michael Gratton <mike vee net>
+ *
+ * This software is licensed under the GNU Lesser General Public License
+ * (version 2.1 or later). See the COPYING file in this distribution.
+ */
+
+
+/**
+ * Collects application state related to a single open account.
+ */
+internal class Application.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 search folder */
+    public Geary.App.SearchFolder search = null;
+
+    /** The account's email store */
+    public Geary.App.EmailStore emails { get; private set; }
+
+    /** The account's contact store */
+    public ContactStore contacts { get; private set; }
+
+    /** The account's application command stack. */
+    public CommandStack commands {
+        get { return this.controller_stack; }
+    }
+
+    /** A cancellable tied to the life-cycle of the account. */
+    public Cancellable cancellable {
+        get; private set; default = new Cancellable();
+    }
+
+    /** The account's application command stack. */
+    internal ControllerCommandStack controller_stack {
+        get; protected set; default = new ControllerCommandStack();
+    }
+
+    /** Determines if the account has an authentication problem. */
+    internal bool authentication_failed {
+        get; internal set; default = false;
+    }
+
+    /** Determines if the account is prompting for a pasword. */
+    internal bool authentication_prompting {
+        get; internal set; default = false;
+    }
+
+    /** Determines if currently prompting for a password. */
+    internal uint authentication_attempts {
+        get; internal set; default = 0;
+    }
+
+    /** Determines if any TLS certificate errors have been seen. */
+    internal bool tls_validation_failed {
+        get; internal set; default = false;
+    }
+
+    /** Determines if currently prompting about TLS certificate errors. */
+    internal bool tls_validation_prompting {
+        get; internal set; default = false;
+    }
+
+
+    public AccountContext(Geary.Account account,
+                          Geary.App.SearchFolder search,
+                          Geary.App.EmailStore emails,
+                          Application.ContactStore contacts) {
+        this.account = account;
+        this.search = search;
+        this.emails = emails;
+        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;
+        if (current.is_online()) {
+            effective |= ONLINE;
+        }
+        if (current.has_service_problem()) {
+            // Only retain service problem if the problem isn't auth
+            // or cert related, that is handled elsewhere.
+            const Geary.ClientService.Status SPECIALS[] = {
+                AUTHENTICATION_FAILED,
+                TLS_VALIDATION_FAILED
+            };
+            if (!(account.incoming.current_status in SPECIALS) &&
+                !(account.outgoing.current_status in SPECIALS)) {
+                effective |= SERVICE_PROBLEM;
+            }
+        }
+        return effective;
+    }
+
+}
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 4ca43b7f..dc95c9c7 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -1689,102 +1689,6 @@ internal class Application.Controller : Geary.BaseObject {
 }
 
 
-/**
- * Collects application state related to a single open account.
- */
-internal class Application.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 search folder */
-    public Geary.App.SearchFolder search = null;
-
-    /** The account's email store */
-    public Geary.App.EmailStore emails { get; private set; }
-
-    /** The account's contact store */
-    public ContactStore contacts { get; private set; }
-
-    /** The account's application command stack. */
-    public CommandStack commands {
-        get { return this.controller_stack; }
-    }
-
-    /** A cancellable tied to the life-cycle of the account. */
-    public Cancellable cancellable {
-        get; private set; default = new Cancellable();
-    }
-
-    /** The account's application command stack. */
-    internal ControllerCommandStack controller_stack {
-        get; protected set; default = new ControllerCommandStack();
-    }
-
-    /** 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 AccountContext(Geary.Account account,
-                          Geary.App.SearchFolder search,
-                          Geary.App.EmailStore emails,
-                          Application.ContactStore contacts) {
-        this.account = account;
-        this.search = search;
-        this.emails = emails;
-        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;
-        if (current.is_online()) {
-            effective |= ONLINE;
-        }
-        if (current.has_service_problem()) {
-            // Only retain service problem if the problem isn't auth
-            // or cert related, that is handled elsewhere.
-            const Geary.ClientService.Status SPECIALS[] = {
-                AUTHENTICATION_FAILED,
-                TLS_VALIDATION_FAILED
-            };
-            if (!(account.incoming.current_status in SPECIALS) &&
-                !(account.outgoing.current_status in SPECIALS)) {
-                effective |= SERVICE_PROBLEM;
-            }
-        }
-        return effective;
-    }
-
-}
-
-
 /** Base class for all application controller commands. */
 internal class Application.ControllerCommandStack : CommandStack {
 
diff --git a/src/client/meson.build b/src/client/meson.build
index c86e42ea..75c1712b 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -11,6 +11,7 @@ geary_client_package = '@0@-@1@'.format(
 )
 
 geary_client_vala_sources = files(
+  'application/application-account-context.vala',
   'application/application-attachment-manager.vala',
   'application/application-avatar-store.vala',
   'application/application-certificate-manager.vala',


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