[geary/wip/remote-retry] Allow for operations to close in background after closing folder
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/remote-retry] Allow for operations to close in background after closing folder
- Date: Thu, 22 Jan 2015 01:29:30 +0000 (UTC)
commit 41bb57d12990610c2a43cdd316c37f452c666dd4
Author: Jim Nelson <jim yorba org>
Date: Wed Jan 21 17:29:11 2015 -0800
Allow for operations to close in background after closing folder
src/client/application/geary-controller.vala | 8 +++++++-
.../imap-engine/imap-engine-minimal-folder.vala | 7 +++----
2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index ffcf08a..02f1ebd 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1262,7 +1262,7 @@ public class GearyController : Geary.BaseObject {
debug("Switching to %s...", folder.to_string());
- cancel_folder();
+ closed_folder();
// This function is not reentrant. It should be, because it can be
// called reentrant-ly if you select folders quickly enough. This
@@ -1526,6 +1526,12 @@ public class GearyController : Geary.BaseObject {
old_cancellable.cancel();
}
+ // Like cancel_folder() but doesn't cancel outstanding operations, allowing them to complete
+ // in the background
+ private void closed_folder() {
+ cancellable_folder = new Cancellable();
+ }
+
private void cancel_inbox(Geary.Account account) {
if (!inbox_cancellables.has_key(account)) {
debug("Unable to cancel inbox operation for %s", account.to_string());
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index b7b5ac7..5a7b9e3 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -43,7 +43,8 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
private Folder.OpenFlags open_flags = OpenFlags.NONE;
private int open_count = 0;
private bool remote_opened = false;
- private Nonblocking.ReportingSemaphore<bool>? remote_semaphore = null;
+ private Nonblocking.ReportingSemaphore<bool> remote_semaphore =
+ new Nonblocking.ReportingSemaphore<bool>(false);
private ReplayQueue replay_queue;
private int remote_count = -1;
private uint open_remote_timer_id = 0;
@@ -485,7 +486,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
}
public override async void wait_for_open_async(Cancellable? cancellable = null) throws Error {
- if (open_count == 0 || remote_semaphore == null)
+ if (open_count == 0)
throw new EngineError.OPEN_REQUIRED("wait_for_open_async() can only be called after
open_async()");
// if remote has not yet been opened, do it now ... this bool can go true only once after
@@ -520,8 +521,6 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
// first open gets to name the flags, but see note above
this.open_flags = open_flags;
- remote_semaphore = new Geary.Nonblocking.ReportingSemaphore<bool>(false);
-
// Unless NO_DELAY is set, do NOT open the remote side here; wait for the ReplayQueue to
// require a remote connection or wait_for_open_async() to be called ... this allows for
// fast local-only operations to occur, local-only either because (a) the folder has all
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]