aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2001-06-28 05:22:37 +0800
committerPeter Williams <peterw@src.gnome.org>2001-06-28 05:22:37 +0800
commit4cbcd49a8bed07221be190b80e84e23f0ad7d449 (patch)
tree29eac92a416e1ccd54694bc79183f6025003af08 /mail
parent6fa46ef11d80a615733338bfe1f76acaef5eab48 (diff)
downloadgsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar.gz
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar.bz2
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar.lz
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar.xz
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.tar.zst
gsoc2013-evolution-4cbcd49a8bed07221be190b80e84e23f0ad7d449.zip
Bump required gal version for new accessors in ETree.
2001-06-27 Peter Williams <peterw@ximian.com> * configure.in (gal): Bump required gal version for new accessors in ETree. mail: 2001-06-27 Peter Williams <peterw@ximian.com> * folder-browser-ui.c: Uncomment EditSelectThread. Yaay! * mail-callbacks.c (select_thread): New function. Self-explanatory name. Implementation is a little hairy. * mail-callbacks.h: Prototype it here. * mail-callbacks.c (invert_selection): Here too. (select_all): Here too. * subscribe-dialog.c (subscribe_select_all): Update to use new ETree accessors. (subscribe_invert_selection): Here too. calendar: 2001-06-27 Peter Williams <peterw@ximian.com> * conduits/*/Makefile.am (INCLUDES): More srcdir != builddir fixes. svn path=/trunk/; revision=10544
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/folder-browser-ui.c2
-rw-r--r--mail/mail-callbacks.c79
-rw-r--r--mail/mail-callbacks.h1
-rw-r--r--mail/subscribe-dialog.c10
5 files changed, 102 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8bd080d2a6..66a40e9df5 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+2001-06-27 Peter Williams <peterw@ximian.com>
+
+ * folder-browser-ui.c: Uncomment EditSelectThread. Yaay!
+
+ * mail-callbacks.c (select_thread): New function. Self-explanatory
+ name. Implementation is a little hairy.
+
+ * mail-callbacks.h: Prototype it here.
+
+ * mail-callbacks.c (invert_selection): Here too.
+ (select_all): Here too.
+
+ * subscribe-dialog.c (subscribe_select_all): Update to use new
+ ETree accessors.
+ (subscribe_invert_selection): Here too.
+
2001-06-27 jacob berkman <jacob@ximian.com>
* folder-browser.c (save_cursor_pos): work around an e-tree bug
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 2a72b349fe..31b4b94140 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -83,7 +83,7 @@ static BonoboUIVerb list_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("EditPaste", folder_browser_paste),
BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", invert_selection),
BONOBO_UI_UNSAFE_VERB ("EditSelectAll", select_all),
-/* BONOBO_UI_UNSAFE_VERB ("EditSelectThread", select_thread),*/
+ BONOBO_UI_UNSAFE_VERB ("EditSelectThread", select_thread),
BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", configure_folder),
BONOBO_UI_UNSAFE_VERB ("FolderExpunge", expunge_folder),
/* HideDeleted is a toggle */
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 7c3db7b418..a51f573482 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -979,11 +979,85 @@ select_all (BonoboUIComponent *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
MessageList *ml = fb->message_list;
+ ESelectionModel *etsm = e_tree_get_selection_model (ml->tree);
if (ml->folder == NULL)
return;
- e_tree_select_all (ml->tree);
+ e_selection_model_select_all (etsm);
+}
+
+/* Thread selection */
+
+typedef struct thread_select_info {
+ MessageList *ml;
+ GPtrArray *paths;
+} thread_select_info_t;
+
+static gboolean
+select_node (ETreeModel *tm, ETreePath path, gpointer user_data)
+{
+ thread_select_info_t *tsi = (thread_select_info_t *) user_data;
+
+ g_ptr_array_add (tsi->paths, path);
+ return FALSE; /*not done yet*/
+}
+
+static void
+thread_select_foreach (ETreePath path, gpointer user_data)
+{
+ thread_select_info_t *tsi = (thread_select_info_t *) user_data;
+ ETreeModel *tm = tsi->ml->model;
+ ETreePath node;
+
+ /* @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.
+ */
+
+ if (e_tree_model_node_get_first_child (tm, path))
+ node = path;
+ else {
+ node = e_tree_model_node_get_parent (tm, path);
+
+ /* 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 (tm, node))
+ node = path;
+ }
+
+ e_tree_model_node_traverse (tm, node, select_node, tsi);
+}
+
+void
+select_thread (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ MessageList *ml = fb->message_list;
+ ETreeSelectionModel *selection_model;
+ thread_select_info_t tsi;
+ int i;
+
+ if (ml->folder == NULL)
+ return;
+
+ /* For every selected item, select the thread containing it.
+ * We can't alter the selection while iterating through it,
+ * so build up a list of paths.
+ */
+
+ tsi.ml = ml;
+ tsi.paths = g_ptr_array_new ();
+
+ e_tree_selected_path_foreach (ml->tree, thread_select_foreach, &tsi);
+
+ selection_model = E_TREE_SELECTION_MODEL (e_tree_get_selection_model (ml->tree));
+
+ for (i = 0; i < tsi.paths->len; i++)
+ e_tree_selection_model_add_to_selection (selection_model,
+ tsi.paths->pdata[i]);
+ g_ptr_array_free (tsi.paths, TRUE);
}
void
@@ -991,11 +1065,12 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
MessageList *ml = fb->message_list;
+ ESelectionModel *etsm = e_tree_get_selection_model (ml->tree);
if (ml->folder == NULL)
return;
- e_tree_invert_selection (ml->tree);
+ e_selection_model_invert_selection (etsm);
}
/* flag all selected messages. Return number flagged */
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 2d82995180..e96b5d1ff9 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -81,6 +81,7 @@ void search_msg (GtkWidget *widget, gpointer user_data);
void load_images (GtkWidget *widget, gpointer user_data);
void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
+void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c
index 0ba539c84e..117e7cbfd0 100644
--- a/mail/subscribe-dialog.c
+++ b/mail/subscribe-dialog.c
@@ -422,8 +422,10 @@ subscribe_select_all (BonoboUIComponent *uic,
{
SubscribeDialog *sc = (SubscribeDialog*)user_data;
ETreeScrolled *scrolled = E_TREE_SCROLLED (sc->folder_etree);
-
- e_tree_select_all (e_tree_scrolled_get_tree(scrolled));
+ ETree *tree = e_tree_scrolled_get_tree (scrolled);
+ ESelectionModel *esm = e_tree_get_selection_model (E_TREE (tree));
+
+ e_selection_model_select_all (E_SELECTION_MODEL (esm));
}
static void
@@ -432,8 +434,10 @@ subscribe_invert_selection (BonoboUIComponent *uic,
{
SubscribeDialog *sc = (SubscribeDialog*)user_data;
ETreeScrolled *scrolled = E_TREE_SCROLLED (sc->folder_etree);
+ ETree *tree = e_tree_scrolled_get_tree (scrolled);
+ ESelectionModel *esm = e_tree_get_selection_model (E_TREE (tree));
- e_tree_invert_selection (e_tree_scrolled_get_tree(scrolled));
+ e_selection_model_invert_selection (E_SELECTION_MODEL (esm));
}
static void