Commit Graph

597 Commits

Author SHA1 Message Date
robxnano
adc0264dac
filechooser: Fix gtk_file_chooser_set_choice again
If the choice was in the form of a GtkDropDown, the code failed to
find the widget and so the choice never got set. Fixes #5346.
2022-11-16 18:07:20 +00:00
Matthias Clasen
f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
9ab732ce2d gtk: Port to async dialog API 2022-10-29 13:31:41 -04:00
Bilal Elmoussaoui
6ca33c639e g-i: Add missing since annotation 2022-10-27 15:38:14 +00:00
Matthias Clasen
f44570e71a filechooserwidget: Drop deprecation guards
We got rid of all deprecated api here.
2022-10-21 21:48:39 -04:00
Corey Berla
e5cea4e39d filechooserwidget: Show popup when clicking on empty space
Add gesture to right click or long press in the empty space
in the FileChooserWidget.  Only show the global settings when
clicking on the empty space.
2022-10-21 13:57:21 -07:00
Matthias Clasen
1d9c61cada filechooserwidget: Remember sort columns and order
These settings existed before, we keep using them.
This loses some information about sorting by multiple
columns, but it is sufficient to get the same primary
sort column back.
2022-10-20 22:34:41 -04:00
Corey Berla
71adb26a0d filechooserwidget: Fix time_sort_func 2022-10-20 22:34:41 -04:00
Corey Berla
e27fa33690 filechooser: Add show-time property
The "Show Time" setting does not take immediate effect (only after
changing folders) because it's set as a single call to
column_view_get_time_visible() on the FileChooserCell creation.
Instead create a bind a show-time property that gets updated
as the setting is changed.
2022-10-20 22:34:41 -04:00
Corey Berla
f7dfead861 filechoosercell: Add a GtkDragSource
Allow dragging one or more items.  If the item dragged is not part of
the current selection, only drag that item.
2022-10-20 22:34:41 -04:00
Corey Berla
8af191e52d filechooserwidget: Expose selection model
FileChooserCell may need to change the selection during a DND.
2022-10-20 22:34:41 -04:00
Corey Berla
06382ff836 filechooserwidget: Rename and expose get_selected_files()
GtkFileChooserCell will need this function
2022-10-20 22:34:41 -04:00
Matthias Clasen
cd469788c3 filechooserwidget: Make rename popover work
Make the rename popover operate on the file that
the context menu was opened for, and pop up at
the same position.
2022-10-20 22:34:40 -04:00
Matthias Clasen
44b5076cf2 filechooserwidget: Make context menus mostly work
Move the gestures to the individual cells, and
make them trigger the context menu via an action
that takes item position and coordinates.

The semantics are changed slightly: the menu actions
now operate on the clicked item, not on the selection.

Still to do: Fix up keyboard activation.
2022-10-20 22:34:40 -04:00
Matthias Clasen
e5be9e1035 filesystemmodel: Drop the model types
We are no longer storing extra values, so no need
to take their types in the api.
2022-10-20 22:34:40 -04:00
Matthias Clasen
b831d01f0d filesystemmodel: Drop unused arguments
Drop the unused get_func arguments in constructors.

Update all callers.
2022-10-20 22:34:40 -04:00
Matthias Clasen
edd5ed169e filesystemmodel: Drop _gtk_file_system_model_get_value
This function is unused, so drop it, and its callback.
2022-10-20 22:34:40 -04:00
Matthias Clasen
8ec9c3fdc6 filechooser: Some work on popup menus
This is a start towards placing menus properly.

We once again center keyboard-triggered menus
on the file list.
2022-10-20 22:34:40 -04:00
Matthias Clasen
e95022040f filechooser: Drop deprecated includes
We no longer use cell renderers and tree models
here. Yay.
2022-10-20 22:34:40 -04:00
Matthias Clasen
df49bf9eec filechooserwidget: Use a string sorter for names
We can use the new collation property of GtkStringSorter,
and get the benefit of sort key caching. This commit
also fixes an accidental leak of all sorters, and
removes the sorter from the location column - we never
show that column when individual colummns are sortable.
2022-10-20 22:34:40 -04:00
Matthias Clasen
53327f3aea filechooser: Drop unnecessary theme tracking
The widgets we are using handle theme changes
themselves, so there is no need for the filechooser
to do anything.
2022-10-20 22:34:40 -04:00
Matthias Clasen
c0c3d75062 filechooser: Bring back sorting
Add a sort model between the filter model and the
file system model, and set it up to sort according
to the circumstances.
2022-10-20 22:34:40 -04:00
Corey Berla
d0d0409f9d filechooserwidget: Reimplement DnD Drop Target
This reverts commit 34752a15a71597d00a8d08befc545ac1c178b81b.

