]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Create duplicate list model so sorting by columns works again
authorDirk Hohndel <dirk@hohndel.org>
Mon, 13 Aug 2012 21:42:55 +0000 (14:42 -0700)
committerDirk Hohndel <dirk@hohndel.org>
Tue, 14 Aug 2012 19:43:15 +0000 (12:43 -0700)
One major downside of the switch to a tree model is that sorting by
columns other than date was broken - it would sort the entries within each
date which is not all that useful.

After playing with some Gtk trickery that would allow us to filter out
those rows it quickly became clear that the much easier solution is to
simply maintain TWO models (and therefore two storages). This causes some
overhead and requires some careful tracking of all changes, but it turned
out to be rather straight forward to do.

dive_list now has three model related members:
 model     - current model displayed (which is one of the following two)
 treemodel - the tree model
 listmodel - the list model

One side effect is that the callbacks no longer can pass the model around
(as this could have changed since the callback was registered), but that
seems only a minor drawback and was easily addressed.

The implementation in this commit still has a couple of obvious flaws:
when switching back from the list model to the tree model all the
expansion state of the rows is lost and we end up with just a list of the
different years visible. Also, selections aren't maintained when switching
models.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

No differences found