file chooser: Make search shortcut toggle
authorMatthias Clasen <mclasen@redhat.com>
Mon, 29 Jun 2015 15:39:22 +0000 (08:39 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 4 Jul 2015 04:29:25 +0000 (00:29 -0400)
This is more in line with having a toggle button for search,
and it matches what we do e.g. in nautilus.

gtk/gtkfilechooserwidget.c

index a497b4ad4dabe6bc3e9d2aa5baffedcb586938b8..c944257f6b0a6cd5d9a2704e381b424a55146762 100644 (file)
@@ -7295,7 +7295,18 @@ desktop_folder_handler (GtkFileChooserWidget *impl)
 static void
 search_shortcut_handler (GtkFileChooserWidget *impl)
 {
-  operation_mode_set (impl, OPERATION_MODE_SEARCH);
+  GtkFileChooserWidgetPrivate *priv = impl->priv;
+
+  if (priv->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      operation_mode_set (impl, OPERATION_MODE_BROWSE);
+      if (priv->current_folder)
+        change_folder_and_display_error (impl, priv->current_folder, FALSE);
+      else
+        switch_to_home_dir (impl);
+    }
+  else
+    operation_mode_set (impl, OPERATION_MODE_SEARCH);
 }
 
 /* Handler for the "recent-shortcut" keybinding signal */