Index: gtk/gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.296
diff -u -r1.296 gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c	5 Oct 2005 05:05:42 -0000	1.296
+++ gtk/gtkfilechooserdefault.c	10 Oct 2005 12:05:46 -0000
@@ -6882,6 +6882,24 @@
    */
   if (child_is_hidden)
     g_object_set (impl, "show-hidden", TRUE, NULL);
+
+  /* Say we have "/foo/bar/baz" and the user clicks on "bar". We should then
+   * focus the "baz" entry in the files list - the reason for this is that
+   * if user furst changed to /foo/bar/baz from /foo/bar unintentionally instead
+   * of /foo/bar/baz1, it will take quite some time to scroll to baz1 in the file
+   * list, especially if this directory contains lots of folders
+   */
+  if (gtk_file_path_compare (_gtk_path_bar_get_path (path_bar), file_path) > 0)
+    {
+      gchar *child = (gchar *) gtk_file_path_copy (_gtk_path_bar_get_path (path_bar));
+      gchar *p = &(child[strlen ((gchar *) file_path) + 1]);
+      p = index (p, '/');
+      if (p != NULL)
+          *p = '\0';
+
+      gtk_file_chooser_default_select_path (impl, (GtkFilePath *) child, NULL);
+      browse_files_center_selected_row (impl);
+    }
 }
 
 static const GtkFileInfo *
Index: gtk/gtkpathbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpathbar.c,v
retrieving revision 1.45
diff -u -r1.45 gtkpathbar.c
--- gtk/gtkpathbar.c	4 Oct 2005 20:08:32 -0000	1.45
+++ gtk/gtkpathbar.c	10 Oct 2005 12:05:47 -0000
@@ -1475,3 +1475,21 @@
 	}
     }
 }
+
+/**
+ * _gtk_path_bar_get_path:
+ * @path_bar: a #GtkPathBar
+ *
+ * @returns: the full path of the #GtkBathBar (that is, the
+ * path that the deepest (rightmost) button is mapped to).
+ **/
+GtkFilePath *
+_gtk_path_bar_get_path (GtkPathBar *path_bar)
+{
+  g_return_val_if_fail (GTK_IS_PATH_BAR (path_bar), NULL);
+
+  GList *l = g_list_first (path_bar->button_list);
+  g_return_val_if_fail (l != NULL, NULL);
+
+  return BUTTON_DATA (l->data)->path;
+}
Index: gtk/gtkpathbar.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpathbar.h,v
retrieving revision 1.16
diff -u -r1.16 gtkpathbar.h
--- gtk/gtkpathbar.h	7 Jul 2005 12:40:50 -0000	1.16
+++ gtk/gtkpathbar.h	10 Oct 2005 12:05:47 -0000
@@ -84,6 +84,8 @@
 void     _gtk_path_bar_up              (GtkPathBar *path_bar);
 void     _gtk_path_bar_down            (GtkPathBar *path_bar);
 
+GtkFilePath * _gtk_path_bar_get_path   (GtkPathBar *path_bar);
+
 G_END_DECLS
 
 #endif /* __GTK_PATH_BAR__ */
