FILENAME ENTRY:

2006-03-29  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkpathbar.c (gtk_path_bar_init): Reduce the inter-button
	spacing to 0.

	* gtk/gtkfilechooserdefault.c (browse_widgets_create): Make the
	location label bold.

2006-03-29  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkfilechooserdefault.c (location_mode_set): Just change the
	location_mode field if we are in SAVE/CREATE_FOLDER modes.
	(gtk_file_chooser_default_get_paths): Get the path based on the
	currently focused widget, or the last-focused widget.  This is
	what we should have been doing in the beginning, but it worked out
	fine because we didn't have the possibility of a filename entry in
	OPEN mode.
	(gtk_file_chooser_default_should_respond): Handle the case where
	the last focused widget is the location_entry.

2006-03-28  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkfilechoosersettings.[ch]: New files with a simple
	framework for saving/loading settings from the file chooser in
	$XDG_CONFIG_HOME/gtk-2.0/gtkfilechooser.

	* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_unmap):
	Save the current settings.
	(settings_save): New helper function.  We save the location_mode
	and show_hidden flags.
	(gtk_file_chooser_default_map): Load the settings.
	(settings_load): New helper function.

	* gtk/gtkfilechooserentry.c
	(_gtk_file_chooser_entry_set_file_part): Oops, don't modify
	in_change.  Our handlers are what set the file_part, so they
	*must* be run when we modify the text.

2006-03-27  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserDefault):
	Removed the save_file_name_entry.  We'll make this be the same as
	the location_entry widget.
	(struct _GtkFileChooserDefault): Leave only location_button,
	location_entry_box, location_label, location_entry.  We'll use a
	single toggle button for the location entry, which will appear
	below the path bar.
	(struct _GtkFileChooserDefault): Added a
	processing_pending_selections flag.

	* gtk/gtkfilechooserdefault.c (save_widgets_create): Destroy the
	old location_entry if necessary, and hide the location toggle
	widgets.
	(update_chooser_entry): In multiple selection mode, just clear the
	location_entry.
	(check_save_entry): Allow running in OPEN or SELECT_FOLDER modes
	if we are in LOCATION_MODE_FILENAME_ENTRY.
	(gtk_file_chooser_default_should_respond): Switch to a folder if
	the location_entry contains a folder name in OPEN and SAVE mode,
	not just SAVE mode.  If the entry doesn't contain a folder name,
	but is otherwise well-formed, and we are in OPEN mode, return that
	we should respond with that filename.
	(gtk_file_chooser_default_initial_focus): Focus the location_entry
	if appropriate.
	(browse_widgets_create): Create the location_entry_box and the
	location_label here.
	(update_appearance): Call location_mode_set() when switching back
	to OPEN/SELECT_FOLDER mode.  Hide the location_button when
	switching to SAVE/CREATE_FOLDER mode.
	(pending_select_paths_process): Turn the
	processing_pending_selections flag on and off around changes to
	the current selection.  Don't special-case OPEN mode anymore,
	since the new flag will take care of things in
	update_chooser_entry().
	(update_chooser_entry): Don't do anything if
	processing_pending_selections is TRUE.  This keeps the entry from
	being polluted when changing folders.
	(location_popup_handler): In OPEN/SELECT_FOLDER modes, toggle
	between the path bar and the entry.  In SAVE/CREATE_FOLDER modes, simply focus the
	location_entry.
	(update_from_entry): Removed.
	(location_entry_create): Removed.
	(open_location_cb): Removed.
	(file_list_build_popup_menu): Don't add an "Open _Location" menu item.
	(location_entry_set_initial_text): Don't do anything if
	current_folder is NULL.

	* gtk/gtkfilechooserentry.c
	(_gtk_file_chooser_entry_set_file_part): Turn in_change on and off
	around the call to gtk_entry_set_text().  This makes completion
	not happen when the caller has explicitly set a name.

2006-03-24  Federico Mena Quintero  <federico@novell.com>

	* gtk/gtkfilechooserprivate.h (struct _GtkFileChooserDefault):
	Added fields location_mode_box, location_pathbar_radio,
	location_filename_radio, location_widget_box, location_label,
	location_entry.  The radio buttons will switch between the pathbar
	and the location entry; the other boxes are for layout purposes.
	(enum LocationMode): New enum.
	(struct _GtkFileChooserDefault): Added a location_mode field.

	* gtk/gtkfilechooserdefault.c (browse_widgets_create): Create the
	location radio buttons to switch between the pathbar and the
	location entry.  Pack the browse_path_bar in the new
	location_widget_box instead of a generic hbox.
	(location_buttons_create): New function.
	(gtk_file_chooser_default_init): Initialize impl->location_mode.
	(location_switch_to_path_bar): New function.
	(location_switch_to_filename_entry): New function.

	* gtk/gtkfilechooserbutton.c (model_add_special): The display_name
	should not be const.



BEAGLE SEARCHING:

2006-02-16  Federico Mena Quintero  <federico@novell.com>

	Add a "Search" shortcut to the file chooser so that we can use
	Beagle for searching.  Fixes
	https://bugzilla.novell.com/show_bug.cgi?id=151580

	* gtk/gtkfilechooserdefault.c (OperationMode): New enumeration
	with OPERATION_MODE_BROWSE and OPERATION_MODE_SEARCH.
	(struct _GtkFileChooserDefault): New operation_mode field.
	(gtk_file_chooser_default_init): Start with OPERATION_MODE_BROWSE.
	(SHORTCUTS_COL_TYPE): New column number for the shortcuts model;
	this replaces SHORTCUTS_COL_IS_VOLUME.
	(ShortcutType): New enumeration for the type of each shortcut.
	(shortcuts_model_create): Create the SHORTCUT_COL_TYPE column with
	type G_TYPE_INT so that we can stuff a ShortcutType value in it.
	(shortcuts_free_row_data): Check the shortcut type.
	(shortcuts_row_separator_func): Use the SHORTCUTS_COL_TYPE and
	test its value for SHORTCUT_TYPE_SEPARATOR, instead of checking
	for a non-null name.
	(shortcuts_list_create): Don't pass any user_data to
	gtk_tree_view_set_row_separator_func(); we don't need it anymore.
	(save_folder_combo_create): Likewise.
	(ShortcutsIndex): Added SHORTCUTS_SEARCH and
	SHORTCUTS_SEARCH_SEPARATOR at the beginning.
	(shortcuts_get_index): Added cases for SHORTCUTS_SEARCH and
	SHORTCUTS_SEARCH_SEPARATOR.
	(shortcuts_model_create): Call shortcuts_append_search().
	(shortcuts_append_search): New function.
	(shortcuts_reload_icons): Re-render the Search icon.
	(shortcuts_insert_separator): Accept SHORTCUTS_SEARCH_SEPARATOR as
	well.  Set the type column to SHORTCUT_TYPE_SEPARATOR.
	(shortcuts_insert_path): Take a ShortcutType rather than a boolean
	is_volume argument.
	(shortcuts_select_func): Consider all separators, not just the
	bookmarks separator.
	(shortcuts_activate_iter): Activate searching mode when we come to
	the SHORTCUT_TYPE_SEARCH item.
	(search_activate): New function; activates search mode.
	(stop_loading_and_clear_list_model): New helper function; moved
	the code over from set_list_model().
	(set_list_model): Use stop_loading_and_clear_list_model().
	(search_activate): Stop any loading operations and set up the
	widgets for the search.
	(search_setup_widgets): New function.
	(search_setup_model): New function.
	(search_entry_activate_cb): New callback.
	(search_start_query): New function.
	(struct _GtkFileChooserDefault): New field browse_path_bar_hbox.
	This is the hbox that normally holds the path bar and the Create
	Folder button, but it was not a stored field before.
	(file_pane_create): Use impl->browse_path_bar_hbox.
	(list_select_func): If we are in OPERATION_MODE_SEARCH, always
	allow selecting files.
	(list_icon_data_func): Return a null icon for now if we are in
	OPERATION_MODE_SEARCH.
	(list_name_data_func): Handle OPERATION_MODE_SEARCH; get the
	display name from the search_model.
	(list_mtime_data_func): Handle OPERATION_MODE_SEARCH; get the
	mtime from the struct stat in the search_model.
	(shortcuts_row_activated_cb): Don't focus the
	browse_files_tree_view; do it explicitly when we need it.
	(focus_browse_tree_view_if_possible): New helper function; focuses
	the browse list only if it is visible.
	(gtk_file_chooser_default_should_respond): Use
	focus_browse_tree_view_if_possible().
	(switch_to_shortcut): Give the focus to the browse_files_tree_view
	by using focus_browse_tree_view_if_possible().
	(shortcuts_activate_volume): Give the focus to the
	browse_files_tree_view by using
	focus_browse_tree_view_if_possible().
	(shortcuts_activate_iter): Give the focus to the
	browse_files_tree_view when activating a path by using
	focus_browse_tree_view_if_possible().
	(search_switch_to_browse_mode): New function.
	(shortcuts_activate_volume): Call search_switch_to_browse_mode().
	(gtk_file_chooser_default_update_current_folder): Likewise.
	(create_file_list): Set the vertical scrollbar policy to ALWAYS to
	avoid flickering when we clear/unset/re-set the model.
	(create_file_list): Don't set the ellipsization of the cell
	renderer for the Name column here.
	(list_name_data_func): Set the ellipsization here:  START for
	search mode, NONE for type-a-folder-name, END for normal files.
	(list_row_activated): Just emit "file-activated" if we are in
	OPERATION_MODE_SEARCH.
	(search_should_respond): New function; sees whether there are
	selected files in search mode.
	(gtk_file_chooser_default_should_respond): If we are in the case
	for the file list and the operation mode is OPERATION_MODE_SEARCH,
	call search_should_respond().  If we are in OPERATION_MODE_SEARCH
	and the toplevel_last_focus_widget was the search_entry, start the
	search process.
	(search_get_selected_paths): New function.
	(gtk_file_chooser_default_get_paths): If we are in
	OPERATION_MODE_SEARCH, just call search_get_selected_paths().
	(gtk_file_chooser_default_map): Only do the reload_state actions
	if we are in OPERATION_MODE_SEARCH.
	(gtk_file_chooser_default_finalize): Call search_clear_model().
	(gtk_file_chooser_default_dispose): Stop searching if we are in
	OPERATION_MODE_SEARCH.
	(gtk_file_chooser_default_select_path): Unconditionally queue a
	path change request if we are in OPERATION_MODE_SEARCH.
	(gtk_file_chooser_default_select_all): Handle
	OPERATION_MODE_SEARCH by selecting all the rows.
	(gtk_file_chooser_default_get_current_folder): Return NULL if we
	are in OPERATION_MODE_SEARCH.
	(list_selection_changed): Don't check the editable row unless we
	are in OPERATION_MODE_BROWSE.
	(update_chooser_entry): If we are in OPERATION_MODE_SEARCH, set
	the entry from the display name of the selected search hit.
	(check_preview_change): Update the preview data from the
	search_model if we are in OPERATION_MODE_SEARCH.
	(bookmarks_check_add_sensitivity): Make the items insensitive if
	we are in OPERATION_MODE_SEARCH.
	(remove_selected_bookmarks): Assert that the data in the bookmark
	is not NULL only after we have checked that the bookmark is
	removable.
	(struct _GtkFileChooserDefault): New list_mtime_column field.
	(file_list_set_sort_column_ids): New function.
	(create_file_list): Use the impl->list_mtime_column field instead
	of a temporary variable.  Call file_list_set_sort_column_ids()
	instead of setting the ids here.

	* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_map): Call
	::initial_focus() on the child before calling ::map() on our
	parent class.  This will prevent the shortcuts treeview from
	highlighting its first row as a result of getting assigned focus
	by gtk_dialog_map().  Fixes
	https://bugzilla.novell.com/show_bug.cgi?id=148896

	* gtkfilechooserdefault.c (struct _GtkFileChooserDefault): Renamed
	the shortcuts_filter_model field to shortcuts_pane_filter_model.
	(struct _GtkFileChooserDefault): Added a
	shortcuts_combo_filter_model field.
	(shortcuts_pane_filter_cb): Renamed from shortcuts_filter_cb().
	(shortcuts_combo_filter_func): New function; we use it to filter
	out the "Search" row and its separator, so that they don't show up
	in the "Save in folder" combo.
	(save_folder_combo_create): Create a GtkTreeModelFilter with
	shortcuts_combo_filter_func() for the "Save in folder" combo.
	(gtk_file_chooser_default_finalize): Unref the
	shortcuts_combo_filter_model.
	(shortcuts_add_bookmarks): Use the shortcuts_combo_filter_model
	instead of the plain shortcuts_model.
	(shortcuts_add_bookmarks): Take into account the Search item and
	its separator when computing the position of the selected row in
	the save folder combo.
	(shortcuts_add_current_folder): Likewise.
	(save_folder_combo_changed_cb): Convert the iter from the combo
	into a child iter from the filter model.
	(gtk_file_chooser_default_add_shortcut_folder): Refilter the combo
	filter model as well.
	(shortcuts_add_volumes): Likewise.
	(ShortcutsModelFilter): Renamed to ShortcutsPaneModelFilter;
	renamed its method functions accordingly.

diff -uNrp gtk+-2.8.10.orig/gtk/gtkbutton.c gtk+-2.8.10.beagle/gtk/gtkbutton.c
--- gtk+-2.8.10.orig/gtk/gtkbutton.c	2005-09-29 08:41:07.000000000 -0500
+++ gtk+-2.8.10.beagle/gtk/gtkbutton.c	2006-03-29 11:24:15.000000000 -0600
@@ -664,10 +664,17 @@ gtk_button_new (void)
 static gboolean
 show_image (GtkButton *button)
 {
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (button));  
   gboolean show;
+  
+  if (button->label_text)
+    {
+      GtkSettings *settings;
 
-  g_object_get (settings, "gtk-button-images", &show, NULL);
+      settings = gtk_widget_get_settings (GTK_WIDGET (button));        
+      g_object_get (settings, "gtk-button-images", &show, NULL);
+    }
+  else
+    show = TRUE;
 
   return show;
 }
