Commit Graph

73990 Commits

Author SHA1 Message Date
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
Matthias Clasen
83431a999c filesystemmodel: Make filtering info available
Provide the filtered-out and visible bits as a file attributes
under the names filechooser::filtered-out and filechooser::visible,
so that we can filter on it.
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
3e4ae62b44 filesystemmodel: Drop an unused include 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
Matthias Clasen
52ef16c21b actionmuxer: Add debug spew for action activation
This helps tracking down whe activation goes wrong.
2022-10-20 22:34:40 -04:00
Matthias Clasen
6ca7104015 filesystemmodel: Drop the tree model implementation
This is no longer used.
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
dc651c3dc3 filechooserentry: Use separate GtkTreeStore for completion
Soon GtkFileSystemModel will not be a GtkTreeModel implementation,
so preemptively remove any usage of this interface. Populate the
list store using the GListModel's 'items-changed' signal.
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
4e3fbd0b0f filesystemmodel: Always set standard::file attribute
This will help us greatly when porting GtkFileSystemModel to
GtkDirectoryList.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
8a24fdea38 filesystemmodel: Trivial cleanup
Use g_set_object() which does exactly what the code there does.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b26222b6ba filechooserutils: Add helper to get GFile from info
This will be used extensively starting from next commit!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c8d291ab86 filechooserentry: Trivial cleanups
Use g_clear_object() in a couple of places. No functional changes.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0a87438432 searchenginemodel: Use GListModel API to filter
We now start a mini-series of commits that will ultimately remove
the GtkTreeModel implementation of GtkFileSystemModel.

As a first step, port GtkSearchEngineModel iter through the files
using GListModel API.
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
1f2561b08e filesystemmodel: Add more GtkFileSystemItem getters
They'll help us further remove GtkTreeModel code.
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
27a3d2d09e filesystemmodel: Don't implement GtkTreeDragSource 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
44c37fa34a filesystemmodel: Drop GtkTreeSortable interface
Stop implementing this interface. We'll be able to reimplement
sorting once we fully transition to GListModel.
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
174af596c5 filechooserwidget: Use column view scrolled window
One less hook to treeview widgetry.
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
3b53a6b0a9 filechooserwidget: Remove extra action bar 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
Georges Basile Stavracas Neto
a0d3bdc911 filechooserwidget: Move file icon to column view
This commit moves the icon loading code into a new private
widget called GtkFileThumbnail, which is bound to the GFileInfo
of the model, and asynchronously loads the file icon from that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b96317b872 filechooserwidget: Move file name to column view
And remove it from the tree view. Next commits will look a lot like
this, until all columns are moved.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
6c84958b9f filechooserwidget: Replace 'list' page with column view
Replace the 'list' page of the main stack with another page, this
one containing a GtkColumnView. This, again, is the very minimal
code to achieve a column view - and validate the GListModel code
introduced in the previous commit - but there's a long way until
this column view covers the full range of features of the file
chooser.

The tree view still lives in an unused 'list2' page. From now on,
commits will "cannibalize" the treeview, each commit porting any
particular feature - be it a column, an event controller, etc -
to the column view, and dropping the corresponding feature from
the treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f2559b1dbb filesystemmodel: Implement GListModel
This is a trivial implementation of the GListModel interface. It
does not do anything fancy, like filtering out hidden files, nor
sorting.

The purpose of this minimal implementation is to bootstrap the
initial work to port GtkFileChooserWidget to GtkColumnView.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ed2ade4801 filesystemmodel: Use g_clear_* on finalize
Trivial cleanup, no functional changes.
2022-10-20 22:34:40 -04:00
Matthias Clasen
4549172825 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix accessibility calls

See merge request GNOME/gtk!5154
2022-10-21 02:28:02 +00:00