How to properly clear a ListStore/TreeView and re-populate it?



I have a ListStore and a TreeView of it.  How do I properly clear them
and re-populate them with new items?  I have tried

    gtk_list_store_clear(store);

as well as deleting each item indvidually with:

if (gtk_tree_model_get_iter_first(model, &iter)) {
    delete = iter;
    gtk_tree_model_iter_next(model, &iter);
    do {
        gtk_list_store_remove(store, &delete);
        delete = iter;
    } while (gtk_tree_model_iter_next(model, &iter));
}

(as well as the less complicated method of not preserving iter before
deleting it).

All three methods seem to yield the following kinds of errors on the
stderr though:

  (chooser2:7962): Gtk-CRITICAL **: file ../../gtk/gtktreeview.c: line 3073
  (gtk_tree_view_bin_expose): assertion `has_next' 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.
  
  
  (chooser2:7962): Gtk-CRITICAL **: file ../../gtk/gtktreeview.c: line
  3073 (gtk_tree_view_bin_expose): assertion `has_next' 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.

It seems like there is some kind of syncronization event that I am
missing but I can't seem to find it in any of the GtkTreeView,
GtkTreeModel or GtkListStore API references.

Thanx,
b.

-- 
Brian J. Murrell

Attachment: pgph6gUwriVCd.pgp
Description: PGP signature



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