diff options
author | António Fernandes <antoniof@gnome.org> | 2018-10-11 12:02:11 +0100 |
---|---|---|
committer | Ernestas Kulik <ernestas.kulik@gmail.com> | 2018-10-12 09:47:20 +0000 |
commit | 4581155f0a13968c08a151cecdb7eb70bddf4f7c (patch) | |
tree | a887dbe13f3382af52dbf56cefe635df3230487a /src/nautilus-query-editor.c | |
parent | 8f90858a6bdb45a4fc20d97f5cf24c03ed57fee1 (diff) | |
download | nautilus-4581155f0a13968c08a151cecdb7eb70bddf4f7c.tar.gz |
query-editor: Add a key binding to focus view
We used to emit the "focus-view" in handle_event() when the [Down] and
[Up] keys were pressed.
But this doesn't work after the previous commit.
To restore it's function, use the "focus-view" signal into a key
binding signal.
Diffstat (limited to 'src/nautilus-query-editor.c')
-rw-r--r-- | src/nautilus-query-editor.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index a1dc0a63e..f4e380a1e 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -281,6 +281,12 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + gtk_binding_entry_add_signal (gtk_binding_set_by_class (class), + GDK_KEY_Down, + 0, + "focus-view", + 0); + /** * NautilusQueryEditor::location: * @@ -737,30 +743,8 @@ gboolean nautilus_query_editor_handle_event (NautilusQueryEditor *self, GdkEvent *event) { - guint keyval; - GdkModifierType state; - g_return_val_if_fail (NAUTILUS_IS_QUERY_EDITOR (self), GDK_EVENT_PROPAGATE); g_return_val_if_fail (event != NULL, GDK_EVENT_PROPAGATE); - if (G_UNLIKELY (!gdk_event_get_keyval (event, &keyval))) - { - g_return_val_if_reached (GDK_EVENT_PROPAGATE); - } - - gdk_event_get_state (event, &state); - - /* In the case of key up/down we want to move the focus to the view, since - * the user is probably trying to navigate the files - */ - if (gtk_widget_has_focus (GTK_WIDGET (self->entry))) - { - if (keyval == GDK_KEY_Down || keyval == GDK_KEY_Up) - { - g_signal_emit (self, signals[FOCUS_VIEW], 0); - return GDK_EVENT_STOP; - } - } - return gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (self->entry), event); } |