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 750068 - "Recent" shortcut is missing from the left pane in the file chooser
"Recent" shortcut is missing from the left pane in the file chooser
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.16.x
Other Windows
: Normal major
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2015-05-28 21:55 UTC by draymond
Modified: 2015-06-09 21:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description draymond 2015-05-28 21:55:42 UTC
When I create a file chooser dialog with GTK_FILE_CHOOSER_ACTION_OPEN it starts up with the right pane displaying recent files.  However, there is no shortcut in the left pane to select this location.  If the user navigates to a different location there is no way to go back to "Recent" without closing and reopening the file chooser dialog.
Comment 1 Matthias Clasen 2015-05-29 03:12:55 UTC
What does 

gsettings get org.gnome.desktop.privacy remember-recent-files

say ?
Comment 2 draymond 2015-05-29 03:28:41 UTC
$ gsettings get org.gnome.desktop.privacy remember-recent-files
No such schema 'org.gnome.desktop.privacy'
Comment 3 Matthias Clasen 2015-05-30 04:16:15 UTC
Does

gvfs-ls recent:// 

work ?
Comment 4 draymond 2015-05-30 04:18:29 UTC
$ gvfs-ls recent://
bash: gvfs-ls: command not found

(note that this is on Windows, not Linux)
Comment 5 Matthias Clasen 2015-05-30 12:59:25 UTC
Since you say that the file list _is_ showing recent files (you could probably verify that by opening the location entry with Ctrl-L, and entering 'recent:///'), the only possibility I see is that you have a settings.ini file somewhere that sets gtk-recent-files-enabled to FALSE.
Comment 6 Matthias Clasen 2015-05-30 13:23:36 UTC
I've pushed a change to prevent the sidebar and the file list from having different opinions about whether recent files should be shown. Maybe that helps in your case.
Comment 7 draymond 2015-06-01 20:51:09 UTC
I applied your changes and now I don't see recent files at all.  It just dumps me into the directory that contains the application binaries.  How is that an improvement?
Comment 8 draymond 2015-06-01 20:55:52 UTC
By the way, when I press Ctrl-L and type "recent:///" it won't accept the ':' character.
Comment 9 Matthias Clasen 2015-06-02 14:26:50 UTC
> How is that an improvement?

It makes GTK+ internally consistent.

> By the way, when I press Ctrl-L and type "recent:///" it won't accept the
> ':' character.

pretty clearly, there is no support for the recent: scheme in your glib - which makes some sense, since it is implemented in gvfs.
Comment 10 draymond 2015-06-02 14:49:11 UTC
>> How is that an improvement?
>
> It makes GTK+ internally consistent

But now the user experience is degraded.  Previously he had access to recent files and now he doesn't.
Comment 11 Matthias Clasen 2015-06-02 15:25:22 UTC
(In reply to draymond from comment #10)
> >> How is that an improvement?
> >
> > It makes GTK+ internally consistent
> 
> But now the user experience is degraded.  Previously he had access to recent
> files and now he doesn't.

I don't see how that can be if the recent: scheme is not supported.
Comment 12 draymond 2015-06-02 17:26:13 UTC
If you look at the original problem description that is exactly what is happening.  The file chooser dialog starts up showing recent files but there is no link to navigate there in the left pane.

Remember - this is on Windows.  A lot of the stuff you were asking seems Linux oriented.
Comment 13 Matthias Clasen 2015-06-03 17:53:39 UTC
There's no win32-specific code in GTK+ for handling recent files that I can find. If you can figure out where GTK+ on windows would get recent files info from, by all means, tell me and we'll figure out a way to bring the Recent item in the sidebar back.
Comment 14 draymond 2015-06-03 20:55:07 UTC
The recent file list is coming from the default recent manager.  The following code snippet generates the same list of files that I see in the right pane of my file chooser when I first open it:

{
   GtkRecentManager *manager;
   GList *list;

   manager = gtk_recent_manager_get_default();
   list = gtk_recent_manager_get_items(manager);

   while (list)
   {
      GtkRecentInfo *info = list->data;
      printf("%s\n", gtk_recent_info_get_display_name(info));
      list = list->next;
   }
}
Comment 15 draymond 2015-06-04 17:22:41 UTC
The function recent_scheme_is_supported() in gtkplacessidebar.c seems to be the problem.  It queries supported URI schemes which are "file, http, https" on my Windows system.  Since "recent" is not present the function returns FALSE.  Forcing recent_scheme_is_supported() to return TRUE causes the Recent bookmark to appear and it works as expected.
Comment 16 Matthias Clasen 2015-06-04 18:22:37 UTC
I think I would like to remove the current code that loads recent files 'manually' in gtkfilechooserwidget.c and instead rely on gvfs support for loading recent files. But in the interim, we can make this work.
Comment 17 draymond 2015-06-06 19:28:00 UTC
FYI, the same problem currently exists on OSX and the hack above resolves it there, too.
Comment 18 Matthias Clasen 2015-06-06 21:51:23 UTC
Pushed a few changes that should fix this
Comment 19 draymond 2015-06-08 20:58:51 UTC
There seems to be another small issue.  When the user selects the Recent bookmark it is displayed correctly in the right pane of the file chooser.  However, the bookmark itself is not highlighted.  It highlights when you first click it and then the highlighting quickly disappears so that none of the bookmarks are highlighted.  None of the other bookmarks exhibit this behavior.
Comment 20 draymond 2015-06-08 21:08:19 UTC
Also, I looked through your latest changes.  Am I correct in my understanding that the application must now make a call to set a property before the Recent bookmark appears?  How will the application developer know to do this?
Comment 21 Matthias Clasen 2015-06-09 12:17:56 UTC
No, the property is set by GTK+, no need for applications to get involved, unless they are using the places sidebar themselves - really just nautilus.
Comment 22 draymond 2015-06-09 19:13:20 UTC
1) the Recent bookmark will not appear if should_show_recent() returns false

2) should_show_recent() will return false on Windows and OSX if the new variable "show_recent_set" is false

3) "show_recent_set" will be false unless a call is made to the new function gtk_places_sidebar_set_show_recent()

4) the only place that calls gtk_places_sidebar_set_show_recent() is gtk_places_sidebar_set_property() when called with the new property "PROP_SHOW_RECENT"

5) since "PROP_SHOW_RECENT" is new nobody is currently using it


So as I see it, with these changes the Recent bookmark will not appear on Windows or OSX.
Comment 23 Matthias Clasen 2015-06-09 20:11:21 UTC
show-recent is set in gtkfilechooserwidget.ui where the sidebar is constructed
Comment 24 draymond 2015-06-09 21:50:15 UTC
OK, I ported the changes to 3.16 and tested it on Windows.  The Recent bookmark does appear correctly in the sidebar now.  Regarding the other issue (highlighting of bookmark not working) I created a new bug: 750663.