diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/summaryview.c | 36 | ||||
-rw-r--r-- | src/summaryview.h | 4 |
2 files changed, 32 insertions, 8 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); diff --git a/src/summaryview.h b/src/summaryview.h index aaeaa57e..021b9f21 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2006 Hiroyuki Yamamoto + * Copyright (C) 1999-2007 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,6 +182,8 @@ SummarySelection summary_get_selection_type (SummaryView *summaryview); GSList *summary_get_selected_msg_list (SummaryView *summaryview); GSList *summary_get_changed_msg_list (SummaryView *summaryview); GSList *summary_get_msg_list (SummaryView *summaryview); +GSList *summary_get_flagged_msg_list (SummaryView *summaryview, + MsgPermFlags flags); void summary_select_prev_unread (SummaryView *summaryview); void summary_select_next_unread (SummaryView *summaryview); |