[Xfce4-commits] <thunar:jannis/new-shortcuts-pane> Allow rows to be activated with the return/space key.

Jannis Pohlmann noreply at xfce.org
Tue Jun 7 14:24:01 CEST 2011


Updating branch refs/heads/jannis/new-shortcuts-pane
         to 3570e3c747e51fedd5b414faae3605768ddf355b (commit)
       from 5847cb1b9c13ef66a65859463c5ce172a49cc3b4 (commit)

commit 3570e3c747e51fedd5b414faae3605768ddf355b
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Tue Jun 7 14:23:47 2011 +0200

    Allow rows to be activated with the return/space key.

 thunar/thunar-shortcut-row.c  |   25 +++++++++++++++++++++++++
 thunar/thunar-standard-view.c |    5 +----
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-shortcut-row.c b/thunar/thunar-shortcut-row.c
index 4a70625..950b011 100644
--- a/thunar/thunar-shortcut-row.c
+++ b/thunar/thunar-shortcut-row.c
@@ -25,6 +25,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <gdk/gdkkeysyms.h>
+
 #include <exo/exo.h>
 
 #include <thunar/thunar-browser.h>
@@ -78,6 +80,8 @@ static void     thunar_shortcut_row_set_property         (GObject           *obj
                                                           GParamSpec        *pspec);
 static gboolean thunar_shortcut_row_button_press_event   (GtkWidget         *widget,
                                                           GdkEventButton    *event);
+static gboolean thunar_shortcut_row_key_press_event      (GtkWidget         *widget,
+                                                          GdkEventKey       *event);
 static gboolean thunar_shortcut_row_enter_notify_event   (GtkWidget         *widget,
                                                           GdkEventCrossing  *event);
 static gboolean thunar_shortcut_row_leave_notify_event   (GtkWidget         *widget,
@@ -182,6 +186,7 @@ thunar_shortcut_row_class_init (ThunarShortcutRowClass *klass)
 
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
   gtkwidget_class->button_press_event = thunar_shortcut_row_button_press_event;
+  gtkwidget_class->key_press_event = thunar_shortcut_row_key_press_event;
   gtkwidget_class->enter_notify_event = thunar_shortcut_row_enter_notify_event;
   gtkwidget_class->leave_notify_event = thunar_shortcut_row_leave_notify_event;
   gtkwidget_class->expose_event = thunar_shortcut_row_expose_event;
@@ -505,6 +510,26 @@ thunar_shortcut_row_button_press_event (GtkWidget      *widget,
 
 
 static gboolean
+thunar_shortcut_row_key_press_event (GtkWidget   *widget,
+                                     GdkEventKey *event)
+{
+  _thunar_return_val_if_fail (THUNAR_IS_SHORTCUT_ROW (widget), FALSE);
+
+  if (event->keyval == GDK_KEY_Return 
+      || event->keyval == GDK_KEY_KP_Enter 
+      || event->keyval == GDK_KEY_space
+      || event->keyval== GDK_KEY_KP_Space)
+    {
+      thunar_shortcut_row_resolve_and_activate (THUNAR_SHORTCUT_ROW (widget));
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+
+
+static gboolean
 thunar_shortcut_row_enter_notify_event (GtkWidget        *widget,
                                         GdkEventCrossing *event)
 {
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 2478d7e..43cb040 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -3387,10 +3387,7 @@ thunar_standard_view_request_thumbnails (ThunarStandardView *standard_view)
 
   /* reschedule the source if we're still loading the folder */
   if (thunar_view_get_loading (THUNAR_VIEW (standard_view)))
-    {
-      g_debug ("weird, this should never happen");
-      return TRUE;
-    }
+    return TRUE;
 
   /* compute visible item range */
   if ((*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_visible_range) (standard_view,



More information about the Xfce4-commits mailing list