From 94cc603cca2152ad8aedcbec3cd0e28110e9a21c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 1 Apr 2010 14:02:43 +0200 Subject: Bug #374533 - Read window stays open after last email is deleted --- mail/message-list.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'mail/message-list.c') diff --git a/mail/message-list.c b/mail/message-list.c index 88a711085b..453e261574 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -3851,6 +3851,33 @@ message_list_set_selected(MessageList *ml, GPtrArray *uids) g_ptr_array_free(paths, TRUE); } +struct ml_count_data { + MessageList *ml; + guint count; +}; + +static void +ml_getcount_cb (ETreePath path, gpointer user_data) +{ + struct ml_count_data *data = user_data; + + if (!e_tree_model_node_is_root (data->ml->model, path)) + data->count++; +} + +guint +message_list_count (MessageList *message_list) +{ + struct ml_count_data data = { message_list, 0 }; + + g_return_val_if_fail (message_list != NULL, 0); + g_return_val_if_fail (IS_MESSAGE_LIST (message_list), 0); + + e_tree_path_foreach (E_TREE (message_list), ml_getcount_cb, &data); + + return data.count; +} + void message_list_freeze(MessageList *ml) { -- cgit