TreeModelFilter and TreeModelSort performance



I'm writing a window where users can filter a list of items.
They enter a search criteria in a text box, and a TreeView
is filled with the items that satisfy their criteria. Items are
sorted by their relevance.

In order to do this, I've loaded all the items into a ListStore.
The ListStore contains an extra column for relevance value.
Then, I've created a function to compute the relevance of an item
according to the search criteria ( returns 0 when items does
not satisfy the criteria ).
Then a TreeModelFilter is connected to the ListStore to
filter out items with relevance equal to 0. Then a TreeModelSort
is connected over TreeModelFilter to sort the items by relevance.
The TreeModelSort is connected to the TreeView.
So, when the user modifies the search criteria, I iterate through
all items in the ListStore, and write a new value into the relevance column.

This works fine for few items ( now, I have less then 200 ).
But, for a large number of items, I think that the TreeModelSort
will have a problem resorting the items too many times.
So, I want to "disable" the TreeModelSort while I'm updating
the relevance, and when the update of relevance is finished,
"enabling" the TreeModelSort, that will sort the items.
Is there a way, or is usefull to do this?

Thank you,
Tiberius



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