@@ -685,26 +692,25 @@ gtk_button_construct_child (GtkButton *b
   
   if (!button->constructed)
     return;
-  
-  if (button->label_text == NULL)
+ 
+  if (!button->label_text && !priv->image)
     return;
-
-  if (GTK_BIN (button)->child)
-    {
-      if (priv->image && !priv->image_is_stock)
-	{
-	  image = g_object_ref (priv->image);
-	  if (image->parent)
-	    gtk_container_remove (GTK_CONTAINER (image->parent), image);
-	}
-
-      gtk_container_remove (GTK_CONTAINER (button),
-  			    GTK_BIN (button)->child);
   
+  if (priv->image && !priv->image_is_stock)
+    {
+      image = g_object_ref (priv->image);
+      if (image->parent)
+	gtk_container_remove (GTK_CONTAINER (image->parent), image);
+      
       priv->image = NULL;
     }
   
+  if (GTK_BIN (button)->child)
+    gtk_container_remove (GTK_CONTAINER (button),
+			  GTK_BIN (button)->child);
+  
   if (button->use_stock &&
+      button->label_text &&
       gtk_stock_lookup (button->label_text, &item))
     {
       if (!image)
@@ -717,9 +723,6 @@ gtk_button_construct_child (GtkButton *b
 
   if (image)
     {
-      label = gtk_label_new_with_mnemonic (label_text);
-      gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
-      
       priv->image = image;
 
       g_object_set (priv->image, 
@@ -734,7 +737,15 @@ gtk_button_construct_child (GtkButton *b
 	align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
 	
       gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+      if (label_text)
+	{
+	  label = gtk_label_new_with_mnemonic (label_text);
+	  gtk_label_set_mnemonic_widget (GTK_LABEL (label), 
+					 GTK_WIDGET (button));
+
+	  gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+	}
       
       gtk_container_add (GTK_CONTAINER (button), align);
       gtk_container_add (GTK_CONTAINER (align), hbox);
@@ -745,7 +756,7 @@ gtk_button_construct_child (GtkButton *b
       return;
     }
   
- if (button->use_underline)
+  if (button->use_underline)
     {
       label = gtk_label_new_with_mnemonic (button->label_text);
       gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
@@ -755,7 +766,7 @@ gtk_button_construct_child (GtkButton *b
   
   if (priv->align_set)
     gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
-
+  
   gtk_widget_show (label);
   gtk_container_add (GTK_CONTAINER (button), label);
 }
diff -uNrp gtk+-2.8.10.orig/gtk/gtkfilechooserbutton.c gtk+-2.8.10.beagle/gtk/gtkfilechooserbutton.c
--- gtk+-2.8.10.orig/gtk/gtkfilechooserbutton.c	2006-01-06 15:54:46.000000000 -0600
+++ gtk+-2.8.10.beagle/gtk/gtkfilechooserbutton.c	2006-03-29 11:24:15.000000000 -0600
@@ -1321,7 +1321,7 @@ static inline void
 model_add_special (GtkFileChooserButton *button)
 {
   const gchar *homedir;
-  const gchar *display_name;
+  gchar *display_name;
   gchar *desktopdir = NULL;
   GtkListStore *store;
   GtkTreeIter iter;
diff -uNrp gtk+-2.8.10.orig/gtk/gtkfilechooserdialog.c gtk+-2.8.10.beagle/gtk/gtkfilechooserdialog.c
--- gtk+-2.8.10.orig/gtk/gtkfilechooserdialog.c	2005-05-02 23:47:13.000000000 -0500
+++ gtk+-2.8.10.beagle/gtk/gtkfilechooserdialog.c	2006-03-29 11:54:26.000000000 -0600
@@ -499,9 +499,9 @@ gtk_file_chooser_dialog_map (GtkWidget *
   if (!GTK_WIDGET_MAPPED (priv->widget))
     gtk_widget_map (priv->widget);
 
-  GTK_WIDGET_CLASS (parent_class)->map (widget);
-
   _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
+
+  GTK_WIDGET_CLASS (parent_class)->map (widget);
 }
 
 /* GtkWidget::unmap handler */
diff -uNrp gtk+-2.8.10.orig/gtk/gtkfilechooserprivate.h gtk+-2.8.10.beagle/gtk/gtkfilechooserprivate.h
--- gtk+-2.8.10.orig/gtk/gtkfilechooserprivate.h	2005-07-14 23:55:56.000000000 -0500
+++ gtk+-2.8.10.beagle/gtk/gtkfilechooserprivate.h	2006-03-29 11:24:15.000000000 -0600
@@ -26,6 +26,11 @@
 
 G_BEGIN_DECLS
 
+typedef enum {
+  LOCATION_MODE_PATH_BAR,
+  LOCATION_MODE_FILENAME_ENTRY
+} LocationMode;
+
 #define GTK_FILE_CHOOSER_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER, GtkFileChooserIface))
 
 typedef struct _GtkFileChooserIface GtkFileChooserIface;
diff -uNrp gtk+-2.8.10.orig/gtk/gtkfilechoosersettings.c gtk+-2.8.10.beagle/gtk/gtkfilechoosersettings.c
--- gtk+-2.8.10.orig/gtk/gtkfilechoosersettings.c	1969-12-31 18:00:00.000000000 -0600
+++ gtk+-2.8.10.beagle/gtk/gtkfilechoosersettings.c	2006-03-29 11:24:15.000000000 -0600
@@ -0,0 +1,535 @@
+/* GTK - The GIMP Toolkit
+ * gtkfilechoosersettings.c: Internal settings for the GtkFileChooser widget
+ * Copyright (C) 2006, Novell, Inc.
+ *
+ * Authors: Federico Mena-Quintero <federico@novell.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* TODO:
+ *
+ * - Persist these:
+ *   - hpaned position
+ *   - browse_for_other_folders?
+ *
+ * - Do we want lockdown?
+ */
+
+#include <config.h>
+#include <errno.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include "gtkfilechoosersettings.h"
+
+/* Increment this every time you change the configuration format */
+#define CONFIG_VERSION 0
+
+#define ELEMENT_TOPLEVEL	"gtkfilechooser"
+#define ELEMENT_LOCATION	"location"
+#define ELEMENT_SHOW_HIDDEN     "show_hidden"
+#define ATTRIBUTE_VERSION       "version"
+#define ATTRIBUTE_MODE		"mode"
+#define ATTRIBUTE_VALUE         "value"
+#define MODE_PATH_BAR		"path-bar"
+#define MODE_FILENAME_ENTRY	"filename-entry"
+#define VALUE_TRUE              "true"
+#define VALUE_FALSE             "false"
+
+#define EQ(a, b) (g_ascii_strcasecmp ((a), (b)) == 0)
+
+static char *
+get_config_dirname (void)
+{
+  return g_build_filename (g_get_user_config_dir (), "gtk-2.0", NULL);
+}
+
+static char *
+get_config_filename (void)
+{
+  return g_build_filename (g_get_user_config_dir (), "gtk-2.0", "gtkfilechooser", NULL);
+}
+
+static void
+set_defaults (GtkFileChooserSettings *settings)
+{
+  settings->location_mode = LOCATION_MODE_PATH_BAR;
+  settings->show_hidden = FALSE;
+}
+
+typedef enum {
+  STATE_START,
+  STATE_END,
+  STATE_ERROR,
+  STATE_IN_TOPLEVEL,
+  STATE_IN_LOCATION,
+  STATE_IN_SHOW_HIDDEN
+} State;
+
+struct parse_state {
+  GtkFileChooserSettings *settings;
+  int version;
+  State state;
+};
+
+static const char *
+get_attribute_value (const char **attribute_names,
+		     const char **attribute_values,
+		     const char *attribute)
+{
+  const char **name;
+  const char **value;
+
+  name = attribute_names;
+  value = attribute_values;
+
+  while (*name)
+    {
+      if (EQ (*name, attribute))
+	return *value;
+
+      name++;
+      value++;
+    }
+
+  return NULL;
+}
+
+static void
+set_missing_attribute_error (struct parse_state *state,
+			     int line,
+			     int col,
+			     const char *attribute,
+			     GError **error)
+{
+  state->state = STATE_ERROR;
+  g_set_error (error,
+	       G_MARKUP_ERROR,
+	       G_MARKUP_ERROR_INVALID_CONTENT,
+	       _("Line %d, column %d: missing attribute \"%s\""),
+	       line,
+	       col,
+	       attribute);
+}
+
+static void
+set_unexpected_element_error (struct parse_state *state,
+			      int line,
+			      int col,
+			      const char *element,
+			      GError **error)
+{
+  state->state = STATE_ERROR;
+  g_set_error (error,
+	       G_MARKUP_ERROR,
+	       G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+	       _("Line %d, column %d: unexpected element \"%s\""),
+	       line,
+	       col,
+	       element);
+}
+
+static void
+set_unexpected_element_end_error (struct parse_state *state,
+				  int line,
+				  int col,
+				  const char *expected_element,
+				  const char *unexpected_element,
+				  GError **error)
+{
+  state->state = STATE_ERROR;
+  g_set_error (error,
+	       G_MARKUP_ERROR,
+	       G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+	       _("Line %d, column %d: expected end of element \"%s\", but got element for \"%s\" instead"),
+	       line,
+	       col,
+	       expected_element,
+	       unexpected_element);
+}
+
+
+static void
+parse_start_element_cb (GMarkupParseContext *context,
+			const char *element_name,
+			const char **attribute_names,
+			const char **attribute_values,
+			gpointer data,
+			GError **error)
+{
+  struct parse_state *state;
+  int line, col;
+
+  state = data;
+  g_markup_parse_context_get_position (context, &line, &col);
+
+  switch (state->state)
+    {
+    case STATE_START:
+      if (EQ (element_name, ELEMENT_TOPLEVEL))
+	{
+	  const char *version_str;
+
+	  state->state = STATE_IN_TOPLEVEL;
+
+	  version_str = get_attribute_value (attribute_names, attribute_values, ATTRIBUTE_VERSION);
+	  if (!version_str)
+	    state->version = -1;
+	  else
+	    if (sscanf (version_str, "%d", &state->version) != 1 || state->version < 0)
+	      state->version = -1;
+	}
+      else
+	{
+	  state->state = STATE_ERROR;
+	  g_set_error (error,
+		       G_MARKUP_ERROR,
+		       G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+		       _("Line %d, column %d: expected \"%s\" at the toplevel, but found \"%s\" instead"),
+		       line,
+		       col,
+		       ELEMENT_TOPLEVEL,
+		       element_name);
+	}
+      break;
+
+    case STATE_END:
+      g_assert_not_reached ();
+      break;
+
+    case STATE_ERROR:
+      g_assert_not_reached ();
+      break;
+
+    case STATE_IN_TOPLEVEL:
+      if (EQ (element_name, ELEMENT_LOCATION))
+	{
+	  const char *location_mode_str;
+
+	  state->state = STATE_IN_LOCATION;
+
+	  location_mode_str = get_attribute_value (attribute_names, attribute_values, ATTRIBUTE_MODE);
+	  if (!location_mode_str)
+	    set_missing_attribute_error (state, line, col, ATTRIBUTE_MODE, error);
+	  else if (EQ (location_mode_str, MODE_PATH_BAR))
+	    state->settings->location_mode = LOCATION_MODE_PATH_BAR;
+	  else if (EQ (location_mode_str, MODE_FILENAME_ENTRY))
+	    state->settings->location_mode = LOCATION_MODE_FILENAME_ENTRY;
+	  else
+	    {
+	      state->state = STATE_ERROR;
+	      g_set_error (error,
+			   G_MARKUP_ERROR,
+			   G_MARKUP_ERROR_INVALID_CONTENT,
+			   _("Line %d, column %d: expected \"%s\" or \"%s\", but found \"%s\" instead"),
+			   line,
+			   col,
+			   MODE_PATH_BAR,
+			   MODE_FILENAME_ENTRY,
+			   location_mode_str);
+	    }
+	}
+      else if (EQ (element_name, ELEMENT_SHOW_HIDDEN))
+	{
+	  const char *value_str;
+
+	  state->state = STATE_IN_SHOW_HIDDEN;
+
+	  value_str = get_attribute_value (attribute_names, attribute_values, ATTRIBUTE_VALUE);
+
+	  if (!value_str)
+	    set_missing_attribute_error (state, line, col, ATTRIBUTE_VALUE, error);
+	  else if (EQ (value_str, VALUE_TRUE))
+	    state->settings->show_hidden = TRUE;
+	  else if (EQ (value_str, VALUE_FALSE))
+	    state->settings->show_hidden = FALSE;
+	  else
+	    {
+	      state->state = STATE_ERROR;
+	      g_set_error (error,
+			   G_MARKUP_ERROR,
+			   G_MARKUP_ERROR_INVALID_CONTENT,
+			   _("Line %d, column %d: expected \"%s\" or \"%s\", but found \"%s\" instead"),
+			   line,
+			   col,
+			   VALUE_FALSE,
+			   VALUE_TRUE,
+			   value_str);
+	    }
+	}
+      else
+	set_unexpected_element_error (state, line, col, element_name, error);
+
+      break;
+
+    case STATE_IN_LOCATION:
+    case STATE_IN_SHOW_HIDDEN:
+      set_unexpected_element_error (state, line, col, element_name, error);
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+}
+
+static void
+parse_end_element_cb (GMarkupParseContext *context,
+		      const char *element_name,
+		      gpointer data,
+		      GError **error)
+{
+  struct parse_state *state;
+  int line, col;
+
+  state = data;
+  g_markup_parse_context_get_position (context, &line, &col);
+
+  switch (state->state)
+    {
+    case STATE_START:
+      g_assert_not_reached ();
+      break;
+
+    case STATE_END:
+      g_assert_not_reached ();
+      break;
+
+    case STATE_ERROR:
+      g_assert_not_reached ();
+      break;
+
+    case STATE_IN_TOPLEVEL:
+      if (EQ (element_name, ELEMENT_TOPLEVEL))
+	state->state = STATE_END;
+      else
+	set_unexpected_element_end_error (state, line, col, ELEMENT_TOPLEVEL, element_name, error);
+
+      break;
+
+    case STATE_IN_LOCATION:
+      if (EQ (element_name, ELEMENT_LOCATION))
+	state->state = STATE_IN_TOPLEVEL;
+      else
+	set_unexpected_element_end_error (state, line, col, ELEMENT_LOCATION, element_name, error);
+
+      break;
+
+    case STATE_IN_SHOW_HIDDEN:
+      if (EQ (element_name, ELEMENT_SHOW_HIDDEN))
+	state->state = STATE_IN_TOPLEVEL;
+      else
+	set_unexpected_element_end_error (state, line, col, ELEMENT_SHOW_HIDDEN, element_name, error);
+
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+}
+
+static gboolean
+parse_config (GtkFileChooserSettings *settings,
+	      const char *contents,
+	      GError **error)
+{
+  GMarkupParser parser = { 0, };
+  GMarkupParseContext *context;
+  struct parse_state state;
+  gboolean retval;
+
+  parser.start_element = parse_start_element_cb;
+  parser.end_element = parse_end_element_cb;
+
+  state.settings = settings;
+  state.version = -1;
+  state.state = STATE_START;
+
+  context = g_markup_parse_context_new (&parser,
+					0,
+					&state,
+					NULL);
+
+  retval = g_markup_parse_context_parse (context, contents, -1, error);
+  g_markup_parse_context_free (context);
+
+  return retval;
+}
+
+static gboolean
+read_config (GtkFileChooserSettings *settings,
+	     GError **error)
+{
+  char *filename;
+  char *contents;
+  gsize contents_len;
+  gboolean success;
+
+  filename = get_config_filename ();
+
+  success = g_file_get_contents (filename, &contents, &contents_len, error);
+  g_free (filename);
+
+  if (!success)
+    {
+      set_defaults (settings);
+      return FALSE;
+    }
+
+  success = parse_config (settings, contents, error);
+
+  g_free (contents);
+
+  return success;
+}
+
+static void
+ensure_settings_read (GtkFileChooserSettings *settings)
+{
+  if (settings->settings_read)
+    return;
+
+  /* NULL GError */
+  read_config (settings, NULL);
+
+  settings->settings_read = TRUE;
+}
+
+G_DEFINE_TYPE (GtkFileChooserSettings,
+	       _gtk_file_chooser_settings,
+	       G_TYPE_OBJECT);
+
+static void
+_gtk_file_chooser_settings_class_init (GtkFileChooserSettingsClass *class)
+{
+}
+
+static void
+_gtk_file_chooser_settings_init (GtkFileChooserSettings *settings)
+{
+}
+
+GtkFileChooserSettings *
+_gtk_file_chooser_settings_new (void)
+{
+  return g_object_new (GTK_FILE_CHOOSER_SETTINGS_TYPE, NULL);
+}
+
+LocationMode
+_gtk_file_chooser_settings_get_location_mode (GtkFileChooserSettings *settings)
+{
+  ensure_settings_read (settings);
+  return settings->location_mode;
+}
+
+void
+_gtk_file_chooser_settings_set_location_mode (GtkFileChooserSettings *settings,
+					      LocationMode location_mode)
+{
+  settings->location_mode = location_mode;
+}
+
+gboolean
+_gtk_file_chooser_settings_get_show_hidden (GtkFileChooserSettings *settings)
+{
+  ensure_settings_read (settings);
+  return settings->show_hidden;
+}
+
+void
+_gtk_file_chooser_settings_set_show_hidden (GtkFileChooserSettings *settings,
+					    gboolean show_hidden)
+{
+  settings->show_hidden = show_hidden ? TRUE : FALSE;
+}
+
+static char *
+settings_to_markup (GtkFileChooserSettings *settings)
+{
+  const char *location_mode_str;
+  const char *show_hidden_str;
+
+  if (settings->location_mode == LOCATION_MODE_PATH_BAR)
+    location_mode_str = MODE_PATH_BAR;
+  else if (settings->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+    location_mode_str = MODE_FILENAME_ENTRY;
+  else
+    {
+      g_assert_not_reached ();
+      return NULL;
+    }
+
+  show_hidden_str = settings->show_hidden ? VALUE_TRUE : VALUE_FALSE;
+
+  return g_strdup_printf
+    ("<" ELEMENT_TOPLEVEL ">\n"						/* <gtkfilechooser>               */
+     "  <" ELEMENT_LOCATION " " ATTRIBUTE_MODE "=\"%s\"/>\n"		/*   <location mode="path-bar"/>  */
+     "  <" ELEMENT_SHOW_HIDDEN " " ATTRIBUTE_VALUE "=\"%s\"/>\n"	/*   <show_hidden value="false"/> */
+     "</" ELEMENT_TOPLEVEL ">\n",					/* </gtkfilechooser>              */
+     location_mode_str,
+     show_hidden_str);
+}
+
+gboolean
+_gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
+				 GError                **error)
+{
+  char *contents;
+  char *filename;
+  char *dirname;
+  gboolean retval;
+
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  contents = settings_to_markup (settings);
+
+  filename = get_config_filename ();
+  dirname = NULL;
+
+  retval = FALSE;
+
+  if (!g_file_set_contents (filename, contents, -1, NULL))
+    {
+      char *dirname;
+      int saved_errno;
+
+      /* Directory is not there? */
+
+      dirname = get_config_dirname ();
+      if (g_mkdir_with_parents (dirname, 0700) != 0) /* 0700 per the XDG basedir spec */
+	{
+	  saved_errno = errno;
+	  g_set_error (error,
+		       G_FILE_ERROR,
+		       g_file_error_from_errno (saved_errno),
+		       _("Could not create directory: %s"),
+		       dirname);
+	  goto out;
+	}
+
+      if (!g_file_set_contents (filename, contents, -1, error))
+	goto out;
+    }
+
+  retval = TRUE;
+
+ out:
+
+  g_free (contents);
+  g_free (dirname);
+  g_free (filename);
+
+  return retval;
+}
diff -uNrp gtk+-2.8.10.orig/gtk/gtkfilechoosersettings.h gtk+-2.8.10.beagle/gtk/gtkfilechoosersettings.h
--- gtk+-2.8.10.orig/gtk/gtkfilechoosersettings.h	1969-12-31 18:00:00.000000000 -0600
+++ gtk+-2.8.10.beagle/gtk/gtkfilechoosersettings.h	2006-03-29 11:24:15.000000000 -0600
@@ -0,0 +1,75 @@
+/* GTK - The GIMP Toolkit
+ * gtkfilechoosersettings.h: Internal settings for the GtkFileChooser widget
+ * Copyright (C) 2006, Novell, Inc.
+ *
+ * Authors: Federico Mena-Quintero <federico@novell.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_FILE_CHOOSER_SETTINGS_H__
+#define __GTK_FILE_CHOOSER_SETTINGS_H__
+
+#include <glib-object.h>
+#include "gtkfilechooserprivate.h"
+
+G_BEGIN_DECLS
+
+#define GTK_FILE_CHOOSER_SETTINGS_TYPE (_gtk_file_chooser_settings_get_type ())
+
+typedef struct _GtkFileChooserSettings GtkFileChooserSettings;
+typedef struct _GtkFileChooserSettingsClass GtkFileChooserSettingsClass;
+
+struct _GtkFileChooserSettings
+{
+  GObject object;
+
+  LocationMode location_mode;
+
+  guint settings_read : 1;
+
+  guint show_hidden : 1;
+};
+
+struct _GtkFileChooserSettingsClass
+{
+  GObjectClass parent_class;
+};
+
+GType _gtk_file_chooser_settings_get_type (void) G_GNUC_CONST;
+
+GtkFileChooserSettings *_gtk_file_chooser_settings_new (void);
+
+LocationMode _gtk_file_chooser_settings_get_location_mode (GtkFileChooserSettings *settings);
+void         _gtk_file_chooser_settings_set_location_mode (GtkFileChooserSettings *settings,
+							   LocationMode            location_mode);
+
+gboolean _gtk_file_chooser_settings_get_show_hidden (GtkFileChooserSettings *settings);
+void     _gtk_file_chooser_settings_set_show_hidden (GtkFileChooserSettings *settings,
+						     gboolean                show_hidden);
+
+gboolean _gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
+					  GError                **error);
+
+/* FIXME: persist these options:
+ *
+ * - paned width
+ * - show_hidden
+ */
+
+G_END_DECLS
+
+#endif
diff -uNrp gtk+-2.8.10.orig/gtk/Makefile.am gtk+-2.8.10.beagle/gtk/Makefile.am
--- gtk+-2.8.10.orig/gtk/Makefile.am	2005-10-26 13:13:22.000000000 -0500
+++ gtk+-2.8.10.beagle/gtk/Makefile.am	2006-03-29 11:24:15.000000000 -0600
@@ -298,6 +298,7 @@ gtk_private_h_sources =		\
 	gtkfilechooserentry.h	\
 	gtkfilechooserdefault.h	\
 	gtkfilechooserprivate.h	\
+	gtkfilechoosersettings.h \
 	gtkfilechooserutils.h	\
 	gtkfilesystemunix.h	\
 	gtkfilesystemmodel.h	\
@@ -377,6 +378,7 @@ gtk_c_sources =                 \
 	gtkfilechooserembed.c	\
 	gtkfilechooserentry.c	\
 	gtkfilechooserdefault.c	\
+	gtkfilechoosersettings.c \
 	gtkfilechooserutils.c	\
 	gtkfilechooserwidget.c	\
 	gtkfilefilter.c		\
--- gtk+-2.8.10.orig/gtk/gtkfilechooserdefault.c	2006-03-28 19:27:48.000000000 -0600
+++ gtk+-2.8.10/gtk/gtkfilechooserdefault.c	2006-03-29 15:48:25.000000000 -0600
@@ -19,6 +19,9 @@
  */
 
 #include <config.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include "gdk/gdkkeysyms.h"
 #include "gtkalignment.h"
 #include "gtkbindings.h"
@@ -35,6 +38,7 @@
 #include "gtkfilechooserdefault.h"
 #include "gtkfilechooserembed.h"
 #include "gtkfilechooserentry.h"
+#include "gtkfilechoosersettings.h"
 #include "gtkfilechooserutils.h"
 #include "gtkfilechooser.h"
 #include "gtkfilesystemmodel.h"
@@ -52,6 +56,7 @@
 #include "gtkmessagedialog.h"
 #include "gtkpathbar.h"
 #include "gtkprivate.h"
+#include "gtkradiobutton.h"
 #include "gtkscrolledwindow.h"
 #include "gtkseparatormenuitem.h"
 #include "gtksizegroup.h"
@@ -158,8 +163,23 @@ typedef enum {
   RELOAD_WAS_UNMAPPED		/* We had a folder but got unmapped; reload is needed */
 } ReloadState;
 
+typedef enum {
+  OPERATION_MODE_BROWSE,
+  OPERATION_MODE_SEARCH
+} OperationMode;
+
 #define MAX_LOADING_TIME 500
 
+/* #include <beagle/beagle.h> */
+typedef struct _BeagleHit BeagleHit;
+typedef struct _BeagleQuery BeagleQuery;
+typedef struct _BeagleClient BeagleClient;
+typedef struct _BeagleRequest BeagleRequest;
+typedef struct _BeagleFinishedResponse BeagleFinishedResponse;
+typedef struct _BeagleHitsAddedResponse BeagleHitsAddedResponse;
+typedef struct _BeagleQueryPartProperty BeagleQueryPartProperty;
+typedef struct _BeagleQueryPart BeagleQueryPart;
+
 struct _GtkFileChooserDefaultClass
 {
   GtkVBoxClass parent_class;
@@ -176,7 +196,6 @@ struct _GtkFileChooserDefault
   /* Save mode widgets */
   GtkWidget *save_widgets;
 
-  GtkWidget *save_file_name_entry;
   GtkWidget *save_folder_label;
   GtkWidget *save_folder_combo;
   GtkWidget *save_expander;
@@ -194,8 +213,16 @@ struct _GtkFileChooserDefault
   GtkWidget *browse_files_popup_menu_add_shortcut_item;
   GtkWidget *browse_files_popup_menu_hidden_files_item;
   GtkWidget *browse_new_folder_button;
+  GtkWidget *browse_path_bar_hbox;
   GtkWidget *browse_path_bar;
 
+  /* Widgets for searching */
+  GtkWidget *search_hbox;
+  GtkWidget *search_entry;
+  BeagleClient *search_client;
+  BeagleQuery *search_query;
+  GtkListStore *search_model;
+
   GtkFileSystemModel *browse_files_model;
 
   GtkWidget *filter_combo_hbox;
@@ -206,8 +233,23 @@ struct _GtkFileChooserDefault
   GtkWidget *extra_align;
   GtkWidget *extra_widget;
 
+  GtkWidget *location_button;
+  GtkWidget *location_entry_box;
+  GtkWidget *location_label;
+  GtkWidget *location_entry;
+  LocationMode location_mode;
+
   GtkListStore *shortcuts_model;
-  GtkTreeModel *shortcuts_filter_model;
+
+  /* Filter for the shortcuts pane.  We filter out the "current folder" row and
+   * the separator that we use for the "Save in folder" combo.
+   */
+  GtkTreeModel *shortcuts_pane_filter_model;
+
+  /* Filter for the "Save in folder" combo.  We filter out the Search row and
+   * its separator.
+   */
+  GtkTreeModel *shortcuts_combo_filter_model;
 
   GtkTreeModelSort *sort_model;
 
@@ -215,6 +257,8 @@ struct _GtkFileChooserDefault
   ReloadState reload_state;
   guint load_timeout_id;
 
+  OperationMode operation_mode;
+
   GSList *pending_select_paths;
 
   GtkFileFilter *current_filter;
@@ -239,6 +283,7 @@ struct _GtkFileChooserDefault
 
   GtkTreeViewColumn *list_name_column;
   GtkCellRenderer *list_name_renderer;
+  GtkTreeViewColumn *list_mtime_column;
 
   GSource *edited_idle;
   char *edited_new_text;
@@ -265,6 +310,7 @@ struct _GtkFileChooserDefault
   guint list_sort_ascending : 1;
   guint changing_folder : 1;
   guint shortcuts_current_folder_active : 1;
+  guint processing_pending_selections : 1;
 
 #if 0
   guint shortcuts_drag_outside : 1;
@@ -288,12 +334,19 @@ enum {
   SHORTCUTS_COL_PIXBUF,
   SHORTCUTS_COL_NAME,
   SHORTCUTS_COL_DATA,
-  SHORTCUTS_COL_IS_VOLUME,
+  SHORTCUTS_COL_TYPE,
   SHORTCUTS_COL_REMOVABLE,
   SHORTCUTS_COL_PIXBUF_VISIBLE,
   SHORTCUTS_COL_NUM_COLUMNS
 };
 
+typedef enum {
+  SHORTCUT_TYPE_PATH,
+  SHORTCUT_TYPE_VOLUME,
+  SHORTCUT_TYPE_SEPARATOR,
+  SHORTCUT_TYPE_SEARCH
+} ShortcutType;
+
 /* Column numbers for the file list */
 enum {
   FILE_LIST_COL_NAME,
@@ -302,6 +355,14 @@ enum {
   FILE_LIST_COL_NUM_COLUMNS
 };
 
+/* Column numbers for the search model.  Keep this in sync with search_setup_model() */
+enum {
+  SEARCH_MODEL_COL_PATH,
+  SEARCH_MODEL_COL_DISPLAY_NAME,
+  SEARCH_MODEL_COL_COLLATION_KEY,
+  SEARCH_MODEL_COL_STAT
+};
+
 /* Identifiers for target types */
 enum {
   GTK_TREE_MODEL_ROW,
@@ -341,9 +402,106 @@ static const GtkTargetEntry file_list_de
 static const int num_file_list_dest_targets = (sizeof (file_list_dest_targets)
 					       / sizeof (file_list_dest_targets[0]));
 
+/* We dlopen() all the following from libbeagle at runtime */
+#define BEAGLE_HIT(x) ((BeagleHit *)(x))
+#define BEAGLE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), beagle_request_get_type(), BeagleRequest))
+#define BEAGLE_QUERY_PART(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), beagle_query_part_get_type(), BeagleQueryPart))
+
+typedef enum {
+        BEAGLE_QUERY_PART_LOGIC_REQUIRED = 1,
+	BEAGLE_QUERY_PART_LOGIC_PROHIBITED = 2
+} BeagleQueryPartLogic;
+
+typedef enum {
+	BEAGLE_PROPERTY_TYPE_UNKNOWN = 0,
+	BEAGLE_PROPERTY_TYPE_TEXT    = 1,
+	BEAGLE_PROPERTY_TYPE_KEYWORD = 2,
+	BEAGLE_PROPERTY_TYPE_DATE    = 3,
+	BEAGLE_PROPERTY_TYPE_LAST    = 4
+} BeaglePropertyType;
+
+/* *static* wrapper function pointers */
+static gboolean (*beagle_client_send_request_async) (BeagleClient   *client,
+                                                    BeagleRequest  *request,
+                                                    GError        **err) = NULL;
+static G_CONST_RETURN char *(*beagle_hit_get_uri) (BeagleHit *hit) = NULL;
+static GSList *(*beagle_hits_added_response_get_hits) (BeagleHitsAddedResponse *response) = NULL;
+static BeagleQuery *(*beagle_query_new) (void) = NULL;
+static void (*beagle_query_add_text) (BeagleQuery     *query,
+                                     const char      *str) = NULL;
+static void (*beagle_query_add_hit_type) (BeagleQuery *query,
+                                         const char  *hit_type) = NULL;
+static BeagleQueryPartProperty *(*beagle_query_part_property_new) (void) = NULL;
+static void (*beagle_query_part_set_logic) (BeagleQueryPart *part, BeagleQueryPartLogic logic) = NULL;
+static void (*beagle_query_part_property_set_key) (BeagleQueryPartProperty *part, const char *key) = NULL;
+static void (*beagle_query_part_property_set_value) (BeagleQueryPartProperty *part, const char *value) = NULL;
+static void (*beagle_query_part_property_set_property_type) (BeagleQueryPartProperty *part, BeaglePropertyType prop_type) = NULL;
+static void (*beagle_query_add_part) (BeagleQuery *query, BeagleQueryPart *part) = NULL;
+static GType (*beagle_request_get_type) (void) = NULL;
+static GType (*beagle_query_part_get_type) (void) = NULL;
+static BeagleClient *(*beagle_client_new_real) (const char *client_name) = NULL;
+
+static struct BeagleDlMapping
+{
+  const char *fn_name;
+  gpointer *fn_ptr_ref;
+} beagle_dl_mapping[] =
+{
+#define MAP(a) { #a, (gpointer *)&a }
+  MAP (beagle_client_send_request_async),
+  MAP (beagle_hit_get_uri),
+  MAP (beagle_hits_added_response_get_hits),
+  MAP (beagle_query_new),
+  MAP (beagle_query_add_text),
+  MAP (beagle_query_add_hit_type),
+  MAP (beagle_query_part_property_new),
+  MAP (beagle_query_part_set_logic),
+  MAP (beagle_query_part_property_set_key),
+  MAP (beagle_query_part_property_set_value),
+  MAP (beagle_query_part_property_set_property_type),
+  MAP (beagle_query_add_part),
+  MAP (beagle_request_get_type),
+  MAP (beagle_query_part_get_type),
+#undef MAP
+  { "beagle_client_new", (gpointer *)&beagle_client_new_real },
+};
+
+static BeagleClient *
+beagle_client_new (const char *client_name)
+{
+  if (!beagle_client_new_real)
+    {
+      int i;
+      GModule *beagle;
+
+      beagle = g_module_open ("libbeagle.so.0", G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+      if (!beagle)
+        {
+         g_warning ("Can't open libbeagle '%s'\n", g_module_error ());
+         return NULL;
+       }
+      
+      for (i = 0; i < G_N_ELEMENTS (beagle_dl_mapping); i++)
+       {
+         if (!g_module_symbol (beagle, beagle_dl_mapping[i].fn_name,
+                               beagle_dl_mapping[i].fn_ptr_ref))
+           {
+             g_warning ("Missing symbol '%s' in libbeagle\n",
+                        beagle_dl_mapping[i].fn_name);
+             g_module_close (beagle);
+             return NULL;
+           }
+       }
+  }
+  if (beagle_client_new_real)
+    return beagle_client_new_real (client_name);
+  return NULL;
+}
 
 /* Interesting places in the shortcuts bar */
 typedef enum {
+  SHORTCUTS_SEARCH,
+  SHORTCUTS_SEARCH_SEPARATOR,
   SHORTCUTS_HOME,
   SHORTCUTS_DESKTOP,
   SHORTCUTS_VOLUMES,
@@ -528,6 +686,18 @@ static const GtkFileInfo *get_list_file_
 static void load_remove_timer (GtkFileChooserDefault *impl);
 static void browse_files_center_selected_row (GtkFileChooserDefault *impl);
 
+static void location_button_create (GtkFileChooserDefault *impl);
+static void location_button_toggled_cb (GtkToggleButton *toggle,
+					GtkFileChooserDefault *impl);
+static void location_switch_to_path_bar (GtkFileChooserDefault *impl);
+
+static void search_stop_searching (GtkFileChooserDefault *impl);
+static void search_clear_model (GtkFileChooserDefault *impl, gboolean remove_from_treeview);
+static gboolean search_should_respond (GtkFileChooserDefault *impl);
+static void search_switch_to_browse_mode (GtkFileChooserDefault *impl);
+static GSList *search_get_selected_paths (GtkFileChooserDefault *impl);
+static void search_entry_activate_cb (GtkEntry *entry, gpointer data);
+
 static GObjectClass *parent_class;
 
 
@@ -538,26 +708,26 @@ typedef struct {
   GtkTreeModelFilter parent;
 
   GtkFileChooserDefault *impl;
-} ShortcutsModelFilter;
+} ShortcutsPaneModelFilter;
 
 typedef struct {
   GtkTreeModelFilterClass parent_class;
-} ShortcutsModelFilterClass;
+} ShortcutsPaneModelFilterClass;
 
-#define SHORTCUTS_MODEL_FILTER_TYPE (_shortcuts_model_filter_get_type ())
-#define SHORTCUTS_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHORTCUTS_MODEL_FILTER_TYPE, ShortcutsModelFilter))
+#define SHORTCUTS_PANE_MODEL_FILTER_TYPE (_shortcuts_pane_model_filter_get_type ())
+#define SHORTCUTS_PANE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHORTCUTS_PANE_MODEL_FILTER_TYPE, ShortcutsPaneModelFilter))
 
-static void shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface);
+static void shortcuts_pane_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (ShortcutsModelFilter,
-			 _shortcuts_model_filter,
+G_DEFINE_TYPE_WITH_CODE (ShortcutsPaneModelFilter,
+			 _shortcuts_pane_model_filter,
 			 GTK_TYPE_TREE_MODEL_FILTER,
 			 G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
-						shortcuts_model_filter_drag_source_iface_init));
+						shortcuts_pane_model_filter_drag_source_iface_init));
 
-static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl,
-						 GtkTreeModel          *child_model,
-						 GtkTreePath           *root);
+static GtkTreeModel *shortcuts_pane_model_filter_new (GtkFileChooserDefault *impl,
+						      GtkTreeModel          *child_model,
+						      GtkTreePath           *root);
 
 
 
@@ -678,7 +848,8 @@ gtk_file_chooser_default_class_init (Gtk
 				GDK_l, GDK_CONTROL_MASK,
 				"location-popup",
 				1, G_TYPE_STRING, "");
-
+  /* FMQ: remove this? */
+#if 0
   gtk_binding_entry_add_signal (binding_set,
 				GDK_slash, 0,
 				"location-popup",
@@ -694,6 +865,7 @@ gtk_file_chooser_default_class_init (Gtk
 				"location-popup",
 				1, G_TYPE_STRING, "~");
 #endif
+#endif
 
   gtk_binding_entry_add_signal (binding_set,
 				GDK_Up, GDK_MOD1_MASK,
@@ -782,6 +954,8 @@ gtk_file_chooser_default_init (GtkFileCh
   impl->load_state = LOAD_EMPTY;
   impl->reload_state = RELOAD_EMPTY;
   impl->pending_select_paths = NULL;
+  impl->location_mode = LOCATION_MODE_PATH_BAR;
+  impl->operation_mode = OPERATION_MODE_BROWSE;
 
   gtk_box_set_spacing (GTK_BOX (impl), 12);
 
@@ -798,16 +972,16 @@ shortcuts_free_row_data (GtkFileChooserD
 			 GtkTreeIter           *iter)
 {
   gpointer col_data;
-  gboolean is_volume;
+  ShortcutType shortcut_type;
 
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
 		      SHORTCUTS_COL_DATA, &col_data,
-		      SHORTCUTS_COL_IS_VOLUME, &is_volume,
+		      SHORTCUTS_COL_TYPE, &shortcut_type,
 		      -1);
-  if (!col_data)
+  if (!(shortcut_type == SHORTCUT_TYPE_PATH || shortcut_type == SHORTCUT_TYPE_VOLUME) || !col_data)
     return;
 
-  if (is_volume)
+  if (shortcut_type == SHORTCUT_TYPE_VOLUME)
     {
       GtkFileSystemVolume *volume;
 
@@ -818,6 +992,8 @@ shortcuts_free_row_data (GtkFileChooserD
     {
       GtkFilePath *path;
 
+      g_assert (shortcut_type == SHORTCUT_TYPE_PATH);
+
       path = col_data;
       gtk_file_path_free (path);
     }
@@ -904,8 +1080,11 @@ gtk_file_chooser_default_finalize (GObje
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
   GSList *l;
 
-  if (impl->shortcuts_filter_model)
-    g_object_unref (impl->shortcuts_filter_model);
+  if (impl->shortcuts_pane_filter_model)
+    g_object_unref (impl->shortcuts_pane_filter_model);
+
+  if (impl->shortcuts_combo_filter_model)
+    g_object_unref (impl->shortcuts_combo_filter_model);
 
   shortcuts_free (impl);
 
@@ -947,6 +1126,8 @@ gtk_file_chooser_default_finalize (GObje
   if (impl->sort_model)
     g_object_unref (impl->sort_model);
 
+  search_clear_model (impl, FALSE);
+
   g_free (impl->preview_display_name);
 
   g_free (impl->edited_new_text);
@@ -1198,6 +1379,13 @@ set_preview_widget (GtkFileChooserDefaul
   update_preview_widget_visibility (impl);
 }
 
+/* Renders a "Search" icon at an appropriate size for a tree view */
+static GdkPixbuf *
+render_search_icon (GtkFileChooserDefault *impl)
+{
+  return gtk_widget_render_icon (GTK_WIDGET (impl), GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
+}
+
 /* Re-reads all the icons for the shortcuts, used when the theme changes */
 static void
 shortcuts_reload_icons (GtkFileChooserDefault *impl)
@@ -1211,19 +1399,20 @@ shortcuts_reload_icons (GtkFileChooserDe
 
   do {
     gpointer data;
-    gboolean is_volume;
+    ShortcutType shortcut_type;
     gboolean pixbuf_visible;
     GdkPixbuf *pixbuf;
 
     gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
 			SHORTCUTS_COL_DATA, &data,
-			SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			SHORTCUTS_COL_TYPE, &shortcut_type,
 			SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
 			-1);
 
-    if (pixbuf_visible && data)
+    pixbuf = NULL;
+    if (pixbuf_visible)
       {
-	if (is_volume)
+	if (shortcut_type == SHORTCUT_TYPE_VOLUME)
 	  {
 	    GtkFileSystemVolume *volume;
 
@@ -1231,7 +1420,7 @@ shortcuts_reload_icons (GtkFileChooserDe
 	    pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
 							 impl->icon_size, NULL);
 	  }
-	else
+	else if (shortcut_type == SHORTCUT_TYPE_PATH)
 	  {
 	    const GtkFilePath *path;
 
@@ -1239,6 +1428,10 @@ shortcuts_reload_icons (GtkFileChooserDe
 	    pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
 						  impl->icon_size, NULL);
 	  }
+	else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
+	  {
+	    pixbuf = render_search_icon (impl);
+	  }
 
 	gtk_list_store_set (impl->shortcuts_model, &iter,
 			    SHORTCUTS_COL_PIXBUF, pixbuf,
@@ -1362,7 +1555,7 @@ check_is_folder (GtkFileSystem      *fil
 static gboolean
 shortcuts_insert_path (GtkFileChooserDefault *impl,
 		       int                    pos,
-		       gboolean               is_volume,
+		       ShortcutType           shortcut_type,
 		       GtkFileSystemVolume   *volume,
 		       const GtkFilePath     *path,
 		       const char            *label,
@@ -1374,16 +1567,17 @@ shortcuts_insert_path (GtkFileChooserDef
   gpointer data;
   GtkTreeIter iter;
 
-  profile_start ("start", is_volume ? "volume" : (char *) path);
+  profile_start ("start", ((shortcut_type == SHORTCUT_TYPE_VOLUME) ? "volume"
+			   : ((shortcut_type == SHORTCUT_TYPE_PATH) ? (char *) path : NULL)));
 
-  if (is_volume)
+  if (shortcut_type == SHORTCUT_TYPE_VOLUME)
     {
       data = volume;
       label_copy = gtk_file_system_volume_get_display_name (impl->file_system, volume);
       pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
 						   impl->icon_size, NULL);
     }
-  else
+  else if (shortcut_type == SHORTCUT_TYPE_PATH)
     {
       if (!check_is_folder (impl->file_system, path, error))
 	{
@@ -1411,6 +1605,11 @@ shortcuts_insert_path (GtkFileChooserDef
       pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
 					    impl->icon_size, NULL);
     }
+  else
+    {
+      g_assert_not_reached ();
+      return FALSE;
+    }
 
   if (pos == -1)
     gtk_list_store_append (impl->shortcuts_model, &iter);
@@ -1422,7 +1621,7 @@ shortcuts_insert_path (GtkFileChooserDef
 		      SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
 		      SHORTCUTS_COL_NAME, label_copy,
 		      SHORTCUTS_COL_DATA, data,
-		      SHORTCUTS_COL_IS_VOLUME, is_volume,
+		      SHORTCUTS_COL_TYPE, shortcut_type,
 		      SHORTCUTS_COL_REMOVABLE, removable,
 		      -1);
 
@@ -1436,6 +1635,28 @@ shortcuts_insert_path (GtkFileChooserDef
   return TRUE;
 }
 
+static void
+shortcuts_append_search (GtkFileChooserDefault *impl)
+{
+  GdkPixbuf *pixbuf;
+  GtkTreeIter iter;
+
+  pixbuf = render_search_icon (impl);
+
+  gtk_list_store_append (impl->shortcuts_model, &iter);
+  gtk_list_store_set (impl->shortcuts_model, &iter,
+		      SHORTCUTS_COL_PIXBUF, pixbuf,
+		      SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
+		      SHORTCUTS_COL_NAME, _("Search"),
+		      SHORTCUTS_COL_DATA, NULL,
+		      SHORTCUTS_COL_TYPE, SHORTCUT_TYPE_SEARCH,
+		      SHORTCUTS_COL_REMOVABLE, FALSE,
+		      -1);
+
+  if (pixbuf)
+    g_object_unref (pixbuf);
+}
+
 /* Appends an item for the user's home directory to the shortcuts model */
 static void
 shortcuts_append_home (GtkFileChooserDefault *impl)
@@ -1456,7 +1677,7 @@ shortcuts_append_home (GtkFileChooserDef
   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);
+  impl->has_home = shortcuts_insert_path (impl, -1, SHORTCUT_TYPE_PATH, NULL, home_path, NULL, FALSE, &error);
   if (!impl->has_home)
     error_getting_info_dialog (impl, home_path, error);
 
@@ -1491,7 +1712,7 @@ shortcuts_append_desktop (GtkFileChooser
   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);
+  impl->has_desktop = shortcuts_insert_path (impl, -1, SHORTCUT_TYPE_PATH, NULL, path, _("Desktop"), FALSE, NULL);
   /* 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.
    */
@@ -1532,7 +1753,7 @@ shortcuts_append_paths (GtkFileChooserDe
       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))
+      if (shortcuts_insert_path (impl, start_row + num_inserted, SHORTCUT_TYPE_PATH, NULL, path, label, TRUE, NULL))
 	num_inserted++;
 
       g_free (label);
@@ -1552,6 +1773,16 @@ shortcuts_get_index (GtkFileChooserDefau
 
   n = 0;
 
+  if (where == SHORTCUTS_SEARCH)
+    goto out;
+
+  n++;
+
+  if (where == SHORTCUTS_SEARCH_SEPARATOR)
+    goto out;
+
+  n++;
+
   if (where == SHORTCUTS_HOME)
     goto out;
 
@@ -1671,7 +1902,7 @@ shortcuts_add_volumes (GtkFileChooserDef
 	    }
 	}
 
-      if (shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, NULL))
+      if (shortcuts_insert_path (impl, start_row + n, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE, NULL))
 	n++;
       else
 	gtk_file_system_volume_free (impl->file_system, volume);
@@ -1680,8 +1911,11 @@ shortcuts_add_volumes (GtkFileChooserDef
   impl->num_volumes = n;
   g_slist_free (list);
 
-  if (impl->shortcuts_filter_model)
-    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
+  if (impl->shortcuts_pane_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+
+  if (impl->shortcuts_combo_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model));
 
   impl->changing_folder = old_changing_folders;
 
@@ -1695,7 +1929,9 @@ shortcuts_insert_separator (GtkFileChoos
 {
   GtkTreeIter iter;
 
-  g_assert (where == SHORTCUTS_BOOKMARKS_SEPARATOR || where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
+  g_assert (where == SHORTCUTS_SEARCH_SEPARATOR
+	    || where == SHORTCUTS_BOOKMARKS_SEPARATOR
+	    || where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
 
   gtk_list_store_insert (impl->shortcuts_model, &iter,
 			 shortcuts_get_index (impl, where));
@@ -1704,6 +1940,7 @@ shortcuts_insert_separator (GtkFileChoos
 		      SHORTCUTS_COL_PIXBUF_VISIBLE, FALSE,
 		      SHORTCUTS_COL_NAME, NULL,
 		      SHORTCUTS_COL_DATA, NULL,
+		      SHORTCUTS_COL_TYPE, SHORTCUT_TYPE_SEPARATOR,
 		      -1);
 }
 
@@ -1716,7 +1953,7 @@ shortcuts_add_bookmarks (GtkFileChooserD
   GtkTreeIter iter;
   GtkFilePath *list_selected = NULL;
   GtkFilePath *combo_selected = NULL;
-  gboolean is_volume;
+  ShortcutType shortcut_type;
   gpointer col_data;
 
   profile_start ("start", NULL);
@@ -1729,10 +1966,10 @@ shortcuts_add_bookmarks (GtkFileChooserD
       gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), 
 			  &iter, 
 			  SHORTCUTS_COL_DATA, &col_data,
-			  SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			  SHORTCUTS_COL_TYPE, &shortcut_type,
 			  -1);
 
-      if (col_data && !is_volume)
+      if (col_data && shortcut_type == SHORTCUT_TYPE_PATH)
 	list_selected = gtk_file_path_copy (col_data);
     }
 
@@ -1740,13 +1977,13 @@ shortcuts_add_bookmarks (GtkFileChooserD
       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (impl->save_folder_combo), 
 				     &iter))
     {
-      gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), 
+      gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_combo_filter_model), 
 			  &iter, 
 			  SHORTCUTS_COL_DATA, &col_data,
-			  SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			  SHORTCUTS_COL_TYPE, &shortcut_type,
 			  -1);
       
-      if (col_data && !is_volume)
+      if (col_data && shortcut_type == SHORTCUT_TYPE_PATH)
 	combo_selected = gtk_file_path_copy (col_data);
     }
 
@@ -1762,8 +1999,11 @@ shortcuts_add_bookmarks (GtkFileChooserD
   if (impl->num_bookmarks > 0)
     shortcuts_insert_separator (impl, SHORTCUTS_BOOKMARKS_SEPARATOR);
 
-  if (impl->shortcuts_filter_model)
-    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
+  if (impl->shortcuts_pane_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+
+  if (impl->shortcuts_combo_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model));
 
   if (list_selected)
     {
@@ -1777,8 +2017,14 @@ shortcuts_add_bookmarks (GtkFileChooserD
 
       pos = shortcut_find_position (impl, combo_selected);
       if (pos != -1)
-	gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), 
-				  pos);
+	{
+	  int search_separator_pos;
+
+	  search_separator_pos = shortcuts_get_index (impl, SHORTCUTS_SEARCH_SEPARATOR);
+	  g_assert (pos >= search_separator_pos + 1);
+	  gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo),
+				    pos - (search_separator_pos + 1));
+	}
       gtk_file_path_free (combo_selected);
     }
   
@@ -1823,12 +2069,12 @@ shortcuts_add_current_folder (GtkFileCho
       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);
+	  success = shortcuts_insert_path (impl, pos, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE, NULL);
 	  if (success)
 	    volume = NULL;
 	}
       else
-	success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
+	success = shortcuts_insert_path (impl, pos, SHORTCUT_TYPE_PATH, NULL, impl->current_folder, NULL, FALSE, NULL);
 
       if (volume)
 	gtk_file_system_volume_free (impl->file_system, volume);
@@ -1843,7 +2089,13 @@ shortcuts_add_current_folder (GtkFileCho
     }
 
   if (success && impl->save_folder_combo != NULL)
-    gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
+    {
+      int search_separator_pos;
+
+      search_separator_pos = shortcuts_get_index (impl, SHORTCUTS_SEARCH_SEPARATOR);
+      g_assert (pos >= search_separator_pos + 1);
+      gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos - (search_separator_pos + 1));
+    }
 }
 
 /* Updates the current folder row in the shortcuts model */
@@ -1865,9 +2117,9 @@ shortcuts_update_current_folder (GtkFile
 
 /* Filter function used for the shortcuts filter model */
 static gboolean
-shortcuts_filter_cb (GtkTreeModel          *model,
-		     GtkTreeIter           *iter,
-		     gpointer               data)
+shortcuts_pane_filter_cb (GtkTreeModel          *model,
+			  GtkTreeIter           *iter,
+			  gpointer               data)
 {
   GtkFileChooserDefault *impl;
   GtkTreePath *path;
@@ -1894,10 +2146,13 @@ shortcuts_model_create (GtkFileChooserDe
 					      GDK_TYPE_PIXBUF,	/* pixbuf */
 					      G_TYPE_STRING,	/* name */
 					      G_TYPE_POINTER,	/* path or volume */
-					      G_TYPE_BOOLEAN,   /* is the previous column a volume? */
+					      G_TYPE_INT,       /* ShortcutType */
 					      G_TYPE_BOOLEAN,   /* removable */
 					      G_TYPE_BOOLEAN);  /* pixbuf cell visibility */
 
+  shortcuts_append_search (impl);
+  shortcuts_insert_separator (impl, SHORTCUTS_SEARCH_SEPARATOR);
+
   if (impl->file_system)
     {
       shortcuts_append_home (impl);
@@ -1905,12 +2160,12 @@ shortcuts_model_create (GtkFileChooserDe
       shortcuts_add_volumes (impl);
     }
 
-  impl->shortcuts_filter_model = shortcuts_model_filter_new (impl,
-							     GTK_TREE_MODEL (impl->shortcuts_model),
-							     NULL);
+  impl->shortcuts_pane_filter_model = shortcuts_pane_model_filter_new (impl,
+								       GTK_TREE_MODEL (impl->shortcuts_model),
+								       NULL);
 
-  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
-					  shortcuts_filter_cb,
+  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model),
+					  shortcuts_pane_filter_cb,
 					  impl,
 					  NULL);
 }
@@ -2092,16 +2347,16 @@ shortcut_find_position (GtkFileChooserDe
   for (i = 0; i < current_folder_separator_idx; i++)
     {
       gpointer col_data;
-      gboolean is_volume;
+      ShortcutType shortcut_type;
 
       gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
 			  SHORTCUTS_COL_DATA, &col_data,
-			  SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			  SHORTCUTS_COL_TYPE, &shortcut_type,
 			  -1);
 
       if (col_data)
 	{
-	  if (is_volume)
+	  if (shortcut_type == SHORTCUT_TYPE_VOLUME)
 	    {
 	      GtkFileSystemVolume *volume;
 	      GtkFilePath *base_path;
@@ -2117,7 +2372,7 @@ shortcut_find_position (GtkFileChooserDe
 	      if (exists)
 		return i;
 	    }
-	  else
+	  else if (shortcut_type == SHORTCUT_TYPE_PATH)
 	    {
 	      GtkFilePath *model_path;
 
@@ -2227,7 +2482,7 @@ shortcuts_get_selected (GtkFileChooserDe
   if (!gtk_tree_selection_get_selected (selection, NULL, &parent_iter))
     return FALSE;
 
-  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
+  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model),
 						    iter,
 						    &parent_iter);
   return TRUE;
@@ -2250,11 +2505,11 @@ remove_selected_bookmarks (GtkFileChoose
 		      SHORTCUTS_COL_DATA, &col_data,
 		      SHORTCUTS_COL_REMOVABLE, &removable,
 		      -1);
-  g_assert (col_data != NULL);
-
   if (!removable)
     return;
 
+  g_assert (col_data != NULL);
+
   path = col_data;
 
   error = NULL;
@@ -2411,6 +2666,16 @@ bookmarks_check_add_sensitivity (GtkFile
   gboolean active;
   gchar *tip;
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, FALSE);
+
+      if (impl->browse_files_popup_menu_add_shortcut_item)
+	gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item, FALSE);
+
+      return;
+    }
+
   selection_check (impl, &num_selected, NULL, &all_folders);
 
   if (num_selected == 0)
@@ -2924,7 +3189,7 @@ shortcuts_reorder (GtkFileChooserDefault
 {
   GtkTreeIter iter;
   gpointer col_data;
-  gboolean is_volume;
+  ShortcutType shortcut_type;
   GtkTreePath *path;
   int old_position;
   int bookmarks_index;
@@ -2949,10 +3214,10 @@ shortcuts_reorder (GtkFileChooserDefault
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
 		      SHORTCUTS_COL_NAME, &name,
 		      SHORTCUTS_COL_DATA, &col_data,
-		      SHORTCUTS_COL_IS_VOLUME, &is_volume,
+		      SHORTCUTS_COL_TYPE, &shortcut_type,
 		      -1);
   g_assert (col_data != NULL);
-  g_assert (!is_volume);
+  g_assert (shortcut_type == SHORTCUT_TYPE_PATH);
   
   file_path = col_data;
   file_path_copy = gtk_file_path_copy (file_path); /* removal below will free file_path, so we need a copy */
@@ -3015,7 +3280,7 @@ shortcuts_drag_data_received_cb (GtkWidg
   position -= bookmarks_index;
 
   if (selection_data->target == gdk_atom_intern ("text/uri-list", FALSE))
-    shortcuts_drop_uris (impl, selection_data->data, position);
+    shortcuts_drop_uris (impl, (char *) selection_data->data, position);
   else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
     shortcuts_reorder (impl, position);
 
@@ -3036,17 +3301,11 @@ shortcuts_row_separator_func (GtkTreeMod
 			      GtkTreeIter  *iter,
 			      gpointer      data)
 {
-  gint column = GPOINTER_TO_INT (data);
-  gchar *text;
+  ShortcutType shortcut_type;
 
-  gtk_tree_model_get (model, iter, column, &text, -1);
+  gtk_tree_model_get (model, iter, SHORTCUTS_COL_TYPE, &shortcut_type, -1);
   
-  if (!text)
-    return TRUE;
-
-  g_free (text);
-
-  return FALSE;
+  return (shortcut_type == SHORTCUT_TYPE_SEPARATOR);
 }
 
 /* Since GtkTreeView has a keybinding attached to '/', we need to catch
@@ -3057,6 +3316,8 @@ tree_view_keybinding_cb (GtkWidget      
 			 GdkEventKey           *event,
 			 GtkFileChooserDefault *impl)
 {
+  /* FMQ: remove this? */
+#if 0
   if ((event->keyval == GDK_slash
        || event->keyval == GDK_KP_Divide
 #ifdef G_OS_UNIX
@@ -3067,7 +3328,7 @@ tree_view_keybinding_cb (GtkWidget      
       location_popup_handler (impl, event->string);
       return TRUE;
     }
-  
+#endif
   return FALSE;
 }
 
@@ -3270,10 +3531,10 @@ shortcuts_list_create (GtkFileChooserDef
 		    G_CALLBACK (shortcuts_popup_menu_cb), impl);
   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);
+  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_pane_filter_model);
 
   gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
 					  GDK_BUTTON1_MASK,
@@ -3324,7 +3585,8 @@ shortcuts_list_create (GtkFileChooserDef
   /* 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);
@@ -3345,8 +3607,7 @@ shortcuts_list_create (GtkFileChooserDef
 
   gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
 					shortcuts_row_separator_func,
-					GINT_TO_POINTER (SHORTCUTS_COL_NAME),
-					NULL);
+					NULL, NULL);
 
   gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
 
@@ -3419,7 +3680,9 @@ trap_activate_cb (GtkWidget   *widget,
   impl = (GtkFileChooserDefault *) data;
 
   modifiers = gtk_accelerator_get_default_mod_mask ();
-  
+
+  /* FMQ: remove this? */
+#if 0
   if ((event->keyval == GDK_slash
        || event->keyval == GDK_KP_Divide
 #ifdef G_OS_UNIX
@@ -3430,6 +3693,7 @@ trap_activate_cb (GtkWidget   *widget,
       location_popup_handler (impl, event->string);
       return TRUE;
     }
+#endif
 
   if ((event->keyval == GDK_Return
        || event->keyval == GDK_ISO_Enter
@@ -3478,14 +3742,6 @@ add_to_shortcuts_cb (GtkMenuItem        
   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,
@@ -3529,7 +3785,7 @@ file_list_drag_data_received_cb (GtkWidg
   chooser = GTK_FILE_CHOOSER (data);
   
   /* Parse the text/uri-list string, navigate to the first one */
-  uris = g_uri_list_extract_uris (selection_data->data);
+  uris = g_uri_list_extract_uris ((char *) selection_data->data);
   if (uris[0]) 
     {
       uri = uris[0];
@@ -3641,14 +3897,6 @@ file_list_build_popup_menu (GtkFileChoos
   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);
@@ -3667,6 +3915,8 @@ file_list_update_popup_menu (GtkFileChoo
 {
   file_list_build_popup_menu (impl);
 
+  /* FMQ: handle OPERATION_MODE_SEARCH */
+
   /* The sensitivity of the Add to Bookmarks item is set in
    * bookmarks_check_add_sensitivity()
    */
@@ -3756,20 +4006,40 @@ list_button_press_event_cb (GtkWidget   
   return TRUE;
 }
 
+/* Sets the sort column IDs for the file list based on the operation mode */
+static void
+file_list_set_sort_column_ids (GtkFileChooserDefault *impl)
+{
+  int name_id, mtime_id;
+
+  if (impl->operation_mode == OPERATION_MODE_BROWSE)
+    {
+      name_id = FILE_LIST_COL_NAME;
+      mtime_id = FILE_LIST_COL_MTIME;
+    }
+  else
+    {
+      name_id = SEARCH_MODEL_COL_PATH;
+      mtime_id = SEARCH_MODEL_COL_STAT;
+    }
+
+  gtk_tree_view_column_set_sort_column_id (impl->list_name_column, name_id);
+  gtk_tree_view_column_set_sort_column_id (impl->list_mtime_column, mtime_id);
+}
+
 /* Creates the widgets for the file list */
 static GtkWidget *
 create_file_list (GtkFileChooserDefault *impl)
 {
   GtkWidget *swin;
   GtkTreeSelection *selection;
-  GtkTreeViewColumn *column;
   GtkCellRenderer *renderer;
 
   /* Scrolled window */
 
   swin = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
-				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+				  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
 				       GTK_SHADOW_IN);
 
@@ -3823,7 +4093,6 @@ create_file_list (GtkFileChooserDefault 
   gtk_tree_view_column_set_expand (impl->list_name_column, TRUE);
   gtk_tree_view_column_set_resizable (impl->list_name_column, TRUE);
   gtk_tree_view_column_set_title (impl->list_name_column, _("Name"));
-  gtk_tree_view_column_set_sort_column_id (impl->list_name_column, FILE_LIST_COL_NAME);
 
   renderer = gtk_cell_renderer_pixbuf_new ();
   gtk_tree_view_column_pack_start (impl->list_name_column, renderer, FALSE);
@@ -3831,9 +4100,6 @@ create_file_list (GtkFileChooserDefault 
 					   list_icon_data_func, impl, NULL);
 
   impl->list_name_renderer = gtk_cell_renderer_text_new ();
-  g_object_set (impl->list_name_renderer,
-		"ellipsize", PANGO_ELLIPSIZE_END,
-		NULL);
   g_signal_connect (impl->list_name_renderer, "edited",
 		    G_CALLBACK (renderer_edited_cb), impl);
   g_signal_connect (impl->list_name_renderer, "editing-canceled",
@@ -3850,7 +4116,7 @@ create_file_list (GtkFileChooserDefault 
   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);
@@ -3858,16 +4124,18 @@ create_file_list (GtkFileChooserDefault 
 #endif
   /* Modification time column */
 
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_resizable (column, TRUE);
-  gtk_tree_view_column_set_title (column, _("Modified"));
+  impl->list_mtime_column = gtk_tree_view_column_new ();
+  gtk_tree_view_column_set_resizable (impl->list_mtime_column, TRUE);
+  gtk_tree_view_column_set_title (impl->list_mtime_column, _("Modified"));
 
   renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, TRUE);
-  gtk_tree_view_column_set_cell_data_func (column, renderer,
+  gtk_tree_view_column_pack_start (impl->list_mtime_column, renderer, TRUE);
+  gtk_tree_view_column_set_cell_data_func (impl->list_mtime_column, renderer,
 					   list_mtime_data_func, impl, NULL);
-  gtk_tree_view_column_set_sort_column_id (column, FILE_LIST_COL_MTIME);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), column);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), impl->list_mtime_column);
+
+  file_list_set_sort_column_ids (impl);
+
   gtk_widget_show_all (swin);
 
   return swin;
@@ -3919,21 +4187,6 @@ file_pane_create (GtkFileChooserDefault 
   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);
@@ -3989,7 +4242,54 @@ save_folder_combo_changed_cb (GtkComboBo
     return;
 
   if (gtk_combo_box_get_active_iter (combo, &iter))
-    shortcuts_activate_iter (impl, &iter);
+    {
+      GtkTreeIter child_iter;
+
+      gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model),
+							&child_iter,
+							&iter);
+      shortcuts_activate_iter (impl, &child_iter);
+    }
+}
+
+/* Filter function used to filter out the Search item and its separator.  Used
+ * for the "Save in folder" combo box, so that these items do not appear in it.
+ */
+static gboolean
+shortcuts_combo_filter_func (GtkTreeModel *model,
+			     GtkTreeIter *iter,
+			     gpointer data)
+{
+  GtkFileChooserDefault *impl;
+  GtkTreePath *tree_path;
+  gint *indices;
+  int idx;
+  gboolean retval;
+
+  impl = GTK_FILE_CHOOSER_DEFAULT (data);
+
+  g_assert (model == GTK_TREE_MODEL (impl->shortcuts_model));
+
+  tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), iter);
+  g_assert (tree_path != NULL);
+
+  indices = gtk_tree_path_get_indices (tree_path);
+
+  retval = TRUE;
+
+  idx = shortcuts_get_index (impl, SHORTCUTS_SEARCH);
+  if (idx == indices[0])
+    retval = FALSE;
+  else
+    {
+      idx = shortcuts_get_index (impl, SHORTCUTS_SEARCH_SEPARATOR);
+      if (idx == indices[0])
+	retval = FALSE;
+    }
+
+  gtk_tree_path_free (tree_path);
+
+  return retval;
 }
 
 /* Creates the combo box with the save folders */
@@ -3999,8 +4299,14 @@ save_folder_combo_create (GtkFileChooser
   GtkWidget *combo;
   GtkCellRenderer *cell;
 
+  impl->shortcuts_combo_filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (impl->shortcuts_model), NULL);
+  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model),
+					  shortcuts_combo_filter_func,
+					  impl,
+					  NULL);
+
   combo = g_object_new (GTK_TYPE_COMBO_BOX,
-			"model", impl->shortcuts_model,
+			"model", impl->shortcuts_combo_filter_model,
 			"focus-on-click", FALSE,
                         NULL);
   gtk_widget_show (combo);
@@ -4022,8 +4328,7 @@ save_folder_combo_create (GtkFileChooser
 
   gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
 					shortcuts_row_separator_func,
-					GINT_TO_POINTER (SHORTCUTS_COL_NAME),
-					NULL);
+					NULL, NULL);
 
   g_signal_connect (combo, "changed",
 		    G_CALLBACK (save_folder_combo_changed_cb), impl);
@@ -4043,6 +4348,8 @@ save_widgets_create (GtkFileChooserDefau
   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);
@@ -4051,7 +4358,7 @@ save_widgets_create (GtkFileChooserDefau
   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);
@@ -4061,17 +4368,19 @@ save_widgets_create (GtkFileChooserDefau
 		    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);
@@ -4115,84 +4424,329 @@ save_widgets_destroy (GtkFileChooserDefa
 
   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);
+
+  if (text)
+    {
+      gboolean need_slash;
+      int len;
+
+      len = strlen (text);
+      need_slash = (text[len - 1] != G_DIR_SEPARATOR);
+
+      if (need_slash)
+	{
+	  char *slash_text;
+
+	  slash_text = g_new (char, len + 2);
+	  strcpy (slash_text, text);
+	  slash_text[len] = G_DIR_SEPARATOR;
+	  slash_text[len + 1] = 0;
+
+	  g_free (text);
+	  text = slash_text;
+	}
+
+      _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), text);
+      g_free (text);
+    }
 }
 
-static GObject*
-gtk_file_chooser_default_constructor (GType                  type,
-				      guint                  n_construct_properties,
-				      GObjectConstructParam *construct_params)
+/* 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)
 {
-  GtkFileChooserDefault *impl;
-  GObject *object;
+  if (impl->location_entry)
+    gtk_widget_destroy (impl->location_entry);
 
-  object = parent_class->constructor (type,
-				      n_construct_properties,
-				      construct_params);
-  impl = GTK_FILE_CHOOSER_DEFAULT (object);
+  /* Box */
 
-  g_assert (impl->file_system);
+  gtk_widget_show (impl->location_entry_box);
 
-  gtk_widget_push_composite_child ();
+  /* Entry */
 
-  /* Shortcuts model */
+  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);
 
-  shortcuts_model_create (impl);
+  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);
 
-  /* The browse widgets */
-  impl->browse_widgets = browse_widgets_create (impl);
-  gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0);
+  /* Configure the entry */
 
-  /* 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_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
+  location_entry_set_initial_text (impl);
 
-  gtk_widget_pop_composite_child ();
-  update_appearance (impl);
+  /* Done */
 
-  return object;
+  gtk_widget_show (impl->location_entry);
+  gtk_widget_grab_focus (impl->location_entry);
 }
 
-/* Sets the extra_widget by packing it in the appropriate place */
+/* Sets a new location mode.  set_buttons determines whether the toggle button
+ * for the mode will also be changed.
+ */
 static void
-set_extra_widget (GtkFileChooserDefault *impl,
-		  GtkWidget             *extra_widget)
+location_mode_set (GtkFileChooserDefault *impl,
+		   LocationMode new_mode,
+		   gboolean set_button)
 {
-  if (extra_widget)
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
     {
-      g_object_ref (extra_widget);
+      GtkWindow *toplevel;
+      GtkWidget *current_focus;
+      gboolean button_active;
+      gboolean switch_to_file_list;
+
+      switch (new_mode)
+	{
+	case LOCATION_MODE_PATH_BAR:
+	  button_active = FALSE;
+
+	  /* 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 *hpaned;
+  GtkWidget *widget;
+  GtkSizeGroup *size_group;
+
+  /* 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 */
+  impl->browse_path_bar_hbox = gtk_hbox_new (FALSE, 12);
+  gtk_widget_show (impl->browse_path_bar_hbox);
+
+  location_button_create (impl);
+  gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_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 (impl->browse_path_bar_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 (impl->browse_path_bar_hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), impl->browse_path_bar_hbox, 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);
+
+  impl->location_label = gtk_label_new_with_mnemonic ("<b>_Location:</b>");
+  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;
+
+  object = 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);
+
+  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);
     }
@@ -4359,6 +4913,7 @@ update_appearance (GtkFileChooserDefault
     {
       const char *text;
 
+      gtk_widget_hide (impl->location_button);
       save_widgets_create (impl);
 
       if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
@@ -4368,8 +4923,6 @@ update_appearance (GtkFileChooserDefault
 
       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);
@@ -4395,10 +4948,15 @@ update_appearance (GtkFileChooserDefault
   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
@@ -4600,6 +5158,9 @@ gtk_file_chooser_default_dispose (GObjec
       impl->extra_widget = NULL;
     }
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    search_stop_searching (impl);
+
   remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -4801,6 +5362,40 @@ get_is_file_filtered (GtkFileChooserDefa
   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)
@@ -4814,33 +5409,36 @@ gtk_file_chooser_default_map (GtkWidget 
 
   GTK_WIDGET_CLASS (parent_class)->map (widget);
 
-  switch (impl->reload_state)
-    {
-    case RELOAD_EMPTY:
-      /* The user didn't explicitly give us a folder to display, so we'll use the cwd */
-      current_working_dir = g_get_current_dir ();
-      gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (impl), current_working_dir);
-      g_free (current_working_dir);
-      break;
-
-    case RELOAD_HAS_FOLDER:
-      /* Nothing; we are already loading or loaded, so we don't need to reload */
-      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);
-      break;
+  if (impl->operation_mode == OPERATION_MODE_BROWSE)
+    switch (impl->reload_state)
+      {
+      case RELOAD_EMPTY:
+	/* The user didn't explicitly give us a folder to display, so we'll use the cwd */
+	current_working_dir = g_get_current_dir ();
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (impl), current_working_dir);
+	g_free (current_working_dir);
+	break;
+
+      case RELOAD_HAS_FOLDER:
+	/* Nothing; we are already loading or loaded, so we don't need to reload */
+	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);
+	break;
 
-    default:
-      g_assert_not_reached ();
-    }
+      default:
+	g_assert_not_reached ();
+      }
 
   bookmarks_changed_cb (impl->file_system, impl);
 
+  settings_load (impl);
+
   profile_end ("end", NULL);
 }
 
@@ -4852,6 +5450,8 @@ gtk_file_chooser_default_unmap (GtkWidge
 
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
+  settings_save (impl);
+
   GTK_WIDGET_CLASS (parent_class)->unmap (widget);
 
   impl->reload_state = RELOAD_WAS_UNMAPPED;
@@ -5216,6 +5816,8 @@ pending_select_paths_process (GtkFileCho
   g_assert (impl->browse_files_model != NULL);
   g_assert (impl->sort_model != NULL);
 
+  impl->processing_pending_selections = TRUE;
+
   if (impl->pending_select_paths)
     {
       /* NULL GError */
@@ -5231,17 +5833,13 @@ pending_select_paths_process (GtkFileCho
        * but rather on behalf of something else like GtkFileChooserButton.  In
        * that case, the chooser's selection should be what the caller expects,
        * as the user can't see that something else got selected.  See bug #165264.
-       *
-       * Also, we don't select the first file if we are not in OPEN mode.  Doing
-       * so would change the contents of the filename entry for SAVE or
-       * CREATE_FOLDER, which is undesired; in SELECT_FOLDER, we don't want to
-       * select a *different* folder from the one into which the user just
-       * navigated.
        */
-      if (GTK_WIDGET_MAPPED (impl) && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+      if (GTK_WIDGET_MAPPED (impl))
 	browse_files_select_first_row (impl);
     }
 
+  impl->processing_pending_selections = FALSE;
+
   g_assert (impl->pending_select_paths == NULL);
 }
 
@@ -5280,15 +5878,9 @@ browse_files_model_finished_loading_cb (
   profile_end ("end", NULL);
 }
 
-/* Gets rid of the old list model and creates a new one for the current folder */
-static gboolean
-set_list_model (GtkFileChooserDefault *impl,
-		GError               **error)
+static void
+stop_loading_and_clear_list_model (GtkFileChooserDefault *impl)
 {
-  g_assert (impl->current_folder != NULL);
-
-  profile_start ("start", NULL);
-
   load_remove_timer (impl); /* This changes the state to LOAD_EMPTY */
 
   if (impl->browse_files_model)
@@ -5303,8 +5895,21 @@ set_list_model (GtkFileChooserDefault *i
       impl->sort_model = NULL;
     }
 
-  set_busy_cursor (impl, TRUE);
   gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+}
+
+/* Gets rid of the old list model and creates a new one for the current folder */
+static gboolean
+set_list_model (GtkFileChooserDefault *impl,
+		GError               **error)
+{
+  g_assert (impl->current_folder != NULL);
+
+  profile_start ("start", NULL);
+
+  stop_loading_and_clear_list_model (impl);
+
+  set_busy_cursor (impl, TRUE);
 
   impl->browse_files_model = _gtk_file_system_model_new (impl->file_system,
 							 impl->current_folder, 0,
@@ -5331,22 +5936,49 @@ set_list_model (GtkFileChooserDefault *i
   return TRUE;
 }
 
+struct update_chooser_entry_selected_foreach_closure {
+  int num_selected;
+  GtkTreeIter first_selected_iter;
+};
+
+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->processing_pending_selections)
     return;
 
-  g_assert (!impl->select_multiple);
+  if (impl->operation_mode == OPERATION_MODE_SEARCH || !impl->location_entry)
+    return;
+
+  g_assert (impl->location_entry != NULL);
+
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
 
-  if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+  closure.num_selected = 0;
+  gtk_tree_selection_selected_foreach (selection, update_chooser_entry_selected_foreach, &closure);
+
+  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
@@ -5355,24 +5987,49 @@ update_chooser_entry (GtkFileChooserDefa
        * 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;
+	file_part = "";
     }
+  else if (closure.num_selected == 1)
+    {
+      if (impl->operation_mode == OPERATION_MODE_BROWSE)
+	{
+	  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... */
+	  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+	      || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+	      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+	    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 CREATE_FOLDER mode */
+
+	  if (change_entry)
+	    file_part = gtk_file_info_get_display_name (info);
+	}
+      else
+	{
+	  gtk_tree_model_get (GTK_TREE_MODEL (impl->search_model), &closure.first_selected_iter,
+			      SEARCH_MODEL_COL_DISPLAY_NAME, &file_part,
+			      -1);
+	}
+    }
   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));
+      /* Multiple selection, so just clear the entry. */
+      file_part = "";
+    }
 
-  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));
+  if (file_part)
+    _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), file_part);
 }
 
 static gboolean
@@ -5394,6 +6051,8 @@ gtk_file_chooser_default_update_current_
 
   profile_start ("start", (char *) path);
 
+  search_switch_to_browse_mode (impl);
+
   g_assert (path != NULL);
 
   if (impl->local_only &&
@@ -5444,8 +6103,8 @@ gtk_file_chooser_default_update_current_
 
   /* 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
@@ -5474,6 +6133,9 @@ gtk_file_chooser_default_get_current_fol
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    return NULL;
+
   if (impl->reload_state == RELOAD_EMPTY)
     {
       char *current_working_dir;
@@ -5502,7 +6164,7 @@ gtk_file_chooser_default_set_current_nam
 		    || 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
@@ -5536,7 +6198,7 @@ gtk_file_chooser_default_select_path (Gt
   if (!parent_path)
     return _gtk_file_chooser_set_current_folder_path (chooser, path, error);
 
-  if (impl->load_state == LOAD_EMPTY)
+  if (impl->operation_mode == OPERATION_MODE_SEARCH || impl->load_state == LOAD_EMPTY)
     same_path = FALSE;
   else
     {
@@ -5632,6 +6294,16 @@ static void
 gtk_file_chooser_default_select_all (GtkFileChooser *chooser)
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
+
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      GtkTreeSelection *selection;
+
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+      gtk_tree_selection_select_all (selection);
+      return;
+    }
+
   if (impl->select_multiple)
     gtk_tree_model_foreach (GTK_TREE_MODEL (impl->sort_model), 
 			    maybe_select, impl);
@@ -5670,9 +6342,12 @@ check_save_entry (GtkFileChooserDefault 
   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)
     {
@@ -5751,17 +6426,38 @@ gtk_file_chooser_default_get_paths (GtkF
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
   struct get_paths_closure info;
+  GtkWindow *toplevel;
+  GtkWidget *current_focus;
+
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    return search_get_selected_paths (impl);
 
   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);
+    }
+  else if (impl->location_entry && current_focus == impl->location_entry)
+    {
+      gboolean is_well_formed, is_empty, is_file_part_empty;
+
+    file_entry:
+
+      check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty);
 
       if (!is_well_formed)
 	return NULL;
@@ -5774,19 +6470,23 @@ gtk_file_chooser_default_get_paths (GtkF
 	      return NULL;
 	    }
 	}
-    }
 
-  if (!info.path_from_entry || impl->select_multiple)
+      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);
-
   /* 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 &&
@@ -5926,13 +6626,16 @@ gtk_file_chooser_default_add_shortcut_fo
 
   pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
 
-  result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);
+  result = shortcuts_insert_path (impl, pos, SHORTCUT_TYPE_PATH, NULL, path, NULL, FALSE, error);
 
   if (result)
     impl->num_shortcuts++;
 
-  if (impl->shortcuts_filter_model)
-    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
+  if (impl->shortcuts_pane_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+
+  if (impl->shortcuts_combo_filter_model)
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_combo_filter_model));
 
   return result;
 }
@@ -5958,15 +6661,15 @@ gtk_file_chooser_default_remove_shortcut
   for (i = 0; i < impl->num_shortcuts; i++)
     {
       gpointer col_data;
-      gboolean is_volume;
+      ShortcutType shortcut_type;
       GtkFilePath *shortcut;
 
       gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
 			  SHORTCUTS_COL_DATA, &col_data,
-			  SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			  SHORTCUTS_COL_TYPE, &shortcut_type,
 			  -1);
       g_assert (col_data != NULL);
-      g_assert (!is_volume);
+      g_assert (shortcut_type == SHORTCUT_TYPE_PATH);
 
       shortcut = col_data;
       if (gtk_file_path_compare (shortcut, path) == 0)
@@ -6014,15 +6717,15 @@ gtk_file_chooser_default_list_shortcut_f
   for (i = 0; i < impl->num_shortcuts; i++)
     {
       gpointer col_data;
-      gboolean is_volume;
+      ShortcutType shortcut_type;
       GtkFilePath *shortcut;
 
       gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
 			  SHORTCUTS_COL_DATA, &col_data,
-			  SHORTCUTS_COL_IS_VOLUME, &is_volume,
+			  SHORTCUTS_COL_TYPE, &shortcut_type,
 			  -1);
       g_assert (col_data != NULL);
-      g_assert (!is_volume);
+      g_assert (shortcut_type == SHORTCUT_TYPE_PATH);
 
       shortcut = col_data;
       list = g_slist_prepend (list, gtk_file_path_copy (shortcut));
@@ -6353,6 +7056,23 @@ should_respond_after_confirm_overwrite (
     }
 }
 
+/* Gives the focus to the browse tree view only if it is visible */
+static void
+focus_browse_tree_view_if_possible (GtkFileChooserDefault *impl)
+{
+  gboolean do_focus;
+
+  if ((impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+       || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+      && !gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
+    do_focus = FALSE;
+  else
+    do_focus = TRUE;
+
+  if (do_focus)
+    gtk_widget_grab_focus (impl->browse_files_tree_view);
+}
+
 /* Implementation for GtkFileChooserEmbed::should_respond() */
 static gboolean
 gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
@@ -6399,6 +7119,9 @@ gtk_file_chooser_default_should_respond 
 
       g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action <= GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
 
+      if (impl->operation_mode == OPERATION_MODE_SEARCH)
+	return search_should_respond (impl);
+
       selection_check (impl, &num_selected, &all_files, &all_folders);
 
       if (num_selected > 2)
@@ -6444,7 +7167,7 @@ gtk_file_chooser_default_should_respond 
 	  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;
@@ -6456,9 +7179,12 @@ gtk_file_chooser_default_should_respond 
     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);
+      entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
       check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty);
 
       if (is_empty || !is_well_formed)
@@ -6470,27 +7196,35 @@ gtk_file_chooser_default_should_respond 
       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;
 
 	  file_exists_and_is_not_folder = g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER);
-
-	  if (impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER && file_exists_and_is_not_folder)
+	  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+	    retval = TRUE; /* user typed a filename; we are done */
+	  else 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);
@@ -6514,7 +7248,7 @@ gtk_file_chooser_default_should_respond 
 			{
 			  const char *file_part;
 
-			  file_part = _gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry));
+			  file_part = _gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry));
 			  retval = should_respond_after_confirm_overwrite (impl, file_part, parent_path);
 			}
 		      else
@@ -6562,8 +7296,7 @@ gtk_file_chooser_default_should_respond 
       if (shortcuts_get_selected (impl, &iter))
 	{
 	  shortcuts_activate_iter (impl, &iter);
-	  
-	  gtk_widget_grab_focus (impl->browse_files_tree_view);
+	  focus_browse_tree_view_if_possible (impl);
 	}
       else
 	goto file_list;
@@ -6577,6 +7310,18 @@ gtk_file_chooser_default_should_respond 
        */
       goto file_list;
     }
+  else if (impl->operation_mode == OPERATION_MODE_SEARCH && impl->toplevel_last_focus_widget == impl->search_entry)
+    {
+      search_entry_activate_cb (GTK_ENTRY (impl->search_entry), impl);
+      return FALSE;
+    }
+  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
@@ -6600,19 +7345,467 @@ gtk_file_chooser_default_initial_focus (
 
   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);
 }
 
+/* Callback used from gtk_tree_selection_selected_foreach(); gets the selected GtkFilePaths */
+static void
+search_selected_foreach_get_path_cb (GtkTreeModel *model,
+				     GtkTreePath  *path,
+				     GtkTreeIter  *iter,
+				     gpointer      data)
+{
+  GSList **list;
+  const GtkFilePath *file_path;
+  GtkFilePath *file_path_copy;
+
+  list = data;
+
+  gtk_tree_model_get (model, iter, SEARCH_MODEL_COL_PATH, &file_path, -1);
+  file_path_copy = gtk_file_path_copy (file_path);
+  *list = g_slist_prepend (*list, file_path_copy);
+}
+
+/* Constructs a list of the selected paths in search mode */
+static GSList *
+search_get_selected_paths (GtkFileChooserDefault *impl)
+{
+  GSList *result;
+  GtkTreeSelection *selection;
+
+  result = NULL;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+  gtk_tree_selection_selected_foreach (selection, search_selected_foreach_get_path_cb, &result);
+  result = g_slist_reverse (result);
+
+  return result;
+}
+
+/* Called from ::should_respond().  We return whether there are selected files
+ * in the search list.
+ */
+static gboolean
+search_should_respond (GtkFileChooserDefault *impl)
+{
+  GtkTreeSelection *selection;
+
+  g_assert (impl->operation_mode == OPERATION_MODE_SEARCH);
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+  return (gtk_tree_selection_count_selected_rows (selection) != 0);
+}
+
+/* Adds one hit from Beagle to the search_model */
+static void
+search_add_hit (GtkFileChooserDefault *impl,
+		BeagleHit *hit)
+{
+  const char *uri;
+  GtkFilePath *path;
+  char *filename;
+  char *display_name;
+  char *collation_key;
+  struct stat statbuf;
+  struct stat *statbuf_copy;
+  GtkTreeIter iter;
+
+  uri = beagle_hit_get_uri (hit);
+
+  path = gtk_file_system_uri_to_path (impl->file_system, uri);
+  if (!path)
+    return;
+
+  filename = gtk_file_system_path_to_filename (impl->file_system, path);
+  if (!filename)
+    {
+      gtk_file_path_free (path);
+      return;
+    }
+
+  if (stat (filename, &statbuf) != 0)
+    {
+      gtk_file_path_free (path);
+      g_free (filename);
+      return;
+    }
+
+  statbuf_copy = g_new (struct stat, 1);
+  *statbuf_copy = statbuf;
+
+  display_name = g_filename_display_name (filename);
+  collation_key = g_utf8_collate_key_for_filename (display_name, -1);
+
+  gtk_list_store_insert_with_values (impl->search_model, &iter, -1,
+				     SEARCH_MODEL_COL_PATH, path,
+				     SEARCH_MODEL_COL_DISPLAY_NAME, display_name,
+				     SEARCH_MODEL_COL_COLLATION_KEY, collation_key,
+				     SEARCH_MODEL_COL_STAT, statbuf_copy,
+				     -1);
+}
+
+/* Callback used from BeagleQuery when we get new hits */
+static void
+search_query_hits_added_cb (BeagleQuery *query,
+			    BeagleHitsAddedResponse *response,
+			    gpointer data)
+{
+  GtkFileChooserDefault *impl;
+  GSList *hits, *l;
+
+  impl = GTK_FILE_CHOOSER_DEFAULT (data);
+
+  /* The list we get from beagle_hits_added_response_get_hits() is immutable, so don't free it */
+  hits = beagle_hits_added_response_get_hits (response);
+  for (l = hits; l; l = l->next)
+    {
+      BeagleHit *hit;
+
+      hit = BEAGLE_HIT (l->data);
+      search_add_hit (impl, hit);
+    }
+}
+
+/* Callback used from BeagleQuery when the query is done running */
+static void
+search_query_finished_cb (BeagleQuery *query,
+			  BeagleFinishedResponse *response,
+			  gpointer data)
+{
+  GtkFileChooserDefault *impl;
+
+  impl = GTK_FILE_CHOOSER_DEFAULT (data);
+
+  /* FMQ: if search was empty, say that we got no hits */
+
+  set_busy_cursor (impl, FALSE);
+}
+
+/* Displays a generic error when we cannot create a BeagleClient.  It would be
+ * better if beagle_client_new() gave us a GError with a better message, but it
+ * doesn't do that right now.
+ */
+static void
+search_error_could_not_create_client (GtkFileChooserDefault *impl)
+{
+  error_message (impl,
+		 _("Could not start the search process"),
+		 _("The program was not able to create a connection to the Beagle "
+		   "daemon.  Please make sure Beagle is running."));
+}
+
+/* Frees the data in the search_model */
+static void
+search_clear_model (GtkFileChooserDefault *impl, gboolean remove_from_treeview)
+{
+  GtkTreeIter iter;
+
+  if (!impl->search_model)
+    return;
+
+  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->search_model), &iter))
+    do
+      {
+	GtkFilePath *path;
+	char *display_name;
+	char *collation_key;
+	struct stat *statbuf;
+
+	gtk_tree_model_get (GTK_TREE_MODEL (impl->search_model), &iter,
+			    SEARCH_MODEL_COL_PATH, &path,
+			    SEARCH_MODEL_COL_DISPLAY_NAME, &display_name,
+			    SEARCH_MODEL_COL_COLLATION_KEY, &collation_key,
+			    SEARCH_MODEL_COL_STAT, &statbuf,
+			    -1);
+
+	gtk_file_path_free (path);
+	g_free (display_name);
+	g_free (collation_key);
+	g_free (statbuf);
+      }
+    while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->search_model), &iter));
+
+  g_object_unref (impl->search_model);
+  impl->search_model = NULL;
+
+  if (remove_from_treeview)
+    gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+}
+
+/* Stops any ongoing searches; does not touch the search_model */
+static void
+search_stop_searching (GtkFileChooserDefault *impl)
+{
+  if (impl->search_query)
+    {
+      g_object_unref (impl->search_query);
+      impl->search_query = NULL;
+    }
+
+  if (impl->search_client)
+    {
+      g_object_unref (impl->search_client);
+      impl->search_client = NULL;
+    }
+}
+
+/* Stops any pending searches, clears the file list, and switches back to OPERATION_MODE_BROWSE */
+static void
+search_switch_to_browse_mode (GtkFileChooserDefault *impl)
+{
+  if (impl->operation_mode == OPERATION_MODE_BROWSE)
+    return;
+
+  search_stop_searching (impl);
+  search_clear_model (impl, TRUE);
+
+  gtk_widget_destroy (impl->search_hbox);
+  impl->search_hbox = NULL;
+  impl->search_entry = NULL;
+
+  gtk_widget_show (impl->browse_path_bar);
+  gtk_widget_show (impl->browse_new_folder_button);
+
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+    {
+      gtk_widget_show (impl->location_button);
+
+      if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+	gtk_widget_show (impl->location_entry_box);
+    }
+
+  impl->operation_mode = OPERATION_MODE_BROWSE;
+
+  file_list_set_sort_column_ids (impl);
+}
+
+/* Sort callback from the path column */
+static gint
+search_column_path_sort_func (GtkTreeModel *model,
+			      GtkTreeIter  *a,
+			      GtkTreeIter  *b,
+			      gpointer      user_data)
+{
+  const char *collation_key_a, *collation_key_b;
+
+  gtk_tree_model_get (model, a, SEARCH_MODEL_COL_COLLATION_KEY, &collation_key_a, -1);
+  gtk_tree_model_get (model, b, SEARCH_MODEL_COL_COLLATION_KEY, &collation_key_b, -1);
+
+  return strcmp (collation_key_a, collation_key_b);
+}
+
+/* Sort callback from the modification time column */
+static gint
+search_column_mtime_sort_func (GtkTreeModel *model,
+			       GtkTreeIter  *a,
+			       GtkTreeIter  *b,
+			       gpointer      user_data)
+{
+  const struct stat *statbuf_a, *statbuf_b;
+
+  /* Note that although we store a whole struct stat in the model, we only
+   * compare the mtime here.  If we add another column relative to a struct stat
+   * (e.g. a file size column), we'll want another sort callback similar to this
+   * one as well.
+   */
+
+  gtk_tree_model_get (model, a, SEARCH_MODEL_COL_STAT, &statbuf_a, -1);
+  gtk_tree_model_get (model, b, SEARCH_MODEL_COL_STAT, &statbuf_b, -1);
+
+  if (statbuf_a->st_mtime < statbuf_b->st_mtime)
+    return -1;
+  else if (statbuf_a->st_mtime > statbuf_b->st_mtime)
+    return 1;
+  else
+    return 0;
+}
+
+/* Creates the search_model and puts it in the tree view */
+static void
+search_setup_model (GtkFileChooserDefault *impl)
+{
+  g_assert (impl->search_model == NULL);
+
+  /* We store these columns in the search model:
+   *
+   * SEARCH_MODEL_COL_PATH - a GtkFilePath for the hit's URI (stored as a pointer, not as a GTK_TYPE_FILE_PATH)
+   * SEARCH_MODEL_COL_DISPLAY_NAME - a string with the display name (stored as a pointer, not as a G_TYPE_STRING)
+   * SEARCH_MODEL_COL_COLLATION_KEY - collation key for the filename (stored as a pointer, not as a G_TYPE_STRING)
+   * SEARCH_MODEL_COL_STAT - pointer to a struct stat
+   *
+   * Keep this in sync with the enumeration defined near the beginning of this file.
+   */
+  impl->search_model = gtk_list_store_new (4,
+					   G_TYPE_POINTER,
+					   G_TYPE_POINTER,
+					   G_TYPE_POINTER,
+					   G_TYPE_POINTER);
+  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
+				   SEARCH_MODEL_COL_PATH,
+				   search_column_path_sort_func,
+				   impl,
+				   NULL);
+  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
+				   SEARCH_MODEL_COL_STAT,
+				   search_column_mtime_sort_func,
+				   impl,
+				   NULL);
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), GTK_TREE_MODEL (impl->search_model));
+}
+
+/* Creates a new Beagle query with the specified text and launches it */
+static void
+search_start_query (GtkFileChooserDefault *impl,
+		    const char *query_text)
+{
+  GError *error;
+  BeagleQueryPartProperty *part;
+
+  search_stop_searching (impl);
+  search_clear_model (impl, TRUE);
+  search_setup_model (impl);
+  set_busy_cursor (impl, TRUE);
+
+  impl->search_client = beagle_client_new (NULL);
+  if (!impl->search_client)
+    {
+      set_busy_cursor (impl, FALSE);
+      search_error_could_not_create_client (impl); /* lame; we don't get an error code or anything */
+      return;
+    }
+
+  impl->search_query = beagle_query_new ();
+  g_signal_connect (impl->search_query, "hits-added",
+		    G_CALLBACK (search_query_hits_added_cb), impl);
+  g_signal_connect (impl->search_query, "finished",
+		    G_CALLBACK (search_query_finished_cb), impl);
+
+  beagle_query_add_text (impl->search_query, query_text);
+  beagle_query_add_hit_type (impl->search_query, "File");
+
+  /* Don't let the system documentation appear in the hits */
+
+  part = beagle_query_part_property_new ();
+  beagle_query_part_set_logic (BEAGLE_QUERY_PART (part), BEAGLE_QUERY_PART_LOGIC_PROHIBITED);
+  beagle_query_part_property_set_key (part, "beagle:Source");
+  beagle_query_part_property_set_value (part, "documentation");
+  beagle_query_part_property_set_property_type (part, BEAGLE_PROPERTY_TYPE_KEYWORD);
+  beagle_query_add_part (impl->search_query, BEAGLE_QUERY_PART (part)); /* the query takes ownership of the part */
+
+  error = NULL;
+  if (!beagle_client_send_request_async (impl->search_client, BEAGLE_REQUEST (impl->search_query), &error))
+    {
+      search_stop_searching (impl);
+      error_message (impl,
+		     _("Could not send the search request"),
+		     error->message);
+      g_error_free (error);
+      set_busy_cursor (impl, FALSE);
+    }
+}
+
+/* Callback used when the user presses Enter while typing on the search entry; starts the query */
+static void
+search_entry_activate_cb (GtkEntry *entry,
+			  gpointer data)
+{
+  GtkFileChooserDefault *impl;
+  const char *text;
+
+  impl = GTK_FILE_CHOOSER_DEFAULT (data);
+
+  text = gtk_entry_get_text (GTK_ENTRY (impl->search_entry));
+  if (strlen (text) == 0)
+    return;
+
+  search_start_query (impl, text);
+}
+
+/* Hides the path bar and creates the search entry */
+static void
+search_setup_widgets (GtkFileChooserDefault *impl)
+{
+  GtkWidget *label;
+
+  impl->search_hbox = gtk_hbox_new (FALSE, 12);
+
+  /* Label */
+
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), "<b>Search:</b>");
+  gtk_box_pack_start (GTK_BOX (impl->search_hbox), label, FALSE, FALSE, 0);
+
+  /* Entry */
+
+  impl->search_entry = gtk_entry_new ();
+  g_signal_connect (impl->search_entry, "activate",
+		    G_CALLBACK (search_entry_activate_cb),
+		    impl);
+  gtk_box_pack_start (GTK_BOX (impl->search_hbox), impl->search_entry, TRUE, TRUE, 0);
+
+  gtk_widget_hide (impl->browse_path_bar);
+  gtk_widget_hide (impl->browse_new_folder_button);
+
+  /* Box for search widgets */
+
+  gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->search_hbox, TRUE, TRUE, 0);
+  gtk_widget_show_all (impl->search_hbox);
+
+  /* Hide the location widgets temporarily */
+
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+    {
+      gtk_widget_hide (impl->location_button);
+      gtk_widget_hide (impl->location_entry_box);
+    }
+
+  gtk_widget_grab_focus (impl->search_entry);
+
+  /* FMQ: hide the filter combo? */
+}
+
+/* Main entry point to the searching functions; this gets called when the user
+ * activates the Search shortcut.
+ */
+static void
+search_activate (GtkFileChooserDefault *impl)
+{
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      gtk_widget_grab_focus (impl->search_entry);
+      return;
+    }
+
+  impl->operation_mode = OPERATION_MODE_SEARCH;
+
+  g_assert (impl->search_hbox == NULL);
+  g_assert (impl->search_entry == NULL);
+  g_assert (impl->search_model == NULL);
+
+  stop_loading_and_clear_list_model (impl);
+  search_setup_widgets (impl);
+  file_list_set_sort_column_ids (impl);
+}
+
 static void
 set_current_filter (GtkFileChooserDefault *impl,
 		    GtkFileFilter         *filter)
