]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilechooserdefault.c
Display an error when we come to the root.
[~andy/gtk] / gtk / gtkfilechooserdefault.c
index a9db44675ee2e474b93b64de4bad8f77b7007ef6..c5338b9b69ef938d9d21ae5188e07bc943c09c88 100644 (file)
@@ -28,6 +28,7 @@
 #include "gtkcellrenderertext.h"
 #include "gtkcellrenderertext.h"
 #include "gtkcheckmenuitem.h"
+#include "gtkclipboard.h"
 #include "gtkcombobox.h"
 #include "gtkentry.h"
 #include "gtkeventbox.h"
@@ -36,6 +37,7 @@
 #include "gtkfilechooserdefault.h"
 #include "gtkfilechooserembed.h"
 #include "gtkfilechooserentry.h"
+#include "gtkfilechoosersettings.h"
 #include "gtkfilechooserutils.h"
 #include "gtkfilechooser.h"
 #include "gtkfilesystemmodel.h"
@@ -53,6 +55,7 @@
 #include "gtkmessagedialog.h"
 #include "gtkpathbar.h"
 #include "gtkprivate.h"
+#include "gtkradiobutton.h"
 #include "gtkscrolledwindow.h"
 #include "gtkseparatormenuitem.h"
 #include "gtksizegroup.h"
@@ -86,7 +89,7 @@
 #endif
 
 /* Profiling stuff */
-#define PROFILE_FILE_CHOOSER
+#undef PROFILE_FILE_CHOOSER
 #ifdef PROFILE_FILE_CHOOSER
 
 
@@ -152,6 +155,7 @@ struct _GtkFileChooserDefaultClass
 /* Signal IDs */
 enum {
   LOCATION_POPUP,
+  LOCATION_POPUP_ON_PASTE,
   UP_FOLDER,
   DOWN_FOLDER,
   HOME_FOLDER,
@@ -170,6 +174,7 @@ enum {
   SHORTCUTS_COL_IS_VOLUME,
   SHORTCUTS_COL_REMOVABLE,
   SHORTCUTS_COL_PIXBUF_VISIBLE,
+  SHORTCUTS_COL_HANDLE,
   SHORTCUTS_COL_NUM_COLUMNS
 };
 
@@ -240,10 +245,8 @@ typedef enum {
 #define NUM_LINES 40
 #define NUM_CHARS 60
 
-static void gtk_file_chooser_default_class_init       (GtkFileChooserDefaultClass *class);
 static void gtk_file_chooser_default_iface_init       (GtkFileChooserIface        *iface);
 static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface   *iface);
-static void gtk_file_chooser_default_init             (GtkFileChooserDefault      *impl);
 
 static GObject* gtk_file_chooser_default_constructor  (GType                  type,
                                                       guint                  n_construct_properties,
@@ -312,6 +315,7 @@ static void           gtk_file_chooser_default_initial_focus          (GtkFileCh
 
 static void location_popup_handler (GtkFileChooserDefault *impl,
                                    const gchar           *path);
+static void location_popup_on_paste_handler (GtkFileChooserDefault *impl);
 static void up_folder_handler      (GtkFileChooserDefault *impl);
 static void down_folder_handler    (GtkFileChooserDefault *impl);
 static void home_folder_handler    (GtkFileChooserDefault *impl);
@@ -379,6 +383,8 @@ static void add_bookmark_button_clicked_cb    (GtkButton             *button,
                                               GtkFileChooserDefault *impl);
 static void remove_bookmark_button_clicked_cb (GtkButton             *button,
                                               GtkFileChooserDefault *impl);
+static void save_folder_combo_changed_cb      (GtkComboBox           *combo,
+                                              GtkFileChooserDefault *impl);
 
 static void list_icon_data_func (GtkTreeViewColumn *tree_column,
                                 GtkCellRenderer   *cell,
@@ -409,7 +415,10 @@ static const GtkFileInfo *get_list_file_info (GtkFileChooserDefault *impl,
 static void load_remove_timer (GtkFileChooserDefault *impl);
 static void browse_files_center_selected_row (GtkFileChooserDefault *impl);
 
-static GObjectClass *parent_class;
+static void location_button_toggled_cb (GtkToggleButton *toggle,
+                                       GtkFileChooserDefault *impl);
+static void location_switch_to_path_bar (GtkFileChooserDefault *impl);
+
 
 \f
 
@@ -434,7 +443,7 @@ G_DEFINE_TYPE_WITH_CODE (ShortcutsModelFilter,
                         _shortcuts_model_filter,
                         GTK_TYPE_TREE_MODEL_FILTER,
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
-                                               shortcuts_model_filter_drag_source_iface_init));
+                                               shortcuts_model_filter_drag_source_iface_init))
 
 static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl,
                                                 GtkTreeModel          *child_model,
@@ -442,56 +451,14 @@ static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl,
 
 \f
 
-GType
-_gtk_file_chooser_default_get_type (void)
-{
-  static GType file_chooser_default_type = 0;
-
-  if (!file_chooser_default_type)
-    {
-      static const GTypeInfo file_chooser_default_info =
-      {
-       sizeof (GtkFileChooserDefaultClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_file_chooser_default_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkFileChooserDefault),
-       0,              /* n_preallocs */
-       (GInstanceInitFunc) gtk_file_chooser_default_init,
-      };
-
-      static const GInterfaceInfo file_chooser_info =
-      {
-       (GInterfaceInitFunc) gtk_file_chooser_default_iface_init, /* interface_init */
-       NULL,                                                          /* interface_finalize */
-       NULL                                                           /* interface_data */
-      };
-
-      static const GInterfaceInfo file_chooser_embed_info =
-      {
-       (GInterfaceInitFunc) gtk_file_chooser_embed_default_iface_init, /* interface_init */
-       NULL,                                                          /* interface_finalize */
-       NULL                                                           /* interface_data */
-      };
-
-      file_chooser_default_type = g_type_register_static (GTK_TYPE_VBOX, I_("GtkFileChooserDefault"),
-                                                        &file_chooser_default_info, 0);
-
-      g_type_add_interface_static (file_chooser_default_type,
-                                  GTK_TYPE_FILE_CHOOSER,
-                                  &file_chooser_info);
-      g_type_add_interface_static (file_chooser_default_type,
-                                  GTK_TYPE_FILE_CHOOSER_EMBED,
-                                  &file_chooser_embed_info);
-    }
-
-  return file_chooser_default_type;
-}
+G_DEFINE_TYPE_WITH_CODE (GtkFileChooserDefault, _gtk_file_chooser_default, GTK_TYPE_VBOX,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
+                                               gtk_file_chooser_default_iface_init)
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
+                                               gtk_file_chooser_embed_default_iface_init));                                            
 
 static void
-gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
+_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
 {
   static const guint quick_bookmark_keyvals[10] = {
     GDK_1, GDK_2, GDK_3, GDK_4, GDK_5, GDK_6, GDK_7, GDK_8, GDK_9, GDK_0
@@ -501,8 +468,6 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
   GtkBindingSet *binding_set;
   int i;
 
-  parent_class = g_type_class_peek_parent (class);
-
   gobject_class->finalize = gtk_file_chooser_default_finalize;
   gobject_class->constructor = gtk_file_chooser_default_constructor;
   gobject_class->set_property = gtk_file_chooser_default_set_property;
@@ -524,6 +489,14 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
                             NULL, NULL,
                             _gtk_marshal_VOID__STRING,
                             G_TYPE_NONE, 1, G_TYPE_STRING);
+  signals[LOCATION_POPUP_ON_PASTE] =
+    _gtk_binding_signal_new ("location-popup-on-paste",
+                            G_OBJECT_CLASS_TYPE (class),
+                            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                            G_CALLBACK (location_popup_on_paste_handler),
+                            NULL, NULL,
+                            _gtk_marshal_VOID__VOID,
+                            G_TYPE_NONE, 0);
   signals[UP_FOLDER] =
     _gtk_binding_signal_new (I_("up-folder"),
                             G_OBJECT_CLASS_TYPE (class),
@@ -576,6 +549,22 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
                                GDK_slash, 0,
                                "location-popup",
                                1, G_TYPE_STRING, "/");
+  gtk_binding_entry_add_signal (binding_set,
+                               GDK_KP_Divide, 0,
+                               "location-popup",
+                               1, G_TYPE_STRING, "/");
+
+#ifdef G_OS_UNIX
+  gtk_binding_entry_add_signal (binding_set,
+                               GDK_asciitilde, 0,
+                               "location-popup",
+                               1, G_TYPE_STRING, "~");
+#endif
+
+  gtk_binding_entry_add_signal (binding_set,
+                               GDK_v, GDK_CONTROL_MASK,
+                               "location-popup-on-paste",
+                               0);
 
   gtk_binding_entry_add_signal (binding_set,
                                GDK_Up, GDK_MOD1_MASK,
@@ -656,8 +645,9 @@ gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
   iface->should_respond = gtk_file_chooser_default_should_respond;
   iface->initial_focus = gtk_file_chooser_default_initial_focus;
 }
+
 static void
-gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
+_gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
 {
   profile_start ("start", NULL);
 #ifdef PROFILE_FILE_CHOOSER
@@ -672,12 +662,12 @@ gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
   impl->load_state = LOAD_EMPTY;
   impl->reload_state = RELOAD_EMPTY;
   impl->pending_select_paths = NULL;
+  impl->location_mode = LOCATION_MODE_PATH_BAR;
 
   gtk_box_set_spacing (GTK_BOX (impl), 12);
 
   impl->tooltips = gtk_tooltips_new ();
-  g_object_ref (impl->tooltips);
-  gtk_object_sink (GTK_OBJECT (impl->tooltips));
+  g_object_ref_sink (impl->tooltips);
 
   profile_end ("end", NULL);
 }
@@ -689,11 +679,17 @@ shortcuts_free_row_data (GtkFileChooserDefault *impl,
 {
   gpointer col_data;
   gboolean is_volume;
+  GtkFileSystemHandle *handle;
 
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
                      SHORTCUTS_COL_DATA, &col_data,
                      SHORTCUTS_COL_IS_VOLUME, &is_volume,
+                     SHORTCUTS_COL_HANDLE, &handle,
                      -1);
+
+  if (handle)
+    gtk_file_system_cancel_operation (handle);
+
   if (!col_data)
     return;
 
@@ -799,12 +795,10 @@ gtk_file_chooser_default_finalize (GObject *object)
 
   shortcuts_free (impl);
 
-  g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
-  impl->volumes_changed_id = 0;
-  g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id);
-  impl->bookmarks_changed_id = 0;
   g_object_unref (impl->file_system);
 
+  g_free (impl->browse_files_last_selected_name);
+
   for (l = impl->filters; l; l = l->next)
     {
       GtkFileFilter *filter;
@@ -826,8 +820,6 @@ gtk_file_chooser_default_finalize (GObject *object)
   if (impl->preview_path)
     gtk_file_path_free (impl->preview_path);
 
-  pending_select_paths_free (impl);
-
   load_remove_timer (impl);
 
   /* Free all the Models we have */
@@ -843,7 +835,7 @@ gtk_file_chooser_default_finalize (GObject *object)
 
   g_object_unref (impl->tooltips);
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (_gtk_file_chooser_default_parent_class)->finalize (object);
 }
 
 /* Shows an error dialog set as transient for the specified window */
@@ -1089,9 +1081,57 @@ set_preview_widget (GtkFileChooserDefault *impl,
 }
 
 /* Re-reads all the icons for the shortcuts, used when the theme changes */
+struct ReloadIconsData
+{
+  GtkFileChooserDefault *impl;
+  GtkTreeRowReference *row_ref;
+};
+
+static void
+shortcuts_reload_icons_get_info_cb (GtkFileSystemHandle *handle,
+                                   const GtkFileInfo   *info,
+                                   const GError        *error,
+                                   gpointer             user_data)
+{
+  GdkPixbuf *pixbuf;
+  GtkTreeIter iter;
+  GtkTreePath *path;
+  gboolean cancelled = handle->cancelled;
+  struct ReloadIconsData *data = user_data;
+
+  if (!g_slist_find (data->impl->reload_icon_handles, handle))
+    goto out;
+
+  data->impl->reload_icon_handles = g_slist_remove (data->impl->reload_icon_handles, handle);
+
+  if (cancelled || error)
+    goto out;
+
+  pixbuf = gtk_file_info_render_icon (info, GTK_WIDGET (data->impl),
+                                     data->impl->icon_size, NULL);
+
+  path = gtk_tree_row_reference_get_path (data->row_ref);
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (data->impl->shortcuts_model), &iter, path);
+  gtk_list_store_set (data->impl->shortcuts_model, &iter,
+                     SHORTCUTS_COL_PIXBUF, pixbuf,
+                     -1);
+  gtk_tree_path_free (path);
+
+  if (pixbuf)
+    g_object_unref (pixbuf);
+
+out:
+  gtk_tree_row_reference_free (data->row_ref);
+  g_object_unref (data->impl);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
 static void
 shortcuts_reload_icons (GtkFileChooserDefault *impl)
 {
+  GSList *l;
   GtkTreeIter iter;
 
   profile_start ("start", NULL);
@@ -1099,44 +1139,68 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
   if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
     goto out;
 
-  do {
-    gpointer data;
-    gboolean is_volume;
-    gboolean pixbuf_visible;
-    GdkPixbuf *pixbuf;
+  for (l = impl->reload_icon_handles; l; l = l->next)
+    {
+      GtkFileSystemHandle *handle = GTK_FILE_SYSTEM_HANDLE (l->data);
+      gtk_file_system_cancel_operation (handle);
+    }
+  g_slist_free (impl->reload_icon_handles);
+  impl->reload_icon_handles = NULL;
 
-    gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
-                       SHORTCUTS_COL_DATA, &data,
-                       SHORTCUTS_COL_IS_VOLUME, &is_volume,
-                       SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
-                       -1);
+  do
+    {
+      gpointer data;
+      gboolean is_volume;
+      gboolean pixbuf_visible;
+      GdkPixbuf *pixbuf;
 
-    if (pixbuf_visible && data)
-      {
-       if (is_volume)
-         {
-           GtkFileSystemVolume *volume;
+      gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+                         SHORTCUTS_COL_DATA, &data,
+                         SHORTCUTS_COL_IS_VOLUME, &is_volume,
+                         SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
+                         -1);
 
-           volume = data;
-           pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
-                                                        impl->icon_size, NULL);
-         }
-       else
-         {
-           const GtkFilePath *path;
+      if (pixbuf_visible && data)
+        {
+         if (is_volume)
+           {
+             GtkFileSystemVolume *volume;
 
-           path = data;
-           pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
-                                                 impl->icon_size, NULL);
-         }
+             volume = data;
+             pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
+                                                          impl->icon_size, NULL);
 
-       gtk_list_store_set (impl->shortcuts_model, &iter,
-                           SHORTCUTS_COL_PIXBUF, pixbuf,
-                           -1);
-       if (pixbuf)
-         g_object_unref (pixbuf);
-      }
-  } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
+             gtk_list_store_set (impl->shortcuts_model, &iter,
+                                 SHORTCUTS_COL_PIXBUF, pixbuf,
+                                 -1);
+
+             if (pixbuf)
+               g_object_unref (pixbuf);
+           }
+         else
+           {
+             const GtkFilePath *path;
+             struct ReloadIconsData *info;
+             GtkTreePath *tree_path;
+             GtkFileSystemHandle *handle;
+
+             path = data;
+
+             info = g_new0 (struct ReloadIconsData, 1);
+             info->impl = g_object_ref (impl);
+             tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
+             info->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->shortcuts_model), tree_path);
+             gtk_tree_path_free (tree_path);
+
+             handle = gtk_file_system_get_info (impl->file_system, path,
+                                                GTK_FILE_INFO_ICON,
+                                                shortcuts_reload_icons_get_info_cb,
+                                                info);
+             impl->reload_icon_handles = g_slist_append (impl->reload_icon_handles, handle);
+           }
+       }
+    }
+  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
 
  out:
 
@@ -1173,83 +1237,203 @@ shortcuts_find_current_folder (GtkFileChooserDefault *impl)
   shortcuts_find_folder (impl, impl->current_folder);
 }
 
