[gtk+/gtk-2-16] bgo#161489 - In the file chooser, let the left/right arrow keys switch focus between the file list a
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] bgo#161489 - In the file chooser, let the left/right arrow keys switch focus between the file list a
- Date: Sat, 29 Aug 2009 02:42:57 +0000 (UTC)
commit 8bf0a0d65206d4ccac9eebe93c58f0a001112456
Author: Federico Mena Quintero <federico novell com>
Date: Mon Jul 27 19:24:42 2009 -0500
bgo#161489 - In the file chooser, let the left/right arrow keys switch focus between the file list and shortcuts
Based on a patch by Christian Neumair <cneumair gnome org>
Signed-off-by: Federico Mena Quintero <federico novell com>
gtk/gtkfilechooserdefault.c | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 6b235be..4409ad9 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -4054,14 +4054,28 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
return vbox;
}
+static gboolean
+key_is_left_or_right (GdkEventKey *event)
+{
+ guint modifiers;
+
+ modifiers = gtk_accelerator_get_default_mod_mask ();
+
+ return ((event->keyval == GDK_Right
+ || event->keyval == GDK_KP_Right
+ || event->keyval == GDK_Left
+ || event->keyval == GDK_KP_Left)
+ && (event->state & modifiers) == 0);
+}
+
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own. Also, checks to see if '/' has been
* pressed. See comment by tree_view_keybinding_cb() for more details.
*/
static gboolean
-trap_activate_cb (GtkWidget *widget,
- GdkEventKey *event,
- gpointer data)
+browse_files_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
{
GtkFileChooserDefault *impl;
int modifiers;
@@ -4081,6 +4095,12 @@ trap_activate_cb (GtkWidget *widget,
return TRUE;
}
+ if (key_is_left_or_right (event))
+ {
+ gtk_widget_grab_focus (impl->browse_shortcuts_tree_view);
+ return TRUE;
+ }
+
if ((event->keyval == GDK_Return
|| event->keyval == GDK_ISO_Enter
|| event->keyval == GDK_KP_Enter
@@ -4624,7 +4644,7 @@ create_file_list (GtkFileChooserDefault *impl)
g_signal_connect (impl->browse_files_tree_view, "row-activated",
G_CALLBACK (list_row_activated), impl);
g_signal_connect (impl->browse_files_tree_view, "key-press-event",
- G_CALLBACK (trap_activate_cb), impl);
+ G_CALLBACK (browse_files_key_press_event_cb), impl);
g_signal_connect (impl->browse_files_tree_view, "popup-menu",
G_CALLBACK (list_popup_menu_cb), impl);
g_signal_connect (impl->browse_files_tree_view, "button-press-event",
@@ -10640,6 +10660,12 @@ shortcuts_key_press_event_cb (GtkWidget *widget,
modifiers = gtk_accelerator_get_default_mod_mask ();
+ if (key_is_left_or_right (event))
+ {
+ gtk_widget_grab_focus (impl->browse_files_tree_view);
+ return TRUE;
+ }
+
if ((event->keyval == GDK_BackSpace
|| event->keyval == GDK_Delete
|| event->keyval == GDK_KP_Delete)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]