diff options
author | Not Zed <NotZed@Ximian.com> | 2002-08-06 12:32:24 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-08-06 12:32:24 +0800 |
commit | a75f6e461db980ecbff380e6a5bf4757cec52bb2 (patch) | |
tree | 9c398cd824e6208dc38b8423eb47aadc0245c2d1 | |
parent | 8a030c88e21c4f2bbd8ddf8eebbf3e8d2fe1117b (diff) | |
download | gsoc2013-evolution-a75f6e461db980ecbff380e6a5bf4757cec52bb2.tar.gz gsoc2013-evolution-a75f6e461db980ecbff380e6a5bf4757cec52bb2.tar.zst gsoc2013-evolution-a75f6e461db980ecbff380e6a5bf4757cec52bb2.zip |
Only count hidden messages which are in the folder. Should probably
2002-08-06 Not Zed <NotZed@Ximian.com>
* message-list.c (message_list_hidden): Only count hidden messages
which are in the folder. Should probably maintain hidden table
better. For #4334.
svn path=/trunk/; revision=17707
-rw-r--r-- | mail/ChangeLog | 4 | ||||
-rw-r--r-- | mail/message-list.c | 26 |
2 files changed, 28 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4060561111..d586c6451f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2002-08-06 Not Zed <NotZed@Ximian.com> + * message-list.c (message_list_hidden): Only count hidden messages + which are in the folder. Should probably maintain hidden table + better. For #4334. + * mail-ops.c (filter_folder_filter): Unref the driver before returning to main thread, so any closing operations are handled async (as in fetch_mail_fetch()), for #28072. diff --git a/mail/message-list.c b/mail/message-list.c index 0899c0071c..1ea817dd43 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2329,6 +2329,24 @@ message_list_length (MessageList *ml) return ml->hide_unhidden; } +struct _glibsuxcrap { + unsigned int count; + CamelFolder *folder; +}; + +static void +glib_crapback(void *key, void *data, void *x) +{ + struct _glibsuxcrap *y = x; + CamelMessageInfo *mi; + + mi = camel_folder_get_message_info(y->folder, key); + if (mi) { + y->count++; + camel_folder_free_message_info(y->folder, mi); + } +} + /* returns number of hidden messages */ unsigned int message_list_hidden(MessageList *ml) @@ -2336,8 +2354,12 @@ message_list_hidden(MessageList *ml) unsigned int hidden = 0; MESSAGE_LIST_LOCK (ml, hide_lock); - if (ml->hidden) - hidden = g_hash_table_size (ml->hidden); + if (ml->hidden && ml->folder) { + /* this is a hack, should probably just maintain the hidden table better */ + struct _glibsuxcrap x = { 0, ml->folder }; + g_hash_table_foreach(ml->hidden, glib_crapback, &x); + hidden = x.count; + } MESSAGE_LIST_UNLOCK (ml, hide_lock); return hidden; |