diff options
-rw-r--r-- | mail/e-mail-reader.c | 2 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 40 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 54 |
3 files changed, 75 insertions, 21 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 6d680aebe1..346344cfc4 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1784,7 +1784,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) cursor_uid = message_list->cursor_uid; format_uid = EM_FORMAT (html_display)->uid; - if (cursor_uid != NULL) { + if (message_list->last_sel_single) { if (g_strcmp0 (cursor_uid, format_uid) != 0) mail_get_messagex ( message_list->folder, cursor_uid, diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index f1c8bdc72f..be0b076a44 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -215,25 +215,25 @@ static ESearchBarItem emfb_search_scope_items[] = { static EMFolderViewClass *emfb_parent; -static void -html_scroll (GtkHTML *html, - GtkOrientation orientation, - GtkScrollType scroll_type, - gfloat position, - EMFolderBrowser *emfb) - -{ - if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL || !mail_config_get_enable_magic_spacebar ()) - return; - - if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { - gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); - message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); - } else if (scroll_type == GTK_SCROLL_PAGE_BACKWARD) { - gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); - message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); - } -} +//static void +//html_scroll (GtkHTML *html, +// GtkOrientation orientation, +// GtkScrollType scroll_type, +// gfloat position, +// EMFolderBrowser *emfb) +// +//{ +// if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL || !mail_config_get_enable_magic_spacebar ()) +// return; +// +// if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { +// gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); +// message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); +// } else if (scroll_type == GTK_SCROLL_PAGE_BACKWARD) { +// gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); +// message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); +// } +//} static void emfb_init(GObject *o) @@ -251,7 +251,7 @@ emfb_init(GObject *o) emfb->view.preview_active = TRUE; emfb->view.list_active = TRUE; - g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb); +// g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb); // g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL); // g_slist_free(emfb->view.ui_files); diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index f3b3b5a513..d410abb9c2 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -142,6 +142,54 @@ mail_shell_view_reader_status_message_cb (EMailShellView *mail_shell_view, } static void +mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, + GtkOrientation orientation, + GtkScrollType scroll_type, + gfloat position, + GtkHTML *html) +{ + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; + EShellSettings *shell_settings; + EMailReader *reader; + MessageList *message_list; + gboolean magic_spacebar; + + if (html->binding_handled) + return; + + if (orientation != GTK_ORIENTATION_VERTICAL) + return; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + shell_settings = e_shell_get_shell_settings (shell); + + magic_spacebar = e_shell_settings_get_boolean ( + shell_settings, "mail-magic-spacebar"); + + if (!magic_spacebar) + return; + + 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 (GTK_WIDGET (message_list)); + message_list_select ( + message_list, MESSAGE_LIST_SELECT_NEXT, + 0, CAMEL_MESSAGE_SEEN); + } else { + gtk_widget_grab_focus (GTK_WIDGET (message_list)); + message_list_select ( + message_list, MESSAGE_LIST_SELECT_PREVIOUS, + 0, CAMEL_MESSAGE_SEEN); + } +} + +static void mail_shell_view_load_view_collection (EShellViewClass *shell_view_class) { GalViewCollection *collection; @@ -317,6 +365,12 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) G_CALLBACK (mail_shell_view_key_press_event_cb), mail_shell_view); + g_signal_connect_data ( + html, "scroll", + G_CALLBACK (mail_shell_view_scroll_cb), + mail_shell_view, (GClosureNotify) NULL, + G_CONNECT_AFTER | G_CONNECT_SWAPPED); + g_signal_connect_swapped ( html, "status-message", G_CALLBACK (mail_shell_view_reader_status_message_cb), |