From ebfe51b97a008e49b0d80ed5314f554ecc71ea1e Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Mon, 30 Jul 2007 17:09:29 +0000 Subject: [PATCH] * src/modest-ui-actions.c: * If we get a folder empty selection, and focus is in headers view, move focus to folder view. * src/maemo/modest-main-window.c: * If the message count of the folder is 0 then move the focus to the folder view (fixes NB#63198). pmo-trunk-r2859 --- src/maemo/modest-main-window.c | 5 ++++- src/modest-ui-actions.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index 4484343..955c7f3 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -1745,11 +1745,13 @@ _on_msg_count_changed (ModestHeaderView *header_view, { printf ("DEBUG: %s\n", __FUNCTION__); gboolean folder_empty = FALSE; - TnyFolderChangeChanged changed; + TnyFolderChangeChanged changed; + ModestMainWindowPrivate *priv; g_return_if_fail (MODEST_IS_MAIN_WINDOW (main_window)); g_return_if_fail (TNY_IS_FOLDER(folder)); g_return_if_fail (TNY_IS_FOLDER_CHANGE(change)); + priv = MODEST_MAIN_WINDOW_GET_PRIVATE (main_window); changed = tny_folder_change_get_changed (change); @@ -1765,6 +1767,7 @@ _on_msg_count_changed (ModestHeaderView *header_view, if (folder_empty) { modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY); + gtk_widget_grab_focus (GTK_WIDGET (priv->folder_view)); } else { modest_main_window_set_contents_style (main_window, diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index e20e028..b984c95 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -1619,6 +1619,20 @@ modest_ui_actions_on_header_selected (ModestHeaderView *header_view, g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window)); g_return_if_fail (MODEST_IS_HEADER_VIEW (header_view)); + /* in the case the folder is empty, show the empty folder message and focus + * folder view */ + if (!header && gtk_widget_is_focus (GTK_WIDGET (header_view))) { + if (modest_header_view_is_empty (header_view)) { + TnyFolder *folder = modest_header_view_get_folder (header_view); + GtkWidget *folder_view = + modest_main_window_get_child_widget (main_window, + MODEST_WIDGET_TYPE_FOLDER_VIEW); + if (folder != NULL) + modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view), folder, FALSE); + gtk_widget_grab_focus (GTK_WIDGET (folder_view)); + return; + } + } /* If no header has been selected then exit */ if (!header) return; -- 1.7.9.5