aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/message-list.c26
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;