diff --git a/src/main_window.c b/src/main_window.c index 1f40557..9d33d82 100644 --- a/src/main_window.c +++ b/src/main_window.c @@ -257,6 +257,9 @@ cb_rstto_main_window_picture_viewer_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data); +static gboolean +cb_rstto_main_window_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); + static void rstto_main_window_update_buttons (RsttoMainWindow *window); static void @@ -660,6 +663,7 @@ rstto_main_window_init (RsttoMainWindow *window) g_signal_connect(G_OBJECT(window->priv->picture_viewer), "enter-notify-event", G_CALLBACK(cb_rstto_main_window_picture_viewer_enter_notify_event), window); g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(cb_rstto_main_window_configure_event), NULL); g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(cb_rstto_main_window_state_event), NULL); + g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(cb_rstto_main_window_key_press_event), NULL); g_signal_connect(G_OBJECT(window->priv->image_list_toolbar), "button-press-event", G_CALLBACK(cb_rstto_main_window_navigationtoolbar_button_press_event), window); g_signal_connect(G_OBJECT(window->priv->thumbnailbar), "button-press-event", G_CALLBACK(cb_rstto_main_window_navigationtoolbar_button_press_event), window); @@ -2553,3 +2557,26 @@ rstto_main_window_add_file_to_recent_files (GFile *file) return FALSE; } + + +static gboolean +cb_rstto_main_window_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) +{ + GtkWindow *window = GTK_WINDOW(widget); + RsttoMainWindow *rstto_window = RSTTO_MAIN_WINDOW(widget); + if(gtk_window_activate_key(window, event) == FALSE) + { + switch(event->keyval) + { + case GDK_Up: + case GDK_Right: + rstto_image_list_iter_next (rstto_window->priv->iter); + break; + case GDK_Down: + case GDK_Left: + rstto_image_list_iter_previous (rstto_window->priv->iter); + break; + } + } + return TRUE; +}