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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.