diff options
-rw-r--r-- | mail/ChangeLog | 18 | ||||
-rw-r--r-- | mail/folder-info.c | 18 | ||||
-rw-r--r-- | mail/message-list.c | 106 | ||||
-rw-r--r-- | mail/message-list.h | 3 |
4 files changed, 102 insertions, 43 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index fd912a3a09..e8546bef08 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2002-06-11 Not Zed <NotZed@Ximian.com> + + * folder-info.c (do_get_info): If we dont get a folder, dont try + and get details off it. Should get rid of most of those annoying + summary warnings, but not the cause of them. + 2002-06-10 Jeffrey Stedfast <fejj@ximian.com> * mail-accounts.c (account_able_clicked): Comment out the code to @@ -48,6 +54,18 @@ (regen_list_regen): If we were cancelled, shortcut processing. This is all for #23571. + * message-list.c (regen_list_regen): Change the way we calculate + the hide deleted messages and tree view options. Do it based on a + search and uid's rather than a summary. + (regen_list_regened): Handle changes to tree storage. + (mail_regen_list): The tree is now stored between updates, so we + can update the tree structure incrementally. This blows out + memory use some however. We need an etree that uses this as its + model directly? + (message_list_destroy): Free the thread tree. + (message_list_set_folder): Clear the thread tree when changing + folder. + 2002-06-05 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (mail_get_message_rfc822): Don't forget to free diff --git a/mail/folder-info.c b/mail/folder-info.c index bf4f11f227..1694458966 100644 --- a/mail/folder-info.c +++ b/mail/folder-info.c @@ -76,22 +76,12 @@ do_get_info (struct _mail_msg *mm) { struct _folder_info_msg *m = (struct _folder_info_msg *) mm; CamelFolder *folder; - CamelException *ex; - ex = camel_exception_new (); - folder = mail_tool_uri_to_folder (m->foldername, 0, ex); - if (camel_exception_is_set (ex)) { - g_warning ("Camel exception: %s", camel_exception_get_description (ex)); + folder = mail_tool_uri_to_folder (m->foldername, 0, NULL); + if (folder) { + m->read = camel_folder_get_message_count (folder); + m->unread = camel_folder_get_unread_message_count (folder); } - - camel_exception_free (ex); - - if (folder == NULL) { - g_warning ("Camel returned NULL for %s\n", m->foldername); - } - - m->read = camel_folder_get_message_count (folder); - m->unread = camel_folder_get_unread_message_count (folder); } static void diff --git a/mail/message-list.c b/mail/message-list.c index ba0e1c194f..1de20b61db 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1220,6 +1220,9 @@ message_list_destroy (GtkObject *object) camel_object_unref (CAMEL_OBJECT (message_list->folder)); } + if (message_list->thread_tree) + camel_folder_thread_messages_unref(message_list->thread_tree); + gtk_object_unref (GTK_OBJECT (message_list->extras)); gtk_object_unref (GTK_OBJECT (message_list->model)); @@ -2018,6 +2021,11 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, g camel_object_unref (CAMEL_OBJECT (message_list->folder)); } + if (message_list->thread_tree) { + camel_folder_thread_messages_unref(message_list->thread_tree); + message_list->thread_tree = NULL; + } + message_list->folder = camel_folder; if (message_list->cursor_uid) { @@ -2407,6 +2415,8 @@ hide_save_state (MessageList *ml) struct _regen_list_msg { struct _mail_msg msg; + int complete; + MessageList *ml; char *search; char *hideexpr; @@ -2439,14 +2449,26 @@ static void regen_list_regen (struct _mail_msg *mm) { struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - GPtrArray *uids, *uidnew, *showuids; + GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL; CamelMessageInfo *info; int i; - if (m->search) - uids = camel_folder_search_by_expression (m->folder, m->search, &mm->ex); - else - uids = camel_folder_get_uids (m->folder); + /* if we have hidedeleted on, use a search to find it out, merge with existing search if set */ + if (m->hidedel) { + char *expr; + + if (m->search) { + expr = alloca(strlen(m->search) + 64); + sprintf(expr, "(and (match-all (not (system-flag \"deleted\")))\n %s)", m->search); + } else + expr = "(match-all (not (system-flag \"deleted\")))"; + searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &mm->ex); + } else { + if (m->search) + searchuids = uids = camel_folder_search_by_expression (m->folder, m->search, &mm->ex); + else + uids = camel_folder_get_uids (m->folder); + } if (camel_exception_is_set (&mm->ex)) return; @@ -2528,32 +2550,32 @@ regen_list_regen (struct _mail_msg *mm) MESSAGE_LIST_UNLOCK(m->ml, hide_lock); - if (!camel_operation_cancel_check(mm->cancel)) { - m->summary = g_ptr_array_new (); - for (i = 0; i < showuids->len; i++) { - info = camel_folder_get_message_info (m->folder, showuids->pdata[i]); - if (info) { - /* FIXME: should this be taken account of in above processing? */ - if (m->hidedel && (info->flags & CAMEL_MESSAGE_DELETED) != 0) - camel_folder_free_message_info (m->folder, info); - else - g_ptr_array_add (m->summary, info); + if (!camel_operation_cancel_check(mm->cancel)) { + /* update/build a new tree */ + if (m->dotree) { + if (m->tree) + camel_folder_thread_messages_apply(m->tree, showuids); + else + m->tree = camel_folder_thread_messages_new(m->folder, showuids); + } else { + m->summary = g_ptr_array_new (); + for (i = 0; i < showuids->len; i++) { + info = camel_folder_get_message_info (m->folder, showuids->pdata[i]); + if (info) + g_ptr_array_add(m->summary, info); } } - - if (m->dotree) - m->tree = camel_folder_thread_messages_new_summary (m->summary); - else - m->tree = NULL; } if (uidnew) g_ptr_array_free (uidnew, TRUE); - - if (m->search) - camel_folder_search_free (m->folder, uids); + + if (searchuids) + camel_folder_search_free (m->folder, searchuids); else camel_folder_free_uids (m->folder, uids); + + m->complete = TRUE; } static void @@ -2563,16 +2585,21 @@ regen_list_regened (struct _mail_msg *mm) if (GTK_OBJECT_DESTROYED(m->ml)) return; - - if (m->summary == NULL) - return; + if (!m->complete) + return; + if (camel_operation_cancel_check(mm->cancel)) return; - if (m->dotree) + if (m->dotree) { build_tree (m->ml, m->tree, m->changes); - else + g_assert(m->ml->thread_tree == NULL || m->ml->thread_tree == m->tree); + if (m->ml->thread_tree == NULL) { + m->ml->thread_tree = m->tree; + m->tree = NULL; + } + } else build_flat (m->ml, m->summary, m->changes); gtk_signal_emit (GTK_OBJECT (m->ml), message_list_signals[MESSAGE_LIST_BUILT]); @@ -2591,7 +2618,7 @@ regen_list_free (struct _mail_msg *mm) } if (m->tree) - camel_folder_thread_messages_destroy (m->tree); + camel_folder_thread_messages_unref (m->tree); if (m->ml->search && m->ml->search != m->search) g_free (m->ml->search); @@ -2625,6 +2652,19 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came if (ml->folder == NULL) return; + + /* cancel any outstanding regeneration requests, we rebuild from scratch anyway */ + if (ml->regen) { + GList *l = ml->regen; + + while (l) { + struct _mail_msg *mm = l->data; + + if (mm->cancel) + camel_operation_cancel(mm->cancel); + l = l->next; + } + } #ifndef BROKEN_ETREE /* this can sometimes crash,so ... */ @@ -2649,6 +2689,14 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came m->folder = ml->folder; camel_object_ref (CAMEL_OBJECT (m->folder)); + if ((!m->hidedel || !m->dotree) && ml->thread_tree) { + camel_folder_thread_messages_unref(ml->thread_tree); + ml->thread_tree = NULL; + } else if (ml->thread_tree) { + m->tree = ml->thread_tree; + camel_folder_thread_messages_ref(m->tree); + } + ml->regen = g_list_prepend(ml->regen, m); e_thread_put (mail_thread_queued, (EMsg *)m); diff --git a/mail/message-list.h b/mail/message-list.h index b1ff3f974f..3cc412f6cc 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -89,6 +89,9 @@ struct _MessageList { /* list of outstanding regeneration requests */ GList *regen; + /* the current camel folder thread tree, if any */ + struct _CamelFolderThread *thread_tree; + /* for message/folder chagned event handling */ struct _MailAsyncEvent *async_event; }; |