diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-06-16 07:56:58 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-06-16 07:56:58 +0000 |
commit | 3408495144e731c76aa54d13c3d3affb515f4a41 (patch) | |
tree | c787415d73af43a8cceba254b00e591ba292328d /libsylph | |
parent | d88c2fb8b9d428fb0b97c231f920c94c44163ba4 (diff) |
added 'Mark all read' to the folder context menu.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1082 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/procmsg.c | 34 | ||||
-rw-r--r-- | libsylph/procmsg.h | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 3a47da3d..4cb56811 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -380,6 +380,40 @@ void procmsg_set_flags(GSList *mlist, FolderItem *item) g_hash_table_destroy(mark_table); } +static void mark_all_read_func(gpointer key, gpointer value, gpointer data) +{ + MSG_UNSET_PERM_FLAGS(*((MsgFlags *)value), MSG_NEW|MSG_UNREAD); +} + +void procmsg_mark_all_read(FolderItem *item) +{ + GHashTable *mark_table; + + debug_print("Marking all messages as read\n"); + + mark_table = procmsg_read_mark_file(item); + if (mark_table) { + g_hash_table_foreach(mark_table, mark_all_read_func, NULL); + procmsg_write_mark_file(item, mark_table); + hash_free_value_mem(mark_table); + g_hash_table_destroy(mark_table); + } + + if (item->mark_queue) { + GSList *cur; + MsgInfo *msginfo; + + for (cur = item->mark_queue; cur != NULL; cur = cur->next) { + msginfo = (MsgInfo *)cur->data; + MSG_UNSET_PERM_FLAGS + (msginfo->flags, MSG_NEW|MSG_UNREAD); + } + item->mark_dirty = TRUE; + } + + item->new = item->unread = 0; +} + static FolderSortType cmp_func_sort_type; GSList *procmsg_sort_msg_list(GSList *mlist, FolderSortKey sort_key, diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h index f61b6f9b..3fc7e119 100644 --- a/libsylph/procmsg.h +++ b/libsylph/procmsg.h @@ -221,6 +221,7 @@ GSList *procmsg_read_cache (FolderItem *item, gboolean scan_file); void procmsg_set_flags (GSList *mlist, FolderItem *item); +void procmsg_mark_all_read (FolderItem *item); GSList *procmsg_sort_msg_list (GSList *mlist, FolderSortKey sort_key, FolderSortType sort_type); |