diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 17 | ||||
-rw-r--r-- | mail/message-list.c | 42 | ||||
-rw-r--r-- | mail/message-thread.c | 12 | ||||
-rw-r--r-- | mail/message-thread.h | 4 |
4 files changed, 53 insertions, 22 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2293762ea1..b70bb51a84 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,22 @@ 2000-08-12 Dan Winship <danw@helixcode.com> + * message-list.c (cleanup_regenerate_messagelist): Don't clear the + tree here. If two "folder_changed"s arrive in close succession, + then one possible ordering of events is + cleanup_regenerate_messagelist, cleanup_regenerate_messagelist, + cleanup_thread_messages, cleanup_thread_messages. Which would + result in the message list being filled in twice without being + cleared in between. So don't clear it until the rebuilding + function itself is called. + (clear_tree): New function to empty out the ETreeModel in the + message list. + (build_tree): Change to simpler interface. Call clear_tree. + (build_subtree): Does most of the work of the old build_tree + (build_flat): Remove unused arg. Call clear_tree. + + * message-thread.c (cleanup_thread_messages): Update for + build_tree interface change. + * mail-ops.c (do_send_mail): Don't leak the transport. * mail-tools.c (mail_tool_get_folder_from_urlname): Don't ref the diff --git a/mail/message-list.c b/mail/message-list.c index 7e9c28e23c..6cbff44481 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -791,11 +791,35 @@ message_list_new (FolderBrowser *parent_folder_browser) return BONOBO_OBJECT (message_list); } +static void +clear_tree (MessageList *ml) +{ + ETreeModel *etm = E_TREE_MODEL (ml->table_model); + + if (ml->tree_root) + e_tree_model_node_remove (etm, ml->tree_root); + ml->tree_root = + e_tree_model_node_insert (etm, NULL, 0, ml); + e_tree_model_node_set_expanded (etm, ml->tree_root, TRUE); +} + /* only call if we have a tree model */ /* builds the tree structure */ +static void build_subtree (MessageList *ml, ETreePath *parent, + struct _container *c, int *row); + static void -build_tree (MessageList *ml, ETreePath *parent, struct _container *c, - int *row) +build_tree (MessageList *ml, struct _container *c) +{ + int row = 0; + + clear_tree (ml); + build_subtree (ml, ml->tree_root, c, &row); +} + +static void +build_subtree (MessageList *ml, ETreePath *parent, + struct _container *c, int *row) { ETreeModel *tree = E_TREE_MODEL (ml->table_model); ETreePath *node; @@ -813,20 +837,21 @@ build_tree (MessageList *ml, ETreePath *parent, struct _container *c, if (c->child) { /* by default, open all trees */ e_tree_model_node_set_expanded (tree, node, TRUE); - build_tree (ml, node, c->child, row); + build_subtree (ml, node, c->child, row); } c = c->next; } } static void -build_flat (MessageList *ml, ETreePath *parent, GPtrArray *uids) +build_flat (MessageList *ml, GPtrArray *uids) { ETreeModel *tree = E_TREE_MODEL (ml->table_model); ETreePath *node; char *uid; int i; + clear_tree (ml); for (i = 0; i < uids->len; i++) { uid = g_strdup_printf ("uid:%s", (char *)uids->pdata[i]); node = e_tree_model_node_insert (tree, ml->tree_root, i, uid); @@ -1171,19 +1196,12 @@ static void cleanup_regenerate_messagelist (gpointer in_data, gpointer op_data, return; } - /* Clear the old contents, build the new */ - if (input->ml->tree_root) - e_tree_model_node_remove(etm, input->ml->tree_root); - input->ml->tree_root = - e_tree_model_node_insert(etm, NULL, 0, input->ml); - e_tree_model_node_set_expanded (etm, input->ml->tree_root, TRUE); - if (mail_config_thread_list()) { mail_do_thread_messages (input->ml, data->uids, (gboolean) !(input->search), build_tree); } else { - build_flat (input->ml, input->ml->tree_root, data->uids); + build_flat (input->ml, data->uids); if (input->search) { camel_folder_search_free (input->ml->folder, data->uids); diff --git a/mail/message-thread.c b/mail/message-thread.c index cb17a65c34..b703889670 100644 --- a/mail/message-thread.c +++ b/mail/message-thread.c @@ -509,13 +509,11 @@ typedef struct thread_messages_input_s { MessageList *ml; GPtrArray *uids; gboolean use_camel_uidfree; - void (*build) (MessageList *, ETreePath *, - struct _container *, int *); + void (*build) (MessageList *, struct _container *); } thread_messages_input_t; typedef struct thread_messages_data_s { struct _container *container; - int row; } thread_messages_data_t; static gchar *describe_thread_messages (gpointer in_data, gboolean gerund); @@ -562,7 +560,6 @@ static void do_thread_messages (gpointer in_data, gpointer op_data, CamelExcepti thread_messages_data_t *data = (thread_messages_data_t *) op_data; data->container = thread_messages (input->ml->folder, input->uids); - data->row = 0; } static void cleanup_thread_messages (gpointer in_data, gpointer op_data, CamelException *ex) @@ -570,8 +567,7 @@ static void cleanup_thread_messages (gpointer in_data, gpointer op_data, CamelEx thread_messages_input_t *input = (thread_messages_input_t *) in_data; thread_messages_data_t *data = (thread_messages_data_t *) op_data; - (input->build) (input->ml, input->ml->tree_root, - data->container, &(data->row)); + (input->build) (input->ml, data->container); thread_messages_free (data->container); if (input->use_camel_uidfree) { @@ -597,8 +593,8 @@ static const mail_operation_spec op_thread_messages = void mail_do_thread_messages (MessageList *ml, GPtrArray *uids, gboolean use_camel_uidfree, - void (*build) (MessageList *, ETreePath *, - struct _container *, int *)) + void (*build) (MessageList *, + struct _container *)) { thread_messages_input_t *input; diff --git a/mail/message-thread.h b/mail/message-thread.h index 46a7a36b03..5c4be91ade 100644 --- a/mail/message-thread.h +++ b/mail/message-thread.h @@ -16,8 +16,8 @@ struct _container { void mail_do_thread_messages (MessageList *ml, GPtrArray *uids, gboolean use_camel_uidfree, - void (*build) (MessageList *, ETreePath *, - struct _container *, int *)); + void (*build) (MessageList *, + struct _container *)); #endif /* !_MESSAGE_THREAD_H */ |