[geary/mjog/invert-folder-class-hierarchy: 21/72] Geary.Folder, Geary.RemoteFolder: Convert into interfaces




commit 1d994ca4949f162cad52857b71b50199ef1fbc91
Author: Michael Gratton <mike vee net>
Date:   Sat Feb 13 16:29:44 2021 +1100

    Geary.Folder, Geary.RemoteFolder: Convert into interfaces
    
    Convert folder and remote folder abstract classes into interfaces so
    in the future implementations can be more easily shared.

 .../plugin/mail-merge/mail-merge-folder.vala       | 23 +++++++++---
 src/engine/api/geary-folder.vala                   | 25 ++++---------
 src/engine/api/geary-remote-folder.vala            |  6 +--
 src/engine/app/app-search-folder.vala              | 40 +++++++++++++-------
 .../imap-engine/imap-engine-minimal-folder.vala    | 42 ++++++++++++---------
 src/engine/outbox/outbox-folder.vala               | 31 +++++++++++-----
 test/mock/mock-folder.vala                         | 22 ++++++++---
 test/mock/mock-remote-folder.vala                  | 43 ++++++++++++++--------
 8 files changed, 145 insertions(+), 87 deletions(-)
---
diff --git a/src/client/plugin/mail-merge/mail-merge-folder.vala 
b/src/client/plugin/mail-merge/mail-merge-folder.vala
index 7d2dbd1e2..e75491d67 100644
--- a/src/client/plugin/mail-merge/mail-merge-folder.vala
+++ b/src/client/plugin/mail-merge/mail-merge-folder.vala
@@ -8,7 +8,9 @@
 /**
  * Plugin to Fill in and send email templates using a spreadsheet.
  */