-/* Convenience function to get the display name and icon info for a path */
-static GtkFileInfo *
-get_file_info (GtkFileSystem      *file_system, 
-              const GtkFilePath  *path, 
-              gboolean            name_only, 
-              GError            **error)
+/* Removes the specified number of rows from the shortcuts list */
+static void
+shortcuts_remove_rows (GtkFileChooserDefault *impl,
+                      int                    start_row,
+                      int                    n_rows)
 {
-  GtkFilePath *parent_path;
-  GtkFileFolder *parent_folder;
-  GtkFileInfo *info;
-  GError *tmp = NULL;
+  GtkTreePath *path;
 
-  profile_start ("start", (char *) path);
+  path = gtk_tree_path_new_from_indices (start_row, -1);
+
+  for (; n_rows; n_rows--)
+    {
+      GtkTreeIter iter;
+
+      if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
+       g_assert_not_reached ();
+
+      shortcuts_free_row_data (impl, &iter);
+      gtk_list_store_remove (impl->shortcuts_model, &iter);
+    }
+
+  gtk_tree_path_free (path);
+}
+
+static void
+shortcuts_update_count (GtkFileChooserDefault *impl,
+                       ShortcutsIndex         type,
+                       gint                   value)
+{
+  switch (type)
+    {
+      case SHORTCUTS_HOME:
+       if (value < 0)
+         impl->has_home = FALSE;
+       else
+         impl->has_home = TRUE;
+       break;
+
+      case SHORTCUTS_DESKTOP:
+       if (value < 0)
+         impl->has_desktop = FALSE;
+       else
+         impl->has_desktop = TRUE;
+       break;
+
+      case SHORTCUTS_VOLUMES:
+       impl->num_volumes += value;
+       break;
+
+      case SHORTCUTS_SHORTCUTS:
+       impl->num_shortcuts += value;
+       break;
 
-  parent_path = NULL;
-  info = NULL;
+      case SHORTCUTS_BOOKMARKS:
+       impl->num_bookmarks += value;
+       break;
 
-  if (!gtk_file_system_get_parent (file_system, path, &parent_path, &tmp))
+      case SHORTCUTS_CURRENT_FOLDER:
+       if (value < 0)
+         impl->shortcuts_current_folder_active = FALSE;
+       else
+         impl->shortcuts_current_folder_active = TRUE;
+       break;
+
+      default:
+       /* nothing */
+       break;
+    }
+}
+
+struct ShortcutsInsertRequest
+{
+  GtkFileChooserDefault *impl;
+  GtkFilePath *parent_path;
+  GtkFilePath *path;
+  int pos;
+  char *label_copy;
+  GtkTreeRowReference *row_ref;
+  ShortcutsIndex type;
+  gboolean name_only;
+  gboolean removable;
+};
+
+static void
+get_file_info_finished (GtkFileSystemHandle *handle,
+                       const GtkFileInfo   *info,
+                       const GError        *error,
+                       gpointer             data)
+{
+  gint pos = -1;
+  gboolean cancelled = handle->cancelled;
+  gboolean is_volume = FALSE;
+  GdkPixbuf *pixbuf;
+  GtkTreePath *path;
+  GtkTreeIter iter;
+  GtkFileSystemHandle *model_handle;
+  struct ShortcutsInsertRequest *request = data;
+
+  path = gtk_tree_row_reference_get_path (request->row_ref);
+  if (!path)
+    /* Handle doesn't exist anymore in the model */
     goto out;
 
-  parent_folder = gtk_file_system_get_folder (file_system, parent_path ? parent_path : path,
-                                             GTK_FILE_INFO_DISPLAY_NAME
-                                             | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER),
-                                             &tmp);
-  if (!parent_folder)
+  pos = gtk_tree_path_get_indices (path)[0];
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (request->impl->shortcuts_model),
+                          &iter, path);
+  gtk_tree_path_free (path);
+
+  /* validate handle, else goto out */
+  gtk_tree_model_get (GTK_TREE_MODEL (request->impl->shortcuts_model), &iter,
+                     SHORTCUTS_COL_HANDLE, &model_handle,
+                     -1);
+  if (handle != model_handle)
     goto out;
 
-  info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, &tmp);
-  g_object_unref (parent_folder);
+  /* set the handle to NULL in the model (we unref later on) */
+  gtk_list_store_set (request->impl->shortcuts_model, &iter,
+                     SHORTCUTS_COL_HANDLE, NULL,
+                     -1);
 
- out:
-  if (parent_path)
-    gtk_file_path_free (parent_path);
+  if (cancelled)
+    goto out;
 
-  if (tmp)
+  if (!info)
     {
-      g_set_error (error,
-                  GTK_FILE_CHOOSER_ERROR,
-                  GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
-                  _("Could not get information about '%s': %s"), 
-                  gtk_file_path_get_string (path),
-                  tmp->message);
-      g_error_free (tmp);
-    }
+      gtk_list_store_remove (request->impl->shortcuts_model, &iter);
+      shortcuts_update_count (request->impl, request->type, -1);
 
-  profile_end ("end", (char *) path);
+      if (request->type == SHORTCUTS_HOME)
+        {
+         const char *home = g_get_home_dir ();
+         GtkFilePath *home_path;
 
-  return info;
-}
+         home_path = gtk_file_system_filename_to_path (request->impl->file_system, home);
+         error_getting_info_dialog (request->impl, home_path, g_error_copy (error));
+         gtk_file_path_free (home_path);
+       }
+      else if (request->type == SHORTCUTS_CURRENT_FOLDER)
+        {
+         /* Remove the current folder separator */
+         gint separator_pos = shortcuts_get_index (request->impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
+         shortcuts_remove_rows (request->impl, separator_pos, 1);
+        }
 
-/* Returns whether a path is a folder */
-static gboolean
-check_is_folder (GtkFileSystem      *file_system, 
-                const GtkFilePath  *path, 
-                GError            **error)
-{
-  GtkFileFolder *folder;
+      goto out;
+    }
+  
+  if (!request->label_copy)
+    request->label_copy = g_strdup (gtk_file_info_get_display_name (info));
+  pixbuf = gtk_file_info_render_icon (info, GTK_WIDGET (request->impl),
+                                     request->impl->icon_size, NULL);
 
-  profile_start ("start", (char *) path);
+  gtk_list_store_set (request->impl->shortcuts_model, &iter,
+                     SHORTCUTS_COL_PIXBUF, pixbuf,
+                     SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
+                     SHORTCUTS_COL_NAME, request->label_copy,
+                     SHORTCUTS_COL_IS_VOLUME, is_volume,
+                     SHORTCUTS_COL_REMOVABLE, request->removable,
+                     -1);
 
-  folder = gtk_file_system_get_folder (file_system, path, 0, error);
-  if (!folder)
+  if (request->impl->shortcuts_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (request->impl->shortcuts_filter_model));
+
+  if (request->type == SHORTCUTS_CURRENT_FOLDER
+      && request->impl->save_folder_combo != NULL)
     {
-      profile_end ("end - is not folder", (char *) path);
-      return FALSE;
+      /* The current folder is updated via _activate_iter(), don't
+       * have save_folder_combo_changed_cb() call _activate_iter()
+       * again.
+       */
+      g_signal_handlers_block_by_func (request->impl->save_folder_combo,
+                                      G_CALLBACK (save_folder_combo_changed_cb),
+                                      request->impl);
+      gtk_combo_box_set_active (GTK_COMBO_BOX (request->impl->save_folder_combo), pos);
+      g_signal_handlers_unblock_by_func (request->impl->save_folder_combo,
+                                        G_CALLBACK (save_folder_combo_changed_cb),
+                                        request->impl);
     }
 
-  g_object_unref (folder);
+  if (pixbuf)
+    g_object_unref (pixbuf);
 
-  profile_end ("end", (char *) path);
-  return TRUE;
+out:
+  g_object_unref (request->impl);
+  gtk_file_path_free (request->parent_path);
+  gtk_file_path_free (request->path);
+  gtk_tree_row_reference_free (request->row_ref);
+  g_free (request->label_copy);
+  g_free (request);
+
+  g_object_unref (handle);
 }
 
 /* Inserts a path in the shortcuts tree, making a copy of it; alternatively,
  * inserts a volume.  A position of -1 indicates the end of the tree.
  */
-static gboolean
+static void
 shortcuts_insert_path (GtkFileChooserDefault *impl,
                       int                    pos,
                       gboolean               is_volume,
@@ -1257,11 +1441,11 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
                       const GtkFilePath     *path,
                       const char            *label,
                       gboolean               removable,
-                      GError               **error)
+                      ShortcutsIndex         type)
 {
   char *label_copy;
-  GdkPixbuf *pixbuf;
-  gpointer data;
+  GdkPixbuf *pixbuf = NULL;
+  gpointer data = NULL;
   GtkTreeIter iter;
 
   profile_start ("start", is_volume ? "volume" : (char *) path);
@@ -1275,38 +1459,54 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
     }
   else
     {
-      if (!check_is_folder (impl->file_system, path, error))
-       {
-         profile_end ("end - is not folder", NULL);
-         return FALSE;
-       }
-
+      struct ShortcutsInsertRequest *request;
+      GtkFileSystemHandle *handle;
+      GtkTreePath *p;
+
+      request = g_new0 (struct ShortcutsInsertRequest, 1);
+      request->impl = g_object_ref (impl);
+      request->path = gtk_file_path_copy (path);
+      request->name_only = TRUE;
+      request->removable = removable;
+      request->pos = pos;
+      request->type = type;
       if (label)
-       label_copy = g_strdup (label);
+       request->label_copy = g_strdup (label);
+
+      if (pos == -1)
+       gtk_list_store_append (impl->shortcuts_model, &iter);
       else
-       {
-         GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
+       gtk_list_store_insert (impl->shortcuts_model, &iter, pos);
 
-         if (!info)
-           {
-             profile_end ("end - could not get info", (char *) path);
-             return FALSE;
-           }
+      p = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
+      request->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->shortcuts_model), p);
+      gtk_tree_path_free (p);
 
-         label_copy = g_strdup (gtk_file_info_get_display_name (info));
-         gtk_file_info_free (info);
-       }
+      handle = gtk_file_system_get_info (request->impl->file_system, request->path,
+                                        GTK_FILE_INFO_DISPLAY_NAME | GTK_FILE_INFO_IS_HIDDEN | GTK_FILE_INFO_ICON,
+                                        get_file_info_finished, request);
 
-      data = gtk_file_path_copy (path);
-      pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
-                                           impl->icon_size, NULL);
+      gtk_list_store_set (impl->shortcuts_model, &iter,
+                         SHORTCUTS_COL_DATA, gtk_file_path_copy (path),
+                         SHORTCUTS_COL_IS_VOLUME, is_volume,
+                         SHORTCUTS_COL_HANDLE, handle,
+                         -1);
+
+      shortcuts_update_count (impl, type, 1);
+
+      return;
     }
 
+  if (!data)
+    data = gtk_file_path_copy (path);
+
   if (pos == -1)
     gtk_list_store_append (impl->shortcuts_model, &iter);
   else
     gtk_list_store_insert (impl->shortcuts_model, &iter, pos);
 
+  shortcuts_update_count (impl, type, 1);
+
   gtk_list_store_set (impl->shortcuts_model, &iter,
                      SHORTCUTS_COL_PIXBUF, pixbuf,
                      SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
@@ -1314,16 +1514,34 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
                      SHORTCUTS_COL_DATA, data,
                      SHORTCUTS_COL_IS_VOLUME, is_volume,
                      SHORTCUTS_COL_REMOVABLE, removable,
+                     SHORTCUTS_COL_HANDLE, NULL,
                      -1);
 
+  if (impl->shortcuts_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
+
+  if (type == SHORTCUTS_CURRENT_FOLDER && impl->save_folder_combo != NULL)
+    {
+      /* The current folder is updated via _activate_iter(), don't
+       * have save_folder_combo_changed_cb() call _activate_iter()
+       * again.
+       */
+      gint combo_pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER);
+      g_signal_handlers_block_by_func (impl->save_folder_combo,
+                                      G_CALLBACK (save_folder_combo_changed_cb),
+                                      impl);
+      gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), combo_pos);
+      g_signal_handlers_unblock_by_func (impl->save_folder_combo,
+                                        G_CALLBACK (save_folder_combo_changed_cb),
+                                        impl);
+    }
+
   g_free (label_copy);
 
   if (pixbuf)
     g_object_unref (pixbuf);
 
   profile_end ("end", NULL);
-
-  return TRUE;
 }
 
 /* Appends an item for the user's home directory to the shortcuts model */
@@ -1332,7 +1550,6 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
 {
   const char *home;
   GtkFilePath *home_path;
-  GError *error;
 
   profile_start ("start", NULL);
 
@@ -1345,10 +1562,7 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
 
   home_path = gtk_file_system_filename_to_path (impl->file_system, home);
 
-  error = NULL;
-  impl->has_home = shortcuts_insert_path (impl, -1, FALSE, NULL, home_path, NULL, FALSE, &error);
-  if (!impl->has_home)
-    error_getting_info_dialog (impl, home_path, error);
+  shortcuts_insert_path (impl, -1, FALSE, NULL, home_path, NULL, FALSE, SHORTCUTS_HOME);
 
   gtk_file_path_free (home_path);
 
@@ -1381,7 +1595,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
   path = gtk_file_system_filename_to_path (impl->file_system, name);
   g_free (name);
 
-  impl->has_desktop = shortcuts_insert_path (impl, -1, FALSE, NULL, path, _("Desktop"), FALSE, NULL);
+  shortcuts_insert_path (impl, -1, FALSE, NULL, path, _("Desktop"), FALSE, SHORTCUTS_DESKTOP);
   /* We do not actually pop up an error dialog if there is no desktop directory
    * because some people may really not want to have one.
    */
@@ -1420,8 +1634,8 @@ shortcuts_append_paths (GtkFileChooserDefault *impl,
       label = gtk_file_system_get_bookmark_label (impl->file_system, path);
 
       /* NULL GError, but we don't really want to show error boxes here */
-      if (shortcuts_insert_path (impl, start_row + num_inserted, FALSE, NULL, path, label, TRUE, NULL))
-       num_inserted++;
+      shortcuts_insert_path (impl, start_row + num_inserted, FALSE, NULL, path, label, TRUE, SHORTCUTS_BOOKMARKS);
+      num_inserted++;
 
       g_free (label);
     }
@@ -1486,30 +1700,6 @@ shortcuts_get_index (GtkFileChooserDefault *impl,
   return n;
 }
 
-/* Removes the specified number of rows from the shortcuts list */
-static void
-shortcuts_remove_rows (GtkFileChooserDefault *impl,
-                      int                    start_row,
-                      int                    n_rows)
-{
-  GtkTreePath *path;
-
-  path = gtk_tree_path_new_from_indices (start_row, -1);
-
-  for (; n_rows; n_rows--)
-    {
-      GtkTreeIter iter;
-
-      if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
-       g_assert_not_reached ();
-
-      shortcuts_free_row_data (impl, &iter);
-      gtk_list_store_remove (impl->shortcuts_model, &iter);
-    }
-
-  gtk_tree_path_free (path);
-}
-
 /* Adds all the file system volumes to the shortcuts model */
 static void
 shortcuts_add_volumes (GtkFileChooserDefault *impl)
@@ -1540,24 +1730,27 @@ shortcuts_add_volumes (GtkFileChooserDefault *impl)
 
       if (impl->local_only)
        {
-         GtkFilePath *base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
-         if (base_path != NULL)
+         if (gtk_file_system_volume_get_is_mounted (impl->file_system, volume))
            {
-             gboolean is_local = gtk_file_system_path_is_local (impl->file_system, base_path);
-             gtk_file_path_free (base_path);
-             
-             if (!is_local)
+             GtkFilePath *base_path;
+
+             base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+             if (base_path != NULL)
                {
-                 gtk_file_system_volume_free (impl->file_system, volume);
-                 continue;
+                 gboolean is_local = gtk_file_system_path_is_local (impl->file_system, base_path);
+                 gtk_file_path_free (base_path);
+
+                 if (!is_local)
+                   {
+                     gtk_file_system_volume_free (impl->file_system, volume);
+                     continue;
+                   }
                }
            }
        }
 
-      if (shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, NULL))
-       n++;
-      else
-       gtk_file_system_volume_free (impl->file_system, volume);
+      shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, SHORTCUTS_VOLUMES);
+      n++;
     }
 
   impl->num_volumes = n;
@@ -1604,6 +1797,7 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
 
   profile_start ("start", NULL);
         
+
   old_changing_folders = impl->changing_folder;
   impl->changing_folder = TRUE;
 
@@ -1638,8 +1832,10 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
                           shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR),
                           impl->num_bookmarks + 1);
 
+  impl->num_bookmarks = 0;
+
   bookmarks = gtk_file_system_list_bookmarks (impl->file_system);
-  impl->num_bookmarks = shortcuts_append_paths (impl, bookmarks);
+  shortcuts_append_paths (impl, bookmarks);
   gtk_file_paths_free (bookmarks);
 
   if (impl->num_bookmarks > 0)
@@ -1706,26 +1902,19 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
       if (base_path &&
          strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
        {
-         success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL);
-         if (success)
-           volume = NULL;
+         shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
        }
       else
-       success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
-
-      if (volume)
-       gtk_file_system_volume_free (impl->file_system, volume);
+        {
+         shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
+         if (volume)
+           gtk_file_system_volume_free (impl->file_system, volume);
+       }
 
       if (base_path)
        gtk_file_path_free (base_path);
-
-      if (!success)
-       shortcuts_remove_rows (impl, pos - 1, 1); /* remove the separator */
-
-      impl->shortcuts_current_folder_active = success;
     }
-
-  if (success && impl->save_folder_combo != NULL)
+  else if (impl->save_folder_combo != NULL)
     gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
 }
 
@@ -1779,7 +1968,8 @@ shortcuts_model_create (GtkFileChooserDefault *impl)
                                              G_TYPE_POINTER,   /* path or volume */
                                              G_TYPE_BOOLEAN,   /* is the previous column a volume? */
                                              G_TYPE_BOOLEAN,   /* removable */
-                                             G_TYPE_BOOLEAN);  /* pixbuf cell visibility */
+                                             G_TYPE_BOOLEAN,   /* pixbuf cell visibility */
+                                             G_TYPE_POINTER);   /* GtkFileSystemHandle */
 
   if (impl->file_system)
     {
@@ -1828,6 +2018,33 @@ new_folder_button_clicked (GtkButton             *button,
   gtk_tree_path_free (path);
 }
 
+static void
+edited_idle_create_folder_cb (GtkFileSystemHandle *handle,
+                             const GtkFilePath   *path,
+                             const GError        *error,
+                             gpointer             data)
+{
+  gboolean cancelled = handle->cancelled;
+  GtkFileChooserDefault *impl = data;
+
+  if (!g_slist_find (impl->pending_handles, handle))
+    goto out;
+
+  impl->pending_handles = g_slist_remove (impl->pending_handles, handle);
+
+  if (cancelled)
+    goto out;
+
+  if (!error)
+    change_folder_and_display_error (impl, path);
+  else
+    error_creating_folder_dialog (impl, path, g_error_copy (error));
+
+ out:
+  g_object_unref (impl);
+  g_object_unref (handle);
+}
+
 /* Idle handler for creating a new folder after editing its name cell, or for
  * canceling the editing.
  */
@@ -1850,15 +2067,18 @@ edited_idle_cb (GtkFileChooserDefault *impl)
       GtkFilePath *file_path;
 
       error = NULL;
-      file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
+      file_path = gtk_file_system_make_path (impl->file_system,
+                                            impl->current_folder,
+                                            impl->edited_new_text,
                                             &error);
       if (file_path)
        {
-         error = NULL;
-         if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
-           change_folder_and_display_error (impl, file_path);
-         else
-           error_creating_folder_dialog (impl, file_path, error);
+         GtkFileSystemHandle *handle;
+
+         handle = gtk_file_system_create_folder (impl->file_system, file_path,
+                                                 edited_idle_create_folder_cb,
+                                                 g_object_ref (impl));
+         impl->pending_handles = g_slist_append (impl->pending_handles, handle);
 
          gtk_file_path_free (file_path);
        }
@@ -1882,17 +2102,17 @@ queue_edited_idle (GtkFileChooserDefault *impl,
    * just now.
    */
 
-  g_assert (!impl->edited_idle);
-  g_assert (!impl->edited_new_text);
-
-  impl->edited_idle = g_idle_source_new ();
-  g_source_set_closure (impl->edited_idle,
-                       g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
-                                              G_OBJECT (impl)));
-  g_source_attach (impl->edited_idle, NULL);
+  if (!impl->edited_idle)
+    {
+      impl->edited_idle = g_idle_source_new ();
+      g_source_set_closure (impl->edited_idle,
+                           g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
+                                                  G_OBJECT (impl)));
+      g_source_attach (impl->edited_idle, NULL);
+    }
 
