GNOME Bugzilla – Bug 318444
GtkFileChooser annoyance when navigating folders with a pathbar
Last modified: 2011-02-04 16:19:59 UTC
A GtkFileChooser would always select the first item in the files list when user changes folders pressing some button in the GtkPathBar. However, when navigating from, say, "/foo/bar/baz" to "/foo/bar" you would like to have "baz" selected instead of the first folder in the "/foo/bar" folder. (Think of selecting wrong folder in some directory with lots of subfolders and navigating up one folder to select the right one). Other information:
Created attachment 53286 [details] [review] proposed fix
Thanks for the patch, Andrei :) I wonder if you could make a few changes. Currently, GtkPathBar has this signal: void (* path_clicked) (GtkPathBar *path_bar, GtkFilePath *file_path, gboolean child_is_hidden); It gets emitted when you click on a button in the path bar. Say you have this: [/][home][federico][[.gnome2]] (i.e. ".gnome2" is selected) If you click on "federico", that signal will be emitted with these arguments: file_path -> /home/federico child_is_hidden -> TRUE The right way to fix this bug is to add another argument to the "path_clicked" signal, which would be the GtkFilePath corresponding to the child that you wish to highlight when going to a parent folder. So, let's make it look like this: void (* path_clicked) (GtkPathBar *path_bar, GtkFilePath *file_path, GtkFilePath *child_path, gboolean child_is_hidden); In the case above, you would pass file_path -> "/home/federico" child_path -> "/home/federico/.gnome2" child_is_hidden -> TRUE The signal handler (gtkfilechooserdefault.c:path_bar_clicked) would then do this: pending_select_paths_add (impl, child_path) if (!change_folder_and_display_error (impl, file_path, ...)) ...
Created attachment 54535 [details] [review] Modified patch OK, I've modified the patch with changes you advised. As a side-effect it required adding a VOID:POINTER,POINTER,BOOLEAN marshaller to the gtkmarshalers.list.
2005-11-10 Matthias Clasen <mclasen@redhat.com> Improve navigation to parent folders. (#318444, Andrei Yurkevich) * gtk/gtkpathbar.[hc]: Add a child_path argument to the path_clicked signal. * gtk/gtkfilechooserdefault.c (path_bar_clicked): Select the child_path, if it is provided. * gtk/marshalers.list (path_bar_clicked): Add the necessary glue.