aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-10-20 17:14:19 +0800
committerMilan Crha <mcrha@redhat.com>2010-10-20 17:15:43 +0800
commit92e6052e56b0e81e9718bdd665ada8356f90dbc1 (patch)
treeff8406aec5476fa88d06bac55b7eaa374cbf65de
parentbc8ab2a93b61faef7ba1285dd602a353e812bc68 (diff)
downloadgsoc2013-evolution-92e6052e56b0e81e9718bdd665ada8356f90dbc1.tar.gz
gsoc2013-evolution-92e6052e56b0e81e9718bdd665ada8356f90dbc1.tar.zst
gsoc2013-evolution-92e6052e56b0e81e9718bdd665ada8356f90dbc1.zip
Bug #630969 - Implement also Message->Go to->Previous Thread
-rw-r--r--mail/e-mail-reader.c18
-rw-r--r--mail/message-list.c37
-rw-r--r--mail/message-list.h1
-rw-r--r--ui/evolution-mail-reader.ui1
4 files changed, 57 insertions, 0 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index a45301f3fe..dedacb8451 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1058,6 +1058,17 @@ action_mail_previous_important_cb (GtkAction *action,
}
static void
+action_mail_previous_thread_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ GtkWidget *message_list;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_select_prev_thread (MESSAGE_LIST (message_list));
+}
+
+static void
action_mail_previous_unread_cb (GtkAction *action,
EMailReader *reader)
{
@@ -2036,6 +2047,13 @@ static GtkActionEntry mail_reader_entries[] = {
N_("Display the previous important message"),
G_CALLBACK (action_mail_previous_important_cb) },
+ { "mail-previous-thread",
+ NULL,
+ N_("Previous T_hread"),
+ NULL,
+ N_("Display the previous thread"),
+ G_CALLBACK (action_mail_previous_thread_cb) },
+
{ "mail-previous-unread",
NULL,
N_("P_revious Unread Message"),
diff --git a/mail/message-list.c b/mail/message-list.c
index 31a3221d23..974eb1c295 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -782,6 +782,43 @@ message_list_select_next_thread (MessageList *ml)
}
}
+void
+message_list_select_prev_thread (MessageList *ml)
+{
+ ETreePath node;
+ ETreeTableAdapter *etta;
+ gint i, row;
+ gboolean skip_first;
+
+ etta = e_tree_get_table_adapter (E_TREE (ml));
+
+ if (!ml->cursor_uid
+ || (node = g_hash_table_lookup (ml->uid_nodemap, ml->cursor_uid)) == NULL)
+ return;
+
+ row = e_tree_table_adapter_row_of_node (etta, node);
+ if (row == -1)
+ return;
+
+ /* skip first found if in the middle of the thread */
+ skip_first = !e_tree_model_node_is_root (ml->model, e_tree_model_node_get_parent (ml->model, node));
+
+ /* find the previous node which has a root parent (i.e. toplevel node) */
+ for (i = row - 1; i >= 0; i--) {
+ node = e_tree_table_adapter_node_at_row (etta, i);
+ if (node
+ && e_tree_model_node_is_root (ml->model, e_tree_model_node_get_parent (ml->model, node))) {
+ if (skip_first) {
+ skip_first = FALSE;
+ continue;
+ }
+
+ select_path (ml, node);
+ return;
+ }
+ }
+}
+
static gboolean
message_list_select_all_timeout_cb (MessageList *message_list)
{
diff --git a/mail/message-list.h b/mail/message-list.h
index 3e455a68ac..4ca9015490 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -206,6 +206,7 @@ void message_list_select_uid (MessageList *message_list,
const gchar *uid,
gboolean with_fallback);
void message_list_select_next_thread (MessageList *message_list);
+void message_list_select_prev_thread (MessageList *message_list);
void message_list_select_all (MessageList *message_list);
void message_list_select_thread (MessageList *message_list);
void message_list_select_subthread (MessageList *message_list);
diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui
index 55f2b8aa37..ec07d3d6cf 100644
--- a/ui/evolution-mail-reader.ui
+++ b/ui/evolution-mail-reader.ui
@@ -58,6 +58,7 @@
<menuitem action='mail-previous'/>
<menuitem action='mail-previous-unread'/>
<menuitem action='mail-previous-important'/>
+ <menuitem action='mail-previous-thread'/>
<separator/>
<menuitem action='mail-goto-folder'/>
<menuitem action='mail-goto-nexttab'/>