Re: 'reloading' gtktreeview when model changes drastically

On Sat, 2007-08-04 at 17:00 +0200, Philip Van Hoof wrote:

> The model itself is the source. The view is just a viewer for it. The
> source itself doesn't change. The content of the source changes. The
> view, being an observer of the model in the MVC paradigm, should adapt
> to the changes. It should not require a sudden set and unset of its
> model.

I'm a big user of MVC. Although on some level I agree with you, I would
ask what the difference is between:

void gtk_treeview_freeze (GtkTreeView* tv) { 
      /* store model in tv, then unset */
void gtk_treeview_thaw (GtkTreeView* tv) {
      /* reset model in tv */

and just calling gtk_treeview_set_model (NULL) and
gtk_treeview_set_model (NOTNULL).

there are additional issues: freeze/thaw semantics require use of a
counter, so that, for example, if 3 nested contexts call "freeze", only
the 3rd subsequent call to "thaw" actually unfreezes. contrast this to
the simplicity of code in which only the top level sets+unsets the
model, and all lower levels act on the model regardless of whether its
connected to a view or not.

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