Index: gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.333
diff -u -p -r1.333 gtkfilechooserdefault.c
--- gtkfilechooserdefault.c	10 Sep 2006 06:39:16 -0000	1.333
+++ gtkfilechooserdefault.c	20 Sep 2006 15:04:12 -0000
@@ -277,6 +277,7 @@ static gboolean       gtk_file_chooser_d
 static gboolean       gtk_file_chooser_default_update_current_folder 	   (GtkFileChooser    *chooser,
 									    const GtkFilePath *path,
 									    gboolean           keep_trail,
+									    gboolean           grab_focus,
 									    GError           **error);
 static GtkFilePath *  gtk_file_chooser_default_get_current_folder 	   (GtkFileChooser    *chooser);
 static void           gtk_file_chooser_default_set_current_name   	   (GtkFileChooser    *chooser,
@@ -347,7 +348,8 @@ static gboolean shortcuts_select_func   
 static gboolean shortcuts_get_selected  (GtkFileChooserDefault *impl,
 					 GtkTreeIter           *iter);
 static void shortcuts_activate_iter (GtkFileChooserDefault *impl,
-				     GtkTreeIter           *iter);
+				     GtkTreeIter           *iter,
+				     gboolean               grab_focus);
 static int shortcuts_get_index (GtkFileChooserDefault *impl,
 				ShortcutsIndex         where);
 static int shortcut_find_position (GtkFileChooserDefault *impl,
@@ -991,7 +993,8 @@ error_changing_folder_dialog (GtkFileCho
 /* Changes folders, displaying an error dialog if this fails */
 static gboolean
 change_folder_and_display_error (GtkFileChooserDefault *impl,
-				 const GtkFilePath     *path)
+				 const GtkFilePath     *path,
+				 gboolean               grab_focus)
 {
   GError *error;
   gboolean result;
@@ -1013,7 +1016,7 @@ change_folder_and_display_error (GtkFile
   path_copy = gtk_file_path_copy (path);
 
   error = NULL;
-  result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, &error);
+  result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, grab_focus, &error);
 
   if (!result)
     error_changing_folder_dialog (impl, path_copy, error);
@@ -2036,7 +2039,7 @@ edited_idle_create_folder_cb (GtkFileSys
     goto out;
 
   if (!error)
-    change_folder_and_display_error (impl, path);
+    change_folder_and_display_error (impl, path, FALSE);
   else
     error_creating_folder_dialog (impl, path, g_error_copy (error));
 
@@ -3680,7 +3683,7 @@ file_list_drag_data_received_get_info_cb
        data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
       data->uris[1] == 0 && !error &&
       gtk_file_info_get_is_folder (info))
-    change_folder_and_display_error (data->impl, data->path);
+    change_folder_and_display_error (data->impl, data->path, FALSE);
   else
     {
       GError *error = NULL;
@@ -4161,7 +4164,7 @@ save_folder_combo_changed_cb (GtkComboBo
     return;
 
   if (gtk_combo_box_get_active_iter (combo, &iter))
-    shortcuts_activate_iter (impl, &iter);
+    shortcuts_activate_iter (impl, &iter, FALSE);
 }
 
 /* Creates the combo box with the save folders */
@@ -5406,7 +5409,8 @@ gtk_file_chooser_default_map (GtkWidget 
       if (impl->current_folder)
         {
           pending_select_paths_store_selection (impl);
-          change_folder_and_display_error (impl, impl->current_folder);
+          gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+          change_folder_and_display_error (impl, impl->current_folder, FALSE);
 	}
       break;
 
@@ -6129,7 +6133,7 @@ gtk_file_chooser_default_set_current_fol
 					     const GtkFilePath *path,
 					     GError           **error)
 {
-  return gtk_file_chooser_default_update_current_folder (chooser, path, FALSE, error);
+  return gtk_file_chooser_default_update_current_folder (chooser, path, FALSE, FALSE, error);
 }
 
 
@@ -6140,6 +6144,7 @@ struct UpdateCurrentFolderData
   gboolean keep_trail;
   GtkFilePath *original_path;
   GError *original_error;
+  gboolean grab_focus;
 };
 
 static void
@@ -6262,6 +6267,9 @@ update_current_folder_get_info_cb (GtkFi
 
   g_signal_emit_by_name (impl, "selection-changed", 0);
 
+  if (data->grab_focus)
+    gtk_widget_grab_focus (impl->browse_files_tree_view);
+
 out:
   gtk_file_path_free (data->path);
   g_free (data);
@@ -6273,6 +6281,7 @@ static gboolean
 gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
 						const GtkFilePath *path,
 						gboolean           keep_trail,
+						gboolean           grab_focus,
 						GError           **error)
 {
   GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
@@ -6302,6 +6311,7 @@ gtk_file_chooser_default_update_current_
   data->impl = impl;
   data->path = gtk_file_path_copy (path);
   data->keep_trail = keep_trail;
+  data->grab_focus = grab_focus;
 
   impl->reload_state = RELOAD_HAS_FOLDER;
 
@@ -7144,7 +7154,7 @@ switch_to_selected_folder (GtkFileChoose
 
   g_assert (closure.path && closure.num_selected == 1);
 
-  change_folder_and_display_error (impl, closure.path);
+  change_folder_and_display_error (impl, closure.path, FALSE);
 }
 
 /* Gets the GtkFileInfo for the selected row in the file list; assumes single
@@ -7439,7 +7449,7 @@ save_entry_get_info_cb (GtkFileSystemHan
   else
     {
       /* This will display an error, which is what we want */
-      change_folder_and_display_error (data->impl, data->parent_path);
+      change_folder_and_display_error (data->impl, data->parent_path, FALSE);
     }
 
 out:
@@ -7685,7 +7695,7 @@ gtk_file_chooser_default_should_respond 
 	      || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
 	    {
 	      _gtk_file_chooser_entry_set_file_part (entry, "");
-	      change_folder_and_display_error (impl, path);
+	      change_folder_and_display_error (impl, path, FALSE);
 	      retval = FALSE;
 	    }
 	  else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
@@ -7742,9 +7752,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);
+	  shortcuts_activate_iter (impl, &iter, TRUE);
 	}
       else
 	goto file_list;
