Commit Graph

226 Commits

Author SHA1 Message Date
Matthias Clasen
3c217e6954 file chooser: Avoid search interruption
When the search entry is shown, the 'special' nature of
., ~ and / should not trigger the location entry, because
that interrupts the search and is likely not what the
user intended.

https://bugzilla.gnome.org/show_bug.cgi?id=756505
2015-10-15 20:53:43 -04:00
Matthias Clasen
eabdaf17dc file chooser: Clear busy cursor before showing error
It looks odd to still have a busy cursor while the error
dialog is presented.
2015-10-02 06:57:05 -04:00
Matthias Clasen
7d4ed3692e file chooser: Improve search focus handling
Move focus to list when search results appear to make it
possible to select the first search result by just hitting
Enter. To keep this from interfering with keynav, we need
to make sure that we still handle Escape to search. And when
search comes up empty, we need to move the focus back to the
entry.

https://bugzilla.gnome.org/show_bug.cgi?id=755926
2015-10-01 23:32:30 -04:00
Matthias Clasen
134c2ea799 file chooser: Don't select in the search entry
The stack calls gtk_widget_grab_focus on the last focus widget,
which selects the text in the entry, so we need to make sure to
move the focus there first to keep that from happening.

https://bugzilla.gnome.org/show_bug.cgi?id=755931
2015-10-01 22:59:57 -04:00
Matthias Clasen
450056cdfe file chooser: Avoid a crash
When right-clicking in an empty folder, you should get a context
menu, not a crash. The code for positioning the popover was not
handling the eventuality of no row under the pointer. Just position
the popover right at the click location in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=755021
2015-09-16 07:41:02 -07:00
Matthias Clasen
b3a3e91f02 file chooser: Make sure places view type is known
Similar to how we handle GtkPathBar, make sure that the
type for GtkPlacesView is registered before we load the
template.

https://bugzilla.gnome.org//show_bug.cgi?id=754133
2015-09-01 01:00:46 -04:00
Paolo Borelli
8e975b28ff filechooser: check if we can access the parent folder
If we manually enter an unaccessible path in the entry, e.g
"/root/foo.txt", we should receive an error saying that the
folder is not accessible instead of showing the replace
confirmation dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=753969
2015-08-23 15:44:09 +02:00
Matthias Clasen
198d99d680 Whitespace fixes 2015-08-03 22:02:22 -04:00
Matthias Clasen
14de03cedf file chooser: Don't leave out icons by accident
We only load thumbnails when we find that the row is in the visible
range of the treeview. It seems that animated scrolling makes it so
that the bottommost row stays out of the visible range until it is
too late. To work around this, extend the range by one row in each
direction.

http://bugzilla.gnome.org/show_bug.cgi?id=753142
2015-08-02 20:51:12 -04:00
Matthias Clasen
9f24b54786 Code cleanup
Use g_slist_free_full more consistently. This commit just converts
the obvious cases where g_slist_forall is directly followed by
g_slist_free.
2015-07-31 22:23:35 -04:00
Matthias Clasen
fb0a13b7f0 file chooser: Allow activating without double-click
Interpret a unmodified primary click on the selection like a double
click. This makes it possible to activate a file or open a folder
without using double-click.
2015-07-31 13:46:35 -04:00
Matthias Clasen
49a596aa52 file chooser: Note when searching remote locations
Inform the user that we won't search recursively when searching
in remote locations.
2015-07-27 08:07:39 -04:00
Matthias Clasen
eee85d39e5 Avoid more GFile<>uri roundtrips
Make GtkSearchHit carry a GFile instead of an uri. Most of the
search engines already have the object around, and converting
to an uri and back is unnecessary extra work.
2015-07-27 08:07:39 -04:00
Matthias Clasen
48c172f4e0 Always pass a location into the query
Failure to do so was causing search to start from the home dir
when the current folder is not represented on the sidebar.
2015-07-27 08:07:38 -04:00
Matthias Clasen
71b3e0b66b Store locations as GFile
It is a bit pointless to have the file chooser get a uri from an
existing GFile to put in the query, only to have some of the search
engines reconstruct a GFile from it.
2015-07-27 08:07:38 -04:00
Matthias Clasen
5c2759af3c Use standard cursor names
This changes GTK+ to use gdk_cursor_new_from_name() with the
'standard' css names, instead of GdkCursorType.

