diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2017-05-13 20:29:15 +0300 |
---|---|---|
committer | Ernestas Kulik <ernestask@gnome.org> | 2017-05-14 12:21:12 +0300 |
commit | fb8b8ca54e29de2a9208793927e96cf324ae0418 (patch) | |
tree | 7eafce7ee5b526565f36d97802c199055c02a012 /src | |
parent | 1e898de96648fa9cb12653ed129c7ed2b0c26c72 (diff) | |
download | nautilus-fb8b8ca54e29de2a9208793927e96cf324ae0418.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-canvas-container.c | 16 | ||||
-rw-r--r-- | src/nautilus-canvas-view.c | 12 | ||||
-rw-r--r-- | src/nautilus-files-view.c | 6 | ||||
-rw-r--r-- | src/nautilus-list-view.c | 15 | ||||
-rw-r--r-- | 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 65c5c102c..ff8d1edc3 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 b3a062f85..6bc726a75 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 b6974dbcc..38f9d5c9e 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 622fa2d1f..aa0e5a376 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 d7b42e269..6361bad2a 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> |