[geary/mjog/special-type-cleanup: 6/6] Geary.SpecialFolderType: Rename class and related properties, signals
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/special-type-cleanup: 6/6] Geary.SpecialFolderType: Rename class and related properties, signals
- Date: Tue, 31 Mar 2020 07:22:42 +0000 (UTC)
commit 8dcab7f3066249c3c5b3f5a722612f21256df537
Author: Michael Gratton <mike vee net>
Date: Tue Mar 31 16:08:46 2020 +1100
Geary.SpecialFolderType: Rename class and related properties, signals
The `SpecialFolderType` was somewhat mis-named, since the special use
does not (in most cases) confer any special type, rather it's simply
defines what a particular folder is used /for/.
As such, rename the enum to to `Geary.Folder.SpecialUse`, moving it in
to the `Folder` class, since it relates specifically to folders, also
rename `Folder::special_folder_type` and
`Folder::special_folder_type_changed` reflect the above and not
duplicate the type name, and similarly rename
`Account::folders_special_type`.
Update the many call sites.
po/POTFILES.in | 1 -
src/client/application/application-controller.vala | 20 ++--
.../application-folder-store-factory.vala | 18 ++--
.../application/application-main-window.vala | 56 +++++------
.../application/application-plugin-manager.vala | 2 +-
.../formatted-conversation-data.vala | 2 +-
.../conversation-viewer/conversation-list-box.vala | 5 +-
.../folder-list/folder-list-account-branch.vala | 18 ++--
.../folder-list/folder-list-folder-entry.vala | 36 +++----
.../folder-list/folder-list-inboxes-branch.vala | 2 -
src/client/folder-list/folder-list-tree.vala | 8 +-
.../desktop-notifications.vala | 4 +-
.../plugin/folder-highlight/folder-highlight.vala | 4 +-
.../plugin/messaging-menu/messaging-menu.vala | 2 +-
.../notification-badge/notification-badge.vala | 4 +-
src/client/plugin/plugin-folder.vala | 2 +-
.../plugin/special-folders/special-folders.vala | 4 +-
src/client/util/util-i18n.vala | 6 +-
src/engine/api/geary-account-information.vala | 58 ++++++------
src/engine/api/geary-account.vala | 14 +--
src/engine/api/geary-folder.vala | 75 +++++++++++++--
src/engine/app/app-conversation-monitor.vala | 12 +--
src/engine/app/app-draft-manager.vala | 2 +-
src/engine/app/app-search-folder.vala | 26 +++---
src/engine/common/common-contact-harvester.vala | 7 +-
.../gmail/imap-engine-gmail-account.vala | 40 ++++----
.../gmail/imap-engine-gmail-all-mail-folder.vala | 5 +-
.../gmail/imap-engine-gmail-drafts-folder.vala | 5 +-
.../gmail/imap-engine-gmail-folder.vala | 8 +-
.../gmail/imap-engine-gmail-spam-trash-folder.vala | 4 +-
.../imap-engine/imap-engine-generic-account.vala | 103 +++++++++++----------
.../imap-engine/imap-engine-generic-folder.vala | 8 +-
.../imap-engine/imap-engine-minimal-folder.vala | 22 ++---
.../other/imap-engine-other-account.vala | 12 +--
.../other/imap-engine-other-folder.vala | 5 +-
.../outlook/imap-engine-outlook-account.vala | 16 ++--
.../outlook/imap-engine-outlook-drafts-folder.vala | 5 +-
.../outlook/imap-engine-outlook-folder.vala | 4 +-
.../yahoo/imap-engine-yahoo-account.vala | 12 +--
.../yahoo/imap-engine-yahoo-folder.vala | 4 +-
src/engine/imap/api/imap-account-session.vala | 6 +-
src/engine/imap/command/imap-create-command.vala | 24 ++---
.../imap/response/imap-mailbox-attributes.vala | 26 +++---
src/engine/meson.build | 1 -
src/engine/outbox/outbox-folder.vala | 4 +-
test/engine/api/geary-account-mock.vala | 6 +-
test/engine/api/geary-folder-mock.vala | 10 +-
test/engine/app/app-conversation-monitor-test.vala | 4 +-
test/engine/app/app-conversation-set-test.vala | 2 +-
test/engine/app/app-conversation-test.vala | 2 +-
.../common/common-contact-harvester-test.vala | 10 +-
.../imap/command/imap-create-command-test.vala | 2 +-
52 files changed, 397 insertions(+), 341 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0f08b32a..8c011660 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -173,7 +173,6 @@ src/engine/api/geary-revokable.vala
src/engine/api/geary-search-query.vala
src/engine/api/geary-service-information.vala
src/engine/api/geary-service-provider.vala
-src/engine/api/geary-special-folder-type.vala
src/engine/app/app-conversation-monitor.vala
src/engine/app/app-conversation.vala
src/engine/app/app-draft-manager.vala
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index 1035930d..f680a409 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -23,7 +23,7 @@ internal class Application.Controller : Geary.BaseObject {
public static bool does_folder_support_trash(Geary.Folder? target) {
return (
target != null &&
- target.special_folder_type != TRASH &&
+ target.used_as != TRASH &&
!target.properties.is_local_only &&
(target as Geary.FolderSupport.Move) != null
);
@@ -39,9 +39,9 @@ internal class Application.Controller : Geary.BaseObject {
return false;
// if folder contains children, we must ensure that there is at least one of the same type
- Geary.SpecialFolderType type = folder.special_folder_type;
+ Geary.Folder.SpecialUse type = folder.used_as;
foreach (Geary.Folder other in all) {
- if (other.special_folder_type == type && other.path.parent == folder.path)
+ if (other.used_as == type && other.path.parent == folder.path)
return true;
}
@@ -613,7 +613,7 @@ internal class Application.Controller : Geary.BaseObject {
}
public async void move_conversations_special(Geary.Folder source,
- Geary.SpecialFolderType destination,
+ Geary.Folder.SpecialUse destination,
Gee.Collection<Geary.App.Conversation> conversations)
throws GLib.Error {
AccountContext? context = this.accounts.get(source.account.information);
@@ -691,7 +691,7 @@ internal class Application.Controller : Geary.BaseObject {
}
public async void move_messages_special(Geary.Folder source,
- Geary.SpecialFolderType destination,
+ Geary.Folder.SpecialUse destination,
Gee.Collection<Geary.App.Conversation> conversations,
Gee.Collection<Geary.EmailIdentifier> messages)
throws GLib.Error {
@@ -1183,7 +1183,7 @@ internal class Application.Controller : Geary.BaseObject {
private void on_account_email_removed(Geary.Folder folder,
Gee.Collection<Geary.EmailIdentifier> ids) {
- if (folder.special_folder_type == OUTBOX) {
+ if (folder.used_as == OUTBOX) {
foreach (MainWindow window in this.application.get_main_windows()) {
window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SEND_FAILURE);
window.status_bar.deactivate_message(StatusBar.Message.OUTBOX_SAVE_SENT_MAIL_FAILED);
@@ -1254,7 +1254,7 @@ internal class Application.Controller : Geary.BaseObject {
}
GLib.Cancellable cancellable = context.cancellable;
- if (folder.special_folder_type == INBOX) {
+ if (folder.used_as == INBOX) {
if (context.inbox == null) {
context.inbox = folder;
}
@@ -1270,7 +1270,7 @@ internal class Application.Controller : Geary.BaseObject {
while (has_prev) {
Geary.Folder folder = unavailable_iterator.get();
- if (folder.special_folder_type == INBOX) {
+ if (folder.used_as == INBOX) {
context.inbox = null;
}
@@ -2263,7 +2263,7 @@ private class Application.ArchiveEmailCommand : RevokableCommand {
// affected, so if the dest is the location, just assume
// they are for now.
foreach (var folder in removed) {
- if (folder.special_folder_type == ARCHIVE) {
+ if (folder.used_as == ARCHIVE) {
ret = REMOVE;
break;
}
@@ -2281,7 +2281,7 @@ private class Application.ArchiveEmailCommand : RevokableCommand {
// affected, so if the dest is the location, just assume they
// are for now.
return (
- location.special_folder_type == ARCHIVE
+ location.used_as == ARCHIVE
? EmailCommand.StateChangePolicy.REMOVE
: base.email_removed(location, targets)
);
diff --git a/src/client/application/application-folder-store-factory.vala
b/src/client/application/application-folder-store-factory.vala
index 6e063858..4da4aca3 100644
--- a/src/client/application/application-folder-store-factory.vala
+++ b/src/client/application/application-folder-store-factory.vala
@@ -118,8 +118,8 @@ internal class Application.FolderStoreFactory : Geary.BaseObject {
}
private string _display_name;
- public Geary.SpecialFolderType folder_type {
- get { return this.backing.special_folder_type; }
+ public Geary.Folder.SpecialUse used_as {
+ get { return this.backing.used_as; }
}
public Plugin.Account? account {
@@ -149,7 +149,7 @@ internal class Application.FolderStoreFactory : Geary.BaseObject {
}
internal void folder_type_changed() {
- notify_property("folder-type");
+ notify_property("used-as");
this._display_name = Util.I18n.to_folder_display_name(this.backing);
notify_property("display-name");
}
@@ -235,8 +235,8 @@ internal class Application.FolderStoreFactory : Geary.BaseObject {
account.folders_available_unavailable.connect(
on_folders_available_unavailable
);
- account.folders_special_type.connect(
- on_folders_type_changed
+ account.folders_use_changed.connect(
+ on_folders_use_changed
);
add_folders(account.list_folders());
} catch (GLib.Error err) {
@@ -253,8 +253,8 @@ internal class Application.FolderStoreFactory : Geary.BaseObject {
account.folders_available_unavailable.disconnect(
on_folders_available_unavailable
);
- account.folders_special_type.disconnect(
- on_folders_type_changed
+ account.folders_use_changed.disconnect(
+ on_folders_use_changed
);
remove_folders(account.list_folders());
this.accounts.unset(removed);
@@ -320,8 +320,8 @@ internal class Application.FolderStoreFactory : Geary.BaseObject {
}
}
- private void on_folders_type_changed(Geary.Account account,
- Gee.Collection<Geary.Folder> changed) {
+ private void on_folders_use_changed(Geary.Account account,
+ Gee.Collection<Geary.Folder> changed) {
var folders = to_plugin_folders(changed);
foreach (FolderImpl folder in folders) {
folder.folder_type_changed();
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 5d774105..18327b4d 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -705,12 +705,12 @@ public class Application.MainWindow :
// Prefer the inboxes branch if it is a thing, but
// only for non-interactive calls
if (is_interactive ||
- (to_select.special_folder_type != INBOX ||
+ (to_select.used_as != INBOX ||
!this.folder_list.select_inbox(to_select.account))) {
this.folder_list.select_folder(to_select);
}
- if (to_select.special_folder_type == SEARCH) {
+ if (to_select.used_as == SEARCH) {
this.previous_non_search_folder = to_select;
}
} else {
@@ -963,7 +963,7 @@ public class Application.MainWindow :
this.search_open = new GLib.Cancellable();
if (this.previous_non_search_folder != null &&
- this.selected_folder.special_folder_type == SEARCH) {
+ this.selected_folder.used_as == SEARCH) {
this.select_folder.begin(
this.previous_non_search_folder, is_interactive
);
@@ -1036,7 +1036,7 @@ public class Application.MainWindow :
if (this.selected_folder != null &&
this.selected_folder.account == to_remove.account) {
bool is_account_search_active = (
- this.selected_folder.special_folder_type == SEARCH
+ this.selected_folder.used_as == SEARCH
);
yield select_folder(to_select, false);
@@ -1076,15 +1076,15 @@ public class Application.MainWindow :
this.main_toolbar.copy_folder_menu.add_folder(to_add);
this.main_toolbar.move_folder_menu.add_folder(to_add);
}
- to_add.special_folder_type_changed.connect(
- on_special_folder_type_changed
+ to_add.use_changed.connect(
+ on_use_changed
);
}
/** Removes a folder from the window. */
private void remove_folder(Geary.Folder to_remove) {
- to_remove.special_folder_type_changed.disconnect(
- on_special_folder_type_changed
+ to_remove.use_changed.disconnect(
+ on_use_changed
);
if (to_remove.account == this.selected_account) {
this.main_toolbar.copy_folder_menu.remove_folder(to_remove);
@@ -1283,7 +1283,7 @@ public class Application.MainWindow :
return base.key_release_event(event);
}
- internal bool prompt_empty_folder(Geary.SpecialFolderType type) {
+ internal bool prompt_empty_folder(Geary.Folder.SpecialUse type) {
var folder_name = Util.I18n.to_folder_type_display_name(type);
ConfirmationDialog dialog = new ConfirmationDialog(
this,
@@ -1616,7 +1616,7 @@ public class Application.MainWindow :
if (!this.has_composer) {
if (this.conversations.size == 0) {
// Let the user know if there's no available conversations
- if (this.selected_folder.special_folder_type == SEARCH) {
+ if (this.selected_folder.used_as == SEARCH) {
this.conversation_viewer.show_empty_search();
} else {
this.conversation_viewer.show_empty_folder();
@@ -1681,9 +1681,9 @@ public class Application.MainWindow :
/// Current folder's name followed by its unread count, i.e. "Inbox (42)"
// except for Drafts and Outbox, where we show total count
int count;
- switch (this.selected_folder.special_folder_type) {
- case Geary.SpecialFolderType.DRAFTS:
- case Geary.SpecialFolderType.OUTBOX:
+ switch (this.selected_folder.used_as) {
+ case DRAFTS:
+ case OUTBOX:
count = this.selected_folder.properties.email_total;
break;
@@ -1712,7 +1712,7 @@ public class Application.MainWindow :
sensitive &&
!multiple &&
this.selected_folder != null &&
- this.selected_folder.special_folder_type != DRAFTS
+ this.selected_folder.used_as != DRAFTS
);
get_window_action(ACTION_REPLY_CONVERSATION).set_enabled(reply_sensitive);
get_window_action(ACTION_REPLY_ALL_CONVERSATION).set_enabled(reply_sensitive);
@@ -1991,9 +1991,9 @@ public class Application.MainWindow :
}
}
- private void on_special_folder_type_changed(Geary.Folder folder,
- Geary.SpecialFolderType old_type,
- Geary.SpecialFolderType new_type) {
+ private void on_use_changed(Geary.Folder folder,
+ Geary.Folder.SpecialUse old_type,
+ Geary.Folder.SpecialUse new_type) {
// Update the main window
this.folder_list.remove_folder(folder);
this.folder_list.add_folder(folder);
@@ -2118,7 +2118,7 @@ public class Application.MainWindow :
private void on_conversation_activated(Geary.App.Conversation activated) {
if (this.selected_folder != null) {
- if (this.selected_folder.special_folder_type != DRAFTS) {
+ if (this.selected_folder.used_as != DRAFTS) {
this.application.new_window.begin(
this.selected_folder,
this.conversation_list_view.copy_selected()
@@ -2237,10 +2237,12 @@ public class Application.MainWindow :
get_window_action(ACTION_MARK_AS_UNSTARRED).set_enabled(starred_selected);
// If we're in Drafts/Outbox, we also shouldn't set a message as junk
- bool in_junk_folder = (selected_folder.special_folder_type == JUNK);
- get_window_action(ACTION_TOGGLE_JUNK).set_enabled(!in_junk_folder &&
- selected_folder.special_folder_type != Geary.SpecialFolderType.DRAFTS &&
- selected_folder.special_folder_type != Geary.SpecialFolderType.OUTBOX);
+ bool in_junk_folder = (selected_folder.used_as == JUNK);
+ get_window_action(ACTION_TOGGLE_JUNK).set_enabled(
+ !in_junk_folder &&
+ selected_folder.used_as != DRAFTS &&
+ selected_folder.used_as != OUTBOX
+ );
}
private void on_mark_conversations(Gee.Collection<Geary.App.Conversation> conversations,
@@ -2342,10 +2344,10 @@ public class Application.MainWindow :
private void on_mark_as_junk_toggle() {
Geary.Folder? source = this.selected_folder;
if (source != null) {
- Geary.SpecialFolderType destination =
- (source.special_folder_type != JUNK)
- ? Geary.SpecialFolderType.JUNK
- : Geary.SpecialFolderType.INBOX;
+ Geary.Folder.SpecialUse destination =
+ (source.used_as != JUNK)
+ ? Geary.Folder.SpecialUse.JUNK
+ : Geary.Folder.SpecialUse.INBOX;
this.controller.move_conversations_special.begin(
source,
destination,
@@ -2424,7 +2426,7 @@ public class Application.MainWindow :
if (source != null) {
this.controller.move_conversations_special.begin(
source,
- Geary.SpecialFolderType.TRASH,
+ TRASH,
this.conversation_list_view.copy_selected(),
(obj, res) => {
try {
diff --git a/src/client/application/application-plugin-manager.vala
b/src/client/application/application-plugin-manager.vala
index 4dffbf28..abcb73bf 100644
--- a/src/client/application/application-plugin-manager.vala
+++ b/src/client/application/application-plugin-manager.vala
@@ -101,7 +101,7 @@ public class Application.PluginManager : GLib.Object {
Geary.Folder? target = this.folders.get_engine_folder(folder);
if (target != null) {
- if (!main.prompt_empty_folder(target.special_folder_type)) {
+ if (!main.prompt_empty_folder(target.used_as)) {
throw new Plugin.Error.PERMISSION_DENIED(
"Permission not granted"
);
diff --git a/src/client/conversation-list/formatted-conversation-data.vala
b/src/client/conversation-list/formatted-conversation-data.vala
index 7dcfa162..f1ec9dde 100644
--- a/src/client/conversation-list/formatted-conversation-data.vala
+++ b/src/client/conversation-list/formatted-conversation-data.vala
@@ -121,7 +121,7 @@ public class FormattedConversationData : Geary.BaseObject {
this.config = config;
this.conversation = conversation;
this.account_owner_emails = account_owner_emails;
- use_to = (folder != null) && folder.special_folder_type.is_outgoing();
+ use_to = (folder != null) && folder.used_as.is_outgoing();
// Load preview-related data.
update_date_string();
diff --git a/src/client/conversation-viewer/conversation-list-box.vala
b/src/client/conversation-viewer/conversation-list-box.vala
index 15a766ff..81e22d86 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1278,12 +1278,11 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
// XXX should be able to edit draft emails from any
// conversation. This test should be more like "is in drafts
// folder"
- Geary.SpecialFolderType type =
- this.conversation.base_folder.special_folder_type;
+ Geary.Folder.SpecialUse use = this.conversation.base_folder.used_as;
bool is_in_folder = this.conversation.is_in_base_folder(email.id);
return (
- is_in_folder && type == Geary.SpecialFolderType.DRAFTS // ||
+ is_in_folder && use == DRAFTS // ||
//email.flags.is_draft()
);
}
diff --git a/src/client/folder-list/folder-list-account-branch.vala
b/src/client/folder-list/folder-list-account-branch.vala
index a22f62ae..7aeca9fc 100644
--- a/src/client/folder-list/folder-list-account-branch.vala
+++ b/src/client/folder-list/folder-list-account-branch.vala
@@ -56,16 +56,10 @@ public class FolderList.AccountBranch : Sidebar.Branch {
if (a is Sidebar.Grouping || b is Sidebar.Grouping)
return special_grouping_comparator(a, b);
- assert(a is FolderEntry);
- assert(b is FolderEntry);
-
FolderEntry entry_a = (FolderEntry) a;
FolderEntry entry_b = (FolderEntry) b;
- Geary.SpecialFolderType type_a = entry_a.folder.special_folder_type;
- Geary.SpecialFolderType type_b = entry_b.folder.special_folder_type;
-
- assert(type_a != Geary.SpecialFolderType.NONE);
- assert(type_b != Geary.SpecialFolderType.NONE);
+ Geary.Folder.SpecialUse type_a = entry_a.folder.used_as;
+ Geary.Folder.SpecialUse type_b = entry_b.folder.used_as;
// Special folders are ordered by their enum value.
return (int) type_a - (int) type_b;
@@ -83,9 +77,9 @@ public class FolderList.AccountBranch : Sidebar.Branch {
public void add_folder(Geary.Folder folder) {
Sidebar.Entry? graft_point = null;
FolderEntry folder_entry = new FolderEntry(folder);
- Geary.SpecialFolderType special_folder_type = folder.special_folder_type;
- if (special_folder_type != Geary.SpecialFolderType.NONE) {
- if (special_folder_type == Geary.SpecialFolderType.SEARCH)
+ Geary.Folder.SpecialUse used_as = folder.used_as;
+ if (used_as != NONE) {
+ if (used_as == SEARCH)
return; // Don't show search folder under the account.
// Special folders go in the root of the account.
@@ -120,7 +114,7 @@ public class FolderList.AccountBranch : Sidebar.Branch {
folder_entries.set(folder.path, folder_entry);
} else {
debug("Could not add folder %s of type %s to folder list", folder.to_string(),
- special_folder_type.to_string());
+ used_as.to_string());
}
}
diff --git a/src/client/folder-list/folder-list-folder-entry.vala
b/src/client/folder-list/folder-list-folder-entry.vala
index d26577d6..7c23495a 100644
--- a/src/client/folder-list/folder-list-folder-entry.vala
+++ b/src/client/folder-list/folder-list-folder-entry.vala
@@ -44,36 +44,36 @@ public class FolderList.FolderEntry : FolderList.AbstractFolderEntry, Sidebar.In
}
public override string? get_sidebar_icon() {
- switch (folder.special_folder_type) {
- case Geary.SpecialFolderType.NONE:
+ switch (folder.used_as) {
+ case NONE:
return "tag-symbolic";
- case Geary.SpecialFolderType.INBOX:
+ case INBOX:
return "mail-inbox-symbolic";
- case Geary.SpecialFolderType.DRAFTS:
+ case DRAFTS:
return "mail-drafts-symbolic";
- case Geary.SpecialFolderType.SENT:
+ case SENT:
return "mail-sent-symbolic";
- case Geary.SpecialFolderType.FLAGGED:
+ case FLAGGED:
return "starred-symbolic";
- case Geary.SpecialFolderType.IMPORTANT:
+ case IMPORTANT:
return "task-due-symbolic";
- case Geary.SpecialFolderType.ALL_MAIL:
- case Geary.SpecialFolderType.ARCHIVE:
+ case ALL_MAIL:
+ case ARCHIVE:
return "mail-archive-symbolic";
- case Geary.SpecialFolderType.JUNK:
+ case JUNK:
return "dialog-warning-symbolic";
- case Geary.SpecialFolderType.TRASH:
+ case TRASH:
return "user-trash-symbolic";
- case Geary.SpecialFolderType.OUTBOX:
+ case OUTBOX:
return "mail-outbox-symbolic";
default:
@@ -119,16 +119,16 @@ public class FolderList.FolderEntry : FolderList.AbstractFolderEntry, Sidebar.In
}
public override int get_count() {
- switch (folder.special_folder_type) {
+ switch (folder.used_as) {
// for Drafts and Outbox, interested in showing total count, not unread count
- case Geary.SpecialFolderType.DRAFTS:
- case Geary.SpecialFolderType.OUTBOX:
+ case DRAFTS:
+ case OUTBOX:
return folder.properties.email_total;
// only show counts for Inbox, Junk, and user folders
- case Geary.SpecialFolderType.INBOX:
- case Geary.SpecialFolderType.JUNK:
- case Geary.SpecialFolderType.NONE:
+ case INBOX:
+ case JUNK:
+ case NONE:
return folder.properties.email_unread;
// otherwise, to avoid clutter, no counts displayed (but are available in tooltip)
diff --git a/src/client/folder-list/folder-list-inboxes-branch.vala
b/src/client/folder-list/folder-list-inboxes-branch.vala
index 9b4ab2ca..0e7d1ba8 100644
--- a/src/client/folder-list/folder-list-inboxes-branch.vala
+++ b/src/client/folder-list/folder-list-inboxes-branch.vala
@@ -30,8 +30,6 @@ public class FolderList.InboxesBranch : Sidebar.Branch {
}
public void add_inbox(Geary.Folder inbox) {
- assert(inbox.special_folder_type == Geary.SpecialFolderType.INBOX);
-
InboxFolderEntry folder_entry = new InboxFolderEntry(inbox);
graft(get_root(), folder_entry);
diff --git a/src/client/folder-list/folder-list-tree.vala b/src/client/folder-list/folder-list-tree.vala
index 4a623a29..a3c8432f 100644
--- a/src/client/folder-list/folder-list-tree.vala
+++ b/src/client/folder-list/folder-list-tree.vala
@@ -51,7 +51,7 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
entry.set_has_new(has_new);
}
- if (folder.special_folder_type == INBOX &&
+ if (folder.used_as == INBOX &&
has_branch(inboxes_branch)) {
entry = inboxes_branch.get_entry_for_account(folder.account);
if (entry != null) {
@@ -105,7 +105,7 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
if (account_branches.size > 1 && !has_branch(inboxes_branch))
graft(inboxes_branch, INBOX_ORDINAL); // The Inboxes branch comes first.
- if (folder.special_folder_type == Geary.SpecialFolderType.INBOX)
+ if (folder.used_as == INBOX)
inboxes_branch.add_inbox(folder);
account_branch.add_folder(folder);
@@ -132,7 +132,7 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
}
// if Inbox, remove from inboxes branch, selected or not
- if (folder.special_folder_type == Geary.SpecialFolderType.INBOX)
+ if (folder.used_as == INBOX)
inboxes_branch.remove_inbox(folder.account);
account_branch.remove_folder(folder);
@@ -163,7 +163,7 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
public void select_folder(Geary.Folder to_select) {
if (this.selected != to_select) {
bool selected = false;
- if (to_select.special_folder_type == INBOX) {
+ if (to_select.used_as == INBOX) {
selected = select_inbox(to_select.account);
}
diff --git a/src/client/plugin/desktop-notifications/desktop-notifications.vala
b/src/client/plugin/desktop-notifications/desktop-notifications.vala
index e5fa7edd..67c7d07e 100644
--- a/src/client/plugin/desktop-notifications/desktop-notifications.vala
+++ b/src/client/plugin/desktop-notifications/desktop-notifications.vala
@@ -26,7 +26,7 @@ public class Plugin.DesktopNotifications :
TrustedExtension {
- private const Geary.SpecialFolderType[] MONITORED_TYPES = {
+ private const Geary.Folder.SpecialUse[] MONITORED_TYPES = {
INBOX, NONE
};
@@ -269,7 +269,7 @@ public class Plugin.DesktopNotifications :
private void check_folders(Gee.Collection<Folder> folders) {
foreach (Folder folder in folders) {
- if (folder.folder_type in MONITORED_TYPES) {
+ if (folder.used_as in MONITORED_TYPES) {
this.notifications.start_monitoring_folder(folder);
} else {
this.notifications.stop_monitoring_folder(folder);
diff --git a/src/client/plugin/folder-highlight/folder-highlight.vala
b/src/client/plugin/folder-highlight/folder-highlight.vala
index 67dc557c..ff4796ad 100644
--- a/src/client/plugin/folder-highlight/folder-highlight.vala
+++ b/src/client/plugin/folder-highlight/folder-highlight.vala
@@ -22,7 +22,7 @@ public class Plugin.FolderHighlight :
PluginBase, NotificationExtension, FolderExtension, TrustedExtension {
- private const Geary.SpecialFolderType[] MONITORED_TYPES = {
+ private const Geary.Folder.SpecialUse[] MONITORED_TYPES = {
INBOX, NONE
};
@@ -66,7 +66,7 @@ public class Plugin.FolderHighlight :
private void check_folders(Gee.Collection<Folder> folders) {
foreach (Folder folder in folders) {
- if (folder.folder_type in MONITORED_TYPES) {
+ if (folder.used_as in MONITORED_TYPES) {
this.notifications.start_monitoring_folder(folder);
} else {
this.notifications.stop_monitoring_folder(folder);
diff --git a/src/client/plugin/messaging-menu/messaging-menu.vala
b/src/client/plugin/messaging-menu/messaging-menu.vala
index 145c196b..46ed8eec 100644
--- a/src/client/plugin/messaging-menu/messaging-menu.vala
+++ b/src/client/plugin/messaging-menu/messaging-menu.vala
@@ -113,7 +113,7 @@ public class Plugin.MessagingMenu :
private void check_folders(Gee.Collection<Folder> folders) {
foreach (Folder folder in folders) {
- if (folder.folder_type == INBOX) {
+ if (folder.used_as == INBOX) {
this.notifications.start_monitoring_folder(folder);
} else if (this.notifications.is_monitoring_folder(folder)) {
this.notifications.stop_monitoring_folder(folder);
diff --git a/src/client/plugin/notification-badge/notification-badge.vala
b/src/client/plugin/notification-badge/notification-badge.vala
index d0321b37..2230fa48 100644
--- a/src/client/plugin/notification-badge/notification-badge.vala
+++ b/src/client/plugin/notification-badge/notification-badge.vala
@@ -20,7 +20,7 @@ public class Plugin.NotificationBadge :
PluginBase, NotificationExtension, FolderExtension, TrustedExtension {
- private const Geary.SpecialFolderType[] MONITORED_TYPES = {
+ private const Geary.Folder.SpecialUse[] MONITORED_TYPES = {
INBOX, NONE
};
@@ -82,7 +82,7 @@ public class Plugin.NotificationBadge :
private void check_folders(Gee.Collection<Folder> folders) {
foreach (Folder folder in folders) {
- if (folder.folder_type in MONITORED_TYPES) {
+ if (folder.used_as in MONITORED_TYPES) {
this.notifications.start_monitoring_folder(folder);
} else {
this.notifications.stop_monitoring_folder(folder);
diff --git a/src/client/plugin/plugin-folder.vala b/src/client/plugin/plugin-folder.vala
index 85bb8375..0bbf30a4 100644
--- a/src/client/plugin/plugin-folder.vala
+++ b/src/client/plugin/plugin-folder.vala
@@ -24,7 +24,7 @@ public interface Plugin.Folder : Geary.BaseObject {
public abstract string display_name { get; }
/** Returns the type of this folder. */
- public abstract Geary.SpecialFolderType folder_type { get; }
+ public abstract Geary.Folder.SpecialUse used_as { get; }
/** Returns the account the folder belongs to, if any. */
public abstract Account? account { get; }
diff --git a/src/client/plugin/special-folders/special-folders.vala
b/src/client/plugin/special-folders/special-folders.vala
index aed4fc18..3bd5cf4f 100644
--- a/src/client/plugin/special-folders/special-folders.vala
+++ b/src/client/plugin/special-folders/special-folders.vala
@@ -78,7 +78,7 @@ public class Plugin.SpecialFolders :
}
private void update_folder(Folder target) {
- switch (target.folder_type) {
+ switch (target.used_as) {
case TRASH:
this.folders.add_folder_info_bar(
target, get_folder_info_bar(target), PRIORITY
@@ -104,7 +104,7 @@ public class Plugin.SpecialFolders :
target.identifier, this.cancellable
);
foreach (var folder in folders) {
- if (folder.folder_type == DRAFTS) {
+ if (folder.used_as == DRAFTS) {
is_draft = true;
break;
}
diff --git a/src/client/util/util-i18n.vala b/src/client/util/util-i18n.vala
index 417c3868..e57c444f 100644
--- a/src/client/util/util-i18n.vala
+++ b/src/client/util/util-i18n.vala
@@ -255,7 +255,7 @@ namespace Util.I18n {
* folder path step is returned.
*/
public string? to_folder_display_name(Geary.Folder folder) {
- var name = to_folder_type_display_name(folder.special_folder_type);
+ var name = to_folder_type_display_name(folder.used_as);
if (Geary.String.is_empty_or_whitespace(name)) {
name = folder.path.name;
}
@@ -265,8 +265,8 @@ namespace Util.I18n {
/**
* Returns the localised name for a specific folder type, if any.
*/
- public unowned string? to_folder_type_display_name(Geary.SpecialFolderType type) {
- switch (type) {
+ public unowned string? to_folder_type_display_name(Geary.Folder.SpecialUse use) {
+ switch (use) {
case INBOX:
return _("Inbox");
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 91c3da80..9aa618dc 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -369,7 +369,7 @@ public class Geary.AccountInformation : BaseObject {
}
/**
- * Returns the configured path for a special folder type.
+ * Returns the configured path for a special folder use.
*
* This is used when Geary has found or created a special folder
* for this account. The path will be null if Geary has always
@@ -378,22 +378,22 @@ public class Geary.AccountInformation : BaseObject {
* JUNK, and TRASH special folder types are valid to pass to this
* function.
*/
- public Geary.FolderPath? get_special_folder_path(Geary.SpecialFolderType special) {
+ public Geary.FolderPath? get_special_folder_path(Folder.SpecialUse special) {
switch (special) {
- case Geary.SpecialFolderType.DRAFTS:
- return this.drafts_folder_path;
+ case DRAFTS:
+ return this.drafts_folder_path;
- case Geary.SpecialFolderType.SENT:
- return this.sent_folder_path;
+ case SENT:
+ return this.sent_folder_path;
- case Geary.SpecialFolderType.JUNK:
- return this.junk_folder_path;
+ case JUNK:
+ return this.junk_folder_path;
- case Geary.SpecialFolderType.TRASH:
- return this.trash_folder_path;
+ case TRASH:
+ return this.trash_folder_path;
- case Geary.SpecialFolderType.ARCHIVE:
- return this.archive_folder_path;
+ case ARCHIVE:
+ return this.archive_folder_path;
}
return null;
@@ -407,33 +407,33 @@ public class Geary.AccountInformation : BaseObject {
* ARCHIVE special folder types are valid to pass to this
* function.
*/
- public void set_special_folder_path(Geary.SpecialFolderType special,
- Geary.FolderPath? new_path) {
+ public void set_special_folder_path(Folder.SpecialUse special,
+ FolderPath? new_path) {
Geary.FolderPath? old_path = null;
switch (special) {
- case Geary.SpecialFolderType.DRAFTS:
- old_path = this.drafts_folder_path;
- this.drafts_folder_path = new_path;
+ case DRAFTS:
+ old_path = this.drafts_folder_path;
+ this.drafts_folder_path = new_path;
break;
- case Geary.SpecialFolderType.SENT:
- old_path = this.sent_folder_path;
- this.sent_folder_path = new_path;
+ case SENT:
+ old_path = this.sent_folder_path;
+ this.sent_folder_path = new_path;
break;
- case Geary.SpecialFolderType.JUNK:
- old_path = this.junk_folder_path;
- this.junk_folder_path = new_path;
+ case JUNK:
+ old_path = this.junk_folder_path;
+ this.junk_folder_path = new_path;
break;
- case Geary.SpecialFolderType.TRASH:
- old_path = this.trash_folder_path;
- this.trash_folder_path = new_path;
+ case TRASH:
+ old_path = this.trash_folder_path;
+ this.trash_folder_path = new_path;
break;
- case Geary.SpecialFolderType.ARCHIVE:
- old_path = this.archive_folder_path;
- this.archive_folder_path = new_path;
+ case ARCHIVE:
+ old_path = this.archive_folder_path;
+ this.archive_folder_path = new_path;
break;
}
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index 505b71c6..c2d65d90 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -215,9 +215,9 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
public signal void folders_contents_altered(Gee.Collection<Geary.Folder> altered);
/**
- * Fired when a Folder's type is detected having changed.
+ * Fired when a Folder's special use is detected having changed.
*/
- public signal void folders_special_type(Gee.Collection<Geary.Folder> altered);
+ public signal void folders_use_changed(Gee.Collection<Geary.Folder> altered);
/**
* Fired when emails are appended to a folder in this account.
@@ -395,9 +395,9 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
/**
* Returns a folder for the given special folder type, it is exists.
*/
- public virtual Geary.Folder? get_special_folder(Geary.SpecialFolderType type){
+ public virtual Geary.Folder? get_special_folder(Folder.SpecialUse use) {
return traverse<Folder>(list_folders())
- .first_matching(f => f.special_folder_type == type);
+ .first_matching(f => f.used_as == use);
}
/**
@@ -406,8 +406,10 @@ public abstract class Geary.Account : BaseObject, Logging.Source {
* folder doesn't exist and can't be created. The only valid special folder types that
* can be required are: DRAFTS, SENT, JUNK, and TRASH.
*/
- public abstract async Geary.Folder get_required_special_folder_async(Geary.SpecialFolderType special,
- Cancellable? cancellable = null) throws Error;
+ public abstract async Geary.Folder get_required_special_folder_async(
+ Folder.SpecialUse special,
+ GLib.Cancellable? cancellable = null
+ ) throws GLib.Error;
/**
* Search the local account for emails referencing a Message-ID value
diff --git a/src/engine/api/geary-folder.vala b/src/engine/api/geary-folder.vala
index 422cae80..cbddb77b 100644
--- a/src/engine/api/geary-folder.vala
+++ b/src/engine/api/geary-folder.vala
@@ -63,6 +63,62 @@
*/
public abstract class Geary.Folder : BaseObject, Logging.Source {
+
+ /**
+ * Specifies the use of a specific folder.
+ *
+ * These are populated from a number of sources, including mailbox
+ * names, protocol hints, and special folder implementations.
+ */
+ public enum SpecialUse {
+
+ /** No special type, likely user-created. */
+ NONE,
+
+ // Well-known concrete folders
+
+ /** Denotes the inbox for the account. */
+ INBOX,
+
+ /** Stores email to be kept. */
+ ARCHIVE,
+
+ /** Stores email that has not yet been sent. */
+ DRAFTS,
+
+ /** Stores spam, malware and other kinds of unwanted email. */
+ JUNK,
+
+ /** Stores email that is waiting to be sent. */
+ OUTBOX,
+
+ /** Stores email that has been sent. */
+ SENT,
+
+ /** Stores email that is to be deleted. */
+ TRASH,
+
+ // Virtual folders
+
+ /** A view of all email in an account. */
+ ALL_MAIL,
+
+ /** A view of all flagged/starred email in an account. */
+ FLAGGED,
+
+ /** A view of email the server thinks is important. */
+ IMPORTANT,
+
+ /** A view of email matching some kind of search criteria. */
+ SEARCH;
+
+ public bool is_outgoing() {
+ return this == SENT || this == OUTBOX;
+ }
+
+ }
+
+
/**
* Indicates if a folder has been opened, and if so in which way.
*/
@@ -232,8 +288,8 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
/** The folder path represented by this object. */
public abstract Geary.FolderPath path { get; }
- /** Determines the type of this folder. */
- public abstract Geary.SpecialFolderType special_folder_type { get; }
+ /** Determines the special use of this folder. */
+ public abstract SpecialUse used_as { get; }
/** Monitor for notifying of progress when opening the folder. */
public abstract Geary.ProgressMonitor opening_monitor { get; }
@@ -385,13 +441,12 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
public signal void email_locally_complete(Gee.Collection<Geary.EmailIdentifier> ids);
/**
- * Fired when the {@link SpecialFolderType} has changed.
+ * Fired when the folder's special use has changed.
*
- * This will usually happen when the local object has been updated with data discovered from the
- * remote account.
+ * This will usually happen when the local object has been updated
+ * with data discovered from the remote account.
*/
- public signal void special_folder_type_changed(Geary.SpecialFolderType old_type,
- Geary.SpecialFolderType new_type);
+ public signal void use_changed(SpecialUse old_use, SpecialUse new_use);
protected virtual void notify_opened(Geary.Folder.OpenState state, int count) {
@@ -439,9 +494,9 @@ public abstract class Geary.Folder : BaseObject, Logging.Source {
email_locally_complete(ids);
}
- protected virtual void notify_special_folder_type_changed(SpecialFolderType old_type,
- SpecialFolderType new_type) {
- special_folder_type_changed(old_type, new_type);
+ protected virtual void notify_use_changed(SpecialUse old_use,
+ SpecialUse new_use) {
+ use_changed(old_use, new_use);
}
/** Determines if a folder has been opened, and if so in which way. */
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 405c78b5..91f1238a 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -423,14 +423,14 @@ public class Geary.App.ConversationMonitor : BaseObject {
* Returns the list of folders that disqualify emails from conversations.
*/
internal Gee.Collection<Geary.FolderPath> get_search_folder_blacklist() {
- Geary.SpecialFolderType[] blacklisted_folder_types = {
- Geary.SpecialFolderType.JUNK,
- Geary.SpecialFolderType.TRASH,
- Geary.SpecialFolderType.DRAFTS,
+ Folder.SpecialUse[] blacklisted_folder_types = {
+ JUNK,
+ TRASH,
+ DRAFTS,
};
- Gee.ArrayList<Geary.FolderPath?> blacklist = new Gee.ArrayList<Geary.FolderPath?>();
- foreach (Geary.SpecialFolderType type in blacklisted_folder_types) {
+ var blacklist = new Gee.ArrayList<Geary.FolderPath?>();
+ foreach (var type in blacklisted_folder_types) {
Geary.Folder? blacklist_folder = this.base_folder.account.get_special_folder(type);
if (blacklist_folder != null) {
blacklist.add(blacklist_folder.path);
diff --git a/src/engine/app/app-draft-manager.vala b/src/engine/app/app-draft-manager.vala
index 23434b7b..bcaf26c9 100644
--- a/src/engine/app/app-draft-manager.vala
+++ b/src/engine/app/app-draft-manager.vala
@@ -205,7 +205,7 @@ public class Geary.App.DraftManager : BaseObject {
if (current_draft_id != null)
draft_state = DraftState.STORED;
- drafts_folder = account.get_special_folder(SpecialFolderType.DRAFTS);
+ drafts_folder = account.get_special_folder(DRAFTS);
if (drafts_folder == null)
throw new EngineError.NOT_FOUND("%s: No drafts folder found", to_string());
diff --git a/src/engine/app/app-search-folder.vala b/src/engine/app/app-search-folder.vala
index 53386c51..0c128704 100644
--- a/src/engine/app/app-search-folder.vala
+++ b/src/engine/app/app-search-folder.vala
@@ -23,11 +23,11 @@ public class Geary.App.SearchFolder :
/** The canonical name of the search folder. */
public const string MAGIC_BASENAME = "$GearyAccountSearchFolder$";
- private const SpecialFolderType[] EXCLUDE_TYPES = {
- SpecialFolderType.JUNK,
- SpecialFolderType.TRASH,
- SpecialFolderType.DRAFTS,
- // Orphan emails (without a folder) are also excluded; see ct or.
+ private const Folder.SpecialUse[] EXCLUDE_TYPES = {
+ DRAFTS,
+ JUNK,
+ TRASH,
+ // Orphan emails (without a folder) are also excluded; see ctor.
};
@@ -98,8 +98,8 @@ public class Geary.App.SearchFolder :
*
* Always returns {@link SpecialFolderType.SEARCH}.
*/
- public override SpecialFolderType special_folder_type {
- get { return SpecialFolderType.SEARCH; }
+ public override Folder.SpecialUse used_as {
+ get { return SEARCH; }
}
/** The query being evaluated by this folder, if any. */
@@ -126,7 +126,7 @@ public class Geary.App.SearchFolder :
this._path = root.get_child(MAGIC_BASENAME, Trillian.TRUE);
account.folders_available_unavailable.connect(on_folders_available_unavailable);
- account.folders_special_type.connect(on_folders_special_type);
+ account.folders_use_changed.connect(on_folders_use_changed);
account.email_locally_complete.connect(on_email_locally_complete);
account.email_removed.connect(on_account_email_removed);
@@ -139,7 +139,7 @@ public class Geary.App.SearchFolder :
~SearchFolder() {
account.folders_available_unavailable.disconnect(on_folders_available_unavailable);
- account.folders_special_type.disconnect(on_folders_special_type);
+ account.folders_use_changed.disconnect(on_folders_use_changed);
account.email_locally_complete.disconnect(on_email_locally_complete);
account.email_removed.disconnect(on_account_email_removed);
}
@@ -573,15 +573,15 @@ public class Geary.App.SearchFolder :
) {
if (available != null) {
// Exclude it from searching if it's got the right special type.
- foreach(Folder folder in traverse<Folder>(available)
- .filter(f => f.special_folder_type in EXCLUDE_TYPES))
+ foreach(var folder in traverse<Folder>(available)
+ .filter(f => f.used_as in EXCLUDE_TYPES))
exclude_folder(folder);
}
}
- private void on_folders_special_type(Gee.Collection<Folder> folders) {
+ private void on_folders_use_changed(Gee.Collection<Folder> folders) {
foreach (Folder folder in folders) {
- if (folder.special_folder_type in EXCLUDE_TYPES) {
+ if (folder.used_as in EXCLUDE_TYPES) {
exclude_folder(folder);
} else {
include_folder(folder);
diff --git a/src/engine/common/common-contact-harvester.vala b/src/engine/common/common-contact-harvester.vala
index 5fb20646..38abfa16 100644
--- a/src/engine/common/common-contact-harvester.vala
+++ b/src/engine/common/common-contact-harvester.vala
@@ -20,7 +20,7 @@ internal class Geary.ContactHarvesterImpl : BaseObject, ContactHarvester {
private const Email.Field REQUIRED_FIELDS = ORIGINATORS | RECEIVERS;
- private const SpecialFolderType[] FOLDER_WHITELIST = {
+ private const Folder.SpecialUse[] FOLDER_WHITELIST = {
INBOX,
ARCHIVE,
SENT,
@@ -30,11 +30,12 @@ internal class Geary.ContactHarvesterImpl : BaseObject, ContactHarvester {
private ContactStore store;
private Gee.Collection<RFC822.MailboxAddress> owner_mailboxes;
- private SpecialFolderType location;
+ private Folder.SpecialUse location;
private bool is_whitelisted;
+
public ContactHarvesterImpl(ContactStore store,
- SpecialFolderType location,
+ Folder.SpecialUse location,
Gee.Collection<RFC822.MailboxAddress> owners) {
this.store = store;
this.owner_mailboxes = owners;
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
index 7621410d..9ff7eea7 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
@@ -9,11 +9,11 @@
private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
// Archive is handled specially, so don't require it
- private const Geary.SpecialFolderType[] SUPPORTED_SPECIAL_FOLDERS = {
- Geary.SpecialFolderType.DRAFTS,
- Geary.SpecialFolderType.SENT,
- Geary.SpecialFolderType.JUNK,
- Geary.SpecialFolderType.TRASH,
+ private const Folder.SpecialUse[] SUPPORTED_SPECIAL_FOLDERS = {
+ DRAFTS,
+ SENT,
+ JUNK,
+ TRASH,
};
@@ -45,36 +45,36 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
base(config, local, incoming_remote, outgoing_remote);
}
- protected override Geary.SpecialFolderType[] get_supported_special_folders() {
+ protected override Folder.SpecialUse[] get_supported_special_folders() {
return SUPPORTED_SPECIAL_FOLDERS;
}
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
FolderPath path = local_folder.get_path();
- SpecialFolderType type;
+ Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
- type = SpecialFolderType.INBOX;
+ use = INBOX;
} else {
- type = local_folder.get_properties().attrs.get_special_folder_type();
+ use = local_folder.get_properties().attrs.get_special_use();
// There can be only one Inbox
- if (type == SpecialFolderType.INBOX) {
- type = SpecialFolderType.NONE;
+ if (use == INBOX) {
+ use = NONE;
}
}
- switch (type) {
- case SpecialFolderType.ALL_MAIL:
- return new GmailAllMailFolder(this, local_folder, type);
+ switch (use) {
+ case ALL_MAIL:
+ return new GmailAllMailFolder(this, local_folder);
- case SpecialFolderType.DRAFTS:
- return new GmailDraftsFolder(this, local_folder, type);
+ case DRAFTS:
+ return new GmailDraftsFolder(this, local_folder);
- case SpecialFolderType.JUNK:
- case SpecialFolderType.TRASH:
- return new GmailSpamTrashFolder(this, local_folder, type);
+ case JUNK:
+ case TRASH:
+ return new GmailSpamTrashFolder(this, local_folder, use);
default:
- return new GmailFolder(this, local_folder, type);
+ return new GmailFolder(this, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-all-mail-folder.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-all-mail-folder.vala
index f5fa92e4..68748971 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-all-mail-folder.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-all-mail-folder.vala
@@ -10,9 +10,8 @@
private class Geary.ImapEngine.GmailAllMailFolder : MinimalFolder, FolderSupport.Remove {
public GmailAllMailFolder(GmailAccount account,
- ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base(account, local_folder, special_folder_type);
+ ImapDB.Folder local_folder) {
+ base(account, local_folder, ALL_MAIL);
}
public async void
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-drafts-folder.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-drafts-folder.vala
index ede8622a..242880ef 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-drafts-folder.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-drafts-folder.vala
@@ -15,9 +15,8 @@ private class Geary.ImapEngine.GmailDraftsFolder :
MinimalFolder, FolderSupport.Create, FolderSupport.Remove {
public GmailDraftsFolder(GmailAccount account,
- ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base(account, local_folder, special_folder_type);
+ ImapDB.Folder local_folder) {
+ base(account, local_folder, DRAFTS);
}
public new async EmailIdentifier?
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-folder.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-folder.vala
index cab40317..127873c9 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-folder.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-folder.vala
@@ -9,8 +9,8 @@ private class Geary.ImapEngine.GmailFolder : MinimalFolder, FolderSupport.Archiv
FolderSupport.Create, FolderSupport.Remove {
public GmailFolder(GmailAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base (account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base (account, local_folder, use);
}
public new async EmailIdentifier?
@@ -31,7 +31,7 @@ private class Geary.ImapEngine.GmailFolder : MinimalFolder, FolderSupport.Archiv
// Use move_email_async("All Mail") here; Gmail will do the right thing and report
// it was copied with the pre-existing All Mail UID (in other words, no actual copy is
// performed). This allows for undoing an archive with the same code path as a move.
- Geary.Folder? all_mail = account.get_special_folder(Geary.SpecialFolderType.ALL_MAIL);
+ Geary.Folder? all_mail = account.get_special_folder(ALL_MAIL);
if (all_mail != null)
return yield move_email_async(email_ids, all_mail.path, cancellable);
@@ -65,7 +65,7 @@ private class Geary.ImapEngine.GmailFolder : MinimalFolder, FolderSupport.Archiv
GLib.Cancellable? cancellable)
throws GLib.Error {
// Get path to Trash folder
- Geary.Folder? trash = folder.account.get_special_folder(SpecialFolderType.TRASH);
+ Geary.Folder? trash = folder.account.get_special_folder(TRASH);
if (trash == null)
throw new EngineError.NOT_FOUND("%s: Trash folder not found for removal", folder.to_string());
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-spam-trash-folder.vala
b/src/engine/imap-engine/gmail/imap-engine-gmail-spam-trash-folder.vala
index b42a09b7..be9b6777 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-spam-trash-folder.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-spam-trash-folder.vala
@@ -16,8 +16,8 @@ private class Geary.ImapEngine.GmailSpamTrashFolder :
public GmailSpamTrashFolder(GmailAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base(account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base(account, local_folder, use);
}
public async void
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 9ecac241..2ca9c39d 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -17,12 +17,12 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
// we don't need to double check.
private const int REFRESH_FOLDER_LIST_SEC = 15 * 60;
- private const Geary.SpecialFolderType[] SUPPORTED_SPECIAL_FOLDERS = {
- Geary.SpecialFolderType.DRAFTS,
- Geary.SpecialFolderType.SENT,
- Geary.SpecialFolderType.JUNK,
- Geary.SpecialFolderType.TRASH,
- Geary.SpecialFolderType.ARCHIVE,
+ private const Folder.SpecialUse[] SUPPORTED_SPECIAL_FOLDERS = {
+ DRAFTS,
+ SENT,
+ JUNK,
+ TRASH,
+ ARCHIVE,
};
private static GLib.VariantType email_id_type = new GLib.VariantType(
@@ -50,8 +50,8 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
private AccountSynchronizer sync;
private TimeoutManager refresh_folder_timer;
- private Gee.Map<Geary.SpecialFolderType, Gee.List<string>> special_search_names =
- new Gee.HashMap<Geary.SpecialFolderType, Gee.List<string>>();
+ private Gee.Map<Folder.SpecialUse,Gee.List<string>> special_search_names =
+ new Gee.HashMap<Folder.SpecialUse,Gee.List<string>>();
protected GenericAccount(AccountInformation config,
@@ -426,8 +426,10 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
.to_array_list();
}
- public override async Geary.Folder get_required_special_folder_async(Geary.SpecialFolderType special,
- Cancellable? cancellable) throws Error {
+ public override async Geary.Folder get_required_special_folder_async(
+ Folder.SpecialUse special,
+ GLib.Cancellable? cancellable
+ ) throws GLib.Error {
if (!(special in get_supported_special_folders())) {
throw new EngineError.BAD_PARAMETERS(
"Invalid special folder type %s passed to get_required_special_folder_async",
@@ -587,27 +589,27 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
/**
* Marks a folder as a specific special folder type.
*/
- internal void promote_folders(Gee.Map<Geary.SpecialFolderType,Geary.Folder> specials) {
- Gee.Set<Geary.Folder> changed = new Gee.HashSet<Geary.Folder>();
- foreach (Geary.SpecialFolderType special in specials.keys) {
+ internal void promote_folders(Gee.Map<Folder.SpecialUse,Folder> specials) {
+ var changed = new Gee.HashSet<Geary.Folder>();
+ foreach (var special in specials.keys) {
MinimalFolder? minimal = specials.get(special) as MinimalFolder;
- if (minimal.special_folder_type != special) {
+ if (minimal.used_as != special) {
debug("Promoting %s to %s",
minimal.to_string(), special.to_string());
- minimal.set_special_folder_type(special);
+ minimal.set_use(special);
changed.add(minimal);
MinimalFolder? existing =
get_special_folder(special) as MinimalFolder;
if (existing != null && existing != minimal) {
- existing.set_special_folder_type(SpecialFolderType.NONE);
+ existing.set_use(NONE);
changed.add(existing);
}
}
}
if (!changed.is_empty) {
- folders_special_type(changed);
+ folders_use_changed(changed);
}
}
@@ -647,18 +649,18 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
*/
internal async Folder
ensure_special_folder_async(Imap.AccountSession remote,
- SpecialFolderType type,
+ Folder.SpecialUse use,
GLib.Cancellable? cancellable)
throws GLib.Error {
- Folder? special = get_special_folder(type);
+ Folder? special = get_special_folder(use);
if (special == null) {
- FolderPath? path = information.get_special_folder_path(type);
+ FolderPath? path = information.get_special_folder_path(use);
if (path != null) {
if (!remote.is_folder_path_valid(path)) {
warning(
"Ignoring bad special folder path '%s' for type %s",
path.to_string(),
- type.to_string()
+ use.to_string()
);
path = null;
} else {
@@ -669,7 +671,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
if (path == null) {
FolderPath root =
yield remote.get_default_personal_namespace(cancellable);
- Gee.List<string> search_names = special_search_names.get(type);
+ Gee.List<string> search_names = special_search_names.get(use);
foreach (string search_name in search_names) {
FolderPath search_path = root.get_child(search_name);
foreach (FolderPath test_path in folder_map.keys) {
@@ -687,18 +689,18 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
}
debug("Guessed folder \'%s\' for special_path %s",
- path.to_string(), type.to_string()
+ path.to_string(), use.to_string()
);
- information.set_special_folder_path(type, path);
+ information.set_special_folder_path(use, path);
}
if (!this.folder_map.has_key(path)) {
debug("Creating \"%s\" to use as special folder %s",
- path.to_string(), type.to_string());
+ path.to_string(), use.to_string());
GLib.Error? created_err = null;
try {
- yield remote.create_folder_async(path, type, cancellable);
+ yield remote.create_folder_async(path, use, cancellable);
} catch (GLib.Error err) {
// Hang on to the error since the folder might exist
// on the remote, so try fetching it anyway.
@@ -732,8 +734,8 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
special= this.folder_map.get(path);
promote_folders(
- Collection.single_map<SpecialFolderType,Folder>(
- type, special
+ Collection.single_map<Folder.SpecialUse,Folder>(
+ use, special
)
);
}
@@ -834,7 +836,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
}
}
- protected virtual Geary.SpecialFolderType[] get_supported_special_folders() {
+ protected virtual Folder.SpecialUse[] get_supported_special_folders() {
return SUPPORTED_SPECIAL_FOLDERS;
}
@@ -849,7 +851,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
* session's language. Also checks for lower-case versions of
* each.
*/
- foreach (Geary.SpecialFolderType type in get_supported_special_folders()) {
+ foreach (Folder.SpecialUse type in get_supported_special_folders()) {
Gee.List<string> compiled = new Gee.ArrayList<string>();
foreach (string names in get_special_search_names(type)) {
foreach (string name in names.split("|")) {
@@ -870,11 +872,11 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
}
}
- private Gee.List<string> get_special_search_names(Geary.SpecialFolderType type) {
+ private Gee.List<string> get_special_search_names(Folder.SpecialUse type) {
Gee.List<string> loc_names = new Gee.ArrayList<string>();
Gee.List<string> unloc_names = new Gee.ArrayList<string>();
switch (type) {
- case Geary.SpecialFolderType.DRAFTS:
+ case DRAFTS:
// List of general possible folder names to match for the
// Draft mailbox. Separate names using a vertical bar and
// put the most common localized name to the front for the
@@ -883,7 +885,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
unloc_names.add("Drafts | Draft");
break;
- case Geary.SpecialFolderType.SENT:
+ case SENT:
// List of general possible folder names to match for the
// Sent mailbox. Separate names using a vertical bar and
// put the most common localized name to the front for the
@@ -898,7 +900,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
break;
- case Geary.SpecialFolderType.JUNK:
+ case JUNK:
// List of general possible folder names to match for the
// Junk/Spam mailbox. Separate names using a vertical bar
// and put the most common localized name to the front for
@@ -908,7 +910,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
break;
- case Geary.SpecialFolderType.TRASH:
+ case TRASH:
// List of general possible folder names to match for the
// Trash mailbox. Separate names using a vertical bar and
// put the most common localized name to the front for the
@@ -923,7 +925,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
break;
- case Geary.SpecialFolderType.ARCHIVE:
+ case ARCHIVE:
// List of general possible folder names to match for the
// Archive mailbox. Separate names using a vertical bar
// and put the most common localized name to the front for
@@ -969,12 +971,12 @@ internal class Geary.ImapEngine.LoadFolders : AccountOperation {
private weak ImapDB.Account local;
- private Geary.SpecialFolderType[] specials;
+ private Folder.SpecialUse[] specials;
internal LoadFolders(GenericAccount account,
ImapDB.Account local,
- Geary.SpecialFolderType[] specials) {
+ Folder.SpecialUse[] specials) {
base(account);
this.local = local;
this.specials = specials;
@@ -1032,9 +1034,8 @@ internal class Geary.ImapEngine.LoadFolders : AccountOperation {
// that will attempt to create the folders if missing, which
// is bad if offline.
GenericAccount generic = (GenericAccount) this.account;
- Gee.Map<Geary.SpecialFolderType,Geary.Folder> added_specials =
- new Gee.HashMap<Geary.SpecialFolderType,Geary.Folder>();
- foreach (Geary.SpecialFolderType type in this.specials) {
+ var added_specials = new Gee.HashMap<Folder.SpecialUse,Folder>();
+ foreach (var type in this.specials) {
if (generic.get_special_folder(type) == null) {
Geary.FolderPath? path =
generic.information.get_special_folder_path(type);
@@ -1105,11 +1106,11 @@ internal class Geary.ImapEngine.UpdateRemoteFolders : AccountOperation {
private weak GenericAccount generic_account;
- private Geary.SpecialFolderType[] specials;
+ private Folder.SpecialUse[] specials;
internal UpdateRemoteFolders(GenericAccount account,
- Geary.SpecialFolderType[] specials) {
+ Folder.SpecialUse[] specials) {
base(account);
this.generic_account = account;
this.specials = specials;
@@ -1227,8 +1228,11 @@ internal class Geary.ImapEngine.UpdateRemoteFolders : AccountOperation {
// its properties relies on the optional SPECIAL-USE or
// XLIST extensions) use this iteration to add discovered
// properties to map
- if (minimal_folder.special_folder_type == SpecialFolderType.NONE)
-
minimal_folder.set_special_folder_type(remote_folder.properties.attrs.get_special_folder_type());
+ if (minimal_folder.used_as == NONE) {
+ minimal_folder.set_use(
+ remote_folder.properties.attrs.get_special_use()
+ );
+ }
}
// If path in remote but not local, need to add it
@@ -1302,13 +1306,16 @@ internal class Geary.ImapEngine.UpdateRemoteFolders : AccountOperation {
}
// Ensure each of the important special folders we need already exist
- foreach (Geary.SpecialFolderType special in this.specials) {
+ foreach (var use in this.specials) {
try {
yield this.generic_account.ensure_special_folder_async(
- remote, special, cancellable
+ remote, use, cancellable
);
} catch (Error e) {
- warning("Unable to ensure special folder %s: %s", special.to_string(), e.message);
+ warning(
+ "Unable to ensure special folder %s: %s",
+ use.to_string(), e.message
+ );
}
}
}
diff --git a/src/engine/imap-engine/imap-engine-generic-folder.vala
b/src/engine/imap-engine/imap-engine-generic-folder.vala
index b9a28b22..1740bb20 100644
--- a/src/engine/imap-engine/imap-engine-generic-folder.vala
+++ b/src/engine/imap-engine/imap-engine-generic-folder.vala
@@ -13,8 +13,8 @@ private class Geary.ImapEngine.GenericFolder : MinimalFolder,
public GenericFolder(GenericAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base (account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base (account, local_folder, use);
}
public async Geary.Revokable?
@@ -23,7 +23,9 @@ private class Geary.ImapEngine.GenericFolder : MinimalFolder,
throws GLib.Error {
Geary.Folder? archive_folder = null;
try {
- archive_folder = yield
account.get_required_special_folder_async(Geary.SpecialFolderType.ARCHIVE, cancellable);
+ archive_folder = yield account.get_required_special_folder_async(
+ Folder.SpecialUse.ARCHIVE, cancellable
+ );
} catch (Error e) {
debug("Error looking up archive folder in %s: %s", account.to_string(), e.message);
}
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 3417f1da..eeb863d7 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -46,12 +46,12 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
}
}
- private SpecialFolderType _special_folder_type;
- public override SpecialFolderType special_folder_type {
+ public override Folder.SpecialUse used_as {
get {
- return _special_folder_type;
+ return this._used_as;
}
}
+ private Folder.SpecialUse _used_as;
private ProgressMonitor _opening_monitor =
new Geary.ReentrantProgressMonitor(Geary.ProgressType.ACTIVITY);
@@ -117,12 +117,12 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
public MinimalFolder(GenericAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
+ Folder.SpecialUse use) {
this._account = account;
this.local_folder = local_folder;
this.local_folder.email_complete.connect(on_email_complete);
- this._special_folder_type = special_folder_type;
+ this._used_as = use;
this._properties.add(local_folder.get_properties());
this.email_prefetcher = new EmailPrefetcher(this);
update_harvester();
@@ -178,11 +178,11 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
notify_email_flags_changed(flag_map);
}
- public void set_special_folder_type(SpecialFolderType new_type) {
- SpecialFolderType old_type = _special_folder_type;
- _special_folder_type = new_type;
- if (old_type != new_type)
- notify_special_folder_type_changed(old_type, new_type);
+ public void set_use(Folder.SpecialUse new_use) {
+ var old_use = this._used_as;
+ this._used_as = new_use;
+ if (old_use != new_use)
+ notify_use_changed(old_use, new_use);
update_harvester();
}
@@ -1579,7 +1579,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
private void update_harvester() {
this.harvester = new ContactHarvesterImpl(
this.account.contact_store,
- this.special_folder_type,
+ this._used_as,
this.account.information.sender_mailboxes
);
}
diff --git a/src/engine/imap-engine/other/imap-engine-other-account.vala
b/src/engine/imap-engine/other/imap-engine-other-account.vala
index 7e5d496f..65e194a9 100644
--- a/src/engine/imap-engine/other/imap-engine-other-account.vala
+++ b/src/engine/imap-engine/other/imap-engine-other-account.vala
@@ -17,18 +17,18 @@ private class Geary.ImapEngine.OtherAccount : Geary.ImapEngine.GenericAccount {
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
FolderPath path = local_folder.get_path();
- SpecialFolderType type;
+ Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
- type = SpecialFolderType.INBOX;
+ use = INBOX;
} else {
- type = local_folder.get_properties().attrs.get_special_folder_type();
+ use = local_folder.get_properties().attrs.get_special_use();
// There can be only one Inbox
- if (type == SpecialFolderType.INBOX) {
- type = SpecialFolderType.NONE;
+ if (use == INBOX) {
+ use = NONE;
}
}
- return new OtherFolder(this, local_folder, type);
+ return new OtherFolder(this, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/other/imap-engine-other-folder.vala
b/src/engine/imap-engine/other/imap-engine-other-folder.vala
index 25d85f0c..3153c875 100644
--- a/src/engine/imap-engine/other/imap-engine-other-folder.vala
+++ b/src/engine/imap-engine/other/imap-engine-other-folder.vala
@@ -5,10 +5,11 @@
*/
private class Geary.ImapEngine.OtherFolder : GenericFolder {
+
public OtherFolder(OtherAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base (account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base(account, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index dca134d6..df55b227 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -39,21 +39,21 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
FolderPath path = local_folder.get_path();
- SpecialFolderType type;
+ Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
- type = SpecialFolderType.INBOX;
+ use = INBOX;
} else {
- type = local_folder.get_properties().attrs.get_special_folder_type();
+ use = local_folder.get_properties().attrs.get_special_use();
// There can be only one Inbox
- if (type == SpecialFolderType.INBOX) {
- type = SpecialFolderType.NONE;
+ if (use == INBOX) {
+ use = NONE;
}
}
- if (type == Geary.SpecialFolderType.DRAFTS)
- return new OutlookDraftsFolder(this, local_folder, type);
+ if (use == DRAFTS)
+ return new OutlookDraftsFolder(this, local_folder);
- return new OutlookFolder(this, local_folder, type);
+ return new OutlookFolder(this, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-drafts-folder.vala
b/src/engine/imap-engine/outlook/imap-engine-outlook-drafts-folder.vala
index a6a8ebdc..b3a7788b 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-drafts-folder.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-drafts-folder.vala
@@ -13,8 +13,7 @@
*/
private class Geary.ImapEngine.OutlookDraftsFolder : MinimalFolder {
public OutlookDraftsFolder(OutlookAccount account,
- ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base(account, local_folder, special_folder_type);
+ ImapDB.Folder local_folder) {
+ base(account, local_folder, DRAFTS);
}
}
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-folder.vala
b/src/engine/imap-engine/outlook/imap-engine-outlook-folder.vala
index 4bf46b01..dacc6139 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-folder.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-folder.vala
@@ -7,7 +7,7 @@
private class Geary.ImapEngine.OutlookFolder : GenericFolder {
public OutlookFolder(OutlookAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base(account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base(account, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
index edd24a3d..6ee00323 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
@@ -39,22 +39,22 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
FolderPath path = local_folder.get_path();
- SpecialFolderType type;
+ Folder.SpecialUse use = NONE;
if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
- type = SpecialFolderType.INBOX;
+ use = INBOX;
} else {
// Despite Yahoo not advertising that it supports
// SPECIAL-USE via its CAPABILITIES, it lists the
// appropriate attributes in LIST results anyway, so we
// can just consult that. :|
- type = local_folder.get_properties().attrs.get_special_folder_type();
+ use = local_folder.get_properties().attrs.get_special_use();
// There can be only one Inbox
- if (type == SpecialFolderType.INBOX) {
- type = SpecialFolderType.NONE;
+ if (use == INBOX) {
+ use = NONE;
}
}
- return new YahooFolder(this, local_folder, type);
+ return new YahooFolder(this, local_folder, use);
}
}
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-folder.vala
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-folder.vala
index dc8481ff..1a49466b 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-folder.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-folder.vala
@@ -7,7 +7,7 @@
private class Geary.ImapEngine.YahooFolder : GenericFolder {
public YahooFolder(YahooAccount account,
ImapDB.Folder local_folder,
- SpecialFolderType special_folder_type) {
- base (account, local_folder, special_folder_type);
+ Folder.SpecialUse use) {
+ base (account, local_folder, use);
}
}
diff --git a/src/engine/imap/api/imap-account-session.vala b/src/engine/imap/api/imap-account-session.vala
index f0bdfef1..7c12f4d1 100644
--- a/src/engine/imap/api/imap-account-session.vala
+++ b/src/engine/imap/api/imap-account-session.vala
@@ -91,14 +91,14 @@ internal class Geary.Imap.AccountSession : Geary.Imap.SessionObject {
* used to specify the type of the new folder.
*/
public async void create_folder_async(FolderPath path,
- Geary.SpecialFolderType? type,
+ Geary.Folder.SpecialUse? use,
Cancellable? cancellable)
throws Error {
ClientSession session = claim_session();
MailboxSpecifier mailbox = session.get_mailbox_for_path(path);
bool can_create_special = session.capabilities.has_capability(Capabilities.CREATE_SPECIAL_USE);
- CreateCommand cmd = (type != null && can_create_special)
- ? new CreateCommand.special_use(mailbox, type)
+ CreateCommand cmd = (use != null && can_create_special)
+ ? new CreateCommand.special_use(mailbox, use)
: new CreateCommand(mailbox);
StatusResponse response = yield send_command_async(
diff --git a/src/engine/imap/command/imap-create-command.vala
b/src/engine/imap/command/imap-create-command.vala
index 2ec68f3a..3cbf3fee 100644
--- a/src/engine/imap/command/imap-create-command.vala
+++ b/src/engine/imap/command/imap-create-command.vala
@@ -22,32 +22,32 @@ public class Geary.Imap.CreateCommand : Command {
public MailboxSpecifier mailbox { get; private set; }
- public Geary.SpecialFolderType use {
- get; private set; default = Geary.SpecialFolderType.NONE;
+ public Geary.Folder.SpecialUse use {
+ get; private set; default = NONE;
}
- private static MailboxAttribute? get_special_folder_type(Geary.SpecialFolderType type) {
- switch (type) {
- case Geary.SpecialFolderType.ALL_MAIL:
+ private static MailboxAttribute? get_special_folder_type(Geary.Folder.SpecialUse use) {
+ switch (use) {
+ case ALL_MAIL:
return MailboxAttribute.SPECIAL_FOLDER_ALL;
- case Geary.SpecialFolderType.ARCHIVE:
+ case ARCHIVE:
return MailboxAttribute.SPECIAL_FOLDER_ARCHIVE;
- case Geary.SpecialFolderType.DRAFTS:
+ case DRAFTS:
return MailboxAttribute.SPECIAL_FOLDER_DRAFTS;
- case Geary.SpecialFolderType.FLAGGED:
+ case FLAGGED:
return MailboxAttribute.SPECIAL_FOLDER_FLAGGED;
- case Geary.SpecialFolderType.JUNK:
+ case JUNK:
return MailboxAttribute.SPECIAL_FOLDER_JUNK;
- case Geary.SpecialFolderType.SENT:
+ case SENT:
return MailboxAttribute.SPECIAL_FOLDER_SENT;
- case Geary.SpecialFolderType.TRASH:
+ case TRASH:
return MailboxAttribute.SPECIAL_FOLDER_TRASH;
default:
@@ -62,7 +62,7 @@ public class Geary.Imap.CreateCommand : Command {
}
public CreateCommand.special_use(MailboxSpecifier mailbox,
- Geary.SpecialFolderType use) {
+ Geary.Folder.SpecialUse use) {
this(mailbox);
this.use = use;
diff --git a/src/engine/imap/response/imap-mailbox-attributes.vala
b/src/engine/imap/response/imap-mailbox-attributes.vala
index c37f9007..df67f792 100644
--- a/src/engine/imap/response/imap-mailbox-attributes.vala
+++ b/src/engine/imap/response/imap-mailbox-attributes.vala
@@ -58,41 +58,41 @@ public class Geary.Imap.MailboxAttributes : Geary.Imap.Flags {
* Search the {@link MailboxAttributes} looking for an XLIST-style
* {@link Geary.SpecialFolderType}.
*/
- public Geary.SpecialFolderType get_special_folder_type() {
+ public Geary.Folder.SpecialUse get_special_use() {
if (contains(MailboxAttribute.XLIST_INBOX))
- return Geary.SpecialFolderType.INBOX;
+ return INBOX;
if (contains(MailboxAttribute.XLIST_ALL_MAIL))
- return Geary.SpecialFolderType.ALL_MAIL;
+ return ALL_MAIL;
if (contains(MailboxAttribute.SPECIAL_FOLDER_TRASH))
- return Geary.SpecialFolderType.TRASH;
+ return TRASH;
if (contains(MailboxAttribute.SPECIAL_FOLDER_DRAFTS))
- return Geary.SpecialFolderType.DRAFTS;
+ return DRAFTS;
if (contains(MailboxAttribute.SPECIAL_FOLDER_SENT))
- return Geary.SpecialFolderType.SENT;
+ return SENT;
if (contains(MailboxAttribute.SPECIAL_FOLDER_JUNK))
- return Geary.SpecialFolderType.JUNK;
+ return JUNK;
if (contains(MailboxAttribute.XLIST_SPAM))
- return Geary.SpecialFolderType.JUNK;
+ return JUNK;
if (contains(MailboxAttribute.XLIST_STARRED))
- return Geary.SpecialFolderType.FLAGGED;
+ return FLAGGED;
if (contains(MailboxAttribute.SPECIAL_FOLDER_IMPORTANT))
- return Geary.SpecialFolderType.IMPORTANT;
+ return IMPORTANT;
if (contains(MailboxAttribute.SPECIAL_FOLDER_ARCHIVE))
- return Geary.SpecialFolderType.ARCHIVE;
+ return ARCHIVE;
if (contains(MailboxAttribute.SPECIAL_FOLDER_FLAGGED))
- return Geary.SpecialFolderType.FLAGGED;
+ return FLAGGED;
- return Geary.SpecialFolderType.NONE;
+ return NONE;
}
}
diff --git a/src/engine/meson.build b/src/engine/meson.build
index 0d6cbe71..c74a72be 100644
--- a/src/engine/meson.build
+++ b/src/engine/meson.build
@@ -40,7 +40,6 @@ geary_engine_vala_sources = files(
'api/geary-search-query.vala',
'api/geary-service-information.vala',
'api/geary-service-provider.vala',
- 'api/geary-special-folder-type.vala',
'app/app-conversation.vala',
'app/app-conversation-monitor.vala',
diff --git a/src/engine/outbox/outbox-folder.vala b/src/engine/outbox/outbox-folder.vala
index 7d574d17..a52c82bc 100644
--- a/src/engine/outbox/outbox-folder.vala
+++ b/src/engine/outbox/outbox-folder.vala
@@ -68,9 +68,9 @@ public class Geary.Outbox.Folder :
*
* This is always {@link Geary.SpecialFolderType.OUTBOX}
*/
- public override SpecialFolderType special_folder_type {
+ public override Geary.Folder.SpecialUse used_as {
get {
- return Geary.SpecialFolderType.OUTBOX;
+ return OUTBOX;
}
}
diff --git a/test/engine/api/geary-account-mock.vala b/test/engine/api/geary-account-mock.vala
index 9f074d62..b39ad115 100644
--- a/test/engine/api/geary-account-mock.vala
+++ b/test/engine/api/geary-account-mock.vala
@@ -148,7 +148,7 @@ public class Geary.MockAccount : Account, MockObject {
} catch (EngineError.NOT_FOUND err) {
throw err;
} catch (GLib.Error err) {
- return new MockFolder(null, null, null, SpecialFolderType.NONE, null);
+ return new MockFolder(null, null, null, NONE, null);
}
}
@@ -162,7 +162,7 @@ public class Geary.MockAccount : Account, MockObject {
}
}
- public override Folder? get_special_folder(SpecialFolderType special) {
+ public override Folder? get_special_folder(Folder.SpecialUse special) {
try {
return object_call<Folder?>(
"get_special_folder", {box_arg(special)}, null
@@ -172,7 +172,7 @@ public class Geary.MockAccount : Account, MockObject {
}
}
- public override async Folder get_required_special_folder_async(SpecialFolderType special,
+ public override async Folder get_required_special_folder_async(Folder.SpecialUse special,
Cancellable? cancellable = null)
throws Error {
return object_or_throw_call<Folder>(
diff --git a/test/engine/api/geary-folder-mock.vala b/test/engine/api/geary-folder-mock.vala
index 1812e55f..283a2079 100644
--- a/test/engine/api/geary-folder-mock.vala
+++ b/test/engine/api/geary-folder-mock.vala
@@ -20,8 +20,8 @@ public class Geary.MockFolder : Folder, MockObject {
get { return this._path; }
}
- public override SpecialFolderType special_folder_type {
- get { return this._type; }
+ public override Folder.SpecialUse used_as {
+ get { return this._used_as; }
}
public override ProgressMonitor opening_monitor {
@@ -36,19 +36,19 @@ public class Geary.MockFolder : Folder, MockObject {
private Account _account;
private FolderProperties _properties;
private FolderPath _path;
- private SpecialFolderType _type;
+ private Folder.SpecialUse _used_as;
private ProgressMonitor _opening_monitor;
public MockFolder(Account? account,
FolderProperties? properties,
FolderPath? path,
- SpecialFolderType type,
+ Folder.SpecialUse used_as,
ProgressMonitor? monitor) {
this._account = account;
this._properties = properties ?? new MockFolderPoperties();
this._path = path;
- this._type = type;
+ this._used_as = used_as;
this._opening_monitor = monitor;
}
diff --git a/test/engine/app/app-conversation-monitor-test.vala
b/test/engine/app/app-conversation-monitor-test.vala
index b38ad0a3..81043dca 100644
--- a/test/engine/app/app-conversation-monitor-test.vala
+++ b/test/engine/app/app-conversation-monitor-test.vala
@@ -42,14 +42,14 @@ class Geary.App.ConversationMonitorTest : TestCase {
this.account,
null,
this.folder_root.get_child("base"),
- SpecialFolderType.NONE,
+ NONE,
null
);
this.other_folder = new MockFolder(
this.account,
null,
this.folder_root.get_child("other"),
- SpecialFolderType.NONE,
+ NONE,
null
);
}
diff --git a/test/engine/app/app-conversation-set-test.vala b/test/engine/app/app-conversation-set-test.vala
index 1b3dc97b..1250ad6a 100644
--- a/test/engine/app/app-conversation-set-test.vala
+++ b/test/engine/app/app-conversation-set-test.vala
@@ -33,7 +33,7 @@ class Geary.App.ConversationSetTest : TestCase {
null,
null,
this.folder_root.get_child("test"),
- SpecialFolderType.NONE,
+ NONE,
null
);
this.test = new ConversationSet(this.base_folder);
diff --git a/test/engine/app/app-conversation-test.vala b/test/engine/app/app-conversation-test.vala
index a20273ac..e6c73143 100644
--- a/test/engine/app/app-conversation-test.vala
+++ b/test/engine/app/app-conversation-test.vala
@@ -33,7 +33,7 @@ class Geary.App.ConversationTest : TestCase {
null,
null,
this.folder_root.get_child("test"),
- SpecialFolderType.NONE,
+ NONE,
null
);
this.test = new Conversation(this.base_folder);
diff --git a/test/engine/common/common-contact-harvester-test.vala
b/test/engine/common/common-contact-harvester-test.vala
index 4d4578ae..fcb7bf2a 100644
--- a/test/engine/common/common-contact-harvester-test.vala
+++ b/test/engine/common/common-contact-harvester-test.vala
@@ -54,7 +54,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
public void whitelisted_folder_type() throws GLib.Error {
ContactHarvesterImpl whitelisted = new ContactHarvesterImpl(
this.store,
- SpecialFolderType.INBOX,
+ INBOX,
this.senders
);
this.store.expect_call("get_by_rfc822");
@@ -84,7 +84,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
public void blacklisted_folder_type() throws GLib.Error {
ContactHarvesterImpl whitelisted = new ContactHarvesterImpl(
this.store,
- SpecialFolderType.JUNK,
+ JUNK,
this.senders
);
this.email.set_receivers(
@@ -103,7 +103,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
public void seen_priority() throws GLib.Error {
ContactHarvesterImpl whitelisted = new ContactHarvesterImpl(
this.store,
- SpecialFolderType.INBOX,
+ INBOX,
this.senders
);
this.store.expect_call("get_by_rfc822");
@@ -132,7 +132,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
public void sent_priority() throws GLib.Error {
ContactHarvesterImpl whitelisted = new ContactHarvesterImpl(
this.store,
- SpecialFolderType.SENT,
+ SENT,
this.senders
);
this.store.expect_call("get_by_rfc822");
@@ -161,7 +161,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
public void received_priority() throws GLib.Error {
ContactHarvesterImpl whitelisted = new ContactHarvesterImpl(
this.store,
- SpecialFolderType.SENT,
+ SENT,
this.senders
);
this.store.expect_call("get_by_rfc822");
diff --git a/test/engine/imap/command/imap-create-command-test.vala
b/test/engine/imap/command/imap-create-command-test.vala
index b64d52b4..cf6abc19 100644
--- a/test/engine/imap/command/imap-create-command-test.vala
+++ b/test/engine/imap/command/imap-create-command-test.vala
@@ -26,7 +26,7 @@ class Geary.Imap.CreateCommandTest : TestCase {
"---- create Everything (use (\\All))",
new CreateCommand.special_use(
new MailboxSpecifier("Everything"),
- SpecialFolderType.ALL_MAIL
+ ALL_MAIL
).to_string()
);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]