[geary/wip/only-incomplete] Further database upgrades
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/only-incomplete] Further database upgrades
- Date: Thu, 22 May 2014 02:52:59 +0000 (UTC)
commit 82d521ca55d5512d406fbb8025a5ab3b3315ba3f
Author: Jim Nelson <jim yorba org>
Date: Wed May 21 19:52:35 2014 -0700
Further database upgrades
Also, immediately schedule synchronization with Sent Mail when an
email is sent.
src/engine/db/db-transaction-type.vala | 4 +-
src/engine/imap-db/imap-db-account.vala | 2 +-
.../imap-engine-account-synchronizer.vala | 23 +++++++++++++++----
3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/db/db-transaction-type.vala b/src/engine/db/db-transaction-type.vala
index 2aee779..651d43b 100644
--- a/src/engine/db/db-transaction-type.vala
+++ b/src/engine/db/db-transaction-type.vala
@@ -10,8 +10,8 @@ public enum Geary.Db.TransactionType {
EXCLUSIVE,
// coarse synonyms
- RO = IMMEDIATE,
- RW = EXCLUSIVE,
+ RO = DEFERRED,
+ RW = IMMEDIATE,
WR = EXCLUSIVE,
WO = EXCLUSIVE;
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index ccb8e3a..49ee528 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -1472,7 +1472,7 @@ private class Geary.ImapDB.Account : BaseObject {
unread_status, Cancellable? cancellable) throws Error {
Gee.Map<Geary.FolderPath, int> unread_change = new Gee.HashMap<Geary.FolderPath, int>();
- yield db.exec_transaction_async(Db.TransactionType.RO, (cx) => {
+ yield db.exec_transaction_async(Db.TransactionType.RW, (cx) => {
foreach (ImapDB.EmailIdentifier id in unread_status.keys) {
Gee.Set<Geary.FolderPath>? paths = do_find_email_folders(
cx, id.message_id, true, cancellable);
diff --git a/src/engine/imap-engine/imap-engine-account-synchronizer.vala
b/src/engine/imap-engine/imap-engine-account-synchronizer.vala
index 0b7ea84..2ff636b 100644
--- a/src/engine/imap-engine/imap-engine-account-synchronizer.vala
+++ b/src/engine/imap-engine/imap-engine-account-synchronizer.vala
@@ -30,6 +30,7 @@ private class Geary.ImapEngine.AccountSynchronizer : Geary.BaseObject {
account.closed.connect(on_account_closed);
account.folders_available_unavailable.connect(on_folders_available_unavailable);
account.folders_contents_altered.connect(on_folders_contents_altered);
+ account.email_sent.connect(on_email_sent);
}
~AccountSynchronizer() {
@@ -37,6 +38,7 @@ private class Geary.ImapEngine.AccountSynchronizer : Geary.BaseObject {
account.closed.disconnect(on_account_closed);
account.folders_available_unavailable.disconnect(on_folders_available_unavailable);
account.folders_contents_altered.disconnect(on_folders_contents_altered);
+ account.email_sent.disconnect(on_email_sent);
}
public async void stop_async() {
@@ -109,6 +111,16 @@ private class Geary.ImapEngine.AccountSynchronizer : Geary.BaseObject {
delayed_send_all(altered, false);
}
+ private void on_email_sent() {
+ try {
+ Folder? sent_mail = account.get_special_folder(SpecialFolderType.SENT);
+ if (sent_mail != null)
+ send_all(iterate<Folder>(sent_mail).to_array_list(), false);
+ } catch (Error err) {
+ debug("Unable to retrieve Sent Mail from %s: %s", account.to_string(), err.message);
+ }
+ }
+
private void delayed_send_all(Gee.Collection<Folder> folders, bool reason_available) {
Timeout.add_seconds(SYNC_DELAY_SEC, () => {
// remove any unavailable folders
@@ -183,19 +195,20 @@ private class Geary.ImapEngine.AccountSynchronizer : Geary.BaseObject {
case SpecialFolderType.INBOX:
return -60;
- case SpecialFolderType.ALL_MAIL:
+ case SpecialFolderType.SENT:
return -50;
- case SpecialFolderType.SENT:
+ case SpecialFolderType.DRAFTS:
return -40;
- case SpecialFolderType.FLAGGED:
+ case SpecialFolderType.ALL_MAIL:
+ case SpecialFolderType.ARCHIVE:
return -30;
- case SpecialFolderType.IMPORTANT:
+ case SpecialFolderType.FLAGGED:
return -20;
- case SpecialFolderType.DRAFTS:
+ case SpecialFolderType.IMPORTANT:
return -10;
case SpecialFolderType.SPAM:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]