From: Dirk Hohndel Date: Mon, 13 Aug 2012 21:42:55 +0000 (-0700) Subject: Create duplicate list model so sorting by columns works again X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=27a505e579057596ab10f7381c471b870ce86f87;hp=27a505e579057596ab10f7381c471b870ce86f87;p=ext%2Fsubsurface.git Create duplicate list model so sorting by columns works again 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 ---