-  if (new_text)
-    impl->edited_new_text = g_strdup (new_text);
+  g_free (impl->edited_new_text);
+  impl->edited_new_text = g_strdup (new_text);
 }
 
 /* Callback used from the text cell renderer when the new folder is named */
@@ -1972,6 +2192,12 @@ shortcut_find_position (GtkFileChooserDefault *impl,
 
   current_folder_separator_idx = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
 
+#if 0
+  /* FIXME: is this still needed? */
+  if (current_folder_separator_idx >= impl->shortcuts_model->length)
+    return -1;
+#endif
+
   for (i = 0; i < current_folder_separator_idx; i++)
     {
       gpointer col_data;
@@ -2011,7 +2237,11 @@ shortcut_find_position (GtkFileChooserDefault *impl,
            }
        }
 
-      gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
+      if (i < current_folder_separator_idx - 1)
+       {
+         if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+           g_assert_not_reached ();
+       }
     }
 
   return -1;
@@ -2030,14 +2260,6 @@ shortcuts_add_bookmark_from_path (GtkFileChooserDefault *impl,
   if (shortcut_find_position (impl, path) != -1)
     return FALSE;
 
-  /* FIXME: this check really belongs in gtk_file_system_insert_bookmark.  */
-  error = NULL;
-  if (!check_is_folder (impl->file_system, path, &error))
-    {
-      error_adding_bookmark_dialog (impl, path, error);
-      return FALSE;
-    }
-
   error = NULL;
   if (!gtk_file_system_insert_bookmark (impl->file_system, path, pos, &error))
     {
@@ -2436,7 +2658,7 @@ shortcuts_drag_data_delete_cb (GtkWidget             *widget,
                               GdkDragContext        *context,
                               GtkFileChooserDefault *impl)
 {
-  g_signal_stop_emission_by_name (widget, "drag-data-delete");
+  g_signal_stop_emission_by_name (widget, "drag_data_delete");
 }
 
 #if 0
@@ -2623,7 +2845,7 @@ shortcuts_drag_leave_cb (GtkWidget             *widget,
                                   NULL,
                                   GTK_TREE_VIEW_DROP_BEFORE);
 
-  g_signal_stop_emission_by_name (widget, "drag-leave");
+  g_signal_stop_emission_by_name (widget, "drag_leave");
 }
 
 /* Computes the appropriate row and position for dropping */
@@ -2729,7 +2951,7 @@ shortcuts_drag_motion_cb (GtkWidget             *widget,
 
  out:
 
-  g_signal_stop_emission_by_name (widget, "drag-motion");
+  g_signal_stop_emission_by_name (widget, "drag_motion");
 
   if (action != 0)
     {
@@ -2753,7 +2975,7 @@ shortcuts_drag_drop_cb (GtkWidget             *widget,
   shortcuts_cancel_drag_outside_idle (impl);
 #endif
 
-  g_signal_stop_emission_by_name (widget, "drag-drop");
+  g_signal_stop_emission_by_name (widget, "drag_drop");
   return TRUE;
 }
 
@@ -2902,7 +3124,7 @@ shortcuts_drag_data_received_cb (GtkWidget          *widget,
   else if (selection_data->target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
     shortcuts_reorder (impl, position);
 
-  g_signal_stop_emission_by_name (widget, "drag-data-received");
+  g_signal_stop_emission_by_name (widget, "drag_data_received");
 }
 
 /* Callback used when the selection in the shortcuts tree changes */
@@ -2940,13 +3162,17 @@ tree_view_keybinding_cb (GtkWidget             *tree_view,
                         GdkEventKey           *event,
                         GtkFileChooserDefault *impl)
 {
-  if (event->keyval == GDK_slash &&
-      ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
+  if ((event->keyval == GDK_slash
+       || event->keyval == GDK_KP_Divide
+#ifdef G_OS_UNIX
+       || event->keyval == GDK_asciitilde
+#endif
+       ) && ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
     {
-      location_popup_handler (impl, "/");
+      location_popup_handler (impl, event->string);
       return TRUE;
     }
-  
+
   return FALSE;
 }
 
@@ -2972,9 +3198,9 @@ remove_shortcut_cb (GtkMenuItem           *item,
   remove_selected_bookmarks (impl);
 }
 
+/* Rename the selected bookmark */
 static void
-rename_shortcut_cb (GtkMenuItem           *item,
-                   GtkFileChooserDefault *impl)
+rename_selected_bookmark (GtkFileChooserDefault *impl)
 {
   GtkTreeIter iter;
   GtkTreePath *path;
@@ -2996,6 +3222,13 @@ rename_shortcut_cb (GtkMenuItem           *item,
     }
 }
 
+static void
+rename_shortcut_cb (GtkMenuItem           *item,
+                   GtkFileChooserDefault *impl)
+{
+  rename_selected_bookmark (impl);
+}
+
 /* Constructs the popup menu for the file list if needed */
 static void
 shortcuts_build_popup_menu (GtkFileChooserDefault *impl)
@@ -3079,9 +3312,22 @@ shortcuts_button_press_event_cb (GtkWidget             *widget,
                                 GdkEventButton        *event,
                                 GtkFileChooserDefault *impl)
 {
+  static gboolean in_press = FALSE;
+  gboolean handled;
+
+  if (in_press)
+    return FALSE;
+
   if (event->button != 3)
     return FALSE;
 
+  in_press = TRUE;
+  handled = gtk_widget_event (impl->browse_shortcuts_tree_view, (GdkEvent *) event);
+  in_press = FALSE;
+
+  if (!handled)
+    return FALSE;
+
   shortcuts_popup_menu (impl, event);
   return TRUE;
 }
@@ -3099,7 +3345,9 @@ shortcuts_edited (GtkCellRenderer       *cell,
   g_object_set (cell, "editable", FALSE, NULL);
 
   path = gtk_tree_path_new_from_string (path_string);
-  gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path);
+  if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
+    g_assert_not_reached ();
+
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
                      SHORTCUTS_COL_DATA, &shortcut,
                      -1);
@@ -3139,14 +3387,14 @@ shortcuts_list_create (GtkFileChooserDefault *impl)
 #ifdef PROFILE_FILE_CHOOSER
   g_object_set_data (G_OBJECT (impl->browse_shortcuts_tree_view), "fmq-name", "shortcuts");
 #endif
-  g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "key_press_event",
                    G_CALLBACK (tree_view_keybinding_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "popup-menu",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "popup_menu",
                    G_CALLBACK (shortcuts_popup_menu_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "button-press-event",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "button_press_event",
                    G_CALLBACK (shortcuts_button_press_event_cb), impl);
-  atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts"));
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
+  /* Accessible object name for the file chooser's shortcuts pane */
+  atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Places"));
 
   gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model);
 
@@ -3171,26 +3419,26 @@ shortcuts_list_create (GtkFileChooserDefault *impl)
   g_signal_connect (selection, "changed",
                    G_CALLBACK (shortcuts_selection_changed_cb), impl);
 
-  g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "row_activated",
                    G_CALLBACK (shortcuts_row_activated_cb), impl);
 
-  g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "key_press_event",
                    G_CALLBACK (shortcuts_key_press_event_cb), impl);
 
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_begin",
                    G_CALLBACK (shortcuts_drag_begin_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_end",
                    G_CALLBACK (shortcuts_drag_end_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-delete",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_data_delete",
                    G_CALLBACK (shortcuts_drag_data_delete_cb), impl);
 
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-leave",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_leave",
                    G_CALLBACK (shortcuts_drag_leave_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-motion",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_motion",
                    G_CALLBACK (shortcuts_drag_motion_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-drop",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_drop",
                    G_CALLBACK (shortcuts_drag_drop_cb), impl);
-  g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
+  g_signal_connect (impl->browse_shortcuts_tree_view, "drag_data_received",
                    G_CALLBACK (shortcuts_drag_data_received_cb), impl);
 
   gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
@@ -3199,7 +3447,8 @@ shortcuts_list_create (GtkFileChooserDefault *impl)
   /* Column */
 
   column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (column, _("Folder"));
+  /* Column header for the file chooser's shortcuts pane */
+  gtk_tree_view_column_set_title (column, _("_Places"));
 
   renderer = gtk_cell_renderer_pixbuf_new ();
   gtk_tree_view_column_pack_start (column, renderer, FALSE);
@@ -3294,11 +3543,15 @@ trap_activate_cb (GtkWidget   *widget,
   impl = (GtkFileChooserDefault *) data;
 
   modifiers = gtk_accelerator_get_default_mod_mask ();
-  
-  if (event->keyval == GDK_slash &&
-      ! (event->state & (~GDK_SHIFT_MASK & modifiers)))
+
+  if ((event->keyval == GDK_slash
+       || event->keyval == GDK_KP_Divide
+#ifdef G_OS_UNIX
+       || event->keyval == GDK_asciitilde
+#endif
+       ) && ! (event->state & (~GDK_SHIFT_MASK & modifiers)))
     {
-      location_popup_handler (impl, "/");
+      location_popup_handler (impl, event->string);
       return TRUE;
     }
 
@@ -3306,7 +3559,7 @@ trap_activate_cb (GtkWidget   *widget,
        || event->keyval == GDK_ISO_Enter
        || event->keyval == GDK_KP_Enter
        || event->keyval == GDK_space)
-      && ((event->state && modifiers) == 0)
+      && ((event->state & modifiers) == 0)
       && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
           impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
     {
@@ -3349,14 +3602,6 @@ add_to_shortcuts_cb (GtkMenuItem           *item,
   bookmarks_add_selected_folder (impl);
 }
 
-/* Callback used when the "Open Location" menu item is activated */
-static void
-open_location_cb (GtkMenuItem           *item,
-                 GtkFileChooserDefault *impl)
-{
-  location_popup_handler (impl, "");
-}
-
 /* Callback used when the "Show Hidden Files" menu item is toggled */
 static void
 show_hidden_toggled_cb (GtkCheckMenuItem      *item,
@@ -3378,6 +3623,88 @@ error_selecting_dragged_file_dialog (GtkFileChooserDefault *impl,
                path, error);
 }
 
+static void
+file_list_drag_data_select_uris (GtkFileChooserDefault  *impl,
+                                gchar                 **uris)
+{
+  int i;
+  char *uri;
+  GtkFileChooser *chooser = GTK_FILE_CHOOSER (impl);
+
+  for (i = 1; uris[i]; i++)
+    {
+      GtkFilePath *path;
+
+      uri = uris[i];
+      path = gtk_file_system_uri_to_path (impl->file_system, uri);
+
+      if (path)
+        {
+         GError *error = NULL;
+
+         gtk_file_chooser_default_select_path (chooser, path, &error);
+         if (error)
+           error_selecting_dragged_file_dialog (impl, path, error);
+
+         gtk_file_path_free (path);
+       }
+    }
+}
+
+struct FileListDragData
+{
+  GtkFileChooserDefault *impl;
+  gchar **uris;
+  GtkFilePath *path;
+};
+
+static void
+file_list_drag_data_received_get_info_cb (GtkFileSystemHandle *handle,
+                                         const GtkFileInfo   *info,
+                                         const GError        *error,
+                                         gpointer             user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  struct FileListDragData *data = user_data;
+  GtkFileChooser *chooser = GTK_FILE_CHOOSER (data->impl);
+
+  if (handle != data->impl->file_list_drag_data_received_handle)
+    goto out;
+
+  data->impl->file_list_drag_data_received_handle = NULL;
+
+  if (cancelled || error)
+    goto out;
+
+  if ((data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+       data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
+      data->uris[1] == 0 && !error &&
+      gtk_file_info_get_is_folder (info))
+    change_folder_and_display_error (data->impl, data->path);
+  else
+    {
+      GError *error = NULL;
+
+      gtk_file_chooser_default_unselect_all (chooser);
+      gtk_file_chooser_default_select_path (chooser, data->path, &error);
+      if (error)
+       error_selecting_dragged_file_dialog (data->impl, data->path, error);
+      else
+       browse_files_center_selected_row (data->impl);
+    }
+
+  if (data->impl->select_multiple)
+    file_list_drag_data_select_uris (data->impl, data->uris);
+
+out:
+  g_object_unref (data->impl);
+  g_strfreev (data->uris);
+  gtk_file_path_free (data->path);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
 static void
 file_list_drag_data_received_cb (GtkWidget          *widget,
                                 GdkDragContext     *context,
@@ -3394,7 +3721,6 @@ file_list_drag_data_received_cb (GtkWidget          *widget,
   char *uri;
   GtkFilePath *path;
   GError *error = NULL;
-  gint i;
  
   impl = GTK_FILE_CHOOSER_DEFAULT (data);
   chooser = GTK_FILE_CHOOSER (data);
@@ -3408,22 +3734,22 @@ file_list_drag_data_received_cb (GtkWidget          *widget,
       
       if (path)
        {
-         if ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
-              impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
-             uris[1] == 0 &&
-             check_is_folder (impl->file_system, path, NULL))
-           change_folder_and_display_error (impl, path);
-          else
-            {
-              gtk_file_chooser_default_unselect_all (chooser);
-              gtk_file_chooser_default_select_path (chooser, path, &error);
-              if (error)
-               error_selecting_dragged_file_dialog (impl, path, error);
-             else
-               browse_files_center_selected_row (impl);
-            }
+         struct FileListDragData *data;
 
-         gtk_file_path_free (path);
+         data = g_new0 (struct FileListDragData, 1);
+         data->impl = g_object_ref (impl);
+         data->uris = uris;
+         data->path = path;
+
+         if (impl->file_list_drag_data_received_handle)
+           gtk_file_system_cancel_operation (impl->file_list_drag_data_received_handle);
+
+         impl->file_list_drag_data_received_handle =
+           gtk_file_system_get_info (impl->file_system, path,
+                                     GTK_FILE_INFO_IS_FOLDER,
+                                     file_list_drag_data_received_get_info_cb,
+                                     data);
+         goto out;
        }
       else
        {
@@ -3436,29 +3762,14 @@ file_list_drag_data_received_cb (GtkWidget          *widget,
          error_selecting_dragged_file_dialog (impl, NULL, error);
        }
 
-      
       if (impl->select_multiple)
-       {
-         for (i = 1; uris[i]; i++)
-           {
-             uri = uris[i];
-             path = gtk_file_system_uri_to_path (impl->file_system, uri);
-             
-             if (path)
-               {
-                 gtk_file_chooser_default_select_path (chooser, path, &error);
-                 if (error)
-                   error_selecting_dragged_file_dialog (impl, path, error);
-
-                 gtk_file_path_free (path);
-               }
-           }
-       }
+       file_list_drag_data_select_uris (impl, uris);
     }
 
   g_strfreev (uris);
 
-  g_signal_stop_emission_by_name (widget, "drag-data-received");
+out:
+  g_signal_stop_emission_by_name (widget, "drag_data_received");
 }
 
 /* Don't do anything with the drag_drop signal */
@@ -3470,7 +3781,7 @@ file_list_drag_drop_cb (GtkWidget             *widget,
                        guint                  time_,
                        GtkFileChooserDefault *impl)
 {
-  g_signal_stop_emission_by_name (widget, "drag-drop");
+  g_signal_stop_emission_by_name (widget, "drag_drop");
   return TRUE;
 }
 
@@ -3484,7 +3795,7 @@ file_list_drag_motion_cb (GtkWidget             *widget,
                           guint                  time_,
                           GtkFileChooserDefault *impl)
 {
-  g_signal_stop_emission_by_name (widget, "drag-motion");
+  g_signal_stop_emission_by_name (widget, "drag_motion");
   return TRUE;
 }
 
@@ -3512,14 +3823,6 @@ file_list_build_popup_menu (GtkFileChooserDefault *impl)
   gtk_widget_show (item);
   gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
 
-  item = gtk_image_menu_item_new_with_mnemonic (_("Open _Location"));
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
-                                gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
-  g_signal_connect (item, "activate",
-                   G_CALLBACK (open_location_cb), impl);
-  gtk_widget_show (item);
-  gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
-
   item = gtk_separator_menu_item_new ();
   gtk_widget_show (item);
   gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
@@ -3620,9 +3923,19 @@ list_button_press_event_cb (GtkWidget             *widget,
                            GdkEventButton        *event,
                            GtkFileChooserDefault *impl)
 {
+  static gboolean in_press = FALSE;
+  gboolean handled;
+
+  if (in_press)
+    return FALSE;
+
   if (event->button != 3)
     return FALSE;
 
+  in_press = TRUE;
+  handled = gtk_widget_event (impl->browse_files_tree_view, (GdkEvent *) event);
+  in_press = FALSE;
+
   file_list_popup_menu (impl, event);
   return TRUE;
 }
@@ -3662,20 +3975,20 @@ create_file_list (GtkFileChooserDefault *impl)
                      num_file_list_dest_targets,
                      GDK_ACTION_COPY | GDK_ACTION_MOVE);
   
-  g_signal_connect (impl->browse_files_tree_view, "row-activated",
+  g_signal_connect (impl->browse_files_tree_view, "row_activated",
                    G_CALLBACK (list_row_activated), impl);
-  g_signal_connect (impl->browse_files_tree_view, "key-press-event",
+  g_signal_connect (impl->browse_files_tree_view, "key_press_event",
                    G_CALLBACK (trap_activate_cb), impl);
-  g_signal_connect (impl->browse_files_tree_view, "popup-menu",
+  g_signal_connect (impl->browse_files_tree_view, "popup_menu",
                    G_CALLBACK (list_popup_menu_cb), impl);
-  g_signal_connect (impl->browse_files_tree_view, "button-press-event",
+  g_signal_connect (impl->browse_files_tree_view, "button_press_event",
                    G_CALLBACK (list_button_press_event_cb), impl);
 
-  g_signal_connect (impl->browse_files_tree_view, "drag-data-received",
+  g_signal_connect (impl->browse_files_tree_view, "drag_data_received",
                     G_CALLBACK (file_list_drag_data_received_cb), impl);
-  g_signal_connect (impl->browse_files_tree_view, "drag-drop",
+  g_signal_connect (impl->browse_files_tree_view, "drag_drop",
                     G_CALLBACK (file_list_drag_drop_cb), impl);
-  g_signal_connect (impl->browse_files_tree_view, "drag-motion",
+  g_signal_connect (impl->browse_files_tree_view, "drag_motion",
                     G_CALLBACK (file_list_drag_motion_cb), impl);
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
@@ -3710,7 +4023,7 @@ create_file_list (GtkFileChooserDefault *impl)
                NULL);
   g_signal_connect (impl->list_name_renderer, "edited",
                    G_CALLBACK (renderer_edited_cb), impl);
-  g_signal_connect (impl->list_name_renderer, "editing-canceled",
+  g_signal_connect (impl->list_name_renderer, "editing_canceled",
                    G_CALLBACK (renderer_editing_canceled_cb), impl);
   gtk_tree_view_column_pack_start (impl->list_name_column, impl->list_name_renderer, TRUE);
   gtk_tree_view_column_set_cell_data_func (impl->list_name_column, impl->list_name_renderer,
@@ -3724,7 +4037,7 @@ create_file_list (GtkFileChooserDefault *impl)
   gtk_tree_view_column_set_title (column, _("Size"));
 
   renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE); /* bug: it doesn't expand */
   gtk_tree_view_column_set_cell_data_func (column, renderer,
                                           list_size_data_func, impl, NULL);
   gtk_tree_view_column_set_sort_column_id (column, FILE_LIST_COL_SIZE);
@@ -3793,21 +4106,6 @@ file_pane_create (GtkFileChooserDefault *impl,
   vbox = gtk_vbox_new (FALSE, 6);
   gtk_widget_show (vbox);
 
-  /* The path bar and 'Create Folder' button */
-  hbox = gtk_hbox_new (FALSE, 12);
-  gtk_widget_show (hbox);
-  impl->browse_path_bar = create_path_bar (impl);
-  g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl);
-  gtk_widget_show_all (impl->browse_path_bar);
-  gtk_box_pack_start (GTK_BOX (hbox), impl->browse_path_bar, TRUE, TRUE, 0);
-
-  /* Create Folder */
-  impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
-  g_signal_connect (impl->browse_new_folder_button, "clicked",
-                   G_CALLBACK (new_folder_button_clicked), impl);
-  gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
   /* Box for lists and preview */
 
   hbox = gtk_hbox_new (FALSE, PREVIEW_HBOX_SPACING);
@@ -3917,6 +4215,8 @@ save_widgets_create (GtkFileChooserDefault *impl)
   if (impl->save_widgets != NULL)
     return;
 
+  location_switch_to_path_bar (impl);
+
   vbox = gtk_vbox_new (FALSE, 12);
 
   table = gtk_table_new (2, 2, FALSE);
@@ -3925,7 +4225,7 @@ save_widgets_create (GtkFileChooserDefault *impl)
   gtk_table_set_row_spacings (GTK_TABLE (table), 12);
   gtk_table_set_col_spacings (GTK_TABLE (table), 12);
 
-  /* Name entry */
+  /* Label */
 
   widget = gtk_label_new_with_mnemonic (_("_Name:"));
   gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
@@ -3935,17 +4235,19 @@ save_widgets_create (GtkFileChooserDefault *impl)
                    0, 0);
   gtk_widget_show (widget);
 
-  impl->save_file_name_entry = _gtk_file_chooser_entry_new (TRUE);
-  _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
+  /* Location entry */
+
+  impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+  _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
                                           impl->file_system);
-  gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45);
-  gtk_entry_set_activates_default (GTK_ENTRY (impl->save_file_name_entry), TRUE);
-  gtk_table_attach (GTK_TABLE (table), impl->save_file_name_entry,
+  gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
+  gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
+  gtk_table_attach (GTK_TABLE (table), impl->location_entry,
                    1, 2, 0, 1,
                    GTK_EXPAND | GTK_FILL, 0,
                    0, 0);
-  gtk_widget_show (impl->save_file_name_entry);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->save_file_name_entry);
+  gtk_widget_show (impl->location_entry);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->location_entry);
 
   /* Folder combo */
   impl->save_folder_label = gtk_label_new (NULL);
@@ -3989,126 +4291,374 @@ save_widgets_destroy (GtkFileChooserDefault *impl)
 
   gtk_widget_destroy (impl->save_widgets);
   impl->save_widgets = NULL;
-  impl->save_file_name_entry = NULL;
+  impl->location_entry = NULL;
   impl->save_folder_label = NULL;
   impl->save_folder_combo = NULL;
   impl->save_expander = NULL;
 }
 
-/* Creates the main hpaned with the widgets shared by Open and Save mode */
-static GtkWidget *
-browse_widgets_create (GtkFileChooserDefault *impl)
+/* Turns on the path bar widget.  Can be called even if we are already in that
+ * mode.
+ */
+static void
+location_switch_to_path_bar (GtkFileChooserDefault *impl)
 {
-  GtkWidget *vbox;
-  GtkWidget *hpaned;
-  GtkWidget *widget;
-  GtkSizeGroup *size_group;
+  if (impl->location_entry)
+    {
+      gtk_widget_destroy (impl->location_entry);
+      impl->location_entry = NULL;
+    }
 
-  /* size group is used by the [+][-] buttons and the filter combo */
-  size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-  vbox = gtk_vbox_new (FALSE, 12);
+  gtk_widget_hide (impl->location_entry_box);
+}
 
-  /* Paned widget */
-  hpaned = gtk_hpaned_new ();
-  gtk_widget_show (hpaned);
-  gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */
-  gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
+/* Sets the full path of the current folder as the text in the location entry. */
+static void
+location_entry_set_initial_text (GtkFileChooserDefault *impl)
+{
+  char *text;
 
-  widget = shortcuts_pane_create (impl, size_group);
-  gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
-  widget = file_pane_create (impl, size_group);
-  gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
+  if (!impl->current_folder)
+    return;
 
-  g_object_unref (size_group);
+  if (gtk_file_system_path_is_local (impl->file_system, impl->current_folder))
+    {
+      char *filename;
 
-  return vbox;
-}
+      filename = gtk_file_system_path_to_filename (impl->file_system, impl->current_folder);
+      if (filename)
+       {
+         text = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+         g_free (filename);
+       }
+      else
+       text = NULL;
+    }
+  else
+    text = gtk_file_system_path_to_uri (impl->file_system, impl->current_folder);
 
-static GObject*
-gtk_file_chooser_default_constructor (GType                  type,
-                                     guint                  n_construct_properties,
-                                     GObjectConstructParam *construct_params)
-{
-  GtkFileChooserDefault *impl;
-  GObject *object;
+  if (text)
+    {
+      gboolean need_slash;
+      int len;
 
-  profile_start ("start", NULL);
+      len = strlen (text);
+      need_slash = (text[len - 1] != G_DIR_SEPARATOR);
 
-  object = parent_class->constructor (type,
-                                     n_construct_properties,
-                                     construct_params);
-  impl = GTK_FILE_CHOOSER_DEFAULT (object);
+      if (need_slash)
+       {
+         char *slash_text;
 
-  g_assert (impl->file_system);
+         slash_text = g_new (char, len + 2);
+         strcpy (slash_text, text);
+         slash_text[len] = G_DIR_SEPARATOR;
+         slash_text[len + 1] = 0;
 
-  gtk_widget_push_composite_child ();
+         g_free (text);
+         text = slash_text;
+       }
 
-  /* Shortcuts model */
+      _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), text);
+      g_free (text);
+    }
+}
 
-  shortcuts_model_create (impl);
+/* Turns on the location entry.  Can be called even if we are already in that
+ * mode.
+ */
+static void
+location_switch_to_filename_entry (GtkFileChooserDefault *impl)
+{
+  if (impl->location_entry)
+    gtk_widget_destroy (impl->location_entry);
 
-  /* The browse widgets */
-  impl->browse_widgets = browse_widgets_create (impl);
-  gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0);
+  /* Box */
 
-  /* Alignment to hold extra widget */
-  impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
-  gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
+  gtk_widget_show (impl->location_entry_box);
 
-  gtk_widget_pop_composite_child ();
-  update_appearance (impl);
+  /* Entry */
 
-  profile_end ("end", NULL);
+  impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+  _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
+                                          impl->file_system);
+  gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
+  _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
 
-  return object;
-}
+  gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_entry, TRUE, TRUE, 0);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (impl->location_label), impl->location_entry);
 
-/* Sets the extra_widget by packing it in the appropriate place */
-static void
-set_extra_widget (GtkFileChooserDefault *impl,
-                 GtkWidget             *extra_widget)
-{
-  if (extra_widget)
-    {
-      g_object_ref (extra_widget);
-      /* FIXME: is this right ? */
-      gtk_widget_show (extra_widget);
-    }
+  /* Configure the entry */
 
-  if (impl->extra_widget)
-    {
-      gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
-      g_object_unref (impl->extra_widget);
-    }
+  _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
 
-  impl->extra_widget = extra_widget;
-  if (impl->extra_widget)
-    {
-      gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
-      gtk_widget_show (impl->extra_align);
-    }
-  else
-    gtk_widget_hide (impl->extra_align);
+  /* Done */
+
+  gtk_widget_show (impl->location_entry);
+  gtk_widget_grab_focus (impl->location_entry);
 }
 
+/* Sets a new location mode.  set_buttons determines whether the toggle button
+ * for the mode will also be changed.
+ */
 static void
-set_local_only (GtkFileChooserDefault *impl,
-               gboolean               local_only)
+location_mode_set (GtkFileChooserDefault *impl,
+                  LocationMode new_mode,
+                  gboolean set_button)
 {
-  if (local_only != impl->local_only)
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
     {
-      impl->local_only = local_only;
+      GtkWindow *toplevel;
+      GtkWidget *current_focus;
+      gboolean button_active;
+      gboolean switch_to_file_list;
 
-      if (impl->shortcuts_model && impl->file_system)
+      switch (new_mode)
        {
-         shortcuts_add_volumes (impl);
-         shortcuts_add_bookmarks (impl);
-       }
+       case LOCATION_MODE_PATH_BAR:
+         button_active = FALSE;
 
-      if (local_only &&
-         !gtk_file_system_path_is_local (impl->file_system, impl->current_folder))
-       {
-         /* If we are pointing to a non-local folder, make an effort to change
+         /* The location_entry will disappear when we switch to path bar mode.  So,
+          * we'll focus the file list in that case, to avoid having a window with
+          * no focused widget.
+          */
+         toplevel = get_toplevel (GTK_WIDGET (impl));
+         switch_to_file_list = FALSE;
+         if (toplevel)
+           {
+             current_focus = gtk_window_get_focus (toplevel);
+             if (!current_focus || current_focus == impl->location_entry)
+               switch_to_file_list = TRUE;
+           }
+
+         location_switch_to_path_bar (impl);
+
+         if (switch_to_file_list)
+           gtk_widget_grab_focus (impl->browse_files_tree_view);
+
+         break;
+
+       case LOCATION_MODE_FILENAME_ENTRY:
+         button_active = TRUE;
+         location_switch_to_filename_entry (impl);
+         break;
+
+       default:
+         g_assert_not_reached ();
+         return;
+       }
+
+      if (set_button)
+       {
+         g_signal_handlers_block_by_func (impl->location_button,
+                                          G_CALLBACK (location_button_toggled_cb), impl);
+
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->location_button), button_active);
+
+         g_signal_handlers_unblock_by_func (impl->location_button,
+                                            G_CALLBACK (location_button_toggled_cb), impl);
+       }
+    }
+
+  impl->location_mode = new_mode;
+}
+
+/* Callback used when one of the location mode buttons is toggled */
+static void
+location_button_toggled_cb (GtkToggleButton *toggle,
+                           GtkFileChooserDefault *impl)
+{
+  gboolean is_active;
+  LocationMode new_mode;
+
+  is_active = gtk_toggle_button_get_active (toggle);
+
+  if (is_active)
+    {
+      g_assert (impl->location_mode == LOCATION_MODE_PATH_BAR);
+      new_mode = LOCATION_MODE_FILENAME_ENTRY;
+    }
+  else
+    {
+      g_assert (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY);
+      new_mode = LOCATION_MODE_PATH_BAR;
+    }
+
+  location_mode_set (impl, new_mode, FALSE);
+}
+
+/* Creates a toggle button for the location entry. */
+static void
+location_button_create (GtkFileChooserDefault *impl)
+{
+  GtkWidget *image;
+  const char *str;
+
+  image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
+  gtk_widget_show (image);
+
+  impl->location_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
+                                       "image", image,
+                                       NULL);
+
+  g_signal_connect (impl->location_button, "toggled",
+                   G_CALLBACK (location_button_toggled_cb), impl);
+
+  str = _("Type a file name");
+
+  gtk_tooltips_set_tip (impl->tooltips, impl->location_button, str, NULL);
+  atk_object_set_name (gtk_widget_get_accessible (impl->location_button), str);
+}
+
+/* Creates the main hpaned with the widgets shared by Open and Save mode */
+static GtkWidget *
+browse_widgets_create (GtkFileChooserDefault *impl)
+{
+  GtkWidget *vbox;
+  GtkWidget *hbox;
+  GtkWidget *hpaned;
+  GtkWidget *widget;
+  GtkSizeGroup *size_group;
+  gchar *text;
+
+  /* size group is used by the [+][-] buttons and the filter combo */
+  size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+  vbox = gtk_vbox_new (FALSE, 12);
+
+  /* Location widgets */
+  hbox = gtk_hbox_new (FALSE, 12);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+  gtk_widget_show (hbox);
+
+  location_button_create (impl);
+  gtk_box_pack_start (GTK_BOX (hbox), impl->location_button, FALSE, FALSE, 0);
+
+  /* Path bar */
+
+  impl->browse_path_bar = create_path_bar (impl);
+  g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl);
+  gtk_widget_show_all (impl->browse_path_bar);
+  gtk_box_pack_start (GTK_BOX (hbox), impl->browse_path_bar, TRUE, TRUE, 0);
+
+  /* Create Folder */
+  impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
+  g_signal_connect (impl->browse_new_folder_button, "clicked",
+                   G_CALLBACK (new_folder_button_clicked), impl);
+  gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
+
+  /* Box for the location label and entry */
+
+  impl->location_entry_box = gtk_hbox_new (FALSE, 12);
+  gtk_box_pack_start (GTK_BOX (vbox), impl->location_entry_box, FALSE, FALSE, 0);
+  
+  text = g_strconcat ("<b>", _("_Location:"), "</b>", NULL);
+  impl->location_label = gtk_label_new_with_mnemonic (text);
+  g_free (text);
+  gtk_label_set_use_markup (GTK_LABEL (impl->location_label), TRUE);
+  gtk_widget_show (impl->location_label);
+  gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_label, FALSE, FALSE, 0);
+
+  /* Paned widget */
+  hpaned = gtk_hpaned_new ();
+  gtk_widget_show (hpaned);
+  gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */
+  gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
+
+  widget = shortcuts_pane_create (impl, size_group);
+  gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
+  widget = file_pane_create (impl, size_group);
+  gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
+
+  g_object_unref (size_group);
+
+  return vbox;
+}
+
+static GObject*
+gtk_file_chooser_default_constructor (GType                  type,
+                                     guint                  n_construct_properties,
+                                     GObjectConstructParam *construct_params)
+{
+  GtkFileChooserDefault *impl;
+  GObject *object;
+
+  profile_start ("start", NULL);
+
+  object = G_OBJECT_CLASS (_gtk_file_chooser_default_parent_class)->constructor (type,
+                                                                               n_construct_properties,
+                                                                               construct_params);
+  impl = GTK_FILE_CHOOSER_DEFAULT (object);
+
+  g_assert (impl->file_system);
+
+  gtk_widget_push_composite_child ();
+
+  /* Shortcuts model */
+
+  shortcuts_model_create (impl);
+
+  /* The browse widgets */
+  impl->browse_widgets = browse_widgets_create (impl);
+  gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0);
+
+  /* Alignment to hold extra widget */
+  impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
+  gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
+
+  gtk_widget_pop_composite_child ();
+  update_appearance (impl);
+
+  profile_end ("end", NULL);
+
+  return object;
+}
+
+/* Sets the extra_widget by packing it in the appropriate place */
+static void
+set_extra_widget (GtkFileChooserDefault *impl,
+                 GtkWidget             *extra_widget)
+{
+  if (extra_widget)
+    {
+      g_object_ref (extra_widget);
+      /* FIXME: is this right ? */
+      gtk_widget_show (extra_widget);
+    }
+
+  if (impl->extra_widget)
+    {
+      gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
+      g_object_unref (impl->extra_widget);
+    }
+
+  impl->extra_widget = extra_widget;
+  if (impl->extra_widget)
+    {
+      gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
+      gtk_widget_show (impl->extra_align);
+    }
+  else
+    gtk_widget_hide (impl->extra_align);
+}
+
+static void
+set_local_only (GtkFileChooserDefault *impl,
+               gboolean               local_only)
+{
+  if (local_only != impl->local_only)
+    {
+      impl->local_only = local_only;
+
+      if (impl->shortcuts_model && impl->file_system)
+       {
+         shortcuts_add_volumes (impl);
+         shortcuts_add_bookmarks (impl);
+       }
+
+      if (local_only &&
+         !gtk_file_system_path_is_local (impl->file_system, impl->current_folder))
+       {
+         /* If we are pointing to a non-local folder, make an effort to change
           * back to a local folder, but it's really up to the app to not cause
           * such a situation, so we ignore errors.
           */
@@ -4237,6 +4787,7 @@ update_appearance (GtkFileChooserDefault *impl)
     {
       const char *text;
 
+      gtk_widget_hide (impl->location_button);
       save_widgets_create (impl);
 
       if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
@@ -4246,8 +4797,6 @@ update_appearance (GtkFileChooserDefault *impl)
 
       gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->save_folder_label), text);
 
-      _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), impl->action);
-
       if (gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
        {
          gtk_widget_set_sensitive (impl->save_folder_label, FALSE);
@@ -4273,10 +4822,15 @@ update_appearance (GtkFileChooserDefault *impl)
   else if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
           impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
     {
+      gtk_widget_show (impl->location_button);
       save_widgets_destroy (impl);
       gtk_widget_show (impl->browse_widgets);
+      location_mode_set (impl, impl->location_mode, TRUE);
     }
 
+  if (impl->location_entry)
+    _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
+
   if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
     gtk_widget_hide (impl->browse_new_folder_button);
   else
@@ -4470,6 +5024,7 @@ remove_settings_signal (GtkFileChooserDefault *impl,
 static void
 gtk_file_chooser_default_dispose (GObject *object)
 {
+  GSList *l;
   GtkFileChooserDefault *impl = (GtkFileChooserDefault *) object;
 
   if (impl->extra_widget)
@@ -4478,9 +5033,93 @@ gtk_file_chooser_default_dispose (GObject *object)
       impl->extra_widget = NULL;
     }
 
+  if (impl->volumes_changed_id > 0)
+    {
+      g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
+      impl->volumes_changed_id = 0;
+    }
+
+  if (impl->bookmarks_changed_id > 0)
+    {
+      g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id);
+      impl->bookmarks_changed_id = 0;
+    }
+
+  pending_select_paths_free (impl);
+
+  /* cancel all pending operations */
+  if (impl->pending_handles)
+    {
+      for (l = impl->pending_handles; l; l = l->next)
+        {
+         GtkFileSystemHandle *handle =l->data;
+         gtk_file_system_cancel_operation (handle);
+        }
+      g_slist_free (impl->pending_handles);
+      impl->pending_handles = NULL;
+    }
+
+  if (impl->reload_icon_handles)
+    {
+      for (l = impl->reload_icon_handles; l; l = l->next)
+        {
+         GtkFileSystemHandle *handle =l->data;
+         gtk_file_system_cancel_operation (handle);
+        }
+      g_slist_free (impl->reload_icon_handles);
+      impl->reload_icon_handles = NULL;
+    }
+
+  if (impl->loading_shortcuts)
+    {
+      for (l = impl->loading_shortcuts; l; l = l->next)
+        {
+         GtkFileSystemHandle *handle =l->data;
+         gtk_file_system_cancel_operation (handle);
+        }
+      g_slist_free (impl->loading_shortcuts);
+      impl->loading_shortcuts = NULL;
+    }
+
+  if (impl->file_list_drag_data_received_handle)
+    {
+      gtk_file_system_cancel_operation (impl->file_list_drag_data_received_handle);
+      impl->file_list_drag_data_received_handle = NULL;
+    }
+
+  if (impl->update_current_folder_handle)
+    {
+      gtk_file_system_cancel_operation (impl->update_current_folder_handle);
+      impl->update_current_folder_handle = NULL;
+    }
+
+  if (impl->show_and_select_paths_handle)
+    {
+      gtk_file_system_cancel_operation (impl->show_and_select_paths_handle);
+      impl->show_and_select_paths_handle = NULL;
+    }
+
+  if (impl->should_respond_get_info_handle)
+    {
+      gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+      impl->should_respond_get_info_handle = NULL;
+    }
+
+  if (impl->update_from_entry_handle)
+    {
+      gtk_file_system_cancel_operation (impl->update_from_entry_handle);
+      impl->update_from_entry_handle = NULL;
+    }
+
+  if (impl->shortcuts_activate_iter_handle)
+    {
+      gtk_file_system_cancel_operation (impl->shortcuts_activate_iter_handle);
+      impl->shortcuts_activate_iter_handle = NULL;
+    }
+
   remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
 
-  G_OBJECT_CLASS (parent_class)->dispose (object);
+  G_OBJECT_CLASS (_gtk_file_chooser_default_parent_class)->dispose (object);
 }
 
 /* We override show-all since we have internal widgets that
@@ -4534,7 +5173,7 @@ gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
   toplevel = gtk_widget_get_toplevel (widget);
   if (GTK_IS_WINDOW (toplevel))
     {
-      impl->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
+      impl->toplevel_set_focus_id = g_signal_connect (toplevel, "set_focus",
                                                      G_CALLBACK (toplevel_set_focus_cb), impl);
       impl->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
     }
@@ -4620,8 +5259,8 @@ gtk_file_chooser_default_style_set (GtkWidget *widget,
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
   profile_msg ("    parent class style_set start", NULL);
-  if (GTK_WIDGET_CLASS (parent_class)->style_set)
-    GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+  if (GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->style_set)
+    GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->style_set (widget, previous_style);
   profile_msg ("    parent class style_set end", NULL);
 
   if (gtk_widget_has_screen (GTK_WIDGET (impl)))
@@ -4644,8 +5283,8 @@ gtk_file_chooser_default_screen_changed (GtkWidget *widget,
 
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
-  if (GTK_WIDGET_CLASS (parent_class)->screen_changed)
-    GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, previous_screen);
+  if (GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->screen_changed)
+    GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->screen_changed (widget, previous_screen);
 
   remove_settings_signal (impl, previous_screen);
   check_icon_theme (impl);
@@ -4702,6 +5341,40 @@ get_is_file_filtered (GtkFileChooserDefault *impl,
   return !result;
 }
 
+static void
+settings_load (GtkFileChooserDefault *impl)
+{
+  GtkFileChooserSettings *settings;
+  LocationMode location_mode;
+  gboolean show_hidden;
+
+  settings = _gtk_file_chooser_settings_new ();
+
+  location_mode = _gtk_file_chooser_settings_get_location_mode (settings);
+  show_hidden = _gtk_file_chooser_settings_get_show_hidden (settings);
+
+  g_object_unref (settings);
+
+  location_mode_set (impl, location_mode, TRUE);
+  gtk_file_chooser_set_show_hidden (GTK_FILE_CHOOSER (impl), show_hidden);
+}
+
+static void
+settings_save (GtkFileChooserDefault *impl)
+{
+  GtkFileChooserSettings *settings;
+
+  settings = _gtk_file_chooser_settings_new ();
+
+  _gtk_file_chooser_settings_set_location_mode (settings, impl->location_mode);
+  _gtk_file_chooser_settings_set_show_hidden (settings, gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (impl)));
+
+  /* NULL GError */
+  _gtk_file_chooser_settings_save (settings, NULL);
+
+  g_object_unref (settings);
+}
+
 /* GtkWidget::map method */
 static void
 gtk_file_chooser_default_map (GtkWidget *widget)
