diff options
-rw-r--r-- | mail/em-folder-tree.c | 16 | ||||
-rw-r--r-- | mail/em-folder-tree.h | 1 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 25 |
3 files changed, 42 insertions, 0 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index f1274f7c50..b683ef6802 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -118,6 +118,7 @@ enum { FOLDER_ACTIVATED, /* aka double-clicked or user hit enter */ FOLDER_SELECTED, POPUP_EVENT, + HIDDEN_KEY_EVENT, LAST_SIGNAL }; @@ -652,6 +653,12 @@ folder_tree_key_press_event (GtkWidget *widget, GtkTreeSelection *selection; GtkTreeView *tree_view; + if (event && event->type == GDK_KEY_PRESS && (event->keyval == GDK_space || event->keyval == '.' || event->keyval == ',' || event->keyval == '[' || event->keyval == ']')) { + g_signal_emit (widget, signals [HIDDEN_KEY_EVENT], 0, event); + + return TRUE; + } + priv = EM_FOLDER_TREE_GET_PRIVATE (widget); tree_view = GTK_TREE_VIEW (widget); @@ -836,6 +843,15 @@ folder_tree_class_init (EMFolderTreeClass *class) g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + signals[HIDDEN_KEY_EVENT] = + g_signal_new ("hidden-key-event", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMFolderTreeClass, hidden_key_event), + NULL, NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, 1, GDK_TYPE_EVENT); } static void diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index cca5432306..02730cb09d 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -82,6 +82,7 @@ struct _EMFolderTreeClass { const gchar *uri, guint32 flags); void (*popup_event) (EMFolderTree *folder_tree); + void (*hidden_key_event) (EMFolderTree *emft, GdkEvent *event); }; GType em_folder_tree_get_type (void); diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index dd802fc98c..91d0a47072 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -365,6 +365,29 @@ mail_shell_sidebar_selection_changed_cb (EShellSidebar *shell_sidebar, } static void +tree_hidden_key_event_cb (EMFolderTree *emft, GdkEvent *event, EShellView *shell_view) +{ + if (event && event->type == GDK_KEY_PRESS && shell_view) { + MessageList *msg_list = e_mail_reader_get_message_list (E_MAIL_READER (e_shell_view_get_shell_content (shell_view))); + + g_return_if_fail (msg_list != NULL); + + switch (event->key.keyval) { + case '[': + case ',': + gtk_widget_grab_focus ((GtkWidget *) msg_list); + message_list_select (msg_list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); + break; + case ']': + case '.': + gtk_widget_grab_focus ((GtkWidget *) msg_list); + message_list_select (msg_list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); + break; + } + } +} + +static void mail_shell_sidebar_get_property (GObject *object, guint property_id, GValue *value, @@ -461,6 +484,8 @@ mail_shell_sidebar_constructed (GObject *object) shell_settings, "mail-side-bar-search", widget, "enable-search"); + g_signal_connect (widget, "hidden-key-event", G_CALLBACK (tree_hidden_key_event_cb), shell_view); + tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree); selection = gtk_tree_view_get_selection (tree_view); model = gtk_tree_view_get_model (tree_view); |