diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-composer-utils.c | 21 | ||||
-rw-r--r-- | mail/em-folder-tree-model.c | 26 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 26 |
3 files changed, 48 insertions, 25 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 326072110f..1ab739185f 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1227,13 +1227,20 @@ em_utils_edit_message (EShell *shell, const gchar *message_uid) { EMsgComposer *composer; + gboolean folder_is_drafts; + gboolean folder_is_outbox; + gboolean folder_is_templates; g_return_val_if_fail (E_IS_SHELL (shell), NULL); g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL); + folder_is_drafts = em_utils_folder_is_drafts (folder); + folder_is_outbox = em_utils_folder_is_outbox (folder); + folder_is_templates = em_utils_folder_is_templates (folder); + /* Template specific code follows. */ - if (em_utils_folder_is_templates (folder)) { + if (folder_is_templates) { CamelDataWrapper *content; GConfClient *gconf; GSList *clue_list = NULL; @@ -1254,9 +1261,10 @@ em_utils_edit_message (EShell *shell, composer = e_msg_composer_new_with_message (shell, message, NULL); - e_msg_composer_remove_header (composer, "X-Evolution-Replace-Outbox-UID"); + e_msg_composer_remove_header ( + composer, "X-Evolution-Replace-Outbox-UID"); - if (message_uid != NULL && em_utils_folder_is_drafts (folder)) { + if (message_uid != NULL && folder_is_drafts) { gchar *folder_uri; folder_uri = e_mail_folder_uri_from_folder (folder); @@ -1265,8 +1273,11 @@ em_utils_edit_message (EShell *shell, composer, folder_uri, message_uid); g_free (folder_uri); - } else if (message_uid != NULL && em_utils_folder_is_outbox (folder)) { - e_msg_composer_set_header (composer, "X-Evolution-Replace-Outbox-UID", message_uid); + + } else if (message_uid != NULL && folder_is_outbox) { + e_msg_composer_set_header ( + composer, "X-Evolution-Replace-Outbox-UID", + message_uid); } composer_set_no_change (composer); diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 16acd183a1..eb6239e22a 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -637,9 +637,6 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, guint unread; GtkTreePath *path; GtkTreeIter sub; - gboolean load = FALSE; - gboolean is_drafts = FALSE; - gboolean is_templates = FALSE; CamelFolder *folder; gboolean emitted = FALSE; const gchar *uid; @@ -647,6 +644,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, const gchar *display_name; guint32 flags, add_flags = 0; EMEventTargetCustomIcon *target; + gboolean load = FALSE; + gboolean folder_is_drafts = FALSE; + gboolean folder_is_outbox = FALSE; + gboolean folder_is_templates = FALSE; gchar *uri; /* Make sure we don't already know about it. */ @@ -686,9 +687,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, unread = fi->unread; if (mail_folder_cache_get_folder_from_uri ( folder_cache, uri, &folder) && folder) { - is_drafts = em_utils_folder_is_drafts (folder); + folder_is_drafts = em_utils_folder_is_drafts (folder); + folder_is_outbox = em_utils_folder_is_outbox (folder); - if (is_drafts || em_utils_folder_is_outbox (folder)) { + if (folder_is_drafts || folder_is_outbox) { gint total; if ((total = camel_folder_get_message_count (folder)) > 0) { @@ -709,10 +711,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, if (si->store == e_mail_local_get_store ()) { if (strcmp (fi->full_name, "Drafts") == 0) { - is_drafts = TRUE; + folder_is_drafts = TRUE; display_name = _("Drafts"); } else if (strcmp (fi->full_name, "Templates") == 0) { - is_templates = TRUE; + folder_is_templates = TRUE; display_name = _("Templates"); } else if (strcmp (fi->full_name, "Inbox") == 0) { flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | @@ -730,8 +732,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, } if (account != NULL && (flags & CAMEL_FOLDER_TYPE_MASK) == 0) { - if (!is_drafts && account->drafts_folder_uri != NULL) { - is_drafts = e_mail_folder_uri_equal ( + if (!folder_is_drafts && account->drafts_folder_uri != NULL) { + folder_is_drafts = e_mail_folder_uri_equal ( CAMEL_SESSION (session), uri, account->drafts_folder_uri); } @@ -749,9 +751,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, icon_name = em_folder_utils_get_icon_name (flags | add_flags); if (g_str_equal (icon_name, "folder")) { - if (is_drafts) + if (folder_is_drafts) icon_name = "accessories-text-editor"; - else if (is_templates) + else if (folder_is_templates) icon_name = "text-x-generic-template"; } @@ -767,7 +769,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, COL_BOOL_IS_FOLDER, TRUE, COL_BOOL_LOAD_SUBDIRS, load, COL_UINT_UNREAD_LAST_SEL, 0, - COL_BOOL_IS_DRAFT, is_drafts, + COL_BOOL_IS_DRAFT, folder_is_drafts, -1); target = em_event_target_new_custom_icon ( diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 8b951ce380..2107b2c100 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -262,16 +262,26 @@ update_1folder (MailFolderCache *self, folder = mfi->folder; if (folder) { - gboolean is_drafts = FALSE, is_outbox = FALSE; - - d(printf("update 1 folder '%s'\n", folder->full_name)); - if ((self->priv->count_trash && (CAMEL_IS_VTRASH_FOLDER (folder))) - || (is_drafts = em_utils_folder_is_drafts (folder)) - || (is_outbox = em_utils_folder_is_outbox (folder)) - || (self->priv->count_sent && em_utils_folder_is_sent (folder))) { + gboolean folder_is_sent; + gboolean folder_is_drafts; + gboolean folder_is_outbox; + gboolean folder_is_vtrash; + gboolean special_case; + + folder_is_sent = em_utils_folder_is_sent (folder); + folder_is_drafts = em_utils_folder_is_drafts (folder); + folder_is_outbox = em_utils_folder_is_outbox (folder); + folder_is_vtrash = CAMEL_IS_VTRASH_FOLDER (folder); + + special_case = + (self->priv->count_trash && folder_is_vtrash) || + (self->priv->count_sent && folder_is_sent) || + folder_is_drafts || folder_is_outbox; + + if (special_case) { d(printf(" total count\n")); unread = camel_folder_get_message_count (folder); - if (is_drafts || is_outbox) { + if (folder_is_drafts || folder_is_outbox) { guint32 junked = 0; if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0) |