[gtk/file-chooser-escape] file chooser: Prevent accidental search
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/file-chooser-escape] file chooser: Prevent accidental search
- Date: Sun, 28 Apr 2019 15:21:24 +0000 (UTC)
commit b9467a4dc72282374264d5be9017e40d53284aed
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Apr 28 15:17:32 2019 +0000
file chooser: Prevent accidental search
When hitting Escape, the file chooser will go
into search mode, because the search entry
consumes the key to emit the ::search-stopped
signal. Recognize this situation and avoid
switching to search mode in this case.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1850
gtk/gtkfilechooserwidget.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 2e93cd334e..9dfe2e4976 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -363,6 +363,7 @@ struct _GtkFileChooserWidgetPrivate {
guint show_size_column : 1;
guint create_folders : 1;
guint auto_selecting_first_row : 1;
+ guint starting_search : 1;
};
#define MAX_LOADING_TIME 500
@@ -1411,9 +1412,11 @@ widget_key_press_cb (GtkEventControllerKey *controller,
}
else
{
+ priv->starting_search = TRUE;
if (gtk_event_controller_key_forward (controller, priv->search_entry))
{
- if (priv->operation_mode != OPERATION_MODE_SEARCH)
+ if (priv->operation_mode != OPERATION_MODE_SEARCH &&
+ priv->starting_search)
operation_mode_set (impl, OPERATION_MODE_SEARCH);
handled = TRUE;
@@ -7252,6 +7255,8 @@ search_entry_stop_cb (GtkFileChooserWidget *impl)
search_stop_searching (impl, FALSE);
else
g_object_set (impl, "search-mode", FALSE, NULL);
+
+ impl->priv->starting_search = FALSE;
}
/* Hides the path bar and creates the search entry */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]