[Xfce4-commits] <ristretto:master> Add key-bindings for using the arrow-buttons (Bug #5977).

Stephan Arts noreply at xfce.org
Sat Sep 3 00:46:01 CEST 2011


Updating branch refs/heads/master
         to 8296d0929c476bd454a7d444d855915de236c081 (commit)
       from fcb707b507b2a37cb41db93a85a95c78a5b6d3ff (commit)

commit 8296d0929c476bd454a7d444d855915de236c081
Author: Michael Orlitzky <michael at orlitzky.com>
Date:   Sat Sep 3 00:43:09 2011 +0200

    Add key-bindings for using the arrow-buttons (Bug #5977).
    
    Modified slightly by Stephan Arts to correspond the direction
    (up-down) with the direction of the arrows in the UI.
    
    Thanks to Chris Hall, who wrote the original patch.

 src/main_window.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index 3f50b74..bf02317 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -253,6 +253,9 @@ rstto_main_window_update_buttons (RsttoMainWindow *window);
 static void
 rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation);
 
+static gboolean
+cb_rstto_main_window_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
+
 static void
 cb_rstto_main_window_vpaned_pos_changed (GtkWidget *widget, gpointer user_data);
 static void
@@ -667,6 +670,7 @@ rstto_main_window_init (RsttoMainWindow *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);
 
@@ -2569,3 +2573,26 @@ cb_rstto_main_window_clear_private_data (GtkWidget *widget, RsttoMainWindow *win
 
     gtk_widget_destroy (dialog);
 }
+
+
+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_Left:
+                rstto_image_list_iter_previous (rstto_window->priv->iter);
+                break;
+            case GDK_Right:
+            case GDK_Down:
+                rstto_image_list_iter_next (rstto_window->priv->iter);
+                break;
+        }
+    }
+    return TRUE;
+}


More information about the Xfce4-commits mailing list