[geary/wip/search-fixes: 12/23] Explicitly flag when ConversationMonitor Fill op is done



commit 52e558f2255c3629db8878fcd18051a48c7b0a04
Author: Michael Gratton <mike vee net>
Date:   Sun Aug 18 18:38:53 2019 +1000

    Explicitly flag when ConversationMonitor Fill op is done
    
    Flag when out of messages to load on both local and remote, and clear
    it when the remote has re-connected.

 src/engine/app/app-conversation-monitor.vala                       | 5 ++++-
 src/engine/app/conversation-monitor/app-fill-window-operation.vala | 2 ++
 src/engine/app/conversation-monitor/app-reseed-operation.vala      | 7 ++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 14d5ff55..1a9c31b8 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -91,7 +91,7 @@ public class Geary.App.ConversationMonitor : BaseObject {
             return (
                 this.base_folder.properties.email_total >
                 this.folder_window_size
-            );
+            ) && !this.fill_complete;
         }
     }
 
@@ -127,6 +127,9 @@ public class Geary.App.ConversationMonitor : BaseObject {
         }
     }
 
+    /** Determines if the fill operation can load more messages. */
+    internal bool fill_complete { get; set; default = false; }
+
     private Geary.Email.Field required_fields;
     private Geary.Folder.OpenFlags open_flags;
     private ConversationOperationQueue queue = null;
diff --git a/src/engine/app/conversation-monitor/app-fill-window-operation.vala 
b/src/engine/app/conversation-monitor/app-fill-window-operation.vala
index bd6595fc..60e9f717 100644
--- a/src/engine/app/conversation-monitor/app-fill-window-operation.vala
+++ b/src/engine/app/conversation-monitor/app-fill-window-operation.vala
@@ -78,6 +78,8 @@ private class Geary.App.FillWindowOperation : ConversationOperation {
             // Loaded the maximum number of messages, so go see if
             // there are any more needed.
             this.monitor.check_window_count();
+        } else {
+            this.monitor.fill_complete = true;
         }
 
     }
diff --git a/src/engine/app/conversation-monitor/app-reseed-operation.vala 
b/src/engine/app/conversation-monitor/app-reseed-operation.vala
index 62207c57..3d3d7d47 100644
--- a/src/engine/app/conversation-monitor/app-reseed-operation.vala
+++ b/src/engine/app/conversation-monitor/app-reseed-operation.vala
@@ -1,8 +1,9 @@
 /*
  * Copyright 2016 Software Freedom Conservancy Inc.
+ * Copyright 2019 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.
+ * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
 /**
@@ -21,6 +22,10 @@ private class Geary.App.ReseedOperation : ConversationOperation {
     }
 
     public override async void execute_async() throws Error {
+        // Clear the fill flag since more messages may have appeared
+        // after coming online.
+        this.monitor.fill_complete = false;
+
         EmailIdentifier? earliest_id = this.monitor.window_lowest;
         if (earliest_id != null) {
             debug("Reseeding starting from Email ID %s on opened %s",


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