[geary/wip/cx-reestablish] Geary.Controller opening folder too many times



commit c8c4ad2983ff609049d74196376c23d7afd316e3
Author: Jim Nelson <jim yorba org>
Date:   Tue Jan 20 16:31:02 2015 -0800

    Geary.Controller opening folder too many times
    
    Geary.Controller was being "too smart" and only closing the Folder
    if not an Inbox, as it holds it open to monitor for new mail.
    Folder's open_count handles that, however, and hence the Folder was
    being opened but never closed when selecting it again.

 src/client/application/geary-controller.vala |    4 +--
 src/engine/app/app-conversation-monitor.vala |   27 +++++++++++--------------
 2 files changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 27affab..ffcf08a 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1278,10 +1278,8 @@ public class GearyController : Geary.BaseObject {
         // stop monitoring for conversations and close the folder (but only if not an inbox,
         // which we leave open for notifications)
         if (current_conversations != null) {
-            yield current_conversations.stop_monitoring_async(!current_is_inbox, null);
+            yield current_conversations.stop_monitoring_async(null);
             current_conversations = null;
-        } else if (current_folder != null && !current_is_inbox) {
-            yield current_folder.close_async();
         }
         
         // re-enable copy/move to the last selected folder
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 14bf509..ecad09f 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -328,12 +328,11 @@ public class Geary.App.ConversationMonitor : BaseObject {
      * If null is supplied as the Cancellable, no cancellable is used; pass the original Cancellable
      * here to use that.
      */
-    public async void stop_monitoring_async(bool close_folder, Cancellable? cancellable) throws Error {
-        yield stop_monitoring_internal_async(close_folder, false, cancellable);
+    public async void stop_monitoring_async(Cancellable? cancellable) throws Error {
+        yield stop_monitoring_internal_async(false, cancellable);
     }
     
-    private async void stop_monitoring_internal_async(bool close_folder, bool retrying,
-        Cancellable? cancellable) throws Error {
+    private async void stop_monitoring_internal_async(bool retrying, Cancellable? cancellable) throws Error {
         if (!is_monitoring)
             return;
         
@@ -350,17 +349,15 @@ public class Geary.App.ConversationMonitor : BaseObject {
         folder.account.email_locally_complete.disconnect(on_account_email_locally_complete);
         
         Error? close_err = null;
-        if (close_folder) {
-            try {
-                yield folder.close_async(cancellable);
-            } catch (Error err) {
-                // throw, but only after cleaning up (which is to say, if close_async() fails,
-                // then the Folder is still treated as closed, which is the best that can be
-                // expected; it definitely shouldn't still be considered open).
-                debug("Unable to close monitored folder %s: %s", folder.to_string(), err.message);
-                
-                close_err = err;
-            }
+        try {
+            yield folder.close_async(cancellable);
+        } catch (Error err) {
+            // throw, but only after cleaning up (which is to say, if close_async() fails,
+            // then the Folder is still treated as closed, which is the best that can be
+            // expected; it definitely shouldn't still be considered open).
+            debug("Unable to close monitored folder %s: %s", folder.to_string(), err.message);
+            
+            close_err = err;
         }
         
         notify_monitoring_stopped(retrying);


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