Commit Graph

229 Commits

Author SHA1 Message Date
Matthias Clasen
15617a69aa file chooser: Allow renaming files
This has often been requested as a useful feature in save mode.

Based on a patch by John Beard,
https://bugzilla.gnome.org/show_bug.cgi?id=325150
2015-07-04 22:44:30 -04:00
Matthias Clasen
530d295a2e Fix up some whitespace mishap 2015-07-04 22:38:30 -04:00
Matthias Clasen
8379ef3067 file chooser: Redo the trailing space warning
Redo this slightly differently, so we can keep all the simple
checks in one place. This will make it easier to reuse the code
for file renaming.
2015-07-04 22:38:30 -04:00
Arc Riley
94bcdd3217 Strip leading and trailing whitespace from filechooser save filenames
This makes a local copy of the file part of the entry to strip it transparently
Since this is assumed to be a mistake, the user is not notified.

https://bugzilla.gnome.org/show_bug.cgi?id=593372
2015-07-04 19:21:45 -04:00
Arc Riley
02b5ac9ee4 Warn for whitespace at beginning or end of new folder names
The warning is not intended to disable the Create button and must only be shown
when the folder is not found, so this is implemented in the folder name exists
callback.

A "name" entry was added to FileExistsData to pass the filename to the callback

https://bugzilla.gnome.org/show_bug.cgi?id=751800
2015-07-04 18:57:13 -04:00
Matthias Clasen
309c845e69 file chooser: Make Ctrl-L work in search mode
There is no real reason to not allow this. The transition is
not quite as smooth as it should be, currently, but at least
it works.
2015-07-04 00:29:27 -04:00
Matthias Clasen
4dafcf9c8b file chooser: Make unsetting save entry work
Fix an overzealous assertion.
2015-07-04 00:29:27 -04:00
Matthias Clasen
bb6f698abe file chooser: Cleanups 2015-07-04 00:29:26 -04:00
Matthias Clasen
29abbdd3e3 file chooser: Don't show Trash in save mode
You can't save there...
2015-07-04 00:29:26 -04:00
Matthias Clasen
22294a4a0d file chooser: Improve column sizing
Allow the name and location columns to be resized, but arrange
for their sizing to be reset when the column layout changes (either
by the location column appearing/disappearing, or by the time
column changing between mtime and atime. This gives a decent
compromise between good automatic sizing and user control.
2015-07-04 00:29:26 -04:00
Matthias Clasen
ed1c349e0b file chooser: Remove a wrong assumption
The code for getting the selected files was assuming that
we are always in browse mode, and was causing warnings when
hitting Ctrl-L twice, right after opening the file chooser.

The fix is to simple use the model that is passed into the
callback.
2015-07-04 00:29:26 -04:00
Matthias Clasen
17a860cea2 file chooser: Don't show Enter Location in sidebar
Following the file chooser mockups.
2015-07-04 00:29:26 -04:00
Matthias Clasen
191bccebf3 file chooser: Add search progress
Show a spinner if no search reasults have shown up yet and
the search is still going, after 2 seconds.
2015-07-04 00:29:26 -04:00
Matthias Clasen
31a022175f file chooser: Set fixed sort functions for recent and search 2015-07-04 00:29:26 -04:00
Matthias Clasen
0ac17418dd file chooser: Improve location column formatting 2015-07-04 00:29:26 -04:00
Matthias Clasen
39c2d12330 file chooser: Improve the mode switching operation
Avoid reloading models unnecessarily, e.g. when the user
switches to search and back without starting a search.
Keep the current list contents visible until a search is
actually started. Also, synchronize any changes in the
column layout with the corresponding model changes.
2015-07-04 00:29:26 -04:00
Matthias Clasen
5763199e43 file chooser: Clean up enum handling
Use g_settings_get_set_enum to handle the clock and date format
settings.
2015-07-04 00:29:25 -04:00
Matthias Clasen
f690167b0d file chooser: Code cleanups
Shorten excessively long field names.
2015-07-04 00:29:25 -04:00
Matthias Clasen
443601addc file chooser: Consistently clear model caches
This was not done for all models in all places, leading to e.g.
icon theme updates not applying correctly to search results.
2015-07-04 00:29:25 -04:00
Matthias Clasen
2cd6d1a351 file chooser: Add a way to toggle time display 2015-07-04 00:29:25 -04:00
Matthias Clasen
215a9a1b08 file chooser: remove a stale comment 2015-07-04 00:29:25 -04:00
Matthias Clasen
8974ec7413 file chooser: Improve time and date formatting
Use the same formats as nautilus, and put date and time in
separate cells, so they are neatly aligned.
2015-07-04 00:29:25 -04:00
Matthias Clasen
1c82a533ed file chooser: Don't allow resorting recent files
They are inherently sorted by access time.
2015-07-04 00:29:25 -04:00
Matthias Clasen
412e33da16 file chooser: Use access time for recent files
Use access time for sorting the recent files, and show it in
the list instead of mtime.
2015-07-04 00:29:25 -04:00
Matthias Clasen
33b5c26f41 file chooser: Add and use a model search engine
This search engine reuses the GFileInfo that is already loaded
for the file list, to ensure that hits from the current directory
always appear promptly.
2015-07-04 00:29:25 -04:00
Matthias Clasen
fe128b5b4d file chooser: Don't show recent in save mode
Don't show Recent in the sidebar when we are in save mode.
We also ignore the startup-mode = recent in save mode now - we
don't want to populate the file list with recent files if Recent
is not on the sidebar. If you really want to go there, you can
still enter recent:// in the location entry.

https://bugzilla.gnome.org/show_bug.cgi?id=751653
2015-07-04 00:29:25 -04:00
Matthias Clasen
648e4a7ea9 file chooser: Add Ctrl-F as search shortcut
This is what nautilus uses, and is more discoverable than the
somewhat easter-egg Alt-S, which is still supported.
2015-07-04 00:29:25 -04:00
Matthias Clasen
5bc88bdc67 file chooser: Make search shortcut toggle
This is more in line with having a toggle button for search,
and it matches what we do e.g. in nautilus.
2015-07-04 00:29:25 -04:00
Matthias Clasen
75411efa48 file chooser: Tweak bindings in save mode
In save modes, the entry is really more for entering a name than
entering a full location, so don't go there eagerly when '.', '/'
or '~' are pressed. Make Ctrl-L work better in this mode too.
2015-07-04 00:29:25 -04:00
Matthias Clasen
1c3ccb39c7 file chooser: Trigger location entry not just from file list
Use the same code that brings up the location entry on '/',
'~' or '.' also when the focus is not on the file list. This
prevents those key presses on the sidebar from ending up in
the search entry.
2015-07-04 00:29:25 -04:00
Matthias Clasen
5825965027 file chooser: Open location entry on '.'
Typing ./ is a fairly common practice to enter a location
relative to the cwd, so make this open the location entry.
2015-07-04 00:29:25 -04:00
Matthias Clasen
a3470521ae Revert "file chooser: Open location entry more easily"
This reverts commit e6c1cbc88e.
2015-07-04 00:29:24 -04:00
Matthias Clasen
c0afb891c8 Revert "file chooser: Don't start search too eagerly"
This reverts commit f126157bfa.
2015-07-04 00:29:24 -04:00
Matthias Clasen
1883c5fb28 file chooser: Improve keynav
Some internal containers were erroneously taking focus, interrupting
the flow of tab keynav, and using arrow keynav to go from the file
list to the sidebar did not work anymore, after the recent sidebar
rewrite.
2015-07-04 00:29:24 -04:00
Matthias Clasen
710d193f91 file chooser: Give the location column more space
Giving it 15 characters makes it at least fit "Documents" without
ellipsizing.
2015-07-04 00:29:24 -04:00
Matthias Clasen
356f507059 file chooser: Sort search results better
Set a default sort function that sorts results from the
current folder first.
2015-07-04 00:29:24 -04:00
Matthias Clasen
9b5e00b3c4 file chooser entry: Capture Escape and emit :hide-entry
Make the file chooser entry optionally capture Escape
and emit a signal. Make the file chooser widget hide the
entry on that signal and go back to the path bar.
This gives us a two-level undo:
location entry -> path bar -> dialog close.
When the location entry is permanently displayed in the
header for save mode, we still let the first Escape close
the dialog.
2015-07-04 00:29:24 -04:00
Matthias Clasen
e0b81faade file chooser: Make Escape work in search entry
Arrange things so that hitting Escape during a running
search stops the search, but leaves the search results
around, and hitting Escape again leaves the search mode.
2015-07-04 00:29:24 -04:00
Matthias Clasen
0f9b87cfeb file chooser: Make location column work better
The location column did not work for search results in recent://.
Fix that by looking at the target uri in this case. Show the location
column in recent mode. And make it more similar to nautilus by
showing the full path if it is not below $HOME.
2015-07-04 00:29:24 -04:00
Matthias Clasen
f968199b02 file chooser: Make search in recent work
All that was needed here was to set the query location.
2015-07-04 00:29:24 -04:00
Matthias Clasen
4f3f61bf5f file chooser widget: Allow external save entry
Prepare the file chooser to use an external entry in
save mode, instead of the builtin one.
2015-07-04 00:29:24 -04:00
Matthias Clasen
140a157d47 file chooser: Update sidsebar when entry goes away 2015-07-04 00:29:24 -04:00
Matthias Clasen
10f5076bb5 file chooser widget: Expose a "subtitle" property
Give the file chooser widget a "subtitle" property, which
contains a short string that explains the current mode.
2015-07-04 00:29:24 -04:00
Matthias Clasen
7e45b09c8e file chooser: More search rework
Drop the radio buttons for current location vs everywhere, and
always search in the current location.
2015-07-04 00:29:23 -04:00
Matthias Clasen
a4dcc6bc52 file chooser: Small cleanup
Ask the search model if it is empty, instead of maintaining this
information manually in the file chooser widget.
2015-06-19 01:04:42 -04:00
Matthias Clasen
1d63335c8e Use infos from search engine instead of getting them again
When the search engine provides hits with GFileInfo, use that
to add the hits to the model directly, without going through
another round of async get_info calls.

To do this, we add a batched variant of the
_gtk_file_system_model_update_file call that takes lists of
GFiles and GFileInfos. Again, we can avoid repeated resorting
that happens when the files are updated individually.
2015-06-18 15:20:06 -04:00
Matthias Clasen
1b755c546e Fix an oversight in the previous commit
We lost the line marking the search model as non-empty, causing
us to show the 'no results' page despite there being results.
2015-06-18 15:14:54 -04:00
Matthias Clasen
abe4829e36 search engine: Pass file infos along for hits 2015-06-18 14:33:13 -04:00
Matthias Clasen
4b8df8c546 file chooser: Use batched insertion for search results
This helps avoiding excess work when procesing many search
results, as typically happens with short search strings
and recursive search.

https://bugzilla.gnome.org/show_bug.cgi?id=751169
2015-06-18 13:11:30 -04:00
Matthias Clasen
8612942fe2 file chooser: Drop unused variables 2015-06-17 10:01:04 -04:00
Matthias Clasen
916cf8f61e file chooser: Use a revealer
Use a revealer to manage the visibility of the header area where
we show the pathbar, the location entry or search. This is a bit
smoother, and makes search more similar to a search bar.
2015-06-17 10:01:04 -04:00
Carlos Soriano
43a4843b9c gtkfilechooserwidget: show drop hints on gtkplacessidebar
Now with the API addition on gtkplacessidebar, we can show some
hints for the drop targets.

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Matthias Clasen
a8191e7113 places sidebar: Make 'recent' work on other platforms
Since nautilus merge, we were not showing 'Recent' in the sidebar
if GIO did not support the recent: scheme. But the file chooser
can show recent files independent of gvfs - it loads the recent
files manually. This is relevant on Windows and OS X, where gvfs
is typically not used.

This commit adds a show-recent property which can be used to override
the recent: scheme check. We use it in the file chooser.

https://bugzilla.gnome.org/show_bug.cgi?id=750068
2015-06-06 17:13:22 -04:00
Matthias Clasen
557f96c0fe Trivial: remove outdated comment 2015-06-04 15:14:43 -04:00
Matthias Clasen
359d3669ff file chooser: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen
4c971c6f5e file chooser: Respect recent settings
When recent files are not supported in gvfs, or turned off by
settings, we should not try to load them even if the startup
mode says so. This prevents inconsistency with the places
sidebar where 'Recent' will not appear in this case.
2015-05-30 09:21:16 -04:00
Matthias Clasen
41fee7e569 GtkQuery: Cleanups
Strip leading underscores from GtkQuery api, and
clean up the sources a bit.
2015-05-16 00:48:36 -04:00
Matthias Clasen
3f0f68e6ad GtkFileChooser: Show remote search results too
There is no reason not to show them. Removing this
makes search on remote locations just work.
2015-05-16 00:48:36 -04:00
Matthias Clasen
adb58b2c84 file chooser: Set default widget in create folder popover
This is using the new default widget functionality for
popovers to make Enter in the entry activate the Create
button.

https://bugzilla.gnome.org/show_bug.cgi?id=747664
2015-05-02 20:34:28 -04:00
Matthias Clasen
bdf49a7c3a GtkFileChooser: Indicate if search comes up empty
This is a neice touch and helps to understand what
is going on.
2015-05-01 23:09:56 -04:00
Matthias Clasen
0113da4868 GtkFileChooser: Use a better busy cursor
It is possible to interact with the file chooser while
things are loading, so use a cursor that indicates this,
if we have one.
2015-04-30 22:43:50 -04:00
Matthias Clasen
d6543bc009 Remove no longer needed in-tree editing 2015-04-10 15:41:56 -04:00
Matthias Clasen
c41ab14730 Use a popover for creating new folders 2015-04-10 15:41:56 -04:00
Matthias Clasen
e6061caa7b file chooser: Ensure a folder is loaded when browsing
Just showing an empty list when the user hits Ctrl-l in
recent files is not very useful. Load the home directory
instead.
2015-04-05 22:27:23 -04:00
Matthias Clasen
e6c1cbc88e file chooser: Open location entry more easily
Show the location entry also when alphanumerics are typed
into the list.
2015-04-05 22:12:46 -04:00
Benjamin Otte
1506ba060c filechooser: Use same priority everywhere
I managed to stall recent files today while trying to save a GTK
testcase in glade that contained enough spinning spinners that the CPU
was saturated just redrawing things.

I had to navigate the filesystem!
2015-03-25 04:31:33 +01:00
Matthias Clasen
9b18deee1f Add a missing word in the docs 2015-03-08 18:16:11 -04:00
Matthias Clasen
71bd1c7e2c file chooser: Really stop typeahead search popups
GtkTreeView is a bad widget and constantly resets the search-column
behind our back. We need to re-unset it every time a model is set :-(
2015-03-03 18:03:26 -05:00
Carlos Garnacho
5751d4f66e filechooser: Only do search_start_query() while we are in search mode
This signal can be emitted by GtkSearchEntry after search has been
cancelled, and other operation mode is set. It doesn't make sense to
populate the search model in that state anymore, so just avoid doing it.

https://bugzilla.gnome.org/show_bug.cgi?id=745479
2015-03-03 17:57:08 +01:00
Carlos Garnacho
a994f4edfb filechooser: Disconnect signal handlers from search engine before destroying
The search engine might stay alive longer due to extra temporary refs, so
the signal handlers should be removed for the filechooser to ignore these
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=745479
2015-03-03 17:57:08 +01:00
Matthias Clasen
209c5c37f3 file chooser: Avoid animated scrolling for editing
Avoid scrolling animation when scrolling to where we want
to insert the new folder, since adding the entry doesn't
do the right thing if the treeview is still scrolling.

An alternative would be to wait for the animated scrolling
to reach its target before starting the editing, but this
is easier.

https://bugzilla.gnome.org/show_bug.cgi?id=729366
2015-03-02 16:25:30 -05:00
Matthias Clasen
18de5e6547 file chooser: Avoid triggering assertions
cairo surfaces are boxed types, so don't try to set them
with g_value_set_object().
2015-03-02 16:25:30 -05:00
Matthias Clasen
d2fe45ab57 file chooser: Avoid warnings from the location column
Avoid criticals that would come out of this code if file is / or NULL.
2015-03-02 16:25:30 -05:00
Matthias Clasen
f126157bfa file chooser: Don't start search too eagerly
We were trying to start search when the user types anything,
but this is annoying more often than helpful, and interferes
with the location entry. So, stick with explicitly enabled
search (via the search button or Alt-S) for now.
2015-02-28 16:44:21 -05:00
Matthias Clasen
ff87c6516b file chooser: Allow to limit search
Add a button to allow restricting search to the current
folder (and subdirectories). This makes the search more
useful, and makes the file chooser more similar to
nautilus.
2015-02-14 01:03:38 -05:00
Matthias Clasen
2c5ea0dd45 file chooser: Add a location column for search
In search, we show files from differnt locations, and it makes
sense to show where they come from. This makes the file chooser
more similar to nautilus, too.
2015-02-14 01:03:38 -05:00
Matthias Clasen
61012f3efe file chooser: Don't open folders unexpectedly
Folders that show up among search results were unexpectedly
returned even for GTK_FILE_CHOOSER_ACTION_OPEN. Change things
around so that we switch to the folder instead, which is the
behavior we had in GTK+ 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=744204
2015-02-14 01:03:38 -05:00
Matthias Clasen
b876e036b2 file chooser: Allow opening folders in the file manager
This has been suggested in
https://bugzilla.gnome.org/show_bug.cgi?id=325150#c2
2015-02-11 23:34:04 -05:00
Matthias Clasen
99b17488dd file chooser: Unset sidebar during search
It is a bit misleading to have one of the places in the sidebar
selected while in search mode, since the search is not relative
to any location. So, unset the sidebar selection when we enter
search mode.
2015-01-28 18:26:42 -05:00
Matthias Clasen
e31e88582f file chooser: Unify search mode leaving
Make all ways to get out of search mode go through the same
code path, so we always populate the list.
2015-01-28 18:21:18 -05:00
Matthias Clasen
a385ca1bb7 file chooser: Fix key bindings
Key press handlers must chain up for key bindings to work.
2015-01-28 18:17:51 -05:00
Matthias Clasen
59c04d5184 file chooser: Load a directory when leaving search
Ensure that some folder contents are shown in
the list when we leave search mode.

https://bugzilla.gnome.org/show_bug.cgi?id=743659
2015-01-28 18:15:19 -05:00
Matthias Clasen
696129d83c file chooser: Don't switch too eagerly to search mode
If the search entry doesn't consume the key event, don't
change to search mode. Otherwise, we interfere e.g. with
Ctrl and Shift keys for selection.

https://bugzilla.gnome.org/show_bug.cgi?id=743660
2015-01-28 17:01:30 -05:00
Matthias Clasen
86eefc7609 file chooser: Make Escape go out of search mode
This works in most other places where we have search,
and is the expected behavior.
2015-01-28 16:07:51 -05:00
Matthias Clasen
1d64175c4b file chooser: Simplify search entry callback 2015-01-28 16:07:51 -05:00
Matthias Clasen
d270c5524f file chooser: Drop unused callbacks 2015-01-28 16:07:51 -05:00
Matthias Clasen
de4427304c file chooser: Add a search-mode property
This will be used to control search from the dialog.
2015-01-28 16:07:51 -05:00
Matthias Clasen
76b674f3b6 file chooser: Clean up includes 2015-01-28 16:07:51 -05:00
Christoph Reiter
8fc920144b GtkFileChooserWidget: Fix a crash for when the widget was unrefed right after setting a current folder.
Keep a reference to the widget while the async operation is ongoing.

https://bugzilla.gnome.org/show_bug.cgi?id=725164
2015-01-24 17:28:28 -05:00
Christoph Reiter
c235747847 GtkFileChooserWidget: remove unused fields and cleanup code.
These fields are never set, so we don't need the code to clean them up.

https://bugzilla.gnome.org/show_bug.cgi?id=725164
2015-01-24 17:28:28 -05:00
Matthias Clasen
b3c28e14fe file chooser: search improvements
Make it so that typing switches to search unless we have a better
use for the key events, and stop search if the entry is emptied.
2015-01-24 13:32:31 -05:00
Matthias Clasen
82e324f8ac file chooser: Fix up some focus issues
Better to switch the visible stack child early, since GtkStack
has its own focus handling now.
2015-01-18 19:45:13 -05:00
Matthias Clasen
1a38c4d066 file chooser: Make search work again
The last round of filechooser redesign work had left
search somewhat dysfunctional. This commit fixes things
up enough that search is once again a working feature
of the file chooser.
2015-01-18 18:59:43 -05:00
Matthias Clasen
dcd3d15380 file chooser: Drop the location label
Bringing us close to the new design.
2015-01-18 17:57:12 -05:00
Matthias Clasen
4b47c5a649 file chooser: Don't show 'Enter Location' in save modes
In these modes, the entry is permanently visible anyway.
2015-01-18 17:39:05 -05:00
Matthias Clasen
a8cb7352c5 file chooser: Make Ctrl-L work in recent
Just switch to browse mode when we see Ctrl-L in recent mode.
https://bugzilla.gnome.org/show_bug.cgi?id=660450
2015-01-18 17:35:22 -05:00
Matthias Clasen
8133e7e624 file chooser: Ensure the path bar is initialized
There are some cases where we can end up showing the path
bar without ever setting a file on it. One example is:
1) Open file chooser
2) Hit ~
3) Hit Ctrl-L
While this is a bit of a workaround, at least it makes sure
that we never end up with an empty space where the path bar
is supposed to be.
2015-01-18 17:13:12 -05:00
Matthias Clasen
6a7b549608 trivial refactoring 2015-01-18 16:57:21 -05:00
Matthias Clasen
dfe6399de8 file chooser: Make ~ and / work in recent
Complained about in
https://bugzilla.gnome.org/show_bug.cgi?id=743117
2015-01-18 16:18:12 -05:00
Iain Lane
8c5094c22c gtkfilechooserwidget: When using an extra widget, show or hide the filter combo as appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=742653
2015-01-10 20:37:39 -05:00