Re: Speedup insert into treestore
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: Speedup insert into treestore
- Date: Mon, 10 Oct 2005 14:12:42 -0400 (EDT)
Florian Schaefer said:
Hi Muppet!
On Sun, 9 Oct 2005 14:44:29 -0400, muppet said:
[...]
This is the basic idiom; i've written it for a list, but you can
expand that to a tree without much difficulty.
[...]
OK, here is my implementation:
1: my $model = $view->get_model;
2: $view->set_model (undef);
3: my @cursort = $model->get_sort_column_id ();
4: $model->set_sort_column_id (-2, 'descending');
5: $model->clear;
...repopulate...
6: $model->set_sort_column_id (@cursort);
7: $view->set_model ($model);
line 3: produces this error:
Gtk-CRITICAL **: gtk_tree_sortable_get_sort_column_id: assertion
`GTK_IS_TREE_SORTABLE (sortable)' failed
This means that whatever class $model is an instance of does not implement the
GtkTreeSortable interface. ListStore and TreeStore both do. The
TreeModelSort proxy class does. TreeModelFilter does not. Custom models may
not.
What is $model actually, then?
line 4: using only one argument (-2) doesn't work here, I must provide a
second one, with this version it gives the same message as line 3.
Again, that means $model doesn't have the right type.
line 5: this results in:
Gtk-CRITICAL **: gtk_tree_store_clear: assertion `GTK_IS_TREE_STORE
(tree_store)' failed
This is complaining the $model is not a Gtk2::TreeStore.
It really sounds like you're using a TreeModelFilter, and need to use
get_child_model to get to the real TreeStore -- e.g.:
$model = $view->get_model->get_child_model();
The fact that you're able to call these methods with an instance that doesn't
have the correct type implies that something is broken in the bindings' @ISA
setup. Could you please strip your program down to the bare minimum needed to
reproduce the problem, and send that?
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]