[nautilus] views: handle keyboard activation in files-view
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] views: handle keyboard activation in files-view
- Date: Sun, 14 May 2017 09:21:31 +0000 (UTC)
commit fb8b8ca54e29de2a9208793927e96cf324ae0418
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat May 13 20:29:15 2017 +0300
views: handle keyboard activation in files-view
Each view handles keyboard activation on its own by listening to
key-press-event, yet there are actions in files-view that could handle
it. This commit makes it so, additionally swapping the accelerators for
opening in new tab and window to make things more consistent throughout
the application (and others, too, e.g. Firefox).
https://bugzilla.gnome.org/show_bug.cgi?id=782600
src/nautilus-canvas-container.c | 16 ----------------
src/nautilus-canvas-view.c | 12 +++---------
src/nautilus-files-view.c | 6 ++++--
src/nautilus-list-view.c | 15 ---------------
src/resources/gtk/help-overlay.ui | 4 ++--
5 files changed, 9 insertions(+), 44 deletions(-)
---
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index 65c5c10..ff8d1ed 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -5193,22 +5193,6 @@ key_press_event (GtkWidget *widget,
}
break;
- case GDK_KEY_Return:
- case GDK_KEY_KP_Enter:
- {
- if ((event->state & GDK_SHIFT_MASK) != 0)
- {
- activate_selected_items_alternate (container, NULL);
- }
- else
- {
- activate_selected_items (container);
- }
-
- handled = TRUE;
- }
- break;
-
case GDK_KEY_Escape:
{
handled = undo_stretching (container);
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index b3a062f..6bc726a 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -1361,7 +1361,7 @@ canvas_container_activate_alternate_callback (NautilusCanvasContainer *container
GdkEvent *event;
GdkEventButton *button_event;
GdkEventKey *key_event;
- gboolean open_in_tab, open_in_window, close_behind;
+ gboolean open_in_tab, open_in_window;
NautilusWindowOpenFlags flags;
g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
@@ -1371,7 +1371,6 @@ canvas_container_activate_alternate_callback (NautilusCanvasContainer *container
event = gtk_get_current_event ();
open_in_tab = FALSE;
open_in_window = FALSE;
- close_behind = FALSE;
if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE ||
@@ -1400,13 +1399,8 @@ canvas_container_activate_alternate_callback (NautilusCanvasContainer *container
flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
}
- if (close_behind)
- {
- flags |= NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
- }
-
- DEBUG ("Activate alternate, open in tab %d, close behind %d, new window %d\n",
- open_in_tab, close_behind, open_in_window);
+ DEBUG ("Activate alternate, open in tab %d, new window %d\n",
+ open_in_tab, open_in_window);
nautilus_files_view_activate_files (NAUTILUS_FILES_VIEW (canvas_view),
file_list,
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index b6974db..38f9d5c 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9471,6 +9471,8 @@ nautilus_files_view_init (NautilusFilesView *view)
GApplication *app;
const gchar *open_accels[] =
{
+ "Return",
+ "KP_Enter",
"<control>o",
"<alt>Down",
NULL
@@ -9680,8 +9682,8 @@ nautilus_files_view_init (NautilusFilesView *view)
nautilus_application_set_accelerator (app, "view.create-link", "<control>m");
/* Selection menu */
nautilus_application_set_accelerators (app, "view.open-with-default-application", open_accels);
- nautilus_application_set_accelerator (app, "view.open-item-new-tab", "<shift><control>t");
- nautilus_application_set_accelerator (app, "view.open-item-new-window", "<control>Return");
+ nautilus_application_set_accelerator (app, "view.open-item-new-tab", "<control>Return");
+ nautilus_application_set_accelerator (app, "view.open-item-new-window", "<Shift>Return");
nautilus_application_set_accelerator (app, "view.move-to-trash", "Delete");
nautilus_application_set_accelerator (app, "view.delete-from-trash", "Delete");
nautilus_application_set_accelerator (app, "view.delete-permanently-shortcut", "<shift>Delete");
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 622fa2d..aa0e5a3 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1008,21 +1008,6 @@ key_press_callback (GtkWidget *widget,
}
break;
- case GDK_KEY_Return:
- case GDK_KEY_KP_Enter:
- {
- if ((event->state & GDK_SHIFT_MASK) != 0)
- {
- activate_selected_items_alternate (NAUTILUS_LIST_VIEW (view), NULL, TRUE);
- }
- else
- {
- activate_selected_items (NAUTILUS_LIST_VIEW (view));
- }
- handled = TRUE;
- }
- break;
-
case GDK_KEY_v:
{
/* Eat Control + v to not enable type ahead */
diff --git a/src/resources/gtk/help-overlay.ui b/src/resources/gtk/help-overlay.ui
index d7b42e2..6361bad 100644
--- a/src/resources/gtk/help-overlay.ui
+++ b/src/resources/gtk/help-overlay.ui
@@ -70,14 +70,14 @@
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Open in new
tab</property>
- <property name="accelerator"><shift><Primary>T</property>
+ <property name="accelerator"><Primary>Return</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Open in new
window</property>
- <property name="accelerator"><Primary>Return</property>
+ <property name="accelerator"><shift>Return</property>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]