[geary: 52/66] Change Geary.Account.last_storage_cleanup to automatic property



commit 7153b69bd755f01741500be87fb580845ca71432
Author: Chris Heywood <15127-creywood users noreply gitlab gnome org>
Date:   Thu May 7 19:51:15 2020 +1000

    Change Geary.Account.last_storage_cleanup to automatic property

 src/engine/api/geary-account.vala                       | 15 +--------------
 src/engine/imap-engine/imap-engine-generic-account.vala | 11 ++++++++---
 2 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index 34d67a30c..4a4850a57 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -155,15 +155,7 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
      * (in ImapDB.GC) has past, a GC reap is performed
      * 3. GC vacuum is run if recommended
      */
-    public GLib.DateTime? last_storage_cleanup {
-        get { return this._last_storage_cleanup; }
-        set {
-            this._last_storage_cleanup = value;
-            this.last_storage_cleanup_changed(value);
-        }
-    }
-    private GLib.DateTime? _last_storage_cleanup = null;
-
+    public GLib.DateTime? last_storage_cleanup { get; set; }
 
     public signal void opened();
 
@@ -279,11 +271,6 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
     public signal void email_flags_changed(Geary.Folder folder,
         Gee.Map<Geary.EmailIdentifier, Geary.EmailFlags> map);
 
-    /**
-     * Fired when last_storage_cleanup changes.
-     */
-    public signal void last_storage_cleanup_changed(GLib.DateTime? new_value);
-
     /** {@inheritDoc} */
     public Logging.Source? logging_parent { get { return null; } }
 
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index a192ca47e..6c5f1d2d5 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -141,9 +141,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
         }
 
         this.last_storage_cleanup = yield this.local.fetch_last_cleanup_async(cancellable);
-        this.last_storage_cleanup_changed.connect ((dt) => {
-            this.local.set_last_cleanup_async.begin(dt, cancellable);
-        });
+        this.notify["last_storage_cleanup"].connect(on_last_storage_cleanup_notify);
 
         this.open = true;
         notify_opened();
@@ -1004,6 +1002,13 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
         }
     }
 
+    private void on_last_storage_cleanup_notify() {
+        this.local.set_last_cleanup_async.begin(
+            this.last_storage_cleanup,
+            this.open_cancellable
+        );
+    }
+
 }
 
 


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