aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-08-06 12:32:24 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-08-06 12:32:24 +0800
commita75f6e461db980ecbff380e6a5bf4757cec52bb2 (patch)
tree9c398cd824e6208dc38b8423eb47aadc0245c2d1 /mail/message-list.c
parent8a030c88e21c4f2bbd8ddf8eebbf3e8d2fe1117b (diff)
downloadgsoc2013-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
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c26
1 files changed, 24 insertions, 2 deletions
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;