@@ -7942,7 +7950,7 @@ shortcuts_activate_volume_mount_cb (GtkF
   path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
   if (path != NULL)
     {
-      change_folder_and_display_error (impl, path);
+      change_folder_and_display_error (impl, path, TRUE);
       gtk_file_path_free (path);
     }
 
@@ -7980,7 +7988,7 @@ shortcuts_activate_volume (GtkFileChoose
       path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
       if (path != NULL)
         {
-          change_folder_and_display_error (impl, path);
+          change_folder_and_display_error (impl, path, TRUE);
           gtk_file_path_free (path);
         }
     }
@@ -7993,6 +8001,7 @@ struct ShortcutsActivateData
 {
   GtkFileChooserDefault *impl;
   GtkFilePath *path;
+  gboolean grab_focus;
 };
 
 static void
@@ -8013,7 +8022,7 @@ shortcuts_activate_get_info_cb (GtkFileS
     goto out;
 
   if (!error && gtk_file_info_get_is_folder (info))
-    change_folder_and_display_error (data->impl, data->path);
+    change_folder_and_display_error (data->impl, data->path, data->grab_focus);
   else
     gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (data->impl), data->path, NULL);
 
@@ -8027,7 +8036,8 @@ out:
 
 static void
 shortcuts_activate_iter (GtkFileChooserDefault *impl,
-			 GtkTreeIter           *iter)
+			 GtkTreeIter           *iter,
+			 gboolean               grab_focus)
 {
   gpointer col_data;
   gboolean is_volume;
@@ -8064,6 +8074,7 @@ shortcuts_activate_iter (GtkFileChooserD
       data = g_new0 (struct ShortcutsActivateData, 1);
       data->impl = g_object_ref (impl);
       data->path = gtk_file_path_copy (col_data);
+      data->grab_focus = grab_focus;
 
       impl->shortcuts_activate_iter_handle =
         gtk_file_system_get_info (impl->file_system, data->path,
@@ -8088,9 +8099,7 @@ shortcuts_row_activated_cb (GtkTreeView 
   gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
 						    &child_iter,
 						    &iter);
-  shortcuts_activate_iter (impl, &child_iter);
-
-  gtk_widget_grab_focus (impl->browse_files_tree_view);
+  shortcuts_activate_iter (impl, &child_iter, TRUE);
 }
 
 /* Handler for GtkWidget::key-press-event on the shortcuts list */
@@ -8212,7 +8221,7 @@ list_row_activated (GtkTreeView         
       const GtkFilePath *file_path;
 
       file_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter);
-      change_folder_and_display_error (impl, file_path);
+      change_folder_and_display_error (impl, file_path, FALSE);
 
       return;
     }
@@ -8232,7 +8241,7 @@ path_bar_clicked (GtkPathBar            
   if (child_path)
     pending_select_paths_add (impl, child_path);
 
-  if (!change_folder_and_display_error (impl, file_path))
+  if (!change_folder_and_display_error (impl, file_path, FALSE))
     return;
 
   /* Say we have "/foo/bar/[.baz]" and the user clicks on "bar".  We should then
@@ -8549,7 +8558,7 @@ switch_to_shortcut (GtkFileChooserDefaul
   if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
     g_assert_not_reached ();
 
-  shortcuts_activate_iter (impl, &iter);
+  shortcuts_activate_iter (impl, &iter, FALSE);
 }
 
 /* Handler for the "home-folder" keybinding signal */
Index: gtkfilesystemunix.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystemunix.c,v
retrieving revision 1.79
diff -u -p -r1.79 gtkfilesystemunix.c
--- gtkfilesystemunix.c	2 Sep 2006 14:26:12 -0000	1.79
+++ gtkfilesystemunix.c	20 Sep 2006 15:04:12 -0000
@@ -922,6 +922,7 @@ gtk_file_system_unix_get_folder (GtkFile
 	  folder_unix->have_mime_type = FALSE;
 	  folder_unix->have_stat = FALSE;
 	  folder_unix->have_hidden = FALSE;
+	  folder_unix->is_finished_loading = FALSE;
 	  set_asof = TRUE;
 	}
 
Index: gtkfilesystemmodel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystemmodel.c,v
retrieving revision 1.45
diff -u -p -r1.45 gtkfilesystemmodel.c
--- gtkfilesystemmodel.c	14 May 2006 04:25:29 -0000	1.45
+++ gtkfilesystemmodel.c	20 Sep 2006 15:04:12 -0000
@@ -623,12 +623,6 @@ got_root_folder_cb (GtkFileSystemHandle 
 
   model->root_folder = folder;
 
-  if (gtk_file_folder_is_finished_loading (model->root_folder))
-    g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0);
-  else
-    g_signal_connect_object (model->root_folder, "finished-loading",
-			     G_CALLBACK (root_folder_finished_loading_cb), model, 0);
-
   gtk_file_folder_list_children (model->root_folder, &roots, NULL);
 
   g_signal_connect_object (model->root_folder, "deleted",
@@ -665,6 +659,12 @@ got_root_folder_cb (GtkFileSystemHandle 
   g_slist_free (roots);
 
   model->roots = (FileModelNode *) g_slist_reverse ((GSList *)model->roots);
+
+  if (gtk_file_folder_is_finished_loading (model->root_folder))
+    g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0);
+  else
+    g_signal_connect_object (model->root_folder, "finished-loading",
+			     G_CALLBACK (root_folder_finished_loading_cb), model, 0);
 
 out:
   g_object_unref (model);
