Re: 'reloading' gtktreeview when model changes drastically



On Tue, Jun 19, 2007 at 12:45:09PM +0100, Peter Clifton wrote:
> This seems to break the MVC abstraction - if the model changes
> drastically, I need to know which tree-views are connected so I can
> disconnect them? Bad!
> 
> We need some new API I guess - which signals any connected views that
> the data it has cached about the model should be invalidated, and that
> the model may be changing without emitting signals.
> 
> Once the model is updated, a further signal will inform the view that it
> can keep cached state again.

In practise this won't be all that different compared to setting a new
model on the tree view, except that with a signal it will be initiated
from the model.  After the model emits the "I am finished changing
everything" signal, the tree view will have to rebuild its internal
rbtree by iterating over the full model again (any other model that is
connected to this model will have to rebuild its internal state tree
too), since it has no clue what has changed.  This will probably also
involve unreferencing all nodes when the model emits "invalidate" and
re-reference the new nodes after the mass changing, and remembering
selection and expansion state during the mass-changing (this information
is kept in the internal rbtree too), etc.

I think a much better solution would be to be able to group a bunch of
changes together in a kind of "atomic changeset" which is then emitted
with a single signal.  All connected views/models could then process the
full changeset in one pass.  (Possibly this could also add/remove ranges
of nodes, etc).


regards,

-kris.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]