diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 17 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 30 | ||||
-rw-r--r-- | mail/message-list.c | 53 | ||||
-rw-r--r-- | mail/message-list.h | 3 |
4 files changed, 101 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index dd70b33df2..79b83a4513 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,20 @@ +2006-01-16 Srinivasa Ragavan <sragavan@novell.com> + + ** Fixes bug #218570 + + * em-folder-browser.c (emfb_expand_all_threads), + (emfb_collapse_all_threads), (emfb_set_folder), (emfb_activate): + Added code to handle expande/collapse all and call e-tree for regen of + the list. + * message-list.c (load_tree_expand_all), + (message_list_set_threaded_expand_all), + (message_list_set_threaded_collapse_all), + (message_list_set_expand_all), (regen_list_regened): Added code to + conditionally check for expand/collapse all and save the state after + the operation. + * message-list.h: Added state variable for expand/collapse all of + threads. + 2006-01-12 Rohini S <srohini@novell.com> ** Fixes bug #221270. diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index efe3544c34..fd627e6820 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -597,6 +597,24 @@ emfb_folder_properties(BonoboUIComponent *uid, void *data, const char *path) em_folder_properties_show(NULL, emfb->view.folder, emfb->view.folder_uri); } +/* VIEWTHREADED*/ +static void +emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path) +{ + EMFolderView *emfv = data; + + message_list_set_threaded_expand_all(emfv->list); + +} + +static void +emfb_collapse_all_threads(BonoboUIComponent *uid, void *data, const char *path) +{ + EMFolderView *emfv = data; + + message_list_set_threaded_collapse_all(emfv->list); +} + static void emfb_folder_copy(BonoboUIComponent *uid, void *data, const char *path) { @@ -823,6 +841,9 @@ static BonoboUIVerb emfb_verbs[] = { BONOBO_UI_UNSAFE_VERB ("ViewShowAll", emfb_view_show_all), /* ViewThreaded is a toggle */ + BONOBO_UI_UNSAFE_VERB ("ViewThreadsExpandAll", emfb_expand_all_threads), + BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads), + BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy), BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move), BONOBO_UI_UNSAFE_VERB ("FolderDelete", emfb_folder_delete), @@ -861,6 +882,8 @@ static const EMFolderViewEnable emfb_enable_map[] = { { "MailPost", EM_POPUP_SELECT_FOLDER }, { "MessageMarkAllAsRead", EM_POPUP_SELECT_FOLDER }, { "ViewHideSelected", EM_POPUP_SELECT_MANY }, + { "ViewThreadsCollapseAll", EM_FOLDER_VIEW_SELECT_THREADED}, + { "ViewThreadsExpandAll", EM_FOLDER_VIEW_SELECT_THREADED}, { NULL }, }; @@ -1091,8 +1114,11 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) } else state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL); message_list_set_threaded(emfv->list, state); - if (emfv->uic) + if (emfv->uic) { bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); + bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); + } if (emfv->uic) { state = (folder->folder_flags & CAMEL_FOLDER_IS_TRASH) == 0; @@ -1189,6 +1215,8 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) } bonobo_ui_component_set_prop(uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); bonobo_ui_component_add_listener(uic, "ViewThreaded", emfb_view_threaded, emfv); message_list_set_threaded(emfv->list, state); diff --git a/mail/message-list.c b/mail/message-list.c index f95624ee04..ef42be46e6 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1479,6 +1479,16 @@ save_tree_state(MessageList *ml) } static void +load_tree_expand_all (MessageList *ml, gboolean state) +{ + + if (ml->folder == NULL || ml->tree == NULL) + return; + + e_tree_load_all_expanded_state (ml->tree, state); + save_tree_state (ml); +} +static void load_tree_state (MessageList *ml) { char *filename; @@ -3102,6 +3112,28 @@ void message_list_free_uids(MessageList *ml, GPtrArray *uids) } /* set whether we are in threaded view or flat view */ +void +message_list_set_threaded_expand_all (MessageList *ml) +{ + if (ml->threaded) { + ml->expand_all = 1; + + if (ml->frozen == 0) + mail_regen_list (ml, ml->search, NULL, NULL); + } +} + +void +message_list_set_threaded_collapse_all (MessageList *ml) +{ + if (ml->threaded) { + ml->collapse_all = 1; + + if (ml->frozen == 0) + mail_regen_list (ml, ml->search, NULL, NULL); + } +} + void message_list_set_threaded (MessageList *ml, gboolean threaded) { @@ -3114,6 +3146,17 @@ message_list_set_threaded (MessageList *ml, gboolean threaded) } void +message_list_set_expand_all (MessageList *ml, gboolean threaded) +{ + if (ml->threaded != threaded) { + ml->threaded = threaded; + + if (ml->frozen == 0) + mail_regen_list (ml, ml->search, NULL, NULL); + } +} + +void message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted) { if (ml->hidedeleted != hidedeleted) { @@ -3596,7 +3639,15 @@ regen_list_regened (struct _mail_msg *mm) m->ml->thread_tree = m->tree; m->tree = NULL; - load_tree_state (m->ml); + if (m->ml->expand_all) + load_tree_expand_all (m->ml, TRUE); + else if (m->ml->collapse_all) + load_tree_expand_all (m->ml, FALSE); + else + load_tree_state (m->ml); + + m->ml->expand_all = FALSE; + m->ml->collapse_all = FALSE; } else build_flat (m->ml, m->summary, m->changes); diff --git a/mail/message-list.h b/mail/message-list.h index e53fca65db..57f365025b 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -114,6 +114,9 @@ struct _MessageList { /* Are we displaying threaded view? */ guint threaded : 1; + + guint expand_all :1; + guint collapse_all :1; /* do we automatically hide deleted messages? */ guint hidedeleted : 1; |