Leaving out the drag source portion as that needs a total
reimplementation.  The GtkDropTarget only required minor
modifications.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3a7d094542 filechooserwidget: Reinstate show_and_select_files
Now that we have information about visible and
filtered-out status of items, we can make this
function work again.
2022-10-20 22:34:40 -04:00
Matthias Clasen
280adcbb8c filechooserwidget: Add a filter model
Put a filter model between the selection model and
the filesystem model, and make it filter on the
filechooser::visible attribute. This makes the filer
combo in the filterchooser and the 'show hidden files'
item work. But we need to prod the filter to trigger
a refiltering every now and then.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
eeeee99aa8 filechooserwidget: Connect to the right model
When recreating the browse_files_model model, connect to that
model's item-changed signal, instead of connecting to the selection
model.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0f503e0ba2 filechooserwidget: Connect to items-changed when changing model
Just like previous commit, we need to call list_items_changed()
even if we change from single selection to multi selection or
vice-versa.
2022-10-20 22:34:40 -04:00
Matthias Clasen
ec4f814bd4 filechooserwidget: Listen to items-changed too
To track changes of the selected items in a selection
model, we need to listen to both ::selection-changed
and ::items-changed.

This fixes the open button not turning sensitive
when initially loading a new folder.
2022-10-20 22:34:40 -04:00
Matthias Clasen
0141ba4e00 filechooser: Prevent recursion when activating items
When a list item is activated, we activate the default widget.
Unfortunately, due to some other bug, sometimes the open button
is not made sensitive, and then default.activate falls back
to activating the focus widget (which is the item we are just
coming from). Boom
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
07d6166ab8 filechooserwidget: Use GListModel API for post-renaming selection 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f520801626 filesystemmodel: Retire GtkFileSystemItem
This has to be the shortest-living object in GTK history!

It helped us greatly during the transition to GtkColumnView, but
now we can remove it in favour of GFileInfo directly. Perhaps I
could have never introduced GtkFileSystemItem in the first place,
but we're 30 commits deep and it's too late to just redo the whole
thing that will get us exactly here anyway.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ddf1cd6678 filechooserwidget: Remove treeview
Now that most of the treeview usage is gone, remove the remaining
code that uses it - mostly event handling code, which for now won't
work, but will be fixed by next commits - and drop the tree view
entirely.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9c6d5e2ca5 filechooserwidget: Use GtkSelectionModel for selection
So far, GtkFileChooserWidget has relied on GtkTreeView's selection
management. This commit moves it away from GtkTreeView, and that's
a massive surgery - sorry :(

The most important aspect of this commit is that 'selection_model'
is now the main model we deal with. Changing between directories,
recent files, and search, all sets the selection_model's model.

Selections are entirely handled by GtkSelectionModel now.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
d5b31a30fd filechooserwidget: Stop centering on selected files 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
39c678988d filechooserwidget: Don't queue redraw / resize on tree view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9052c191cb filechooserwidget: Compare focus against column view
This effectively doesn't work, but focus will be reworked at some
point, and this gets us a tiny bit closer to that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
766f442636 gtkfilechooserwidget: Don't set size request 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
3a3482e41e filechooserwidget: Remove DnD code
Another case where we'll reimplement it later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
5c41dbfaa5 filechooserwidget: Remove sorting
This will be reimplemented later using list models. For now, let's
remove it so we can untangle all this code properly.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c9d2ff7a0f filechooserwidget: Stop autosizing treeview 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
de2624faa7 filechooserwidget: Move tooltip text to column view
Use a closure binding to query the tooltip.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cda784a5f4 filechooserwidget: Move folder navigation to column view
React to column view's 'activate' signal, instead of treeview's
'row-activated'. It doesn't handle file sensitivity yet, but that
will probably be dropped later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cc33dbef03 filechooserwidget: Move keynav handling to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ce36611c4e filechooserwidget: Set rubberbanding on column view
And stop setting it on the tree view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
038cb31d27 filesystemmodel: Don't expose cache
With this commit we start slowly cleaning up the sattelite code
surrounding GtkFileChooserWidget, so that we eventually drop it
all.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
619ff2338e filechooserwidget: Move date and time to column view
Because this is the last treeview column, some pending tasks
are marked as TODO. We're getting close to dropping the tree
view!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
2bcd6949df filechooserwidget: Move file type to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
abd78ce5f5 filechooserwidget: Move size to column view
This was one of the easier ones. We merely delegate the hard work
to g_format_size(), like we already do for treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
7899fc03c4 filechooserwidget: Move location to column view
Move the entire location column, which only contains the location
renderer, to the column view. The code to generate locations from
the current folder is essentially intact.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9984f00781 filechooserwidget: Drop name column from treeview
It is now entirely handled by the column view.
2022-10-20 22:34:40 -04:00