@@ -4713,7 +5386,7 @@ gtk_file_chooser_default_map (GtkWidget *widget)
 
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->map (widget);
+  GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->map (widget);
 
   switch (impl->reload_state)
     {
@@ -4729,11 +5402,12 @@ gtk_file_chooser_default_map (GtkWidget *widget)
       break;
 
     case RELOAD_WAS_UNMAPPED:
-      /* Just reload the current folder */
-      g_assert (impl->current_folder != NULL);
-
-      pending_select_paths_store_selection (impl);
-      change_folder_and_display_error (impl, impl->current_folder);
+      /* Just reload the current folder; else continue the pending load. */
+      if (impl->current_folder)
+        {
+          pending_select_paths_store_selection (impl);
+          change_folder_and_display_error (impl, impl->current_folder);
+       }
       break;
 
     default:
@@ -4742,6 +5416,8 @@ gtk_file_chooser_default_map (GtkWidget *widget)
 
   bookmarks_changed_cb (impl->file_system, impl);
 
+  settings_load (impl);
+
   profile_end ("end", NULL);
 }
 
@@ -4753,7 +5429,9 @@ gtk_file_chooser_default_unmap (GtkWidget *widget)
 
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+  settings_save (impl);
+
+  GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unmap (widget);
 
   impl->reload_state = RELOAD_WAS_UNMAPPED;
 }
