summaryrefslogtreecommitdiff
path: root/src/nautilus-window-slot.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@redhat.com>2018-10-02 14:38:38 +0200
committerCarlos Soriano <csoriano1618@gmail.com>2018-10-02 12:45:30 +0000
commitdae54e0c72e92a3129c4e8754bd9f3025e487c72 (patch)
tree914363a08614c97b99487ed9502b8a7dc3e4cffd /src/nautilus-window-slot.c
parent461d1c1cd9ed3ba0df05f748b5beaf0269a751f5 (diff)
downloadnautilus-dae54e0c72e92a3129c4e8754bd9f3025e487c72.tar.gz
window-slot: Focus view widget on search up or down arrow pressed
This is a regression from 3.28, where the file items where being selected while searching if the user clicked either up or the down arrows. Since 3.30 we moved the query editor to the header bar, this automatic handling was lost. To fix it, do something similar as we do when activating the search, which is emitting a signal to inform the window slot and the views to perform an explicit action. In this case, we focus the views so further key events are handled by the views themselves and not by the query. Closes: https://gitlab.gnome.org/GNOME/nautilus/issues/610
Diffstat (limited to 'src/nautilus-window-slot.c')
-rw-r--r--src/nautilus-window-slot.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index b3a7bc211..169f1fb6e 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -102,6 +102,7 @@ typedef struct
gulong qe_changed_id;
gulong qe_cancel_id;
gulong qe_activated_id;
+ gulong qe_focus_view_id;
GtkLabel *search_info_label;
GtkRevealer *search_info_label_revealer;
@@ -439,6 +440,19 @@ query_editor_activated_callback (NautilusQueryEditor *editor,
}
static void
+query_editor_focus_view_callback (NautilusQueryEditor *editor,
+ NautilusWindowSlot *self)
+{
+ NautilusWindowSlotPrivate *priv;
+
+ priv = nautilus_window_slot_get_instance_private (self);
+ if (priv->content_view != NULL)
+ {
+ gtk_widget_grab_focus (priv->content_view);
+ }
+}
+
+static void
query_editor_changed_callback (NautilusQueryEditor *editor,
NautilusQuery *query,
gboolean reload,
@@ -476,6 +490,11 @@ hide_query_editor (NautilusWindowSlot *self)
g_signal_handler_disconnect (priv->query_editor, priv->qe_activated_id);
priv->qe_activated_id = 0;
}
+ if (priv->qe_focus_view_id > 0)
+ {
+ g_signal_handler_disconnect (priv->query_editor, priv->qe_focus_view_id);
+ priv->qe_focus_view_id = 0;
+ }
nautilus_query_editor_set_query (priv->query_editor, NULL);
@@ -562,6 +581,12 @@ show_query_editor (NautilusWindowSlot *self)
g_signal_connect (priv->query_editor, "activated",
G_CALLBACK (query_editor_activated_callback), self);
}
+ if (priv->qe_focus_view_id == 0)
+ {
+ priv->qe_focus_view_id =
+ g_signal_connect (priv->query_editor, "focus-view",
+ G_CALLBACK (query_editor_focus_view_callback), self);
+ }
}
static void