https://bugzilla.gnome.org/show_bug.cgi?id=652085
2015-07-26 01:45:06 -04:00
Matthias Clasen
e2b9caf26a file chooser: Fix gtk_file_chooser_set_show_hidden
We should not override an explicitly set show-hidden value
when loading the setting.

https://bugzilla.gnome.org/show_bug.cgi?id=610925
2015-07-23 21:54:47 -04:00
Matthias Clasen
707459fe4e file chooser: Make keynav in save mode smoother
When using the location popup to complete to a directory name
(with a trailing /), we should not punish the user by making the
Open button insensitive and preventing the Enter key from doing
the expected thing (switching to that directory).

https://bugzilla.gnome.org/show_bug.cgi?id=752708
2015-07-23 01:04:15 -04:00
Matthias Clasen
167734c153 file chooser: Fix a crash
The save_widgets_create function was not safe against
being called multiple times in save mode, calling
gtk_file_chooser_set_create_folders was a way to trigger
this crash.
2015-07-22 19:16:23 -04:00
Matthias Clasen
38a5db8f83 GtkQuery: Make API follow GTK+ conversions
We generally have const getters for strings, and the two users
of this API were promptly leaking the (unexpected) copy they
got from gtk_query_get_location and gtk_query_get_text.
2015-07-21 20:39:29 -04:00
Matthias Clasen
2dfad2b0d1 file chooser: Memory handling fixes
I forgot to clean up the long press gesture, and in additon, creating
the rename popover from the ui template was causing the tree view
to not be disposed when the file chooser goes away. Work around this
by manually unsetting the relative-to widget of the popover in dispose.
2015-07-20 11:12:49 -04:00
Matthias Clasen
a9ee745dc1 file chooser: remove an unused GError variable
Pointed out by coverity
2015-07-17 19:19:03 -04:00
Matthias Clasen
9b81372ad9 file chooser: Improve popover positioning
We keep the popover vertically tied to the selected row, but pick
up the horizontal position from the click / touch.
2015-07-17 08:57:40 -04:00
Matthias Clasen
33cc51d994 file chooser: Use a popover for the context menu
Use a popover for the context menu, and add a long press gesture
to allow opening it with touch.
2015-07-17 08:57:39 -04:00
Matthias Clasen
1fb075dbca file chooser: Make bindings work in save entry
With the name entry being in the header bar now, we no longer
get bindings working by just letting the key event bubble up,
we have to explicitly apply them on key events that the save
entry is not handling.
2015-07-16 23:38:47 -04:00
Georges Basile Stavracas Neto
79f2400c0d filechooserwidget: use places view to manage fixed devices
Previous patch modified places sidebar widget to stop handling
fixed devices by adding an "Other Locations..." item. Up to now,
however, these changes are isolated from each other since the
bundled file manager widgets ignore the sidebar requests for
external management of fixed devices and networks.

To fix that, make the file chooser widget be aware of the
GtkPlacesSidebar::show-other-locations signal and, when requested,
show places view to manage the fixed devices and networks.

https://bugzilla.gnome.org/show_bug.cgi?id=752034
2015-07-15 23:11:52 -03:00
Matthias Clasen
e7c0bb6025 file chooser: Show progess spinner even if not empty
With the previous approach, we could only show the spinner
before we had any results. With the new approach, we can just
leave the timeout in place and always show the spinner until
the search is done.
2015-07-15 00:15:44 -04:00
Matthias Clasen
6d757750f1 file chooser: Stop search when entry is cleared 2015-07-15 00:12:33 -04:00
Matthias Clasen
5bd6013165 file chooser: Refine search progress display
Move the spinner to the search bar, so we can keep it around
until the search is over.
2015-07-15 00:03:09 -04:00
Matthias Clasen
eb67d14551 file chooser: Be more careful with subtitles
We were showing things like "Searching in (null)" if the current
folder is not in the sidebar. Avoid that by falling back to using
current_folder.

