mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 16:30:15 +00:00
file chooser: Avoid search interruption
When the search entry is shown, the 'special' nature of ., ~ and / should not trigger the location entry, because that interrupts the search and is likely not what the user intended. https://bugzilla.gnome.org/show_bug.cgi?id=756505
This commit is contained in:
parent
0731c50262
commit
3c217e6954
@ -1278,13 +1278,16 @@ key_is_left_or_right (GdkEventKey *event)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
should_trigger_location_entry (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
should_trigger_location_entry (GtkFileChooserWidget *impl,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GdkModifierType no_text_input_mask;
|
||||
|
||||
if (impl->priv->operation_mode == OPERATION_MODE_SEARCH)
|
||||
return FALSE;
|
||||
|
||||
no_text_input_mask =
|
||||
gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
|
||||
gtk_widget_get_modifier_mask (GTK_WIDGET (impl), GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
|
||||
|
||||
if ((event->keyval == GDK_KEY_slash
|
||||
|| event->keyval == GDK_KEY_KP_Divide
|
||||
@ -1310,7 +1313,7 @@ browse_files_key_press_event_cb (GtkWidget *widget,
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
if (should_trigger_location_entry (widget, event) &&
|
||||
if (should_trigger_location_entry (impl, event) &&
|
||||
(priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
|
||||
{
|
||||
@ -1370,7 +1373,7 @@ gtk_file_chooser_widget_key_press_event (GtkWidget *widget,
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) widget;
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
if (should_trigger_location_entry (widget, event))
|
||||
if (should_trigger_location_entry (impl, event))
|
||||
{
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||
|
Loading…
Reference in New Issue
Block a user