aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNicholas Miell <nmiell@gmail.com>2007-11-26 19:28:54 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-11-26 19:28:54 +0800
commit042ba3ee7ee150deb11c1e03076320a4d44c2c37 (patch)
tree3d460c3fe9275a1044515abbf426606aa823c89c /mail
parent897f2574fd48427e81a21692e6ec0abc8f74eee4 (diff)
downloadgsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar.gz
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar.bz2
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar.lz
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar.xz
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.tar.zst
gsoc2013-evolution-042ba3ee7ee150deb11c1e03076320a4d44c2c37.zip
** Fix for bug #216485 Edit->Select thread menu fix and improvement.
2007-11-26 Nicholas Miell <nmiell@gmail.com> ** Fix for bug #216485 Edit->Select thread menu fix and improvement. * mail/em-folder-browser.c: (emfb_edit_select_subthread): new function, (emfb_enable_map, emfb_verbs) hook it up * mail/message-list.c: (select_thread): new function based on thread_select_foreach, (thread_select_foreach): remove the logic now in select_thread, (message_list_select_thread): use select_thread, (subthread_select_foreach): new function, (message_list_select_subthread): new function * mail/message-list.h: (message_list_select_subthread): add prototype * ui/evolution-mail-list.xml Add Select Message Subthread svn path=/trunk/; revision=34585
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/em-folder-browser.c10
-rw-r--r--mail/message-list.c69
-rw-r--r--mail/message-list.h1
4 files changed, 70 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 83058385cb..b3ca18a6a1 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2007-11-26 Nicholas Miell <nmiell@gmail.com>
+
+ ** Fix for bug #216485
+ Edit->Select thread menu fix and improvement.
+
+ * em-folder-browser.c: (emfb_edit_select_subthread): new function,
+ (emfb_enable_map, emfb_verbs) hook it up
+ * message-list.c: (select_thread): new function based on
+ thread_select_foreach, (thread_select_foreach): remove the logic
+ now in select_thread, (message_list_select_thread): use
+ select_thread, (subthread_select_foreach): new function,
+ (message_list_select_subthread): new function
+ * message-list.h: (message_list_select_subthread): add prototype
+
2007-11-23 Milan Crha <mcrha@redhat.com>
** Fix for bug #494414
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 8f479a15e1..5253101c67 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -150,6 +150,7 @@ static const EMFolderViewEnable emfb_enable_map[] = {
{ "EditInvertSelection", EM_POPUP_SELECT_FOLDER },
{ "EditSelectAll", EM_POPUP_SELECT_FOLDER },
{ "EditSelectThread", EM_FOLDER_VIEW_SELECT_THREADED },
+ { "EditSelectSubthread", EM_FOLDER_VIEW_SELECT_THREADED },
{ "FolderExpunge", EM_POPUP_SELECT_FOLDER },
{ "FolderCopy", EM_POPUP_SELECT_FOLDER },
{ "FolderMove", EM_POPUP_SELECT_FOLDER },
@@ -1300,6 +1301,14 @@ emfb_edit_select_thread(BonoboUIComponent *uid, void *data, const char *path)
}
static void
+emfb_edit_select_subthread(BonoboUIComponent *uid, void *data, const char *path)
+{
+ EMFolderView *emfv = data;
+
+ message_list_select_subthread (emfv->list);
+}
+
+static void
emfb_folder_properties(BonoboUIComponent *uid, void *data, const char *path)
{
EMFolderBrowser *emfb = data;
@@ -1555,6 +1564,7 @@ static BonoboUIVerb emfb_verbs[] = {
BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", emfb_edit_invert_selection),
BONOBO_UI_UNSAFE_VERB ("EditSelectAll", emfb_edit_select_all),
BONOBO_UI_UNSAFE_VERB ("EditSelectThread", emfb_edit_select_thread),
+ BONOBO_UI_UNSAFE_VERB ("EditSelectSubthread", emfb_edit_select_subthread),
BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", emfb_folder_properties),
BONOBO_UI_UNSAFE_VERB ("FolderExpunge", emfb_folder_expunge),
/* HideDeleted is a toggle */
diff --git a/mail/message-list.c b/mail/message-list.c
index b9d5cf56cb..e008301cee 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -718,30 +718,40 @@ select_node (ETreeModel *model, ETreePath path, gpointer user_data)
}
static void
+select_thread (MessageList *message_list, void (*selector)(ETreePath, gpointer))
+{
+ ETreeSelectionModel *etsm;
+ thread_select_info_t tsi;
+
+ tsi.ml = message_list;
+ tsi.paths = g_ptr_array_new ();
+
+ etsm = (ETreeSelectionModel *) e_tree_get_selection_model (message_list->tree);
+
+ e_tree_selected_path_foreach (message_list->tree, selector, &tsi);
+
+ e_tree_selection_model_select_paths (etsm, tsi.paths);
+
+ g_ptr_array_free (tsi.paths, TRUE);
+}
+
+static void
thread_select_foreach (ETreePath path, gpointer user_data)
{
thread_select_info_t *tsi = (thread_select_info_t *) user_data;
ETreeModel *model = tsi->ml->model;
- ETreePath node;
+ ETreePath node, last;
- /* @path part of the initial selection. If it has children,
- * we select them as well. If it doesn't, we select its siblings and
- * their children (ie, the current node must be inside the thread
- * that the user wants to mark.
- */
+ node = path;
- if (e_tree_model_node_get_first_child (model, path)) {
- node = path;
- } else {
- node = e_tree_model_node_get_parent (model, path);
+ do {
+ last = node;
+ node = e_tree_model_node_get_parent (model, node);
+ } while (!e_tree_model_node_is_root (model, node));
- /* Let's make an exception: if no parent, then we're about
- * to mark the whole tree. No. */
- if (e_tree_model_node_is_root (model, node))
- node = path;
- }
+ g_ptr_array_add (tsi->paths, last);
- e_tree_model_node_traverse (model, node, select_node, tsi);
+ e_tree_model_node_traverse (model, last, select_node, tsi);
}
/**
@@ -753,17 +763,28 @@ thread_select_foreach (ETreePath path, gpointer user_data)
void
message_list_select_thread (MessageList *message_list)
{
- ETreeSelectionModel *etsm;
- thread_select_info_t tsi;
+ select_thread (message_list, thread_select_foreach);
+}
- tsi.ml = message_list;
- tsi.paths = g_ptr_array_new ();
+static void
+subthread_select_foreach (ETreePath path, gpointer user_data)
+{
+ thread_select_info_t *tsi = (thread_select_info_t *) user_data;
+ ETreeModel *model = tsi->ml->model;
- etsm = (ETreeSelectionModel *) e_tree_get_selection_model (message_list->tree);
+ e_tree_model_node_traverse (model, path, select_node, tsi);
+}
- e_tree_selected_path_foreach (message_list->tree, thread_select_foreach, &tsi);
- e_tree_selection_model_select_paths(etsm, tsi.paths);
- g_ptr_array_free (tsi.paths, TRUE);
+/**
+ * message_list_select_subthread:
+ * @message_list: Message List widget
+ *
+ * Selects all messages in the current subthread (based on cursor).
+ **/
+void
+message_list_select_subthread (MessageList *message_list)
+{
+ select_thread (message_list, subthread_select_foreach);
}
/**
diff --git a/mail/message-list.h b/mail/message-list.h
index c1713dc4d4..5bec274ad6 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -198,6 +198,7 @@ void message_list_select_next_thread (MessageList *ml);
/* selection manipulation */
void message_list_select_all (MessageList *ml);
void message_list_select_thread (MessageList *ml);
+void message_list_select_subthread (MessageList *ml);
void message_list_invert_selection (MessageList *ml);
/* clipboard stuff */