Commit 1c3ccb39 authored by Matthias Clasen's avatar Matthias Clasen

file chooser: Trigger location entry not just from file list

Use the same code that brings up the location entry on '/',
'~' or '.' also when the focus is not on the file list. This
prevents those key presses on the sidebar from ending up in
the search entry.
parent 58259650
......@@ -1199,17 +1199,10 @@ key_is_left_or_right (GdkEventKey *event)
&& (event->state & modifiers) == 0);
}
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own. Also, checks to see if “/” has been
* pressed.
*/
static gboolean
browse_files_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
should_trigger_location_entry (GtkWidget *widget,
GdkEventKey *event)
{
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
GtkFileChooserWidgetPrivate *priv = impl->priv;
GdkModifierType no_text_input_mask;
no_text_input_mask =
......@@ -1222,6 +1215,24 @@ browse_files_key_press_event_cb (GtkWidget *widget,
|| event->keyval == GDK_KEY_asciitilde
#endif
) && !(event->state & no_text_input_mask))
return TRUE;
return FALSE;
}
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own. Also, checks to see if “/” has been
* pressed.
*/
static gboolean
browse_files_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
GtkFileChooserWidgetPrivate *priv = impl->priv;
if (should_trigger_location_entry (widget, event))
{
location_popup_handler (impl, event->string);
return TRUE;
......@@ -1272,6 +1283,12 @@ gtk_file_chooser_widget_key_press_event (GtkWidget *widget,
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) widget;
GtkFileChooserWidgetPrivate *priv = impl->priv;
if (should_trigger_location_entry (widget, event))
{
location_popup_handler (impl, event->string);
return TRUE;
}
if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->search_entry), (GdkEvent *)event))
{
if (priv->operation_mode != OPERATION_MODE_SEARCH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment