After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 318444 - GtkFileChooser annoyance when navigating folders with a pathbar
GtkFileChooser annoyance when navigating folders with a pathbar
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.8.x
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-10-10 12:15 UTC by Andrei Yurkevich
Modified: 2011-02-04 16:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (2.60 KB, patch)
2005-10-10 12:17 UTC, Andrei Yurkevich
needs-work Details | Review
Modified patch (3.73 KB, patch)
2005-11-09 14:20 UTC, Andrei Yurkevich
none Details | Review

Description Andrei Yurkevich 2005-10-10 12:15: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:
Comment 1 Andrei Yurkevich 2005-10-10 12:17:22 UTC
Created attachment 53286 [details] [review]
proposed fix
Comment 2 Federico Mena Quintero 2005-11-07 17:42:46 UTC
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, ...))
    ...

Comment 3 Andrei Yurkevich 2005-11-09 14:20:54 UTC
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.
Comment 4 Matthias Clasen 2005-11-10 15:25:15 UTC
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.