@@ -6662,26 +7855,45 @@ check_preview_change (GtkFileChooserDefa
 {
   GtkTreePath *cursor_path;
   const GtkFilePath *new_path;
-  const GtkFileInfo *new_info;
+  const char *new_display_name;
 
   gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL);
-  if (cursor_path && impl->sort_model)
-    {
-      GtkTreeIter iter;
-      GtkTreeIter child_iter;
 
-      gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path);
-      gtk_tree_path_free (cursor_path);
+  new_path = NULL;
+  new_display_name = NULL;
 
-      gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter);
-
-      new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter);
-      new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
-    }
-  else
+  if (cursor_path)
     {
-      new_path = NULL;
-      new_info = NULL;
+      if (impl->operation_mode == OPERATION_MODE_BROWSE)
+	{
+	  if (impl->sort_model)
+	    {
+	      GtkTreeIter iter;
+	      GtkTreeIter child_iter;
+	      const GtkFileInfo *new_info;
+
+	      gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path);
+	      gtk_tree_path_free (cursor_path);
+
+	      gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter);
+
+	      new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter);
+	      new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
+	      new_display_name = gtk_file_info_get_display_name (new_info);
+	    }
+	}
+      else
+	{
+	  GtkTreeIter iter;
+
+	  gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->search_model), &iter, cursor_path);
+	  gtk_tree_path_free (cursor_path);
+
+	  gtk_tree_model_get (GTK_TREE_MODEL (impl->search_model), &iter,
+			      SEARCH_MODEL_COL_PATH, &new_path,
+			      SEARCH_MODEL_COL_DISPLAY_NAME, &new_display_name,
+			      -1);
+	}
     }
 
   if (new_path != impl->preview_path &&
@@ -6697,7 +7909,7 @@ check_preview_change (GtkFileChooserDefa
       if (new_path)
 	{
 	  impl->preview_path = gtk_file_path_copy (new_path);
-	  impl->preview_display_name = g_strdup (gtk_file_info_get_display_name (new_info));
+	  impl->preview_display_name = g_strdup (new_display_name);
 	}
       else
 	{
@@ -6721,6 +7933,8 @@ shortcuts_activate_volume (GtkFileChoose
 {
   GtkFilePath *path;
 
+  search_switch_to_browse_mode (impl);
+
   /* We ref the file chooser since volume_mount() may run a main loop, and the
    * user could close the file chooser window in the meantime.
    */
@@ -6757,6 +7971,8 @@ shortcuts_activate_volume (GtkFileChoose
   if (path != NULL)
     {
       change_folder_and_display_error (impl, path);
+      focus_browse_tree_view_if_possible (impl);
+
       gtk_file_path_free (path);
     }
 
@@ -6771,17 +7987,16 @@ shortcuts_activate_iter (GtkFileChooserD
 			 GtkTreeIter           *iter)
 {
   gpointer col_data;
-  gboolean is_volume;
+  ShortcutType shortcut_type;
 
   gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
 		      SHORTCUTS_COL_DATA, &col_data,
-		      SHORTCUTS_COL_IS_VOLUME, &is_volume,
+		      SHORTCUTS_COL_TYPE, &shortcut_type,
 		      -1);
 
-  if (!col_data)
-    return; /* We are on a separator */
-
-  if (is_volume)
+  if (shortcut_type == SHORTCUT_TYPE_SEPARATOR)
+    return;
+  else if (shortcut_type == SHORTCUT_TYPE_VOLUME)
     {
       GtkFileSystemVolume *volume;
 
@@ -6789,12 +8004,17 @@ shortcuts_activate_iter (GtkFileChooserD
 
       shortcuts_activate_volume (impl, volume);
     }
-  else
+  else if (shortcut_type == SHORTCUT_TYPE_PATH)
     {
       const GtkFilePath *file_path;
 
       file_path = col_data;
       change_folder_and_display_error (impl, file_path);
+      focus_browse_tree_view_if_possible (impl);
+    }
+  else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
+    {
+      search_activate (impl);
     }
 }
 
@@ -6808,15 +8028,13 @@ shortcuts_row_activated_cb (GtkTreeView 
   GtkTreeIter iter;
   GtkTreeIter child_iter;
 
-  if (!gtk_tree_model_get_iter (impl->shortcuts_filter_model, &iter, path))
+  if (!gtk_tree_model_get_iter (impl->shortcuts_pane_filter_model, &iter, path))
     return;
 
-  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
+  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model),
 						    &child_iter,
 						    &iter);
   shortcuts_activate_iter (impl, &child_iter);
-
-  gtk_widget_grab_focus (impl->browse_files_tree_view);
 }
 
 /* Handler for GtkWidget::key-press-event on the shortcuts list */
@@ -6856,8 +8074,15 @@ shortcuts_select_func  (GtkTreeSelection
 			gpointer           data)
 {
   GtkFileChooserDefault *impl = data;
+  GtkTreeIter filter_iter;
+  ShortcutType shortcut_type;
 
-  return (*gtk_tree_path_get_indices (path) != shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR));
+  if (!gtk_tree_model_get_iter (impl->shortcuts_pane_filter_model, &filter_iter, path))
+    g_assert_not_reached ();
+
+  gtk_tree_model_get (impl->shortcuts_pane_filter_model, &filter_iter, SHORTCUTS_COL_TYPE, &shortcut_type, -1);
+
+  return (shortcut_type != SHORTCUT_TYPE_SEPARATOR);
 }
 
 static gboolean
@@ -6869,6 +8094,9 @@ list_select_func  (GtkTreeSelection  *se
 {
   GtkFileChooserDefault *impl = data;
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    return TRUE;
+
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
       impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
     {
@@ -6894,7 +8122,7 @@ list_selection_changed (GtkTreeSelection
 			GtkFileChooserDefault *impl)
 {
   /* See if we are in the new folder editable row for Save mode */
-  if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+  if (impl->operation_mode == OPERATION_MODE_BROWSE && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
     {
       const GtkFileInfo *info;
       gboolean had_selection;
@@ -6909,6 +8137,8 @@ list_selection_changed (GtkTreeSelection
 
  out:
 
+  /* AQUI: cambiar las siguientes funciones para que acepten SEARCH */
+
   update_chooser_entry (impl);
   check_preview_change (impl);
   bookmarks_check_add_sensitivity (impl);
@@ -6926,6 +8156,12 @@ list_row_activated (GtkTreeView         
   GtkTreeIter iter, child_iter;
   const GtkFileInfo *info;
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      g_signal_emit_by_name (impl, "file-activated");
+      return;
+    }
+
   if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, path))
     return;
 
@@ -6996,6 +8232,15 @@ list_icon_data_func (GtkTreeViewColumn *
   const GtkFileInfo *info; 
   gboolean sensitive = TRUE;
 
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      g_object_set (cell,
+		    "pixbuf", NULL,
+		    "sensitive", TRUE,
+		    NULL);
+      return;
+    }
+
   profile_start ("start", NULL);
   
   info = get_list_file_info (impl, iter);
@@ -7040,19 +8285,38 @@ list_name_data_func (GtkTreeViewColumn *
 		     gpointer           data)
 {
   GtkFileChooserDefault *impl = data;
-  const GtkFileInfo *info = get_list_file_info (impl, iter);
-  gboolean sensitive = TRUE;
+  const GtkFileInfo *info;
+  gboolean sensitive;
+
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
+    {
+      char *display_name;
+
+      gtk_tree_model_get (GTK_TREE_MODEL (impl->search_model), iter,
+			  SEARCH_MODEL_COL_DISPLAY_NAME, &display_name,
+			  -1);
+      g_object_set (cell,
+		    "text", display_name,
+		    "sensitive", TRUE,
+		    "ellipsize", PANGO_ELLIPSIZE_START,
+		    NULL);
+      return;
+    }
+
+  info = get_list_file_info (impl, iter);
+  sensitive = TRUE;
 
   if (!info)
     {
       g_object_set (cell,
 		    "text", _("Type name of new folder"),
+		    "sensitive", TRUE,
+		    "ellipsize", PANGO_ELLIPSIZE_NONE,
 		    NULL);
 
       return;
     }
 
-
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
 	 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
     {
@@ -7062,6 +8326,7 @@ list_name_data_func (GtkTreeViewColumn *
   g_object_set (cell,
 		"text", gtk_file_info_get_display_name (info),
 		"sensitive", sensitive,
+		"ellipsize", PANGO_ELLIPSIZE_END,
 		NULL);
 }
 
@@ -7081,21 +8346,25 @@ list_size_data_func (GtkTreeViewColumn *
 
   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;
@@ -7103,6 +8372,7 @@ list_size_data_func (GtkTreeViewColumn *
   g_object_set (cell,
   		"text", str,
 		"sensitive", sensitive,
+		"alignment", PANGO_ALIGN_RIGHT,
 		NULL);
 
   g_free (str);
@@ -7118,7 +8388,6 @@ list_mtime_data_func (GtkTreeViewColumn 
 		      gpointer           data)
 {
   GtkFileChooserDefault *impl;
-  const GtkFileInfo *info;
   GtkFileTime time_mtime, time_now;
   GDate mtime, now;
   int days_diff;
@@ -7127,17 +8396,35 @@ list_mtime_data_func (GtkTreeViewColumn 
 
   impl = data;
 
-  info = get_list_file_info (impl, iter);
-  if (!info)
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
     {
-      g_object_set (cell,
-		    "text", "",
-		    "sensitive", TRUE,
-		    NULL);
-      return;
+      struct stat *statbuf;
+
+      gtk_tree_model_get (GTK_TREE_MODEL (impl->search_model), iter,
+			  SEARCH_MODEL_COL_STAT, &statbuf,
+			  -1);
+      time_mtime = statbuf->st_mtime;
     }
+  else
+    {
+      const GtkFileInfo *info;
+
+      info = get_list_file_info (impl, iter);
+      if (!info)
+	{
+	  g_object_set (cell,
+			"text", "",
+			"sensitive", TRUE,
+			NULL);
+	  return;
+	}
 
-  time_mtime = gtk_file_info_get_modification_time (info);
+      time_mtime = gtk_file_info_get_modification_time (info);
+
+      if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+	  impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+	sensitive = gtk_file_info_get_is_folder (info);
+    }
 
   if (time_mtime == 0)
     strcpy (buf, _("Unknown"));
@@ -7168,10 +8455,6 @@ list_mtime_data_func (GtkTreeViewColumn 
 	}
     }
 
-  if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
-      impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
-    sensitive = gtk_file_info_get_is_folder (info);
-
   g_object_set (cell,
 		"text", buf,
 		"sensitive", sensitive,
@@ -7186,250 +8469,49 @@ _gtk_file_chooser_default_new (const cha
 			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);
-  _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), impl->current_folder);
-  if (path[0])
-    gtk_entry_set_text (GTK_ENTRY (entry), path);
-  else
-    {
-      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_popup_handler (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)
+  if (impl->operation_mode == OPERATION_MODE_SEARCH)
     {
-      error_message_with_parent (parent,
-				 _("Cannot change folder"),
-				 _("The folder you specified is an invalid path."));
-      return FALSE;
-    }
+      GtkWidget *widget_to_focus;
 
-  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;
-	}
+      search_switch_to_browse_mode (impl); /* This will give us the location widgets back */
+      if (impl->current_folder)
+	change_folder_and_display_error (impl, impl->current_folder);
 
-      if (gtk_file_info_get_is_folder (info))
-	result = change_folder_and_display_error (impl, subfolder_path);
+      if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+	widget_to_focus = impl->browse_files_tree_view;
       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);
+	widget_to_focus = impl->location_entry;
 
-      if (info)
-	gtk_file_info_free (info);
-
-      return result;
+      gtk_widget_grab_focus (widget_to_focus);
+      return;
     }
 
-  g_assert_not_reached ();
-}
-
-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);
+      LocationMode new_mode;
 
-  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);
-
-  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 (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
-    {
-      if (update_from_entry (impl, GTK_WINDOW (dialog), GTK_FILE_CHOOSER_ENTRY (entry)))
+      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
 	{
-	  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);
-	    }
-	  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);
-	    }
-	  refocus = FALSE;
+	  g_assert_not_reached ();
+	  return;
 	}
-    }
-
-  if (refocus)
-    {
-      GtkWindow *toplevel;
 
-      toplevel = get_toplevel (GTK_WIDGET (impl));
-      if (toplevel && toplevel->focus_widget)
-	gtk_widget_grab_focus (toplevel->focus_widget);
+      location_mode_set (impl, new_mode, TRUE);
     }
-
-  gtk_widget_destroy (dialog);
+  else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+	   || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+    gtk_widget_grab_focus (impl->location_entry);
+  else
+    g_assert_not_reached ();
 }
 
 /* Handler for the "up-folder" keybinding signal */
@@ -7461,6 +8543,7 @@ switch_to_shortcut (GtkFileChooserDefaul
     g_assert_not_reached ();
 
   shortcuts_activate_iter (impl, &iter);
+  focus_browse_tree_view_if_possible (impl);
 }
 
 /* Handler for the "home-folder" keybinding signal */
@@ -7484,26 +8567,26 @@ desktop_folder_handler (GtkFileChooserDe
 /* Drag and drop interfaces */
 
 static void
-_shortcuts_model_filter_class_init (ShortcutsModelFilterClass *class)
+_shortcuts_pane_model_filter_class_init (ShortcutsPaneModelFilterClass *class)
 {
 }
 
 static void
-_shortcuts_model_filter_init (ShortcutsModelFilter *model)
+_shortcuts_pane_model_filter_init (ShortcutsPaneModelFilter *model)
 {
   model->impl = NULL;
 }
 
 /* GtkTreeDragSource::row_draggable implementation for the shortcuts filter model */
 static gboolean
-shortcuts_model_filter_row_draggable (GtkTreeDragSource *drag_source,
-				      GtkTreePath       *path)
+shortcuts_pane_model_filter_row_draggable (GtkTreeDragSource *drag_source,
+					   GtkTreePath       *path)
 {
-  ShortcutsModelFilter *model;
+  ShortcutsPaneModelFilter *model;
   int pos;
   int bookmarks_pos;
 
-  model = SHORTCUTS_MODEL_FILTER (drag_source);
+  model = SHORTCUTS_PANE_MODEL_FILTER (drag_source);
 
   pos = *gtk_tree_path_get_indices (path);
   bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS);
@@ -7513,13 +8596,13 @@ shortcuts_model_filter_row_draggable (Gt
 
 /* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */
 static gboolean
-shortcuts_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
+shortcuts_pane_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
 				      GtkTreePath       *path,
 				      GtkSelectionData  *selection_data)
 {
-  ShortcutsModelFilter *model;
+  ShortcutsPaneModelFilter *model;
 
-  model = SHORTCUTS_MODEL_FILTER (drag_source);
+  model = SHORTCUTS_PANE_MODEL_FILTER (drag_source);
 
   /* FIXME */
 
@@ -7528,30 +8611,30 @@ shortcuts_model_filter_drag_data_get (Gt
 
 /* Fill the GtkTreeDragSourceIface vtable */
 static void
-shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface)
+shortcuts_pane_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface)
 {
-  iface->row_draggable = shortcuts_model_filter_row_draggable;
-  iface->drag_data_get = shortcuts_model_filter_drag_data_get;
+  iface->row_draggable = shortcuts_pane_model_filter_row_draggable;
+  iface->drag_data_get = shortcuts_pane_model_filter_drag_data_get;
 }
 
 #if 0
 /* Fill the GtkTreeDragDestIface vtable */
 static void
-shortcuts_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface)
+shortcuts_pane_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface)
 {
-  iface->drag_data_received = shortcuts_model_filter_drag_data_received;
-  iface->row_drop_possible = shortcuts_model_filter_row_drop_possible;
+  iface->drag_data_received = shortcuts_pane_model_filter_drag_data_received;
+  iface->row_drop_possible = shortcuts_pane_model_filter_row_drop_possible;
 }
 #endif
 
 static GtkTreeModel *
-shortcuts_model_filter_new (GtkFileChooserDefault *impl,
-			    GtkTreeModel          *child_model,
-			    GtkTreePath           *root)
+shortcuts_pane_model_filter_new (GtkFileChooserDefault *impl,
+				 GtkTreeModel          *child_model,
+				 GtkTreePath           *root)
 {
-  ShortcutsModelFilter *model;
+  ShortcutsPaneModelFilter *model;
 
-  model = g_object_new (SHORTCUTS_MODEL_FILTER_TYPE,
+  model = g_object_new (SHORTCUTS_PANE_MODEL_FILTER_TYPE,
 			"child-model", child_model,
 			"virtual-root", root,
 			NULL);
--- gtk+-2.8.10.orig/gtk/gtkpathbar.c	2005-11-18 21:35:29.000000000 -0600
+++ gtk+-2.8.10/gtk/gtkpathbar.c	2006-03-29 15:51:12.000000000 -0600
@@ -143,7 +143,7 @@ gtk_path_bar_init (GtkPathBar *path_bar)
   GTK_WIDGET_SET_FLAGS (path_bar, GTK_NO_WINDOW);
   gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
 
-  path_bar->spacing = 3;
+  path_bar->spacing = 0;
   path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
   path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
   path_bar->icon_size = FALLBACK_ICON_SIZE;
