From 77c5ed36148a3a83099ecc17bf48ad8d5068773a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 3 May 2004 18:59:05 +0000 Subject: Fix for bug #57968 2004-05-03 Jeffrey Stedfast Fix for bug #57968 * message-list.c (message_list_set_folder): Save the tree/hide state of the current folder before clearing the message-list. (message_list_set_folder): Note that a new folder has just been set (now needed by the regen code to tell whether or not it should save the tree state before clearing the tree). (message_list_destroy): Save the tree/hide state before destroying the message-info's, not after. (regen_list_regened): If the regen is being performed in response to a message_list_set_folder, don't save the tree state before clearing the tree or we'll clobber the real state with bogus data. svn path=/trunk/; revision=25767 --- mail/ChangeLog | 15 +++++++++++++++ mail/mail-account-gui.c | 2 +- mail/message-list.c | 21 ++++++++++++++------- mail/message-list.h | 3 +++ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 944c504bff..16f32343b7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2004-05-03 Jeffrey Stedfast + + Fix for bug #57968 + + * message-list.c (message_list_set_folder): Save the tree/hide + state of the current folder before clearing the message-list. + (message_list_set_folder): Note that a new folder has just been + set (now needed by the regen code to tell whether or not it should + save the tree state before clearing the tree). + (message_list_destroy): Save the tree/hide state before destroying + the message-info's, not after. + (regen_list_regened): If the regen is being performed in response + to a message_list_set_folder, don't save the tree state before + clearing the tree or we'll clobber the real state with bogus data. + 2004-05-03 William Jon McCann * mail-account-gui.c: Add gtkdialog header to fix build. diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index adc2e4d844..85af00c601 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -338,7 +338,7 @@ service_complete (MailAccountGuiService *service, GHashTable *extra_config, GtkW return TRUE; } -gboolean +static gboolean mail_account_gui_check_for_license (CamelProvider *prov) { GConfClient *gconf; diff --git a/mail/message-list.c b/mail/message-list.c index c34a1444b1..138832c007 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1625,14 +1625,15 @@ message_list_destroy(GtkObject *object) if (message_list->folder) { /* need to do this before removing folder, folderinfo's might not exist after */ + save_tree_state(message_list); + save_hide_state(message_list); + if (message_list->uid_nodemap) { g_hash_table_foreach(message_list->uid_nodemap, (GHFunc)clear_info, message_list); g_hash_table_destroy (message_list->uid_nodemap); message_list->uid_nodemap = NULL; } - save_tree_state(message_list); - save_hide_state(message_list); camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); camel_object_unref (message_list->folder); message_list->folder = NULL; @@ -2543,10 +2544,14 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c } } + if (message_list->folder != NULL) { + save_tree_state (message_list); + save_hide_state (message_list); + } + clear_tree (message_list); if (message_list->folder) { - save_hide_state(message_list); camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", folder_changed, message_list); camel_object_unref (message_list->folder); @@ -2575,6 +2580,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c camel_object_ref (folder); message_list->folder = folder; + message_list->just_set_folder = TRUE; /* Setup the strikeout effect for non-trash folders */ if (!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) @@ -2681,10 +2687,8 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess else return FALSE; - info = get_message_info (list, path); - if (info == NULL) { + if (!(info = get_message_info (list, path))) return FALSE; - } /* If a message was marked as deleted and the user flags it as important, marks it as needing a reply, marks it as unread, @@ -3286,7 +3290,10 @@ regen_list_regened (struct _mail_msg *mm) return; if (m->dotree) { - save_tree_state (m->ml); + if (m->ml->just_set_folder) + m->ml->just_set_folder = FALSE; + else + save_tree_state (m->ml); build_tree (m->ml, m->tree, m->changes); if (m->ml->thread_tree) diff --git a/mail/message-list.h b/mail/message-list.h index 7a7ccfa78a..c4fed0537b 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -108,6 +108,9 @@ struct _MessageList { /* Current search string, or %NULL */ char *search; + /* are we regenerating the message_list because set_folder was just called? */ + guint just_set_folder : 1; + /* Are we displaying threaded view? */ guint threaded : 1; -- cgit