-public class MailMerge.Folder : Geary.Folder {
+public class MailMerge.Folder : Geary.BaseObject,
+    Geary.Logging.Source,
+    Geary.Folder {
 
 
     private class EmailIdentifier : Geary.EmailIdentifier {
@@ -129,6 +131,10 @@ public class MailMerge.Folder : Geary.Folder {
     /** Specifies if the merged mail is currently being sent. */
     public bool is_sending { get; private set; default = false; }
 
+    /** {@inheritDoc} */
+    public Geary.Logging.Source? logging_parent {
+        get { return this.account; }
+    }
 
     private Gee.List<Geary.EmailIdentifier> ids =
         new Gee.ArrayList<Geary.EmailIdentifier>();
@@ -190,7 +196,7 @@ public class MailMerge.Folder : Geary.Folder {
     }
 
     /** {@inheritDoc} */
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -201,7 +207,7 @@ public class MailMerge.Folder : Geary.Folder {
         ).to_hash_set();
     }
 
-    public override async Geary.Email
+    public async Geary.Email
         fetch_email_async(Geary.EmailIdentifier id,
                           Geary.Email.Field required_fields,
                           Geary.Folder.ListFlags flags,
@@ -216,7 +222,7 @@ public class MailMerge.Folder : Geary.Folder {
         return email;
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_id_async(Geary.EmailIdentifier? initial_id,
                                int count,
                                Geary.Email.Field required_fields,
@@ -264,7 +270,7 @@ public class MailMerge.Folder : Geary.Folder {
         return (list.size > 0) ? list : null;
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_sparse_id_async(Gee.Collection<Geary.EmailIdentifier> ids,
                                       Geary.Email.Field required_fields,
                                       Geary.Folder.ListFlags flags,
@@ -283,7 +289,8 @@ public class MailMerge.Folder : Geary.Folder {
         return (list.size > 0) ? list : null;
     }
 
-    public override void set_used_as_custom(bool enabled)
+    /** {@inheritDoc} */
+    public void set_used_as_custom(bool enabled)
         throws Geary.EngineError.UNSUPPORTED {
         this._used_as = (
             enabled
@@ -292,6 +299,10 @@ public class MailMerge.Folder : Geary.Folder {
         );
     }
 
+    /** {@inheritDoc} */
+    public virtual Geary.Logging.State to_logging_state() {
+        return new Geary.Logging.State(this, this.path.to_string());
+    }
 
     // NB: This is called from a thread outside of the main loop
     private async void load_data(GLib.Cancellable? cancellable) {
diff --git a/src/engine/api/geary-folder.vala b/src/engine/api/geary-folder.vala
index ceacafd88..b3db09f48 100644
--- a/src/engine/api/geary-folder.vala
+++ b/src/engine/api/geary-folder.vala
@@ -34,7 +34,7 @@
  * presence of {@link FolderSupport} interfaces, include {@link
  * FolderSupport.Remove}, {@link FolderSupport.Copy}, and so forth.
  */
-public abstract class Geary.Folder : BaseObject, Logging.Source {
+public interface Geary.Folder : GLib.Object, Logging.Source {
 
 
     /**
@@ -179,10 +179,6 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
      */
     public abstract SpecialUse used_as { get; }
 
-    /** {@inheritDoc} */
-    public Logging.Source? logging_parent {
-        get { return this.account; }
-    }
 
     /**
      * Fired when email has been appended to the folder.
@@ -244,15 +240,15 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
      * and {@link email_removed} (although see the note at
      * email_removed).
      */
-    public signal void email_count_changed(int new_count, CountChangeReason reason);
+    public virtual signal void email_count_changed(int new_count, CountChangeReason reason);
 
     /**
-    * Fired when the folder's special use has changed.
-    *
-    * This will usually happen when the local object has been updated
-    * with data discovered from the remote account.
-    */
-    public signal void use_changed(SpecialUse old_use, SpecialUse new_use);
+     * Fired when the folder's special use has changed.
+     *
+     * This will usually happen when the local object has been updated
+     * with data discovered from the remote account.
+     */
+    public virtual signal void use_changed(SpecialUse old_use, SpecialUse new_use);
 
 
     /**
@@ -375,9 +371,4 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
     public abstract void set_used_as_custom(bool enabled)
         throws EngineError.UNSUPPORTED;
 
-    /** {@inheritDoc} */
-    public virtual Logging.State to_logging_state() {
-        return new Logging.State(this, this.path.to_string());
-    }
-
 }
diff --git a/src/engine/api/geary-remote-folder.vala b/src/engine/api/geary-remote-folder.vala
index de3597df7..f7290d0fa 100644
--- a/src/engine/api/geary-remote-folder.vala
+++ b/src/engine/api/geary-remote-folder.vala
@@ -34,11 +34,11 @@
  * expand_vector}, causing the lower end of the vector to be
  * temporarily ''expanded''.
  */
-public abstract class Geary.RemoteFolder : Folder {
+public interface Geary.RemoteFolder : Folder {
 
 
     /**
-     * Determines if the folder is checking for remote changes to email.
+     * Indicates if the folder is checking for remote changes to email.
      *
      * @see start_monitoring
      * @see stop_monitoring
@@ -46,7 +46,7 @@ public abstract class Geary.RemoteFolder : Folder {
     public abstract bool is_monitoring { get; }
 
     /**
-     * Determines if the folder's local vector contains all remote email.
+     * Indicates if the folder's local vector contains all remote email.
      *
      * This property is not guaranteed to be accurate at all times. It
      * is only updated whenever a connection to the remote folder is
diff --git a/src/engine/app/app-search-folder.vala b/src/engine/app/app-search-folder.vala
index 6ecbbd2b3..4dcdffe34 100644
--- a/src/engine/app/app-search-folder.vala
+++ b/src/engine/app/app-search-folder.vala
@@ -13,7 +13,10 @@
  * search, then collects search results and presents them via the
  * folder interface.
  */
-public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
+public class Geary.App.SearchFolder : BaseObject,
+    Logging.Source,
+    Folder,
+    FolderSupport.Remove {
 
 
     /** Number of messages to include in the initial search. */
@@ -75,19 +78,19 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
 
 
     /** {@inheritDoc} */
-    public override Account account {
+    public Account account {
         get { return _account; }
     }
     private weak Account _account;
 
     /** {@inheritDoc} */
-    public override FolderProperties properties {
+    public FolderProperties properties {
         get { return _properties; }
     }
     private FolderPropertiesImpl _properties;
 
     /** {@inheritDoc} */
-    public override FolderPath path {
+    public FolderPath path {
         get { return _path; }
     }
     private FolderPath? _path = null;
@@ -97,13 +100,18 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
      *
      * Always returns {@link Folder.SpecialUse.SEARCH}.
      */
-    public override Folder.SpecialUse used_as {
+    public Folder.SpecialUse used_as {
         get { return SEARCH; }
     }
 
     /** The query being evaluated by this folder, if any. */
     public SearchQuery? query { get; protected set; default = null; }
 
+    /** {@inheritDoc} */
+    public Logging.Source? logging_parent {
+        get { return this.account; }
+    }
+
     // Folders that should be excluded from search
     private Gee.HashSet<FolderPath?> exclude_folders =
         new Gee.HashSet<FolderPath?>();
@@ -203,7 +211,7 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
     }
 
     /** {@inheritDoc} */
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -220,7 +228,7 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
         ).to_hash_set();
     }
 
-    public override async Gee.List<Email>? list_email_by_id_async(
+    public async Gee.List<Email>? list_email_by_id_async(
         EmailIdentifier? initial_id,
         int count,
         Email.Field required_fields,
@@ -318,7 +326,7 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
         return results;
     }
 
-    public override async Gee.List<Email>? list_email_by_sparse_id_async(
+    public async Gee.List<Email>? list_email_by_sparse_id_async(
         Gee.Collection<EmailIdentifier> list,
         Email.Field required_fields,
         Folder.ListFlags flags,
@@ -329,10 +337,10 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
         );
     }
 
-    public override async Email fetch_email_async(EmailIdentifier fetch,
-                                                  Email.Field required_fields,
-                                                  Folder.ListFlags flags,
-                                                  GLib.Cancellable? cancellable = null)
+    public async Email fetch_email_async(EmailIdentifier fetch,
+                                         Email.Field required_fields,
+                                         Folder.ListFlags flags,
+                                         GLib.Cancellable? cancellable = null)
         throws GLib.Error {
         require_id(fetch);
         return yield this.account.local_fetch_email_async(
@@ -366,11 +374,17 @@ public class Geary.App.SearchFolder : Folder, FolderSupport.Remove {
         }
     }
 
-    public override void set_used_as_custom(bool enabled)
+    /** {@inheritDoc} */
+    public void set_used_as_custom(bool enabled)
         throws EngineError.UNSUPPORTED {
         throw new EngineError.UNSUPPORTED("Folder special use cannot be changed");
     }
 
+    /** {@inheritDoc} */
+    public virtual Logging.State to_logging_state() {
+        return new Logging.State(this, this.path.to_string());
+    }
+
     private void require_id(EmailIdentifier id)
         throws EngineError.NOT_FOUND {
         if (!this.ids.has_key(id)) {
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala 
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 96076228f..5c421357f 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -20,7 +20,10 @@
  * A remote folder connection is not automatically established, only
  * if monitoring or as needed for other folder operations.
  */
-private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
+private class Geary.ImapEngine.MinimalFolder : BaseObject,
+    Logging.Source,
+    Folder,
+    RemoteFolder,
     FolderSupport.Copy,
     FolderSupport.Mark,
     FolderSupport.Move {
@@ -34,26 +37,26 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
 
 
     /** {@inheritDoc} */
-    public override Account account {
+    public Account account {
         get { return this._account; }
     }
     private weak GenericAccount _account;
 
     /** {@inheritDoc} */
-    public override FolderProperties properties {
+    public FolderProperties properties {
         get { return this._properties; }
     }
     private FolderProperties _properties;
 
     /** {@inheritDoc} */
-    public override FolderPath path {
+    public FolderPath path {
         get {
             return local_folder.get_path();
         }
     }
 
     /** {@inheritDoc} */
-    public override Folder.SpecialUse used_as {
+    public Folder.SpecialUse used_as {
         get {
             return this._used_as;
         }
@@ -61,17 +64,22 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     private Folder.SpecialUse _used_as;
 
     /** {@inheritDoc} */
-    public override bool is_monitoring {
+    public bool is_monitoring {
         get { return this._is_monitoring; }
     }
     private bool _is_monitoring = false;
 
     /** {@inheritDoc} */
-    public override bool is_fully_expanded {
+    public bool is_fully_expanded {
         get { return this._is_fully_expanded; }
     }
     private bool _is_fully_expanded = false;
 
+    /** {@inheritDoc} */
+    public Logging.Source? logging_parent {
+        get { return this.account; }
+    }
+
     /** Determines if there is currently a remote session. */
     internal bool is_remote_open {
         get { return this.remote_session != null; }
@@ -138,7 +146,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
         this.closed_semaphore.blind_notify();
     }
 
-    public override void set_used_as_custom(bool enabled)
+    public void set_used_as_custom(bool enabled)
         throws EngineError.UNSUPPORTED {
         if (enabled) {
             if (this._used_as != NONE) {
@@ -168,7 +176,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override void start_monitoring() {
+    public void start_monitoring() {
         this._is_monitoring = true;
         this._account.imap.notify["current-status"].connect(
             this.on_remote_status_check
@@ -177,7 +185,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override void stop_monitoring() {
+    public void stop_monitoring() {
         this._is_monitoring = false;
         this._account.imap.notify["current-status"].disconnect(
             this.on_remote_status_check
@@ -186,7 +194,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override async void synchronise(GLib.Cancellable? cancellable)
+    public async void synchronise(GLib.Cancellable? cancellable)
         throws GLib.Error {
         bool have_nooped = false;
         int retries = 3;
@@ -243,7 +251,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override async void expand_vector(GLib.Cancellable? cancellable)
+    public async void expand_vector(GLib.Cancellable? cancellable)
         throws GLib.Error {
 
     }
@@ -825,7 +833,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -836,7 +844,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     // list email variants
     //
 
-    public override async Gee.List<Geary.Email>? list_email_by_id_async(Geary.EmailIdentifier? initial_id,
+    public async Gee.List<Geary.Email>? list_email_by_id_async(Geary.EmailIdentifier? initial_id,
         int count, Geary.Email.Field required_fields, Folder.ListFlags flags,
         Cancellable? cancellable = null) throws Error {
         check_flags("list_email_by_id_async", flags);
@@ -856,7 +864,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
         return !op.accumulator.is_empty ? op.accumulator : null;
     }
 
-    public async override Gee.List<Geary.Email>? list_email_by_sparse_id_async(
+    public async Gee.List<Geary.Email>? list_email_by_sparse_id_async(
         Gee.Collection<Geary.EmailIdentifier> ids, Geary.Email.Field required_fields, Folder.ListFlags flags,
         Cancellable? cancellable = null) throws Error {
         check_flags("list_email_by_sparse_id_async", flags);
@@ -876,7 +884,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
         return !op.accumulator.is_empty ? op.accumulator : null;
     }
 
-    public override async Geary.Email fetch_email_async(Geary.EmailIdentifier id,
+    public async Geary.Email fetch_email_async(Geary.EmailIdentifier id,
         Geary.Email.Field required_fields, Geary.Folder.ListFlags flags, Cancellable? cancellable = null)
         throws Error {
         check_flags("fetch_email_async", flags);
@@ -1030,7 +1038,7 @@ private class Geary.ImapEngine.MinimalFolder : RemoteFolder,
     }
 
     /** {@inheritDoc} */
-    public override Logging.State to_logging_state() {
+    public Logging.State to_logging_state() {
         return new Logging.State(
             this,
             "%s, remote_opened=%s",
diff --git a/src/engine/outbox/outbox-folder.vala b/src/engine/outbox/outbox-folder.vala
index b1754a2d5..1724b9db9 100644
--- a/src/engine/outbox/outbox-folder.vala
+++ b/src/engine/outbox/outbox-folder.vala
@@ -9,10 +9,12 @@
 /**
  * A folder for storing outgoing mail.
  */
-public class Geary.Outbox.Folder : Geary.Folder,
-    Geary.FolderSupport.Create,
-    Geary.FolderSupport.Mark,
-    Geary.FolderSupport.Remove {
+public class Geary.Outbox.Folder : BaseObject,
+    Logging.Source,
+    Geary.Folder,
+    FolderSupport.Create,
+    FolderSupport.Mark,
+    FolderSupport.Remove {
 
 
     /** The canonical name of the outbox folder. */
@@ -73,6 +75,11 @@ public class Geary.Outbox.Folder : Geary.Folder,
         }
     }
 
+    /** {@inheritDoc} */
+    public Logging.Source? logging_parent {
+        get { return this.account; }
+    }
+
     private weak Account _account;
     private Db.Database db = null;
     private FolderProperties _properties = new FolderProperties(0, 0);
@@ -186,7 +193,7 @@ public class Geary.Outbox.Folder : Geary.Folder,
     }
 
     /** {@inheritDoc} */
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -212,7 +219,7 @@ public class Geary.Outbox.Folder : Geary.Folder,
         return contains;
     }
 
-    public override async Gee.List<Email>?
+    public async Gee.List<Email>?
         list_email_by_id_async(Geary.EmailIdentifier? _initial_id,
                                int count,
                                Geary.Email.Field required_fields,
@@ -297,7 +304,7 @@ public class Geary.Outbox.Folder : Geary.Folder,
         return list;
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_sparse_id_async(Gee.Collection<Geary.EmailIdentifier> ids,
                                       Geary.Email.Field required_fields,
                                       Geary.Folder.ListFlags flags,
@@ -323,7 +330,7 @@ public class Geary.Outbox.Folder : Geary.Folder,
         return (list.size > 0) ? list : null;
     }
 
-    public override async Email
+    public async Email
         fetch_email_async(Geary.EmailIdentifier id,
                           Geary.Email.Field required_fields,
                           Geary.Folder.ListFlags flags,
@@ -346,11 +353,17 @@ public class Geary.Outbox.Folder : Geary.Folder,
         return row_to_email(row);
     }
 
-    public override void set_used_as_custom(bool enabled)
+    /** {@inheritDoc} */
+    public void set_used_as_custom(bool enabled)
         throws EngineError.UNSUPPORTED {
         throw new EngineError.UNSUPPORTED("Folder special use cannot be changed");
     }
 
+    /** {@inheritDoc} */
+    public virtual Logging.State to_logging_state() {
+        return new Logging.State(this, this.path.to_string());
+    }
+
     // Utility for getting an email object back from an outbox row.
     private Geary.Email row_to_email(OutboxRow row) throws Error {
         Geary.Email? email = null;
diff --git a/test/mock/mock-folder.vala b/test/mock/mock-folder.vala
index ebf73f218..951d32aba 100644
--- a/test/mock/mock-folder.vala
+++ b/test/mock/mock-folder.vala
@@ -5,7 +5,9 @@
  * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
-public class Mock.Folder : Geary.Folder,
+public class Mock.Folder : GLib.Object,
+    Geary.Logging.Source,
+    Geary.Folder,
     ValaUnit.TestAssertions,
     ValaUnit.MockObject {
 
@@ -26,6 +28,10 @@ public class Mock.Folder : Geary.Folder,
         get { return this._used_as; }
     }
 
+    public Geary.Logging.Source? logging_parent {
+        get { return this.account; }
+    }
+
     protected Gee.Queue<ValaUnit.ExpectedCall> expected {
         get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
     }
@@ -50,7 +56,7 @@ public class Mock.Folder : Geary.Folder,
         this._opening_monitor = monitor;
     }
 
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -61,7 +67,7 @@ public class Mock.Folder : Geary.Folder,
         );
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_id_async(Geary.EmailIdentifier? initial_id,
                                int count,
                                Geary.Email.Field required_fields,
@@ -75,7 +81,7 @@ public class Mock.Folder : Geary.Folder,
         );
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_sparse_id_async(Gee.Collection<Geary.EmailIdentifier> ids,
                                       Geary.Email.Field required_fields,
                                       Geary.Folder.ListFlags flags,
@@ -88,7 +94,7 @@ public class Mock.Folder : Geary.Folder,
         );
     }
 
-    public override async Geary.Email
+    public async Geary.Email
         fetch_email_async(Geary.EmailIdentifier email_id,
                           Geary.Email.Field required_fields,
                           Geary.Folder.ListFlags flags,
@@ -97,9 +103,13 @@ public class Mock.Folder : Geary.Folder,
         throw new Geary.EngineError.UNSUPPORTED("Mock method");
     }
 
-    public override void set_used_as_custom(bool enabled)
+    public void set_used_as_custom(bool enabled)
         throws Geary.EngineError.UNSUPPORTED {
         throw new Geary.EngineError.UNSUPPORTED("Mock method");
     }
 
+    public virtual Geary.Logging.State to_logging_state() {
+        return new Geary.Logging.State(this, this.path.to_string());
+    }
+
 }
diff --git a/test/mock/mock-remote-folder.vala b/test/mock/mock-remote-folder.vala
index 75cf54a8d..3a5902937 100644
--- a/test/mock/mock-remote-folder.vala
+++ b/test/mock/mock-remote-folder.vala
@@ -5,37 +5,44 @@
  * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
-public class Mock.RemoteFolder : Geary.RemoteFolder,
+public class Mock.RemoteFolder : GLib.Object,
+    Geary.Logging.Source,
+    Geary.Folder,
+    Geary.RemoteFolder,
     ValaUnit.TestAssertions,
     ValaUnit.MockObject {
 
 
-    public override Geary.Account account {
+    public Geary.Account account {
         get { return this._account; }
     }
 
-    public override Geary.FolderProperties properties {
+    public Geary.FolderProperties properties {
         get { return this._properties; }
     }
 
-    public override Geary.FolderPath path {
+    public Geary.FolderPath path {
         get { return this._path; }
     }
 
-    public override Geary.Folder.SpecialUse used_as {
+    public Geary.Folder.SpecialUse used_as {
         get { return this._used_as; }
     }
 
-    public override bool is_monitoring {
+    public bool is_monitoring {
         get { return this._is_monitoring; }
     }
     private bool _is_monitoring = false;
 
-    public override bool is_fully_expanded {
+    public bool is_fully_expanded {
         get { return this._is_fully_expanded; }
     }
     private bool _is_fully_expanded = false;
 
+    public Geary.Logging.Source? logging_parent {
+        get { return this.account; }
+    }
+
     protected Gee.Queue<ValaUnit.ExpectedCall> expected {
         get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
     }
@@ -64,7 +71,7 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         this._is_fully_expanded = is_fully_expanded;
     }
 
-    public override async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
+    public async Gee.Collection<Geary.EmailIdentifier> contains_identifiers(
         Gee.Collection<Geary.EmailIdentifier> ids,
         GLib.Cancellable? cancellable = null)
     throws GLib.Error {
@@ -75,7 +82,7 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         );
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_id_async(Geary.EmailIdentifier? initial_id,
                                int count,
                                Geary.Email.Field required_fields,
@@ -89,7 +96,7 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         );
     }
 
-    public override async Gee.List<Geary.Email>?
+    public async Gee.List<Geary.Email>?
         list_email_by_sparse_id_async(Gee.Collection<Geary.EmailIdentifier> ids,
                                       Geary.Email.Field required_fields,
                                       Geary.Folder.ListFlags flags,
@@ -102,7 +109,7 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         );
     }
 
-    public override async Geary.Email
+    public async Geary.Email
         fetch_email_async(Geary.EmailIdentifier email_id,
                           Geary.Email.Field required_fields,
                           Geary.Folder.ListFlags flags,
@@ -111,12 +118,12 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         throw new Geary.EngineError.UNSUPPORTED("Mock method");
     }
 
-    public override void set_used_as_custom(bool enabled)
+    public void set_used_as_custom(bool enabled)
         throws Geary.EngineError.UNSUPPORTED {
         throw new Geary.EngineError.UNSUPPORTED("Mock method");
     }
 
-    public override void start_monitoring() {
+    public void start_monitoring() {
         try {
             void_call("start_monitoring", {});
             this._is_monitoring = true;
@@ -125,7 +132,7 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         }
     }
 
-    public override void stop_monitoring() {
+    public void stop_monitoring() {
         try {
             void_call("stop_monitoring", {});
             this._is_monitoring = false;
@@ -134,14 +141,18 @@ public class Mock.RemoteFolder : Geary.RemoteFolder,
         }
     }
 
-    public override async void synchronise(GLib.Cancellable? cancellable)
+    public async void synchronise(GLib.Cancellable? cancellable)
         throws GLib.Error {
         yield void_call_async("synchronise", { cancellable });
     }
 
-    public override async void expand_vector(GLib.Cancellable? cancellable)
+    public async void expand_vector(GLib.Cancellable? cancellable)
         throws GLib.Error {
         yield void_call_async("expand_vector", { cancellable });
     }
 
+    public virtual Geary.Logging.State to_logging_state() {
+        return new Geary.Logging.State(this, this.path.to_string());
+    }
+
 }


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