Compare commits

...

2 Commits

Author SHA1 Message Date
Matthias Clasen
9c89beea9a filechooser: Unbreak location entry
We don't want to capture key presses for search
when the location entry or the server entry are
visible.

Fixes: #2985
2020-08-02 00:05:48 -04:00
Matthias Clasen
1e78b32b57 filechooser: Don't open in search mode
When the filechooser is mapped, ensure that
search-mode is FALSE.

Fixes: #2976
2020-08-01 23:46:05 -04:00

View File

@@ -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
@@ -3470,6 +3480,8 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
add_cwd_to_sidebar_if_needed (impl);
g_object_set (impl, "search-mode", FALSE, NULL);
if (impl->operation_mode == OPERATION_MODE_BROWSE)
{
switch (impl->reload_state)
@@ -7685,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));