@@ -4922,7 +5600,7 @@ load_set_model (GtkFileChooserDefault *impl)
   impl->list_sort_ascending = TRUE;
   profile_msg ("    gtk_tree_model_sort_new_with_model end", NULL);
 
-  g_signal_connect (impl->sort_model, "sort-column-changed",
+  g_signal_connect (impl->sort_model, "sort_column_changed",
                    G_CALLBACK (list_sort_column_changed_cb), impl);
 
   profile_msg ("    gtk_tree_view_set_model start", NULL);
@@ -4963,7 +5641,7 @@ load_timeout_cb (gpointer data)
   return FALSE;
 }
 
-/* Sets up a new load timer for the model and switches to the LOAD_LOADING state */
+/* Sets up a new load timer for the model and switches to the LOAD_PRELOAD state */
 static void
 load_setup_timer (GtkFileChooserDefault *impl)
 {
@@ -5044,110 +5722,140 @@ browse_files_center_selected_row (GtkFileChooserDefault *impl)
   gtk_tree_selection_selected_foreach (selection, center_selected_row_foreach_cb, &closure);
 }
 
-static gboolean
-show_and_select_paths (GtkFileChooserDefault *impl,
-                      const GtkFilePath     *parent_path,
-                      const GtkFilePath     *only_one_path,
-                      GSList                *paths,
-                      GError               **error)
+struct ShowAndSelectPathsData
+{
+  GtkFileChooserDefault *impl;
+  GSList *paths;
+};
+
+static void
+show_and_select_paths_finished_loading (GtkFileFolder *folder,
+                                       gpointer user_data)
 {
-  GtkFileFolder *folder;
-  gboolean success;
   gboolean have_hidden;
   gboolean have_filtered;
+  GSList *l;
+  struct ShowAndSelectPathsData *data = user_data;
 
-  profile_start ("start", NULL);
+  have_hidden = FALSE;
+  have_filtered = FALSE;
 
-  if (!only_one_path && !paths)
-    {
-      profile_end ("end", NULL);
-      return TRUE;
-    }
-
-  folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error);
-  if (!folder)
-    {
-      profile_end ("end", NULL);
-      return FALSE;
-    }
-
-  success = FALSE;
-  have_hidden = FALSE;
-  have_filtered = FALSE;
-
-  if (only_one_path)
+  for (l = data->paths; l; l = l->next)
     {
+      const GtkFilePath *path;
       GtkFileInfo *info;
 
-      info = gtk_file_folder_get_info (folder, only_one_path, error);
+      path = l->data;
+
+      /* NULL GError */
+      info = gtk_file_folder_get_info (folder, path, NULL);
       if (info)
        {
-         success = TRUE;
-         have_hidden = gtk_file_info_get_is_hidden (info);
-         have_filtered = get_is_file_filtered (impl, only_one_path, info);
+         if (!have_hidden)
+           have_hidden = gtk_file_info_get_is_hidden (info);
+
+         if (!have_filtered)
+           have_filtered = !gtk_file_info_get_is_folder (info) && get_is_file_filtered (data->impl, path, info);
+
          gtk_file_info_free (info);
+
+         if (have_hidden && have_filtered)
+           break; /* we now have all the information we need */
        }
     }
-  else
-    {
-      GSList *l;
-
-      for (l = paths; l; l = l->next)
-       {
-         const GtkFilePath *path;
-         GtkFileInfo *info;
 
-         path = l->data;
+  g_signal_handlers_disconnect_by_func (folder,
+                                       show_and_select_paths_finished_loading,
+                                       user_data);
 
-         /* NULL GError */
-         info = gtk_file_folder_get_info (folder, path, NULL);
-         if (info)
-           {
-             if (!have_hidden)
-               have_hidden = gtk_file_info_get_is_hidden (info);
+  g_object_unref (folder);
 
-             if (!have_filtered)
-               have_filtered = get_is_file_filtered (impl, path, info);
+  if (have_hidden)
+    g_object_set (data->impl, "show-hidden", TRUE, NULL);
 
-             gtk_file_info_free (info);
+  if (have_filtered)
+    set_current_filter (data->impl, NULL);
 
-             if (have_hidden && have_filtered)
-               break; /* we now have all the information we need */
-           }
-       }
+  for (l = data->paths; l; l = l->next)
+    {
+      const GtkFilePath *path;
 
-      success = TRUE;
+      path = l->data;
+      _gtk_file_system_model_path_do (data->impl->browse_files_model, path,
+                                     select_func, data->impl);
     }
 
-  g_object_unref (folder);
+  browse_files_center_selected_row (data->impl);
 
-  if (!success)
-    {
-      profile_end ("end", NULL);
-      return FALSE;
-    }
+  g_object_unref (data->impl);
+  gtk_file_paths_free (data->paths);
+  g_free (data);
+}
 
-  if (have_hidden)
-    g_object_set (impl, "show-hidden", TRUE, NULL);
+static void
+show_and_select_paths_get_folder_cb (GtkFileSystemHandle   *handle,
+                                    GtkFileFolder         *folder,
+                                    const GError          *error,
+                                    gpointer               user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  struct ShowAndSelectPathsData *data = user_data;
 
-  if (have_filtered)
-    set_current_filter (impl, NULL);
+  if (data->impl->show_and_select_paths_handle != handle)
+    goto out;
+
+  data->impl->show_and_select_paths_handle = NULL;
 
-  if (only_one_path)
-    _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl);
+  if (cancelled || error)
+    goto out;
+
+  g_object_unref (handle);
+
+  if (gtk_file_folder_is_finished_loading (folder))
+    show_and_select_paths_finished_loading (folder, user_data);
   else
-    {
-      GSList *l;
+    g_signal_connect (folder, "finished-loading",
+                     G_CALLBACK (show_and_select_paths_finished_loading),
+                     user_data);
 
-      for (l = paths; l; l = l->next)
-       {
-         const GtkFilePath *path;
+  return;
 
-         path = l->data;
-         _gtk_file_system_model_path_do (impl->browse_files_model, path, select_func, impl);
-       }
+out:
+  g_object_unref (data->impl);
+  gtk_file_paths_free (data->paths);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
+static gboolean
+show_and_select_paths (GtkFileChooserDefault *impl,
+                      const GtkFilePath     *parent_path,
+                      GSList                *paths,
+                      GError                **error)
+{
+  struct ShowAndSelectPathsData *info;
+
+  profile_start ("start", NULL);
+
+  if (!paths)
+    {
+      profile_end ("end", NULL);
+      return TRUE;
     }
 
+  info = g_new (struct ShowAndSelectPathsData, 1);
+  info->impl = g_object_ref (impl);
+  info->paths = gtk_file_paths_copy (paths);
+
+  if (impl->show_and_select_paths_handle)
+    gtk_file_system_cancel_operation (impl->show_and_select_paths_handle);
+
+  impl->show_and_select_paths_handle =
+    gtk_file_system_get_folder (impl->file_system, parent_path,
+                               GTK_FILE_INFO_IS_FOLDER | GTK_FILE_INFO_IS_HIDDEN,
+                               show_and_select_paths_get_folder_cb, info);
+
   profile_end ("end", NULL);
   return TRUE;
 }
@@ -5163,7 +5871,7 @@ pending_select_paths_process (GtkFileChooserDefault *impl)
   if (impl->pending_select_paths)
     {
       /* NULL GError */
-      show_and_select_paths (impl, impl->current_folder, NULL, impl->pending_select_paths, NULL);
+      show_and_select_paths (impl, impl->current_folder, impl->pending_select_paths, NULL);
       pending_select_paths_free (impl);
       browse_files_center_selected_row (impl);
     }
@@ -5278,48 +5986,142 @@ set_list_model (GtkFileChooserDefault *impl,
   return TRUE;
 }
 
+struct update_chooser_entry_selected_foreach_closure {
+  int num_selected;
+  GtkTreeIter first_selected_iter;
+};
+
+static gint
+compare_utf8_filenames (const gchar *a,
+                       const gchar *b)
+{
+  gchar *a_folded, *b_folded;
+  gint retval;
+
+  a_folded = g_utf8_strdown (a, -1);
+  b_folded = g_utf8_strdown (b, -1);
+
+  retval = strcmp (a_folded, b_folded);
+
+  g_free (a_folded);
+  g_free (b_folded);
+
+  return retval;
+}
+
+static void
+update_chooser_entry_selected_foreach (GtkTreeModel *model,
+                                      GtkTreePath *path,
+                                      GtkTreeIter *iter,
+                                      gpointer data)
+{
+  struct update_chooser_entry_selected_foreach_closure *closure;
+
+  closure = data;
+  closure->num_selected++;
+
+  if (closure->num_selected == 1)
+    closure->first_selected_iter = *iter;
+}
+
 static void
 update_chooser_entry (GtkFileChooserDefault *impl)
 {
   GtkTreeSelection *selection;
-  const GtkFileInfo *info;
-  GtkTreeIter iter;
-  GtkTreeIter child_iter;
-  gboolean change_entry;
+  struct update_chooser_entry_selected_foreach_closure closure;
+  const char *file_part;
 
-  if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
+  if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+       || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+       || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+            || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+           && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
     return;
 
-  g_assert (!impl->select_multiple);
+  g_assert (impl->location_entry != NULL);
+
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+  closure.num_selected = 0;
+  gtk_tree_selection_selected_foreach (selection, update_chooser_entry_selected_foreach, &closure);
 
-  if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+  file_part = NULL;
+
+  if (closure.num_selected == 0)
     {
-      /* If nothing is selected, we only reset the file name entry if we are in
-       * CREATE_FOLDER mode.  In SAVE mode, nothing will be selected when the
-       * user starts typeahead in the treeview, and we don't want to clear the
-       * file name entry in that case --- the user could be typing-ahead to look
-       * for a folder name.  See http://bugzilla.gnome.org/show_bug.cgi?id=308332
-       */
-      if (impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-       _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), "");
-      return;
+      goto maybe_clear_entry;
     }
+  else if (closure.num_selected == 1)
+    {
+      GtkTreeIter child_iter;
+      const GtkFileInfo *info;
+      gboolean change_entry;
 
-  gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
-                                                 &child_iter,
-                                                 &iter);
+      gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
+                                                     &child_iter,
+                                                     &closure.first_selected_iter);
 
