diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-05-16 06:53:12 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-05-16 06:53:12 +0000 |
commit | dba371b0f9eb466e52980ed6c54cbb24903fcfe5 (patch) | |
tree | bac611f8d0f80b5859243abea62701360dde097a /src/summaryview.c | |
parent | e7e717c4ee877a009657e2f971a5c188daf55701 (diff) |
improved the performance of Mark all read on IMAP4 by only modifying the flagged messages.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1695 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/summaryview.c')
-rw-r--r-- | src/summaryview.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/summaryview.c b/src/summaryview.c index d9efdcae..a5e1a861 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1197,6 +1197,27 @@ GSList *summary_get_msg_list(SummaryView *summaryview) return g_slist_copy(summaryview->all_mlist); } +GSList *summary_get_flagged_msg_list(SummaryView *summaryview, + MsgPermFlags flags) +{ + MsgInfo *msginfo; + GSList *list, *cur; + GSList *mlist = NULL; + + if (summaryview->on_filter) + list = summaryview->flt_mlist; + else + list = summaryview->all_mlist; + + for (cur = list; cur != NULL; cur = cur->next) { + msginfo = (MsgInfo *)cur->data; + if ((msginfo->flags.perm_flags & flags) != 0) + mlist = g_slist_prepend(mlist, msginfo); + } + + return g_slist_reverse(mlist); +} + static void summary_update_msg_list(SummaryView *summaryview) { GtkTreeModel *model = GTK_TREE_MODEL(summaryview->store); @@ -3082,6 +3103,14 @@ void summary_mark_all_read(SummaryView *summaryview) SORT_BLOCK(SORT_BY_UNREAD); + if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP) { + GSList *msglist; + msglist = summary_get_flagged_msg_list(summaryview, + MSG_NEW | MSG_UNREAD); + imap_msg_list_unset_perm_flags(msglist, MSG_NEW | MSG_UNREAD); + g_slist_free(msglist); + } + valid = gtk_tree_model_get_iter_first(model, &iter); while (valid) { summary_mark_row_as_read(summaryview, &iter); @@ -3103,13 +3132,6 @@ void summary_mark_all_read(SummaryView *summaryview) valid = gtkut_tree_model_next(model, &iter); } - if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP) { - GSList *msglist; - msglist = summary_get_msg_list(summaryview); - imap_msg_list_unset_perm_flags(msglist, MSG_NEW | MSG_UNREAD); - g_slist_free(msglist); - } - SORT_UNBLOCK(SORT_BY_UNREAD); trayicon_set_tooltip(NULL); |