[evolution] Bug 620602 - Next/prev shortcuts should focus message list



commit a15a2953237e02bd69005ea5c39e0d3d45e95cb9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Jun 5 13:52:25 2010 -0400

    Bug 620602 - Next/prev shortcuts should focus message list

 mail/message-list.c                      |    6 ++++++
 modules/mail/e-mail-shell-view-private.c |    7 ++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index ee80748..2de21bf 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -631,6 +631,12 @@ message_list_select(MessageList *ml, MessageListSelectDirection direction, guint
 	path = ml_search_path(ml, direction, flags, mask);
 	if (path) {
 		select_path(ml, path);
+
+		/* This function is usually called in response to a key
+		 * press, so grab focus if the message list is visible. */
+		if (gtk_widget_get_visible (GTK_WIDGET (ml)))
+			gtk_widget_grab_focus (GTK_WIDGET (ml));
+
 		return TRUE;
 	} else
 		return FALSE;
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index b3e856f..4cef432 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -294,19 +294,16 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view,
 	reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
 	message_list = e_mail_reader_get_message_list (reader);
 
-	if (scroll_type == GTK_SCROLL_PAGE_FORWARD) {
-		gtk_widget_grab_focus (message_list);
+	if (scroll_type == GTK_SCROLL_PAGE_FORWARD)
 		message_list_select (
 			MESSAGE_LIST (message_list),
 			MESSAGE_LIST_SELECT_NEXT,
 			0, CAMEL_MESSAGE_SEEN);
-	} else {
-		gtk_widget_grab_focus (message_list);
+	else
 		message_list_select (
 			MESSAGE_LIST (message_list),
 			MESSAGE_LIST_SELECT_PREVIOUS,
 			0, CAMEL_MESSAGE_SEEN);
-	}
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]