Pointed out by Carlos Soriano.
2015-07-14 23:50:40 -04:00
Matthias Clasen
301cf24b33 file chooser: Clean up unused includes 2015-07-11 00:15:42 -05:00
Matthias Clasen
995e87322c file chooser: Remove some obsoltete code
We no longer have editable rows in the list, so no need to
check for them anymore.
2015-07-11 00:15:42 -05:00
Matthias Clasen
0c7237f15e file chooser: Fix multi-selection
Even if we only ever hit the code with a singleton selection,
calling gtk_tree_selection_get_selected is not ok if the tree
selection mode allows multi-selection. Replace all calls to
gtk_tree_selection_get_selected in the file chooser code with
callback loops iterating over the selection. This problem
was introduced with the recently added rename and delete
menuitems.
2015-07-11 00:15:42 -05:00
Matthias Clasen
24dc6f8771 file chooser: Do less work
We only need to update the sensitivity of the context menu
items rihgt before we are going to pop it up. Everything else
is pointless work.
2015-07-11 00:15:42 -05:00
Matthias Clasen
201d4c1101 file chooser: Avoid doing excess work
Whenever we change directories, we unset the model, and then
we set a new model. This causes several emissions of
GtkTreeSelection::changed, for each of which we do a bunch
of work to update the path bar, the location entry, etc.

We can savely ignore some of these signals, and do less work.
2015-07-11 00:15:42 -05:00
Matthias Clasen
72a8064c7d Trivial code cleanup 2015-07-11 00:15:41 -05:00
Matthias Clasen
410d180b45 file chooser: Avoid animations when setting up
There is no need to animate things when we are just setting up
the startup mode, so disable transitions in the revealer and
the stack. Pointed out by Carlos Soriano
2015-07-11 00:15:41 -05:00
Matthias Clasen
e43ba9d726 file chooser: Ensure we update subtitles
Notify the ::subtitle property when modes change that may
affect it. Also ensure that we update the location mode when
we switch back to the pathbar.
2015-07-11 00:15:41 -05:00
Piotr Drąg
d51e8a73cb Fix a minor typo 2015-07-07 21:51:55 +02:00
Matthias Clasen
826c1db859 file chooser: Add a shortcut to focus the sidebar
Alt+P used to do this in the gtk2 filechooser (well, sometimes).
Add this back as a key binding.

https://bugzilla.gnome.org/show_bug.cgi?id=720684
2015-07-07 00:25:22 -04:00
Matthias Clasen
e1211577b3 file chooser: Make delete confirmation match nautilus
No need to diverge here.
2015-07-06 23:03:56 -04:00
Matthias Clasen
b96b796a8d file chooser: Separate out delete and trash
We only ever show one of the two context menu items (and we prefer
Move to Trash over Delete). Only use the confirmation dialog when
deleting.
2015-07-06 22:57:40 -04:00
Matthias Clasen
06f9102840 file chooser: Allow rename-to-self
When checking for a name clash for renaming, don't complain if the
name is unchanged. That's harmless.
2015-07-06 21:39:39 -04:00
Matthias Clasen
7c9e3df198 wip: reshuffle name checks 2015-07-06 21:35:03 -04:00
Matthias Clasen
88cee9288b file chooser: Remove unused field 2015-07-06 20:57:11 -04:00
Matthias Clasen
56af2358de file chooser: Clear search entry when it goes away
Keeping the entry contents conflicts with type-to-search.
2015-07-06 20:50:08 -04:00
Matthias Clasen
39822092f4 file chooser: Allow deleting files
This is another often requestsed feature for save mode.

Based on a patch by John Beard,
https://bugzilla.gnome.org/show_bug.cgi?id=325150
2015-07-04 23:46:11 -04:00
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