diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-tree-model.c | 29 | ||||
-rw-r--r-- | mail/em-folder-tree-model.h | 1 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 8 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 17 |
4 files changed, 21 insertions, 34 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 4322e5e9f4..b753cd7a84 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -388,7 +388,8 @@ folder_tree_model_init (EMFolderTreeModel *model) G_TYPE_BOOLEAN, /* is a store node */ G_TYPE_BOOLEAN, /* is a folder node */ G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */ - G_TYPE_UINT /* last known unread count */ + G_TYPE_UINT, /* last known unread count */ + G_TYPE_BOOLEAN /* folder is a draft folder */ }; store_index = g_hash_table_new_full ( @@ -550,13 +551,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, /* This is duplicated in mail-folder-cache too, should perhaps be functionised */ unread = fi->unread; if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) { - CamelFolder *local_drafts; - CamelFolder *local_outbox; + is_drafts = em_utils_folder_is_drafts (folder, fi->uri); - local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS); - local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); - - if (folder == local_outbox) { + if (is_drafts || em_utils_folder_is_outbox (folder, fi->uri)) { gint total; if ((total = camel_folder_get_message_count (folder)) > 0) { @@ -568,20 +565,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, unread = total > 0 ? total : 0; } - if (folder == local_drafts) { - gint total; - - if ((total = camel_folder_get_message_count (folder)) > 0) { - gint deleted = camel_folder_get_deleted_message_count (folder); - - if (deleted != -1) - total -= deleted; - } - unread = total > 0 ? total : 0; - } camel_object_unref(folder); - } /* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */ @@ -644,6 +629,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, -1); target = em_event_target_new_custom_icon (em_event_peek(), tree_store, iter, fi->full_name, EM_EVENT_CUSTOM_ICON); @@ -669,6 +655,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, COL_STRING_URI, NULL, COL_UINT_UNREAD, 0, COL_UINT_UNREAD_LAST_SEL, 0, + COL_BOOL_IS_DRAFT, FALSE, -1); path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), iter); @@ -1003,7 +990,9 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, COL_BOOL_IS_FOLDER, FALSE, COL_STRING_URI, NULL, COL_UINT_UNREAD, 0, - COL_UINT_UNREAD_LAST_SEL, 0, -1); + COL_UINT_UNREAD_LAST_SEL, 0, + COL_BOOL_IS_DRAFT, FALSE, + -1); /* listen to store events */ si->created_id = camel_object_hook_event ( diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index d75e57c0b4..00e2d39282 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -68,6 +68,7 @@ enum { * has subfolders which have not yet * been added to the tree */ COL_UINT_UNREAD_LAST_SEL, /* last known unread count */ + COL_BOOL_IS_DRAFT, /* %TRUE for a draft folder */ NUM_COLUMNS }; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 0217a7aa58..187522fb0a 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -971,13 +971,15 @@ render_icon (GtkTreeViewColumn *column, guint unread; guint old_unread; gchar *icon_name; - gboolean row_selected; + gboolean row_selected, is_drafts = FALSE; gtk_tree_model_get ( model, iter, COL_STRING_ICON_NAME, &icon_name, COL_UINT_UNREAD_LAST_SEL, &old_unread, - COL_UINT_UNREAD, &unread, -1); + COL_UINT_UNREAD, &unread, + COL_BOOL_IS_DRAFT, &is_drafts, + -1); if (icon_name == NULL) return; @@ -989,7 +991,7 @@ render_icon (GtkTreeViewColumn *column, row_selected = gtk_tree_selection_iter_is_selected (selection, iter); /* Show an emblem if there's new mail. */ - if (!row_selected && unread > old_unread) { + if (!row_selected && unread > old_unread && !is_drafts) { GIcon *temp_icon; GEmblem *emblem; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index d19e163001..9bbb3737d2 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -312,26 +312,21 @@ update_1folder(struct _folder_info *mfi, gint new, CamelFolderInfo *info) { struct _folder_update *up; CamelFolder *folder; - CamelFolder *local_drafts; - CamelFolder *local_outbox; - CamelFolder *local_sent; gint unread = -1; gint deleted; - local_drafts = e_mail_local_get_folder (E_MAIL_FOLDER_DRAFTS); - local_outbox = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); - local_sent = e_mail_local_get_folder (E_MAIL_FOLDER_SENT); - folder = mfi->folder; if (folder) { + gboolean is_drafts = FALSE, is_outbox = FALSE; + d(printf("update 1 folder '%s'\n", folder->full_name)); if ((count_trash && (CAMEL_IS_VTRASH_FOLDER (folder))) - || folder == local_drafts - || folder == local_outbox - || (count_sent && folder == local_sent)) { + || (is_drafts = em_utils_folder_is_drafts (folder, info ? info->uri : NULL)) + || (is_outbox = em_utils_folder_is_outbox (folder, info ? info->uri : NULL)) + || (count_sent && em_utils_folder_is_sent (folder, info ? info->uri : NULL))) { d(printf(" total count\n")); unread = camel_folder_get_message_count (folder); - if (folder == local_drafts || folder == local_outbox) { + if (is_drafts || is_outbox) { guint32 junked = 0; if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0) |