[geary/wip/765516-gtk-widget-conversation-viewer] Fix some bugs in AggregateProgressMonitor when removing monitors.



commit 3f293926d12f8858e67aef208d5640ba4cd24430
Author: Michael James Gratton <mike vee net>
Date:   Fri Aug 19 10:24:35 2016 +1000

    Fix some bugs in AggregateProgressMonitor when removing monitors.
    
    * src/engine/api/geary-progress-monitor.vala (ProgressMonitor): Send a
      start signal if an added monitor is already running, send a finish
      signal if in progress and the the last removed monitor is as well.

 src/engine/api/geary-progress-monitor.vala |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/api/geary-progress-monitor.vala b/src/engine/api/geary-progress-monitor.vala
index f72510c..4ce4dc8 100644
--- a/src/engine/api/geary-progress-monitor.vala
+++ b/src/engine/api/geary-progress-monitor.vala
@@ -217,17 +217,23 @@ public class Geary.AggregateProgressMonitor : Geary.ProgressMonitor {
         pm.start.connect(on_start);
         pm.update.connect(on_update);
         pm.finish.connect(on_finish);
+
+        if (!this.is_in_progress && pm.is_in_progress) {
+            notify_start();
+        }
     }
-    
+
     public void remove(Geary.ProgressMonitor pm) {
         // TODO: Handle the case where we remove a new monitor during progress.
         monitors.remove(pm);
         pm.start.disconnect(on_start);
         pm.update.disconnect(on_update);
         pm.finish.disconnect(on_finish);
-        
-        if (pm.is_in_progress) {
-            // If no other PMs are in progress, we must issue a finish signal.
+
+        // If both this monitor and the removed monitor are in
+        // progress, but no other PMs are, we must issue a finish
+        // signal.
+        if (this.is_in_progress && pm.is_in_progress) {
             bool issue_signal = true;
             foreach(ProgressMonitor p in monitors) {
                 if (p.is_in_progress) {


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