I had a chance to demonstrate some GTK+ file chooser changes that have accumulated in the last year, so I thought I should share some of this material here.
All the screenshots here are of the testfilechooser application in GTK+ master as of today (some bugs were found and fixed in the process).
Search
Search in the filechooser area that I have spent a bit of time on myself this cycle. We’ve improved the internals of the search implementation to match the sophistication of nautilus:
- The current folder is already loaded, so we search through that data without any extra IO.
- We ask tracker (or the platforms native indexer) for search results.
- Locations that are not covered by that, we crawl ourselves, skipping remote locations to avoid excessive network traffic.
The easiest way to start a search is to just type a few characters – the search entry will appear and the search begin (you can of course also use the Search button in the header, or hit Ctrl-F to reveal the search bar.
If you type a character that looks like the beginning of a path (~, / or .), we bring up the location entry instead to let you enter a location.
Note that we show helpful hints in the subtitle in the header: if you are searching, we tell you where. If you are expected to enter a URL, we tell you that.
For search results, we show a location column that helps to determine quickly where a result comes from – results are sorted so that results from the current folder come first. Recent files also have a location column. The formatting of the modification time column has been improved, and it can optionally show times in addition to dates.
As you can also see here, the context menu in the file list (as well as the one in the sidebar) has been changed to a popover. The main motivation for this is that we can now trigger it with a long press on touch screens, which does not work well with a menu.
If the search takes longer than a few moments, we show a spinner. Hitting Escape will stop the search. Hitting it again will hide the search entry. Hitting it one more time will close the dialog.
If the search comes up empty, we tell you about it.
As I already mentioned, we don’t crawl remote locations (and tracker doesn’t index them either). But we still get results for the current folder. The footer below the list informs you about this fact.
Sidebar
The GtkPlacesSidebar is shared between nautilus and the file chooser since a few years ago. This cycle, it has been rewritten to use a GtkListBox instead of a GtkTreeView. This has a number of advantages: we can use real widgets for the rows, and things like the eject button are properly themeable and accessible.
Another aspect that was improved in the sidebar is the drag-and-drop of files to create bookmarks. We now show a clear drop location and gray out all the rest. Some of these changes are a direct result of user testing on nautilus that happened last year.
Places
The sidebar used to list all your removable devices, remote mounts, as well as special items for ‘Enter Location’, etc. To prevent the list from getting too long, we have moved most of these to a new view, and just have a single “Other Locations” item in the sidebar to go there.
As you can see, the places view also has enough room to offer ‘Connect to Server’ functionality.
It has completion for known server locations.
We show progress while connecting to a server.
And after the connection succeeded, the location shows up under ‘Networks’ in the list, from where it can be unmounted again.
The recent server locations are also available in a popover.
If you don’t have any, we tell you so.
Save mode
All of the improvements so far apply to both Open mode and Save mode.
The name entry in Save mode has been moved to the header (if we have one).
For creating directories, we now use a popover instead of an embedded entry in the list.
This lets us handle invalid names in a nicer way.
Credits
All of these changes will appear in GTK+ 3.18 in September. And we are not quite done yet – we may still get a modernized path bar this cycle, if everything works out.
The improvements that I have presented here are not all my work. A lot of credit goes to Allan Day, Carlos Soriano, Georges Basile Stavracas Neto, and Arc Riley. Buy them a drink if you meet them!