Commit Graph

255 Commits

Author SHA1 Message Date
Emmanuele Bassi
590e7e68d8 filechooserwidget: Rename error variable
Avoid shadowing an existing error.
2016-10-17 11:44:10 +01:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Timm Bäder
3b336dda73 dialog: Remove alternative button order API 2016-10-16 18:17:21 +02:00
Timm Bäder
f45dadadd0 box: Remove 'padding' child property 2016-10-16 18:17:21 +02:00
Benjamin Otte
ad64402a55 filechooserwidget: Query dpi from CssStyle 2016-10-16 18:17:21 +02:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Timm Bäder
a985e62b25 Use gtk_popover_popdown/popup where appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=769706
2016-08-16 11:49:26 -04:00
Matthias Clasen
4e418ed71d file chooser: align date formatting with nautilus
We were treating 'yesterday' not quite the same way.

https://bugzilla.gnome.org/show_bug.cgi?id=769568
2016-08-11 12:22:01 -04:00
Timm Bäder
6032e7b216 filechooserwidget: Remove unused enum 2016-08-04 13:09:01 +02:00
Matthias Clasen
5839c13843 Implement combobox apis in GtkFileChooserWidget
https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:08:28 -04:00
Руслан Ижбулатов
fcd3321fa7 GtkFileChooser: don't override already opened folder
When filechooer is re-used (instead of being created and destroyed
every time it's needed), it might happen that the directory the
application wishes to initially show is the same directory that
was shown last time the filechooser was used. In that case, make sure
filechooser knows that it does not need to do its default "select $pwd
or $home" routine.

https://bugzilla.gnome.org/show_bug.cgi?id=766122
2016-05-26 11:44:13 +00:00
Bastien Nocera
6a5224ffcb file-chooser-widget: Fix "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764585
2016-04-05 12:58:58 +02:00
Matthias Clasen
6ac7b54378 dnd: Move GtkDragDest to a separate file
This follows what was done for GtkDragSource in
415030d25f and shaves another
500 lines off gtkdnd.c.
2016-03-25 15:37:20 -04:00
Carlos Soriano
fdde27ea9c gtkplacessidebar: add new other locations with flags signal
We weren't using the open flags on the other locations signal, which
makes impossible for applications like nautilus to act in the same
way that for any other location where the user can choose between
opening in the current view, in a new window or in a new tab.

Add a new signal with an open flags parameter and deprecate
the other-location signal.

https://bugzilla.gnome.org/show_bug.cgi?id=754743
2016-03-04 20:15:52 -05:00
Carlos Soriano
fec0c4c201 Revert "gtkplacessidebar: add open flags to other locations"
This reverts commit 63a204e1c5 since it broke the API.
We will add a new signal instead in an upcomming patch.

https://bugzilla.gnome.org/show_bug.cgi?id=754743
2016-03-04 20:15:52 -05:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Carlos Soriano
63a204e1c5 gtkplacessidebar: add open flags to other locations
We weren't using the open flags on the other locations signal, which
makes impossible for applications like nautilus to act in the same
way that for any other location where the user can choose between
opening in the current view, in a new window or in a new tab.

Add the signal missing parameter in order to allow it.

https://bugzilla.gnome.org/show_bug.cgi?id=754743
2016-02-23 20:29:03 -05:00
Matthias Clasen
8f71060ef9 file chooser: Reload current dir when switching from search mode
The need for this was pointed out by Evangelos Foutras in
https://bugzilla.gnome.org/show_bug.cgi?id=761757
2016-02-15 22:06:17 -05:00
Matthias Clasen
71559c603e file chooser: Avoid nonworking search+save combinations
With the location entry up in the header bar in save mode, we can
end up with the search model being in use when the user types in
the location entry. In this case, we don't make the Save button
sensitive as we should.

Having two entries in the dialog is somewhat confusing anyway,
so just stop the search when the user starts typing in the location
entry.

https://bugzilla.gnome.org/show_bug.cgi?id=761757
2016-02-12 22:05:40 -05:00
Matthias Clasen
811a9b21c1 file chooser: Use the right model when getting the selection
We don't need to make assumptions about which model is currently
used since gtk_tree_selection_get_selection hands us the model.

https://bugzilla.gnome.org/show_bug.cgi?id=761757
2016-02-12 20:35:26 -05:00
Руслан Ижбулатов
4a49d8d14f Don't do remote checks on NULL files
Calling _gtk_file_consider_as_remote() with a NULL argument
results in warnings being thrown.

Note that query->priv->location being NULL is a state that does
not seem to be invalid by itself.

This could happen if you do search-as-you-type in a filechooser,
which has a filter that does not match anything *and* the current
"place" selected is "Recent".

https://bugzilla.gnome.org/show_bug.cgi?id=761552
2016-02-04 15:57:35 +00:00
Matthias Clasen
f793da54a9 file chooser: Avoid a crash
Since 39c2d12330,
priv->operation_mode == OPERATION_MODE_BROWSE no longer
guarantees that priv->browse_files_model is the current
model of the list - we are only switching the models after
loading the new directory. Avoid triggering the assertion
in show_and_select_files by checking if we have right model
before calling it.

https://bugzilla.gnome.org/show_bug.cgi?id=761209
2016-01-30 23:07:56 -05:00
Matthias Clasen
176e85ffe5 file chooser: Make Escape close the dialog
In some situations (no header bar, save mode), hitting Escape
would not do anything because the entry ate the key event.
Fix this by telling the entry to only handle Escape when there
is something to do, such as switching back to the path bar.

https://bugzilla.gnome.org/show_bug.cgi?id=761026
2016-01-29 19:12:51 -05:00
Ondrej Holy
b2eaed62f6 file chooser: Allow saving even if executable attribute is not set
Commit 8e975b2 (Bug 753969) introduced check of parent accessibility.
Consequently it is not possible to save file if executable attribute
is not set, which might happen for some gvfs backends. Let's assume
that the folder is accessible even if the attribute is not set.

https://bugzilla.gnome.org/show_bug.cgi?id=760881
2016-01-20 14:09:46 +01:00
Matthias Clasen
704b41b504 file chooser: Set a CSS name
The CSS name for GtkFileChooserWidget is ... filechooser.
2016-01-13 23:41:38 -05:00
Benjamin Otte
415030d25f dnd: Split GtkDragSourceSite into its own file 2015-11-25 20:31:27 +01:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Paolo Borelli
c619c86250 filechooser: ignore double clicks on the selected item
Since we are now interpreting button press events and
make our own double-click determination, we should not
handle double-click events that are generated by GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=757950
2015-11-13 07:07:53 -05:00
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