-  info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
+      info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
 
-  if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
-    change_entry = !gtk_file_info_get_is_folder (info); /* We don't want the name to change when clicking on a folder... */
+      g_free (impl->browse_files_last_selected_name);
+      impl->browse_files_last_selected_name = g_strdup (gtk_file_info_get_display_name (info));
+
+      if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+         || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+       change_entry = !gtk_file_info_get_is_folder (info); /* We don't want the name to change when clicking on a folder... */
+      else
+       change_entry = TRUE;                                /* ... unless we are in one of the folder modes */
+
+      if (change_entry)
+       _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->browse_files_last_selected_name);
+
+      return;
+    }
   else
-    change_entry = TRUE;                                /* ... unless we are in CREATE_FOLDER mode */
+    {
+      g_assert (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+                 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER));
 
-  if (change_entry)
-    _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
-                                          gtk_file_info_get_display_name (info));
+      /* Multiple selection, so just clear the entry. */
+
+      g_free (impl->browse_files_last_selected_name);
+      impl->browse_files_last_selected_name = NULL;
+
+      _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
+      return;
+    }
+
+ maybe_clear_entry:
+
+  if (impl->browse_files_last_selected_name)
+    {
+      const char *entry_text;
+      int len;
+      gboolean clear_entry;
+
+      entry_text = gtk_entry_get_text (GTK_ENTRY (impl->location_entry));
+      len = strlen (entry_text);
+      if (len != 0)
+       {
+         /* The file chooser entry may have appended a "/" to its text.  So
+          * take it out, and compare the result to the old selection.
+          */
+         if (entry_text[len - 1] == G_DIR_SEPARATOR)
+           {
+             char *tmp;
+
+             tmp = g_strndup (entry_text, len - 1);
+             clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, tmp) == 0);
+             g_free (tmp);
+           }
+         else
+           clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, entry_text) == 0);
+       }
+      else
+       clear_entry = FALSE;
+
+      if (clear_entry)
+       _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
+    }
 }
 
 static gboolean
@@ -5330,50 +6132,99 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
   return gtk_file_chooser_default_update_current_folder (chooser, path, FALSE, error);
 }
 
-static gboolean
-gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
-                                               const GtkFilePath *path,
-                                               gboolean           keep_trail,
-                                               GError           **error)
+
+struct UpdateCurrentFolderData
 {
-  GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
-  gboolean result;
+  GtkFileChooserDefault *impl;
+  GtkFilePath *path;
+  gboolean keep_trail;
+  GtkFilePath *original_path;
+  GError *original_error;
+};
 
-  profile_start ("start", (char *) path);
+static void
+update_current_folder_get_info_cb (GtkFileSystemHandle *handle,
+                                  const GtkFileInfo   *info,
+                                  const GError        *error,
+                                  gpointer             user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  struct UpdateCurrentFolderData *data = user_data;
+  GtkFileChooserDefault *impl = data->impl;
 
-  g_assert (path != NULL);
+  if (handle != impl->update_current_folder_handle)
+    goto out;
 
-  if (impl->local_only &&
-      !gtk_file_system_path_is_local (impl->file_system, path))
-    {
-      g_set_error (error,
-                  GTK_FILE_CHOOSER_ERROR,
-                  GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
-                  _("Cannot change to folder because it is not local"));
+  impl->update_current_folder_handle = NULL;
+  impl->reload_state = RELOAD_EMPTY;
 
-      profile_end ("end - not local", (char *) path);
-      return FALSE;
-    }
+  set_busy_cursor (impl, FALSE);
 
-  /* Test validity of path here.  */
-  if (!check_is_folder (impl->file_system, path, error))
+  if (cancelled)
+    goto out;
+
+  if (error)
     {
-      profile_end ("end - not a folder", (char *) path);
-      return FALSE;
+      GtkFilePath *parent_path;
+
+      if (!data->original_path)
+        {
+         data->original_path = gtk_file_path_copy (data->path);
+         data->original_error = g_error_copy (error);
+       }
+
+      /* get parent path and try to change the folder to that */
+      if (gtk_file_system_get_parent (impl->file_system, data->path, &parent_path, NULL) &&
+         parent_path != NULL)
+        {
+         gtk_file_path_free (data->path);
+         data->path = parent_path;
+
+         g_object_unref (handle);
+
+         /* restart the update current folder operation */
+         impl->reload_state = RELOAD_HAS_FOLDER;
+
+         impl->update_current_folder_handle =
+           gtk_file_system_get_info (impl->file_system, data->path,
+                                     GTK_FILE_INFO_IS_FOLDER,
+                                     update_current_folder_get_info_cb,
+                                     data);
+
+         set_busy_cursor (impl, TRUE);
+
+         return;
+       }
+      else
+        {
+         /* error and bail out */
+         error_changing_folder_dialog (impl, data->original_path, data->original_error);
+
+         gtk_file_path_free (data->original_path);
+
+         goto out;
+       }
     }
 
-  if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, keep_trail, error))
+  if (data->original_path)
     {
-      profile_end ("end - could not set path bar", (char *) path);
-      return FALSE;
+      error_changing_folder_dialog (impl, data->original_path, data->original_error);
+
+      gtk_file_path_free (data->original_path);
     }
 
-  if (impl->current_folder != path)
+  if (!gtk_file_info_get_is_folder (info))
+    goto out;
+
+  if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), data->path, data->keep_trail, NULL))
+    goto out;
+
+  if (impl->current_folder != data->path)
     {
       if (impl->current_folder)
        gtk_file_path_free (impl->current_folder);
 
-      impl->current_folder = gtk_file_path_copy (path);
+      impl->current_folder = gtk_file_path_copy (data->path);
 
       impl->reload_state = RELOAD_HAS_FOLDER;
     }
@@ -5391,15 +6242,15 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
 
   /* Set the folder on the save entry */
 
-  if (impl->save_file_name_entry)
-    _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
+  if (impl->location_entry)
+    _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
                                             impl->current_folder);
 
   /* Create a new list model.  This is slightly evil; we store the result value
    * but perform more actions rather than returning immediately even if it
    * generates an error.
    */
-  result = set_list_model (impl, error);
+  set_list_model (impl, NULL);
 
   /* Refresh controls */
 
@@ -5412,8 +6263,58 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
 
   g_signal_emit_by_name (impl, "selection-changed", 0);
 
+out:
+  gtk_file_path_free (data->path);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
+static gboolean
+gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
+                                               const GtkFilePath *path,
+                                               gboolean           keep_trail,
+                                               GError           **error)
+{
+  GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
+  struct UpdateCurrentFolderData *data;
+
+  profile_start ("start", (char *) path);
+
+  g_assert (path != NULL);
+
+  if (impl->local_only &&
+      !gtk_file_system_path_is_local (impl->file_system, path))
+    {
+      g_set_error (error,
+                  GTK_FILE_CHOOSER_ERROR,
+                  GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
+                  _("Cannot change to folder because it is not local"));
+
+      profile_end ("end - not local", (char *) path);
+      return FALSE;
+    }
+
+  if (impl->update_current_folder_handle)
+    gtk_file_system_cancel_operation (impl->update_current_folder_handle);
+
+  /* Test validity of path here.  */
+  data = g_new0 (struct UpdateCurrentFolderData, 1);
+  data->impl = impl;
+  data->path = gtk_file_path_copy (path);
+  data->keep_trail = keep_trail;
+
+  impl->reload_state = RELOAD_HAS_FOLDER;
+
+  impl->update_current_folder_handle =
+    gtk_file_system_get_info (impl->file_system, path, GTK_FILE_INFO_IS_FOLDER,
+                             update_current_folder_get_info_cb,
+                             data);
+
+  set_busy_cursor (impl, TRUE);
+
   profile_end ("end", NULL);
-  return result;
+  return TRUE;
 }
 
 static GtkFilePath *
@@ -5449,7 +6350,7 @@ gtk_file_chooser_default_set_current_name (GtkFileChooser *chooser,
                    || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
 
   pending_select_paths_free (impl);
-  _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name);
+  _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), name);
 }
 
 static void
@@ -5495,8 +6396,12 @@ gtk_file_chooser_default_select_path (GtkFileChooser    *chooser,
   if (same_path && impl->load_state == LOAD_FINISHED)
     {
       gboolean result;
+      GSList paths;
+
+      paths.data = (gpointer) path;
+      paths.next = NULL;
 
-      result = show_and_select_paths (impl, parent_path, path, NULL, error);
+      result = show_and_select_paths (impl, parent_path, &paths, error);
       gtk_file_path_free (parent_path);
       return result;
     }
@@ -5604,7 +6509,8 @@ check_save_entry (GtkFileChooserDefault *impl,
                  GtkFilePath          **path_ret,
                  gboolean              *is_well_formed_ret,
                  gboolean              *is_empty_ret,
-                 gboolean              *is_file_part_empty_ret)
+                 gboolean              *is_file_part_empty_ret,
+                 gboolean              *is_folder)
 {
   GtkFileChooserEntry *chooser_entry;
   const GtkFilePath *current_folder;
@@ -5613,9 +6519,12 @@ check_save_entry (GtkFileChooserDefault *impl,
   GError *error;
 
   g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-           || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
+           || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+           || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+                || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+               && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
 
-  chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
+  chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
 
   if (strlen (gtk_entry_get_text (GTK_ENTRY (chooser_entry))) == 0)
     {
@@ -5623,6 +6532,7 @@ check_save_entry (GtkFileChooserDefault *impl,
       *is_well_formed_ret = TRUE;
       *is_empty_ret = TRUE;
       *is_file_part_empty_ret = TRUE;
+      *is_folder = FALSE;
 
       return;
     }
@@ -5637,6 +6547,7 @@ check_save_entry (GtkFileChooserDefault *impl,
       *path_ret = gtk_file_path_copy (current_folder);
       *is_well_formed_ret = TRUE;
       *is_file_part_empty_ret = TRUE;
+      *is_folder = TRUE;
 
       return;
     }
@@ -5651,12 +6562,14 @@ check_save_entry (GtkFileChooserDefault *impl,
       error_building_filename_dialog (impl, current_folder, file_part, error);
       *path_ret = NULL;
       *is_well_formed_ret = FALSE;
+      *is_folder = FALSE;
 
       return;
     }
 
   *path_ret = path;
   *is_well_formed_ret = TRUE;
+  *is_folder = _gtk_file_chooser_entry_get_is_folder (chooser_entry, path);
 }
 
 struct get_paths_closure {
@@ -5694,48 +6607,84 @@ gtk_file_chooser_default_get_paths (GtkFileChooser *chooser)
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
   struct get_paths_closure info;
+  GtkWindow *toplevel;
+  GtkWidget *current_focus;
 
   info.impl = impl;
   info.result = NULL;
   info.path_from_entry = NULL;
 
-  if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-      || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+  toplevel = get_toplevel (GTK_WIDGET (impl));
+  if (toplevel)
+    current_focus = gtk_window_get_focus (toplevel);
+  else
+    current_focus = NULL;
+
+  if (current_focus == impl->browse_files_tree_view)
     {
-      gboolean is_well_formed, is_empty, is_file_part_empty;
+      GtkTreeSelection *selection;
 
-      check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty);
+    file_list:
+
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+      gtk_tree_selection_selected_foreach (selection, get_paths_foreach, &info);
+
+      /* If there is no selection in the file list, we probably have this situation:
+       *
+       * 1. The user typed a filename in the SAVE filename entry ("foo.txt").
+       * 2. He then double-clicked on a folder ("bar") in the file list
+       *
+       * So we want the selection to be "bar/foo.txt".  Jump to the case for the
+       * filename entry to see if that is the case.
+       */
+      if (info.result == NULL && impl->location_entry)
+       goto file_entry;
+    }
+  else if (impl->location_entry && current_focus == impl->location_entry)
+    {
+      gboolean is_well_formed, is_empty, is_file_part_empty, is_folder;
+
+    file_entry:
+
+      check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder);
+
+      if (is_empty)
+       goto out;
 
       if (!is_well_formed)
        return NULL;
 
-      if (!is_empty)
+      if (is_file_part_empty && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
        {
-         if (is_file_part_empty && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
-           {
-             gtk_file_path_free (info.path_from_entry);
-             return NULL;
-           }
+         gtk_file_path_free (info.path_from_entry);
+         return NULL;
        }
-    }
 
-  if (!info.path_from_entry || impl->select_multiple)
+      g_assert (info.path_from_entry != NULL);
+      info.result = g_slist_prepend (info.result, info.path_from_entry);
+    }
+  else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
+    goto file_list;
+  else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
+    goto file_entry;
+  else
     {
-      GtkTreeSelection *selection;
-
-      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
-      gtk_tree_selection_selected_foreach (selection, get_paths_foreach, &info);
+    /* The focus is on a dialog's action area button or something else */
+      if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+         || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+       goto file_entry;
+      else
+       goto file_list; 
     }
 
-  if (info.path_from_entry)
-    info.result = g_slist_prepend (info.result, info.path_from_entry);
+ out:
 
   /* If there's no folder selected, and we're in SELECT_FOLDER mode, then we
    * fall back to the current directory */
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
       info.result == NULL)
     {
-      info.result = g_slist_prepend (info.result, gtk_file_path_copy (impl->current_folder));
+      info.result = g_slist_prepend (info.result, _gtk_file_chooser_get_current_folder_path (chooser));
     }
 
   return g_slist_reverse (info.result);
@@ -5784,8 +6733,7 @@ gtk_file_chooser_default_add_filter (GtkFileChooser *chooser,
       return;
     }
 
-  g_object_ref (filter);
-  gtk_object_sink (GTK_OBJECT (filter));
+  g_object_ref_sink (filter);
   impl->filters = g_slist_append (impl->filters, filter);
 
   name = gtk_file_filter_get_name (filter);
@@ -5829,7 +6777,9 @@ gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
 
   /* Remove row from the combo box */
   model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->filter_combo));
-  gtk_tree_model_iter_nth_child  (model, &iter, NULL, filter_index);
+  if (!gtk_tree_model_iter_nth_child  (model, &iter, NULL, filter_index))
+    g_assert_not_reached ();
+
   gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
 
   g_object_unref (filter);
@@ -5854,19 +6804,53 @@ shortcuts_get_pos_for_shortcut_folder (GtkFileChooserDefault *impl,
   return pos + shortcuts_get_index (impl, SHORTCUTS_SHORTCUTS);
 }
 
+struct AddShortcutData
+{
+  GtkFileChooserDefault *impl;
+  GtkFilePath *path;
+};
+
+static void
+add_shortcut_get_info_cb (GtkFileSystemHandle *handle,
+                         const GtkFileInfo   *info,
+                         const GError        *error,
+                         gpointer             user_data)
+{
+  int pos;
+  gboolean cancelled = handle->cancelled;
+  struct AddShortcutData *data = user_data;
+
+  if (!g_slist_find (data->impl->loading_shortcuts, handle))
+    goto out;
+
+  data->impl->loading_shortcuts = g_slist_remove (data->impl->loading_shortcuts, handle);
+
+  if (cancelled || error || !gtk_file_info_get_is_folder (info))
+    goto out;
+
+  pos = shortcuts_get_pos_for_shortcut_folder (data->impl, data->impl->num_shortcuts);
+
+  shortcuts_insert_path (data->impl, pos, FALSE, NULL, data->path, NULL, FALSE, SHORTCUTS_SHORTCUTS);
+
+out:
+  g_object_unref (data->impl);
+  gtk_file_path_free (data->path);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
 static gboolean
 gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser    *chooser,
                                              const GtkFilePath *path,
                                              GError           **error)
 {
+  GtkFileSystemHandle *handle;
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
-  gboolean result;
+  struct AddShortcutData *data;
+  GSList *l;
   int pos;
 
-  /* Test validity of path here.  */
-  if (!check_is_folder (impl->file_system, path, error))
-    return FALSE;
-
   /* Avoid adding duplicates */
   pos = shortcut_find_position (impl, path);
   if (pos >= 0 && pos < shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR))
@@ -5874,27 +6858,54 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser    *chooser,
       gchar *uri;
 
       uri = gtk_file_system_path_to_uri (impl->file_system, path);
+      /* translators, "Shortcut" means "Bookmark" here */
       g_set_error (error,
                   GTK_FILE_CHOOSER_ERROR,
                   GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS,
-                  _("shortcut %s already exists"),
+                  _("Shortcut %s already exists"),
                   uri);
       g_free (uri);
 
       return FALSE;
     }
 
