From 5065d763f8e08ad187c7a2806c1809369f01b2b5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 16 May 2022 20:52:48 +0200 Subject: [PATCH] ews-I#159 - EMFolderTreeModel: Prefer Inbox over other folder types When an Inbox is marked as a Sent folder and the Inbox gets to the MailFolderCache before the folder tree, then the folder tree reads the "is sent folder" for the cached folder and then overrides the folder Inbox type to the Sent folder, which breaks the visual part in the folder tree. Closes https://gitlab.gnome.org/GNOME/evolution-ews/-/issues/159 --- src/mail/em-folder-tree-model.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mail/em-folder-tree-model.c b/src/mail/em-folder-tree-model.c index 4dfff7d69b..63d8ffa795 100644 --- a/src/mail/em-folder-tree-model.c +++ b/src/mail/em-folder-tree-model.c @@ -1507,20 +1507,26 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_INBOX; display_name = _("Inbox"); + folder_is_drafts = FALSE; + folder_is_sent = FALSE; } else if (strcmp (fi->full_name, "Outbox") == 0) { flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_OUTBOX; display_name = _("Outbox"); + folder_is_drafts = FALSE; + folder_is_sent = FALSE; } else if (strcmp (fi->full_name, "Sent") == 0) { folder_is_sent = TRUE; display_name = _("Sent"); } } - if (folder_is_drafts) - flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_DRAFTS; - if (folder_is_sent) - flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_SENT; + if ((flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_INBOX) { + if (folder_is_drafts) + flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_DRAFTS; + if (folder_is_sent) + flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_SENT; + } /* Choose an icon name for the folder. */ icon_name = em_folder_tree_model_get_icon_name_for_folder_uri (model, uri, store, fi->full_name, &flags);