Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouped Folders: Sent #580

Merged
merged 3 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/FoldersView/GroupedFolderSourceItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class Mail.GroupedFolderSourceItem : Granite.Widgets.SourceList.Item {
name = _("Archive");
icon = new ThemedIcon ("mail-archive");
break;
case Camel.FolderInfoFlags.TYPE_SENT:
name = _("Sent");
icon = new ThemedIcon ("mail-sent");
break;
default:
name = "%i".printf (folder_type & Camel.FOLDER_TYPE_MASK);
icon = new ThemedIcon ("folder");
Expand Down Expand Up @@ -146,11 +150,26 @@ public class Mail.GroupedFolderSourceItem : Granite.Widgets.SourceList.Item {
if (Camel.FolderInfoFlags.TYPE_ARCHIVE == (folder_type & Camel.FOLDER_TYPE_MASK)) {
return strip_folder_full_name (account.service.uid, mail_account_extension.dup_archive_folder ());
}

var identity_uid = mail_account_extension.dup_identity_uid ();
var identity_source = session.ref_source (identity_uid);

switch (folder_type & Camel.FOLDER_TYPE_MASK) {
case Camel.FolderInfoFlags.TYPE_SENT:
if (identity_source.has_extension (E.SOURCE_EXTENSION_MAIL_SUBMISSION)) {
var mail_submission_extension = (E.SourceMailSubmission) identity_source.get_extension (E.SOURCE_EXTENSION_MAIL_SUBMISSION);
return strip_folder_full_name (account.service.uid, mail_submission_extension.dup_sent_folder ());
}
break;
}
}
return null;
}

private string strip_folder_full_name (string service_uid, string folder_uri) {
return folder_uri.replace ("folder://%s/".printf (service_uid), "");
private string? strip_folder_full_name (string service_uid, string? folder_uri) {
if (folder_uri != null) {
return folder_uri.replace ("folder://%s/".printf (service_uid), "");
}
return null;
}
}
1 change: 1 addition & 0 deletions src/FoldersView/SessionSourceItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_INBOX));
add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_ARCHIVE));
add (new GroupedFolderSourceItem (session, Camel.FolderInfoFlags.TYPE_SENT));

session.account_added.connect (added_account);
session.account_removed.connect (removed_account);
Expand Down