-  pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
+  for (l = impl->loading_shortcuts; l; l = l->next)
+    {
+      GtkFileSystemHandle *h = l->data;
+      GtkFilePath *p;
 
-  result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);
+      p = g_object_get_data (G_OBJECT (h), "add-shortcut-path-key");
+      if (p && !gtk_file_path_compare (path, p))
+        {
+         gchar *uri;
 
-  if (result)
-    impl->num_shortcuts++;
+          uri = gtk_file_system_path_to_uri (impl->file_system, path);
+          g_set_error (error,
+                      GTK_FILE_CHOOSER_ERROR,
+                      GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS,
+                      _("Shortcut %s already exists"),
+                      uri);
+          g_free (uri);
 
-  if (impl->shortcuts_filter_model)
-    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
+          return FALSE;
+       }
+    }
 
-  return result;
+  data = g_new0 (struct AddShortcutData, 1);
+  data->impl = g_object_ref (impl);
+  data->path = gtk_file_path_copy (path);
+
+  handle = gtk_file_system_get_info (impl->file_system, path,
+                                    GTK_FILE_INFO_IS_FOLDER,
+                                    add_shortcut_get_info_cb, data);
+
+  if (!handle)
+    return FALSE;
+
+  impl->loading_shortcuts = g_slist_append (impl->loading_shortcuts, handle);
+  g_object_set_data (G_OBJECT (handle), "add-shortcut-path-key", data->path);
+
+  return TRUE;
 }
 
 static gboolean
@@ -5905,9 +6916,24 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser    *chooser,
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
   int pos;
   GtkTreeIter iter;
+  GSList *l;
   char *uri;
   int i;
 
+  for (l = impl->loading_shortcuts; l; l = l->next)
+    {
+      GtkFileSystemHandle *h = l->data;
+      GtkFilePath *p;
+
+      p = g_object_get_data (G_OBJECT (h), "add-shortcut-path-key");
+      if (p && !gtk_file_path_compare (path, p))
+        {
+         impl->loading_shortcuts = g_slist_remove (impl->loading_shortcuts, h);
+         gtk_file_system_cancel_operation (h);
+          return TRUE;
+       }
+    }
+
   if (impl->num_shortcuts == 0)
     goto out;
 
@@ -5943,6 +6969,7 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser    *chooser,
  out:
 
   uri = gtk_file_system_path_to_uri (impl->file_system, path);
+  /* translators, "Shortcut" means "Bookmark" here */
   g_set_error (error,
               GTK_FILE_CHOOSER_ERROR,
               GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
@@ -6222,48 +7249,46 @@ confirm_dialog_should_accept_filename (GtkFileChooserDefault *impl,
   return (response == GTK_RESPONSE_ACCEPT);
 }
 
-static char *
-get_display_name_for_folder (GtkFileChooserDefault *impl,
-                            const GtkFilePath     *path)
+struct GetDisplayNameData
 {
-  char *display_name;
-  GtkFilePath *parent_path;
-  GtkFileFolder *parent_folder;
-  GtkFileInfo *info;
+  GtkFileChooserDefault *impl;
+  gchar *file_part;
+};
 
-  display_name = NULL;
-  parent_path = NULL;
-  parent_folder = NULL;
-  info = NULL;
+static void
+confirmation_confirm_get_info_cb (GtkFileSystemHandle *handle,
+                                 const GtkFileInfo   *info,
+                                 const GError        *error,
+                                 gpointer             user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  gboolean should_respond = FALSE;
+  struct GetDisplayNameData *data = user_data;
 
-  if (!gtk_file_system_get_parent (impl->file_system, path, &parent_path, NULL))
+  if (handle != data->impl->should_respond_get_info_handle)
     goto out;
 
-  parent_folder = gtk_file_system_get_folder (impl->file_system,
-                                             parent_path ? parent_path : path,
-                                             GTK_FILE_INFO_DISPLAY_NAME,
-                                             NULL);
-  if (!parent_folder)
-    goto out;
+  data->impl->should_respond_get_info_handle = NULL;
 
-  info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, NULL);
-  if (!info)
+  if (cancelled)
     goto out;
 
-  display_name = g_strdup (gtk_file_info_get_display_name (info));
-
- out:
-
-  if (parent_path)
-    gtk_file_path_free (parent_path);
+  if (error)
+    /* Huh?  Did the folder disappear?  Let the caller deal with it */
+    should_respond = TRUE;
+  else
+    should_respond = confirm_dialog_should_accept_filename (data->impl, data->file_part, gtk_file_info_get_display_name (info));
 
-  if (parent_folder)
-    g_object_unref (parent_folder);
+  set_busy_cursor (data->impl, FALSE);
+  if (should_respond)
+    g_signal_emit_by_name (data->impl, "response-requested");
 
-  if (info)
-    gtk_file_info_free (info);
+out:
+  g_object_unref (data->impl);
+  g_free (data->file_part);
+  g_free (data);
 
-  return display_name;
+  g_object_unref (handle);
 }
 
 /* Does overwrite confirmation if appropriate, and returns whether the dialog
@@ -6287,32 +7312,257 @@ should_respond_after_confirm_overwrite (GtkFileChooserDefault *impl,
     {
     case GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM:
       {
-       char *parent_display_name;
-       gboolean retval;
+       struct GetDisplayNameData *data;
 
        g_assert (file_part != NULL);
 
-       parent_display_name = get_display_name_for_folder (impl, parent_path);
-       if (!parent_display_name)
-         return TRUE; /* Huh?  Did the folder disappear?  Let the caller deal with it */
+       data = g_new0 (struct GetDisplayNameData, 1);
+       data->impl = g_object_ref (impl);
+       data->file_part = g_strdup (file_part);
 
-       retval = confirm_dialog_should_accept_filename (impl, file_part, parent_display_name);
-       g_free (parent_display_name);
-       return retval;
+       if (impl->should_respond_get_info_handle)
+         gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+
+       impl->should_respond_get_info_handle =
+         gtk_file_system_get_info (impl->file_system, parent_path,
+                                   GTK_FILE_INFO_DISPLAY_NAME,
+                                   confirmation_confirm_get_info_cb,
+                                   data);
+       set_busy_cursor (data->impl, TRUE);
+       return FALSE;
       }
 
-    case GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME:
-      return TRUE;
+    case GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME:
+      return TRUE;
+
+    case GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN:
+      return FALSE;
+
+    default:
+      g_assert_not_reached ();
+      return FALSE;
+    }
+}
+
+static void
+action_create_folder_cb (GtkFileSystemHandle *handle,
+                        const GtkFilePath   *path,
+                        const GError        *error,
+                        gpointer             user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  GtkFileChooserDefault *impl = user_data;
+
+  if (!g_slist_find (impl->pending_handles, handle))
+    goto out;
+
+  impl->pending_handles = g_slist_remove (impl->pending_handles, handle);
+
+  set_busy_cursor (impl, FALSE);
+
+  if (cancelled)
+    goto out;
+
+  if (error)
+    error_creating_folder_dialog (impl, path, g_error_copy (error));
+  else
+    g_signal_emit_by_name (impl, "response-requested");
+
+out:
+  g_object_unref (impl);
+  g_object_unref (handle);
+}
+
+struct FileExistsData
+{
+  GtkFileChooserDefault *impl;
+  gboolean file_exists_and_is_not_folder;
+  GtkFilePath *parent_path;
+  GtkFilePath *path;
+};
+
+static void
+save_entry_get_info_cb (GtkFileSystemHandle *handle,
+                       const GtkFileInfo   *info,
+                       const GError        *error,
+                       gpointer             user_data)
+{
+  gboolean parent_is_folder;
+  gboolean cancelled = handle->cancelled;
+  struct FileExistsData *data = user_data;
+
+  if (handle != data->impl->should_respond_get_info_handle)
+    goto out;
+
+  data->impl->should_respond_get_info_handle = NULL;
+
+  set_busy_cursor (data->impl, FALSE);
+
+  if (cancelled)
+    goto out;
+
+  if (!info)
+    parent_is_folder = FALSE;
+  else
+    parent_is_folder = gtk_file_info_get_is_folder (info);
+
+  if (parent_is_folder)
+    {
+      if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+        {
+          if (data->file_exists_and_is_not_folder)
+           {
+             gboolean retval;
+             const char *file_part;
+
+             file_part = _gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (data->impl->location_entry));
+             retval = should_respond_after_confirm_overwrite (data->impl, file_part, data->parent_path);
+
+             if (retval)
+               g_signal_emit_by_name (data->impl, "response-requested");
+           }
+         else
+           g_signal_emit_by_name (data->impl, "response-requested");
+       }
+      else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */
+        {
+         GtkFileSystemHandle *handle;
+
+         g_object_ref (data->impl);
+         handle = gtk_file_system_create_folder (data->impl->file_system,
+                                                 data->path,
+                                                 action_create_folder_cb,
+                                                 data->impl);
+         data->impl->pending_handles = g_slist_append (data->impl->pending_handles, handle);
+         set_busy_cursor (data->impl, TRUE);
+        }
+    }
+  else
+    {
+      /* This will display an error, which is what we want */
+      change_folder_and_display_error (data->impl, data->parent_path);
+    }
+
+out:
+  g_object_unref (data->impl);
+  gtk_file_path_free (data->path);
+  gtk_file_path_free (data->parent_path);
+  g_free (data);
+
+  g_object_unref (handle);
+}
+
+static void
+file_exists_get_info_cb (GtkFileSystemHandle *handle,
+                        const GtkFileInfo   *info,
+                        const GError        *error,
+                        gpointer             user_data)
+{
+  gboolean data_ownership_taken = FALSE;
+  gboolean cancelled = handle->cancelled;
+  gboolean file_exists_and_is_not_folder;
+  struct FileExistsData *data = user_data;
+
+  if (handle != data->impl->file_exists_get_info_handle)
+    goto out;
+
+  data->impl->file_exists_get_info_handle = NULL;
+
+  set_busy_cursor (data->impl, FALSE);
+
+  if (cancelled)
+    goto out;
+
+  file_exists_and_is_not_folder = info && !gtk_file_info_get_is_folder (info);
+
+  if (data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+    /* user typed a filename; we are done */
+    g_signal_emit_by_name (data->impl, "response-requested");
+  else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+          && file_exists_and_is_not_folder)
+    {
+      /* Oops, the user typed the name of an existing path which is not
+       * a folder
+       */
+      error_creating_folder_over_existing_file_dialog (data->impl, data->path,
+                                                      g_error_copy (error));
+    }
+  else
+    {
+      /* check that everything up to the last component exists */
+
+      data->file_exists_and_is_not_folder = file_exists_and_is_not_folder;
+      data_ownership_taken = TRUE;
+
+      if (data->impl->should_respond_get_info_handle)
+       gtk_file_system_cancel_operation (data->impl->should_respond_get_info_handle);
+
+      data->impl->should_respond_get_info_handle =
+       gtk_file_system_get_info (data->impl->file_system,
+                                 data->parent_path,
+                                 GTK_FILE_INFO_IS_FOLDER,
+                                 save_entry_get_info_cb,
+                                 data);
+      set_busy_cursor (data->impl, TRUE);
+    }
+
+out:
+  if (!data_ownership_taken)
+    {
+      g_object_unref (data->impl);
+      gtk_file_path_free (data->path);
+      gtk_file_path_free (data->parent_path);
+      g_free (data);
+    }
+
+  g_object_unref (handle);
+}
+
+static void
+paste_text_received (GtkClipboard          *clipboard,
+                    const gchar           *text,
+                    GtkFileChooserDefault *impl)
+{
+  GtkFilePath *path;
+
+  if (!text)
+    return;
+
+  path = gtk_file_system_uri_to_path (impl->file_system, text);
+  if (!path) 
+    {
+      if (!g_path_is_absolute (text)) 
+       {
+         location_popup_handler (impl, text);
+         return;
+       }
+
+      path = gtk_file_system_filename_to_path (impl->file_system, text);
+      if (!path) 
+       {
+         location_popup_handler (impl, text);
+         return;
+       }
+    }
+
+  if (!gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (impl), path, NULL))
+    location_popup_handler (impl, text);
 
-    case GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN:
-      return FALSE;
+  gtk_file_path_free (path);
+}
 
-    default:
-      g_assert_not_reached ();
-      return FALSE;
-    }
+/* Handler for the "location-popup-on-paste" keybinding signal */
+static void
+location_popup_on_paste_handler (GtkFileChooserDefault *impl)
+{
+  GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (impl),
+                                                     GDK_SELECTION_CLIPBOARD);
+  gtk_clipboard_request_text (clipboard,
+                             (GtkClipboardTextReceivedFunc) paste_text_received,
+                             impl);
 }
 
+
 /* Implementation for GtkFileChooserEmbed::should_respond() */
 static gboolean
 gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
@@ -6404,7 +7654,7 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
          g_assert_not_reached ();
        }
     }
-  else if ((impl->save_file_name_entry != NULL) && (current_focus == impl->save_file_name_entry))
+  else if ((impl->location_entry != NULL) && (current_focus == impl->location_entry))
     {
       GtkFilePath *path;
       gboolean is_well_formed, is_empty, is_file_part_empty;
@@ -6416,10 +7666,13 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
     save_entry:
 
       g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-               || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
+               || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+               || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+                    || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+                   && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
 
-      entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
-      check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty);
+      entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
+      check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder);
 
       if (is_empty || !is_well_formed)
        return FALSE;
@@ -6427,82 +7680,51 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
       g_assert (path != NULL);
 
       error = NULL;
-      is_folder = check_is_folder (impl->file_system, path, &error);
       if (is_folder)
        {
-         if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+         if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+             || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
            {
              _gtk_file_chooser_entry_set_file_part (entry, "");
              change_folder_and_display_error (impl, path);
              retval = FALSE;
            }
-         else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */
+         else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+                  || GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
            {
              /* The folder already exists, so we do not need to create it.
               * Just respond to terminate the dialog.
               */
              retval = TRUE;
            }
+         else
+           {
+             g_assert_not_reached ();
+             retval = FALSE;
+           }
        }
       else
        {
-         gboolean file_exists_and_is_not_folder;
+         struct FileExistsData *data;
 
-         file_exists_and_is_not_folder = g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER);
+         /* We need to check whether path exists and is not a folder */
 
-         if (impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER && file_exists_and_is_not_folder)
-           {
-             /* Oops, the user typed the name of an existing path which is not a folder */
-             error_creating_folder_over_existing_file_dialog (impl, path, error);
-             error = NULL; /* as it will be freed below for the general case */
-             retval = FALSE;
-           }
-         else
-           {
-             GtkFilePath *parent_path;
-             gboolean parent_is_folder;
+         data = g_new0 (struct FileExistsData, 1);
+         data->impl = g_object_ref (impl);
+         data->path = gtk_file_path_copy (path);
+         data->parent_path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
 
-             /* check that everything up to the last component exists */
+         if (impl->file_exists_get_info_handle)
+           gtk_file_system_cancel_operation (impl->file_exists_get_info_handle);
 
-             parent_path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
-             parent_is_folder = check_is_folder (impl->file_system, parent_path, NULL);
-             if (parent_is_folder)
-               {
-                 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
-                   {
-                     if (file_exists_and_is_not_folder)
-                       {
-                         const char *file_part;
-
-                         file_part = _gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry));
-                         retval = should_respond_after_confirm_overwrite (impl, file_part, parent_path);
-                       }
-                     else
-                       retval = TRUE;
-                   }
-                 else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */
-                   {
-                     GError *create_error;
-
-                     create_error = NULL;
-                     if (gtk_file_system_create_folder (impl->file_system, path, &create_error))
-                       retval = TRUE;
-                     else
-                       {
-                         error_creating_folder_dialog (impl, path, create_error);
-                         retval = FALSE;
-                       }
-                   }
-               }
-             else
-               {
-                 /* This will display an error, which is what we want */
-                 change_folder_and_display_error (impl, parent_path);
-                 retval = FALSE;
-               }
+         impl->file_exists_get_info_handle =
+           gtk_file_system_get_info (impl->file_system, path,
+                                     GTK_FILE_INFO_IS_FOLDER,
+                                     file_exists_get_info_cb,
+                                     data);
 
-             gtk_file_path_free (parent_path);
-           }
+         set_busy_cursor (impl, TRUE);
+         retval = FALSE;
 
          if (error != NULL)
            g_error_free (error);
@@ -6537,6 +7759,13 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
        */
       goto file_list;
     }
+  else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
+    {
+      /* The focus is on a dialog's action area button, *and* the widget that
+       * was focused immediately before it is the location entry.
+       */
+      goto save_entry;
+    }
   else
     /* The focus is on a dialog's action area button or something else */
     if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
@@ -6560,16 +7789,22 @@ gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed)
 
   if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
       || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
-    widget = impl->browse_files_tree_view;
+    {
+      if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+       widget = impl->browse_files_tree_view;
+      else
+       widget = impl->location_entry;
+    }
   else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
           || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-    widget = impl->save_file_name_entry;
+    widget = impl->location_entry;
   else
     {
       g_assert_not_reached ();
       widget = NULL;
     }
 
+  g_assert (widget != NULL);
   gtk_widget_grab_focus (widget);
 }
 
@@ -6592,8 +7827,7 @@ set_current_filter (GtkFileChooserDefault *impl,
       impl->current_filter = filter;
       if (impl->current_filter)
        {
-         g_object_ref (impl->current_filter);
-         gtk_object_sink (GTK_OBJECT (filter));
+         g_object_ref_sink (impl->current_filter);
        }
 
       if (impl->filters)
@@ -6630,7 +7864,9 @@ check_preview_change (GtkFileChooserDefault *impl)
       GtkTreeIter iter;
       GtkTreeIter child_iter;
 
-      gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path);
+      if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path))
+       g_assert_not_reached ();
+
       gtk_tree_path_free (cursor_path);
 
       gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter);
