[gtk+/gtk-3-18] file chooser: Avoid search interruption



commit 13f680d11a8b69bb11845864ed91cbd95b6b4214
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 15 20:53:43 2015 -0400

    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

 gtk/gtkfilechooserwidget.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 21bca96..387f618 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]