diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-08-02 00:05:48 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-08-02 00:05:48 -0400 |
commit | 9c89beea9a21becd54fccd43c97cb2caeb796e9b (patch) | |
tree | d309e6c2a4d2287dcbef111c35aa9aefc271f55e | |
parent | 1e78b32b57941098eeff4162c018e7c8dbd3f901 (diff) | |
download | gtk+-filechooser-cancel-search.tar.gz |
filechooser: Unbreak location entryfilechooser-cancel-search
We don't want to capture key presses for search
when the location entry or the server entry are
visible.
Fixes: #2985
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index f79db9de42..39a8aef402 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -2419,6 +2419,16 @@ location_switch_to_filename_entry (GtkFileChooserWidget *impl) gtk_widget_grab_focus (impl->location_entry); } +static LocationMode +location_mode_get (GtkFileChooserWidget *impl) +{ + if (gtk_revealer_get_child_revealed (GTK_REVEALER (impl->browse_header_revealer)) && + strcmp (gtk_stack_get_visible_child_name (GTK_STACK (impl->browse_header_stack)), "location") == 0) + return LOCATION_MODE_FILENAME_ENTRY; + else + return LOCATION_MODE_PATH_BAR; +} + /* Sets a new location mode. */ static void @@ -7687,7 +7697,9 @@ captured_key (GtkEventControllerKey *controller, GtkFileChooserWidget *impl = data; gboolean handled; - if (impl->operation_mode == OPERATION_MODE_SEARCH) + if (impl->operation_mode == OPERATION_MODE_SEARCH || + impl->operation_mode == OPERATION_MODE_OTHER_LOCATIONS || + location_mode_get (impl) == LOCATION_MODE_FILENAME_ENTRY) return GDK_EVENT_PROPAGATE; handled = gtk_event_controller_key_forward (controller, GTK_WIDGET (impl->search_entry)); |