[geary] Minor fix and code cleanup for Geary.Imap.Account.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Minor fix and code cleanup for Geary.Imap.Account.
- Date: Mon, 20 Nov 2017 23:42:40 +0000 (UTC)
commit 69a4e631c1e65b3db19eed22ebe67813ef6aeed0
Author: Michael James Gratton <mike vee net>
Date: Mon Nov 20 11:32:56 2017 +1100
Minor fix and code cleanup for Geary.Imap.Account.
* src/engine/imap/api/imap-account.vala (Account): Replace camel case
methods names with underscores per style guide, fix sense of
is_no_select test in fetch_folder_cached_async() to account for the
double nagative, and clean up the resulting if/else clause a bit.
.../imap-engine/imap-engine-minimal-folder.vala | 2 +-
src/engine/imap/api/imap-account.vala | 22 ++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 7da2316..5fdc357 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -660,7 +660,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
// Use local STATUS data cache to be able to present
// something to the user at least. XXX get the attrs
// from somewhere for Bug 714775
- opening_folder = this.remote.newSelectableFolder(
+ opening_folder = this.remote.new_selectable_folder(
path,
local_status,
new Imap.MailboxAttributes(new Gee.ArrayList<Geary.Imap.MailboxAttribute>())
diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala
index ac3d746..8ecfb12 100644
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@ -187,9 +187,9 @@ private class Geary.Imap.Account : BaseObject {
StatusDataType.all(),
cancellable
);
- folder = newSelectableFolder(path, status, mailbox_info.attrs);
+ folder = new_selectable_folder(path, status, mailbox_info.attrs);
} else {
- folder = newUnselectableFolder(path, mailbox_info.attrs);
+ folder = new_unselectable_folder(path, mailbox_info.attrs);
}
return folder;
@@ -209,8 +209,11 @@ private class Geary.Imap.Account : BaseObject {
check_open();
Imap.Folder? folder = this.folders.get(path);
- if (folder != null) {
- if (refresh_counts && folder.properties.attrs.is_no_select) {
+ if (folder == null) {
+ folder = yield fetch_folder_async(path, cancellable);
+ this.folders.set(path, folder);
+ } else {
+ if (refresh_counts && !folder.properties.attrs.is_no_select) {
try {
ClientSession session = yield claim_session_async(cancellable);
StatusData data = yield send_status_async(
@@ -227,9 +230,6 @@ private class Geary.Imap.Account : BaseObject {
throw_not_found(path);
}
}
- } else {
- folder = yield fetch_folder_async(path, cancellable);
- this.folders.set(path, folder);
}
return folder;
}
@@ -273,7 +273,7 @@ private class Geary.Imap.Account : BaseObject {
FolderPath path = session.get_path_for_mailbox(mailbox_info.mailbox);
Folder? child = this.folders.get(path);
if (child == null) {
- child = newUnselectableFolder(path, mailbox_info.attrs);
+ child = new_unselectable_folder(path, mailbox_info.attrs);
this.folders.set(path, child);
}
children.add(child);
@@ -323,7 +323,7 @@ private class Geary.Imap.Account : BaseObject {
if (child != null) {
child.properties.update_status(status);
} else {
- child = newSelectableFolder(child_path, status, mailbox_info.attrs);
+ child = new_selectable_folder(child_path, status, mailbox_info.attrs);
this.folders.set(child_path, child);
}
@@ -337,7 +337,7 @@ private class Geary.Imap.Account : BaseObject {
return children;
}
- internal Imap.Folder newSelectableFolder(FolderPath path, StatusData status, MailboxAttributes attrs) {
+ internal Imap.Folder new_selectable_folder(FolderPath path, StatusData status, MailboxAttributes attrs) {
return new Imap.Folder(
path, new Imap.FolderProperties.status(status, attrs), this.session_mgr
);
@@ -580,7 +580,7 @@ private class Geary.Imap.Account : BaseObject {
throw new EngineError.OPEN_REQUIRED("Imap.Account not open");
}
- private inline Imap.Folder newUnselectableFolder(FolderPath path, MailboxAttributes attrs) {
+ private inline Imap.Folder new_unselectable_folder(FolderPath path, MailboxAttributes attrs) {
return new Imap.Folder(
path, new Imap.FolderProperties(0, 0, 0, null, null, attrs), this.session_mgr
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]