GtkTreeModel



Hi!

A question for all you GtkTreeModel wizards out there;

I have implemented a custom GtkTreeModel to model a directory tree. For obvious performance reasons, I need to delay the scanning of a subdirectory until the user actually expands it. Thus, all directories will initially be assumed to contain subdirectories (i.e. my gtk_tree_model_iter_has_child() implementation speculatively returns true).

The tricky part is what happens if the user tries to expand a subdirectory which doesn't happen to contain any subdirectories. Just like the Windoze explorer (cough) directory view, I want the expander for that directory to "magically" disappear when the user tries to expand it.

However, just having the model change its mind turns out to be a very bad idea. I get messages like:

(DirectoryTreeTest:30175): Gtk-CRITICAL **: file gtktreeview.c: line 3243 (gtk_tree_view_bin_expose): assertion `has_child' failed.
There is a disparity between the internal view of the GtkTreeView,
and the GtkTreeModel.  This generally means that the model has changed
without letting the view know.  Any display from now on is likely to
be incorrect.

all over the place...

How can I "let the view know" that the model has changed, and is it safe to do it from within the GtkTreeModel implementation?

Cheers,
--
Christer Palm




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