[balsa] Implement select thread
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Subject: [balsa] Implement select thread
- Date: Thu, 7 May 2009 21:52:43 -0400 (EDT)
commit afe6fd54d7f9478b834a6e4181c7a03576ace6ba
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu May 7 21:52:34 2009 -0400
Implement select thread
---
ChangeLog | 9 +++++++++
src/balsa-index.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/balsa-index.h | 3 +++
src/main-window.c | 15 ++++++++++++++-
4 files changed, 72 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17ee0a5..c8fe46b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-05-07 Peter Bloomfield
+
+ Implement select thread
+
+ * src/balsa-index.c (balsa_index_select_thread): new method to
+ select all messages in thread containing current message.
+ * src/balsa-index.h: ditto.
+ * src/main-window.c: use it.
+
2009-05-04 Peter Bloomfield
Add filter for colorizing messages
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 789d333..7765686 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -2761,3 +2761,49 @@ balsa_index_count_selected_messages(BalsaIndex * bindex)
gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection
(GTK_TREE_VIEW(bindex)));
}
+
+/* Select all messages in current thread */
+void
+balsa_index_select_thread(BalsaIndex * bindex)
+{
+ GtkTreeIter iter;
+ GtkTreeModel *model = GTK_TREE_MODEL(bindex->mailbox_node->mailbox);
+ GtkTreeIter next_iter;
+ GtkTreePath *path;
+ GtkTreeSelection *selection =
+ gtk_tree_view_get_selection(GTK_TREE_VIEW(bindex));
+ gboolean valid;
+
+ if (!bindex->current_msgno
+ || !libbalsa_mailbox_msgno_find(bindex->mailbox_node->mailbox,
+ bindex->current_msgno, NULL,
+ &iter))
+ return;
+
+ while (gtk_tree_model_iter_parent(model, &next_iter, &iter))
+ iter = next_iter;
+
+ path = gtk_tree_model_get_path(model, &iter);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(bindex), path, TRUE);
+ gtk_tree_path_free(path);
+
+ do {
+ gtk_tree_selection_select_iter(selection, &iter);
+
+ valid = gtk_tree_model_iter_children(model, &next_iter, &iter);
+ if (valid)
+ iter = next_iter;
+ else {
+ do {
+ GtkTreeIter save_iter = iter;
+
+ valid = gtk_tree_model_iter_next(model, &iter);
+ if (valid)
+ break;
+ valid = gtk_tree_model_iter_parent(model, &iter,
+ &save_iter);
+ } while (valid);
+ }
+ } while (valid
+ && gtk_tree_model_iter_parent(model, &next_iter, &iter));
+}
diff --git a/src/balsa-index.h b/src/balsa-index.h
index 9e5c371..e0e46e6 100644
--- a/src/balsa-index.h
+++ b/src/balsa-index.h
@@ -175,6 +175,9 @@ extern "C" {
/* Select all without previewing any. */
void balsa_index_select_all(BalsaIndex * bindex);
+ /* Select thread containing current message. */
+ void balsa_index_select_thread(BalsaIndex * bindex);
+
/* Count of selected messages. */
gint balsa_index_count_selected_messages(BalsaIndex * bindex);
diff --git a/src/main-window.c b/src/main-window.c
index a7d983e..d71f5f7 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -166,6 +166,7 @@ static void bw_forward_message_inline_cb (GtkAction * action, gpointer data);
static void bw_forward_message_default_cb (GtkAction * action, gpointer data);
#if !defined(ENABLE_TOUCH_UI)
static void bw_pipe_message_cb (GtkAction * action, gpointer data);
+static void bw_select_thread_cb (GtkAction * action, gpointer data);
#endif /* ENABLE_TOUCH_UI */
static void bw_continue_message_cb (GtkAction * action, gpointer data);
@@ -511,6 +512,9 @@ static const GtkActionEntry message_entries[] = {
{"Pipe", BALSA_PIXMAP_FORWARD, N_("_Pipe through..."), NULL,
N_("Pipe the message through another program"),
G_CALLBACK(bw_pipe_message_cb)},
+ {"SelectThread", NULL, N_("Select _Thread"), NULL,
+ N_("Select all messages in current thread"),
+ G_CALLBACK(bw_select_thread_cb)},
#endif /* ENABLE_TOUCH_UI */
};
@@ -532,7 +536,7 @@ static const GtkActionEntry current_message_entries[] = {
N_("Copy message"), G_CALLBACK(bw_message_copy_cb)},
{"SelectText", NULL, N_("_Select Text"), NULL,
N_("Select entire mail"), G_CALLBACK(bw_message_select_all_cb)},
- {"FindInMessage", NULL, N_("_Find in message"), "slash",
+ {"FindInMessage", NULL, N_("Find in _Message"), "slash",
N_("Find a string in this message"),
G_CALLBACK(bw_find_in_message_cb)}
#endif /* ENABLE_TOUCH_UI */
@@ -677,6 +681,7 @@ static const char *ui_description =
" <menu action='EditMenu'>"
" <menuitem action='Copy'/>"
" <menuitem action='SelectAll'/>"
+" <menuitem action='SelectThread'/>"
" <separator/>"
" <menuitem action='Find'/>"
" <menuitem action='FindNext'/>"
@@ -3429,6 +3434,14 @@ bw_pipe_message_cb(GtkAction * action, gpointer data)
(balsa_window_find_current_index
(BALSA_WINDOW(data))));
}
+
+static void
+bw_select_thread_cb(GtkAction * action, gpointer data)
+{
+ balsa_index_select_thread(BALSA_INDEX
+ (balsa_window_find_current_index
+ (BALSA_WINDOW(data))));
+}
#endif /* ENABLE_TOUCH_UI */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]