@@ -6672,6 +7908,51 @@ check_preview_change (GtkFileChooserDefault *impl)
     }
 }
 
+static void
+shortcuts_activate_volume_mount_cb (GtkFileSystemHandle *handle,
+                                   GtkFileSystemVolume *volume,
+                                   const GError        *error,
+                                   gpointer             data)
+{
+  GtkFilePath *path;
+  gboolean cancelled = handle->cancelled;
+  GtkFileChooserDefault *impl = data;
+
+  if (handle != impl->shortcuts_activate_iter_handle)
+    goto out;
+
+  impl->shortcuts_activate_iter_handle = NULL;
+
+  set_busy_cursor (impl, FALSE);
+
+  if (cancelled)
+    goto out;
+
+  if (error)
+    {
+      char *msg;
+
+      msg = g_strdup_printf (_("Could not mount %s"),
+                            gtk_file_system_volume_get_display_name (impl->file_system, volume));
+      error_message (impl, msg, error->message);
+      g_free (msg);
+
+      goto out;
+    }
+
+  path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+  if (path != NULL)
+    {
+      change_folder_and_display_error (impl, path);
+      gtk_file_path_free (path);
+    }
+
+out:
+  g_object_unref (impl);
+  g_object_unref (handle);
+}
+
+
 /* Activates a volume by mounting it if necessary and then switching to its
  * base path.
  */
@@ -6688,44 +7969,63 @@ shortcuts_activate_volume (GtkFileChooserDefault *impl,
 
   if (!gtk_file_system_volume_get_is_mounted (impl->file_system, volume))
     {
-      GError *error;
-      gboolean result;
-
       set_busy_cursor (impl, TRUE);
 
-      error = NULL;
-      result = gtk_file_system_volume_mount (impl->file_system, volume, &error);
+      impl->shortcuts_activate_iter_handle =
+        gtk_file_system_volume_mount (impl->file_system, volume,
+                                     shortcuts_activate_volume_mount_cb,
+                                     g_object_ref (impl));
+    }
+  else
+    {
+      path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+      if (path != NULL)
+        {
+          change_folder_and_display_error (impl, path);
+          gtk_file_path_free (path);
+        }
+    }
 
-      if (!result)
-       {
-         char *msg;
+  g_object_unref (impl);
+}
 
-         msg = g_strdup_printf (_("Could not mount %s"),
-                                gtk_file_system_volume_get_display_name (impl->file_system, volume));
-         error_message (impl, msg, error->message);
-         g_free (msg);
-         g_error_free (error);
-       }
+/* Opens the folder or volume at the specified iter in the shortcuts model */
+struct ShortcutsActivateData
+{
+  GtkFileChooserDefault *impl;
+  GtkFilePath *path;
+};
 
-      set_busy_cursor (impl, FALSE);
+static void
+shortcuts_activate_get_info_cb (GtkFileSystemHandle *handle,
+                               const GtkFileInfo   *info,
+                               const GError        *error,
+                               gpointer             user_data)
+{
+  gboolean cancelled = handle->cancelled;
+  struct ShortcutsActivateData *data = user_data;
 
-      if (!result)
-       goto out;
-    }
+  if (handle != data->impl->shortcuts_activate_iter_handle)
+    goto out;
 
-  path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
-  if (path != NULL)
-    {
-      change_folder_and_display_error (impl, path);
-      gtk_file_path_free (path);
-    }
+  data->impl->shortcuts_activate_iter_handle = NULL;
 
- out:
+  if (cancelled)
+    goto out;
 
-  g_object_unref (impl);
+  if (!error && gtk_file_info_get_is_folder (info))
+    change_folder_and_display_error (data->impl, data->path);
+  else
+    gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (data->impl), data->path, NULL);
+
+out:
+  g_object_unref (data->impl);
+  gtk_file_path_free (data->path);
+  g_free (data);
+
+  g_object_unref (handle);
 }
 
-/* Opens the folder or volume at the specified iter in the shortcuts model */
 static void
 shortcuts_activate_iter (GtkFileChooserDefault *impl,
                         GtkTreeIter           *iter)
@@ -6733,6 +8033,9 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
   gpointer col_data;
   gboolean is_volume;
 
+  if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY && impl->action != GTK_FILE_CHOOSER_ACTION_SAVE)
+    _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
+
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
                      SHORTCUTS_COL_DATA, &col_data,
                      SHORTCUTS_COL_IS_VOLUME, &is_volume,
@@ -6741,6 +8044,12 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
   if (!col_data)
     return; /* We are on a separator */
 
+  if (impl->shortcuts_activate_iter_handle)
+    {
+      gtk_file_system_cancel_operation (impl->shortcuts_activate_iter_handle);
+      impl->shortcuts_activate_iter_handle = NULL;
+    }
+
   if (is_volume)
     {
       GtkFileSystemVolume *volume;
@@ -6751,10 +8060,16 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
     }
   else
     {
-      const GtkFilePath *file_path;
+      struct ShortcutsActivateData *data;
 
-      file_path = col_data;
-      change_folder_and_display_error (impl, file_path);
+      data = g_new0 (struct ShortcutsActivateData, 1);
+      data->impl = g_object_ref (impl);
+      data->path = gtk_file_path_copy (col_data);
+
+      impl->shortcuts_activate_iter_handle =
+        gtk_file_system_get_info (impl->file_system, data->path,
+                                 GTK_FILE_INFO_IS_FOLDER,
+                                 shortcuts_activate_get_info_cb, data);
     }
 }
 
@@ -6798,6 +8113,13 @@ shortcuts_key_press_event_cb (GtkWidget             *widget,
       return TRUE;
     }
 
+  if ((event->keyval == GDK_F2)
+      && (event->state & modifiers) == 0)
+    {
+      rename_selected_bookmark (impl);
+      return TRUE;
+    }
+
   return FALSE;
 }
 
@@ -6908,6 +8230,9 @@ path_bar_clicked (GtkPathBar            *path_bar,
                  gboolean               child_is_hidden,
                  GtkFileChooserDefault *impl)
 {
+  if (child_path)
+    pending_select_paths_add (impl, child_path);
+
   if (!change_folder_and_display_error (impl, file_path))
     return;
 
@@ -6917,18 +8242,6 @@ path_bar_clicked (GtkPathBar            *path_bar,
    */
   if (child_is_hidden)
     g_object_set (impl, "show-hidden", TRUE, NULL);
-
-  /* Say we have "/foo/bar/baz" and the user clicks on "bar". We should then
-   * focus the "baz" entry in the files list - the reason for this is that
-   * if user furst changed to /foo/bar/baz from /foo/bar unintentionally 
-   * instead of /foo/bar/baz1, it will take quite some time to scroll to baz1 
-   * in the file list, especially if this directory contains lots of folders
-   */
-  if (child_path != NULL)
-    {
-      gtk_file_chooser_default_select_path (impl, child_path, NULL);
-      browse_files_center_selected_row (impl);
-    }
 }
 
 static const GtkFileInfo *
@@ -6969,9 +8282,14 @@ list_icon_data_func (GtkTreeViewColumn *tree_column,
 
   if (path)
     {
-      /* FIXME: NULL GError */
-      pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
-                                           impl->icon_size, NULL);
+      pixbuf = NULL;
+
+      if (info)
+        {
+          /* FIXME: NULL GError */
+         pixbuf = gtk_file_info_render_icon (info, GTK_WIDGET (impl),
+                                             impl->icon_size, NULL);
+       }
     }
   else
     {
@@ -7043,21 +8361,25 @@ list_size_data_func (GtkTreeViewColumn *tree_column,
 
   if (!info || gtk_file_info_get_is_folder (info)) 
     {
-      g_object_set (cell,"sensitive", sensitive, NULL);
+      g_object_set (cell,
+                   "text", NULL,
+                   "sensitive", sensitive,
+                   NULL);
       return;
     }
 
   size = gtk_file_info_get_size (info);
-
+#if 0
   if (size < (gint64)1024)
     str = g_strdup_printf (ngettext ("%d byte", "%d bytes", (gint)size), (gint)size);
   else if (size < (gint64)1024*1024)
-    str = g_strdup_printf (_("%.1f K"), size / (1024.));
+    str = g_strdup_printf (_("%.1f KB"), size / (1024.));
   else if (size < (gint64)1024*1024*1024)
-    str = g_strdup_printf (_("%.1f M"), size / (1024.*1024.));
+    str = g_strdup_printf (_("%.1f MB"), size / (1024.*1024.));
   else
-    str = g_strdup_printf (_("%.1f G"), size / (1024.*1024.*1024.));
-
+    str = g_strdup_printf (_("%.1f GB"), size / (1024.*1024.*1024.));
+#endif
+  str = g_strdup_printf ("%" G_GINT64_FORMAT, size);
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
       impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
     sensitive = FALSE;
@@ -7065,6 +8387,7 @@ list_size_data_func (GtkTreeViewColumn *tree_column,
   g_object_set (cell,
                "text", str,
                "sensitive", sensitive,
+               "alignment", PANGO_ALIGN_RIGHT,
                NULL);
 
   g_free (str);
@@ -7081,7 +8404,7 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
 {
   GtkFileChooserDefault *impl;
   const GtkFileInfo *info;
-  GtkFileTime time_mtime, time_now;
+  GtkFileTime time_mtime;
   GDate mtime, now;
   int days_diff;
   char buf[256];
@@ -7105,10 +8428,10 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
     strcpy (buf, _("Unknown"));
   else
     {
-      g_date_set_time (&mtime, (GTime) time_mtime);
-
-      time_now = (GTime ) time (NULL);
-      g_date_set_time (&now, (GTime) time_now);
+      time_t time_now;
+      g_date_set_time_t (&mtime, time_mtime);
+      time_now = time (NULL);
+      g_date_set_time_t (&now, time_now);
 
       days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime);
 
@@ -7148,261 +8471,65 @@ _gtk_file_chooser_default_new (const char *file_system)
                        NULL);
 }
 
-static GtkWidget *
-location_entry_create (GtkFileChooserDefault *impl,
-                      const gchar           *path)
-{
-  GtkWidget *entry;
-
-  entry = _gtk_file_chooser_entry_new (TRUE);
-  /* Pick a good width for the entry */
-  gtk_entry_set_width_chars (GTK_ENTRY (entry), 30);
-  gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
-  _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (entry), impl->file_system);
-  _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (entry), impl->action);
-  if (path[0])
-    {
-      _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), 
-                                              gtk_file_path_new_steal ((gchar *)path));
-      _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), path);
-    }
-  else
-    {
-      _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), impl->current_folder);
-      if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
-         || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
-       _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), "");
-      else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-              || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-       _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry),
-                                              gtk_entry_get_text (GTK_ENTRY (impl->save_file_name_entry)));
-      else
-       g_assert_not_reached ();
-    }
-
-  return GTK_WIDGET (entry);
-}
-
-static gboolean
-update_from_entry (GtkFileChooserDefault *impl,
-                  GtkWindow             *parent,
-                  GtkFileChooserEntry   *chooser_entry)
+static void
+location_set_user_text (GtkFileChooserDefault *impl,
+                       const gchar           *path)
 {
-  const GtkFilePath *folder_path;
-  const char *file_part;
-
-  folder_path = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
-  file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
-
-  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN && !folder_path)
-    {
-      error_message_with_parent (parent,
-                                _("Cannot change folder"),
-                                _("The folder you specified is an invalid path."));
-      return FALSE;
-    }
-
-  if (file_part[0] == '\0')
-    return change_folder_and_display_error (impl, folder_path);
-  else
-    {
-      GtkFileFolder *folder = NULL;
-      GtkFilePath *subfolder_path = NULL;
-      GtkFileInfo *info = NULL;
-      GError *error;
-      gboolean result;
-
-      result = FALSE;
-
-      /* If the file part is non-empty, we need to figure out if it refers to a
-       * folder within folder. We could optimize the case here where the folder
-       * is already loaded for one of our tree models.
-       */
-
-      error = NULL;
-      folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, &error);
-
-      if (!folder)
-       {
-         error_getting_info_dialog (impl, folder_path, error);
-         goto out;
-       }
-
-      error = NULL;
-      subfolder_path = gtk_file_system_make_path (impl->file_system, folder_path, file_part, &error);
-
-      if (!subfolder_path)
-       {
-         char *msg;
-         char *uri;
-
-         uri = gtk_file_system_path_to_uri (impl->file_system, folder_path);
-         msg = g_strdup_printf (_("Could not build file name from '%s' and '%s'"),
-                                uri, file_part);
-         error_message (impl, msg, error->message);
-         g_free (uri);
-         g_free (msg);
-         goto out;
-       }
-
-      error = NULL;
-      info = gtk_file_folder_get_info (folder, subfolder_path, &error);
-
-      if (!info)
-       {
-         if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-             || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-           {
-             if (!change_folder_and_display_error (impl, folder_path))
-               goto out;
-
-             gtk_file_chooser_default_set_current_name (GTK_FILE_CHOOSER (impl), file_part);
-           }
-         else
-           error_getting_info_dialog (impl, subfolder_path, error);
-
-         goto out;
-       }
-
-      if (gtk_file_info_get_is_folder (info))
-       result = change_folder_and_display_error (impl, subfolder_path);
-      else
-       {
-         GError *error;
-
-         error = NULL;
-         result = _gtk_file_chooser_select_path (GTK_FILE_CHOOSER (impl), subfolder_path, &error);
-         if (!result)
-           error_dialog (impl, _("Could not select item"),
-                         subfolder_path, error);
-       }
-
-    out:
-
-      if (folder)
-       g_object_unref (folder);
-
-      gtk_file_path_free (subfolder_path);
-
-      if (info)
-       gtk_file_info_free (info);
-
-      return result;
-    }
-
-  g_assert_not_reached ();
+  _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), path);
+  gtk_editable_set_position (GTK_EDITABLE (impl->location_entry), -1);
 }
 
 static void
 location_popup_handler (GtkFileChooserDefault *impl,
                        const gchar           *path)
 {
-  GtkWidget *dialog;
-  GtkWindow *toplevel;
-  GtkWidget *hbox;
-  GtkWidget *label;
-  GtkWidget *entry;
-  gboolean refocus;
-  const char *title;
-  const char *accept_stock;
-
-  /* Create dialog */
-
-  toplevel = get_toplevel (GTK_WIDGET (impl));
-
   if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
       || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
     {
-      title = _("Open Location");
-      accept_stock = GTK_STOCK_OPEN;
-    }
-  else
-    {
-      g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-               || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
-      title = _("Save in Location");
-      accept_stock = GTK_STOCK_SAVE;
-    }
-
-  dialog = gtk_dialog_new_with_buttons (title,
-                                       toplevel,
-                                       GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                       accept_stock, GTK_RESPONSE_ACCEPT,
-                                       NULL);
-  if (toplevel->group)
-    gtk_window_group_add_window (toplevel->group, GTK_WINDOW (dialog));
-  
-  gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1);
-  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
-
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                          GTK_RESPONSE_ACCEPT,
-                                          GTK_RESPONSE_CANCEL,
-                                          -1);
-
-  hbox = gtk_hbox_new (FALSE, 12);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
-  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
-
-  label = gtk_label_new_with_mnemonic (_("_Location:"));
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-  entry = location_entry_create (impl, path);
+      LocationMode new_mode;
 
-  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-
-  /* Run */
-
-  gtk_widget_show_all (dialog);
-  /* If the dialog is brought up by typing the first characters
-   * of a path, unselect the text in the entry, so that you can
-   * just type on without erasing the initial part.
-   */
-  if (path[0])
-    gtk_editable_select_region (GTK_EDITABLE (entry), -1, -1);
-
-  refocus = TRUE;
+      if (path != NULL)
+       {
+         /* since the user typed something, we unconditionally want to turn on the entry */
+         new_mode = LOCATION_MODE_FILENAME_ENTRY;
+       }
+      else if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+       new_mode = LOCATION_MODE_FILENAME_ENTRY;
+      else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+       new_mode = LOCATION_MODE_PATH_BAR;
+      else
+       {
+         g_assert_not_reached ();
+         return;
+       }
 
-  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
-    {
-      if (update_from_entry (impl, GTK_WINDOW (dialog), GTK_FILE_CHOOSER_ENTRY (entry)))
+      location_mode_set (impl, new_mode, TRUE);
+      if (new_mode == LOCATION_MODE_FILENAME_ENTRY)
        {
-         if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
-             || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
-           {
-             gtk_widget_grab_focus (impl->browse_files_tree_view);
-           }
+         if (path != NULL)
+           location_set_user_text (impl, path);
          else
            {
-             g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
-                       || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
-             gtk_widget_grab_focus (impl->save_file_name_entry);
+             location_entry_set_initial_text (impl);
+             gtk_editable_select_region (GTK_EDITABLE (impl->location_entry), 0, -1);
            }
-         refocus = FALSE;
        }
     }
-
-  if (refocus)
+  else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+          || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
     {
-      GtkWindow *toplevel;
-
-      toplevel = get_toplevel (GTK_WIDGET (impl));
-      if (toplevel && toplevel->focus_widget)
-       gtk_widget_grab_focus (toplevel->focus_widget);
+      gtk_widget_grab_focus (impl->location_entry);
+      if (path != NULL)
+       location_set_user_text (impl, path);
     }
-
-  gtk_widget_destroy (dialog);
+  else
+    g_assert_not_reached ();
 }
 
 /* Handler for the "up-folder" keybinding signal */
 static void
 up_folder_handler (GtkFileChooserDefault *impl)
 {
-  pending_select_paths_add (impl, impl->current_folder);
   _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
 }
 
@@ -7544,6 +8671,3 @@ shortcuts_model_filter_new (GtkFileChooserDefault *impl,
 
   return GTK_TREE_MODEL (model);
 }
-
-#define __GTK_FILE_CHOOSER_DEFAULT_C__
-#include "gtkaliasdef.c"