file chooser: Make Escape work in search entry
authorMatthias Clasen <mclasen@redhat.com>
Sat, 27 Jun 2015 05:23:16 +0000 (01:23 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 4 Jul 2015 04:29:24 +0000 (00:29 -0400)
Arrange things so that hitting Escape during a running
search stops the search, but leaves the search results
around, and hitting Escape again leaves the search mode.

gtk/gtkfilechooserwidget.c

index 05393cabcbdfdd234931b48bfa0cf705ead1a033..1c24421883e8a8d01adfcbac27caced2af25cb5f 100644 (file)
@@ -6283,8 +6283,6 @@ search_engine_error_cb (GtkSearchEngine *engine,
 
   search_stop_searching (impl, TRUE);
   error_message (impl, _("Could not send the search request"), message);
-
-  set_busy_cursor (impl, FALSE);
 }
 
 /* Frees the data in the search_model */
@@ -6323,6 +6321,7 @@ search_stop_searching (GtkFileChooserWidget *impl,
       g_signal_handlers_disconnect_by_data (priv->search_engine, impl);
       g_object_unref (priv->search_engine);
       priv->search_engine = NULL;
+      set_busy_cursor (impl, FALSE);
     }
 }
 
@@ -6444,7 +6443,10 @@ search_entry_activate_cb (GtkFileChooserWidget *impl)
 static void
 search_entry_stop_cb (GtkFileChooserWidget *impl)
 {
-  g_object_set (impl, "search-mode", FALSE, NULL);
+  if (impl->priv->search_engine)
+    search_stop_searching (impl, FALSE);
+  else
+    g_object_set (impl, "search-mode", FALSE, NULL);
 }
 
 /* Hides the path bar and creates the search entry */