Re: Custom Model - iface->get_iter & iface->get_value questions



On Sun, May 3, 2009 at 10:27 PM, Rodrigo Miguel <rodrmigu gmail com> wrote:
Anyway, I think the same can be achieved by using custom models and I found
really good examples in gconf-editor, gnucash and the Gtk Treeview tutorial
from Tim-Philip, so I decide write a generic custom model like Win32
Listview that passes to callback function the cell coords (row and col
number). However I notice the iface->get_iter/get_value goes through all the
records (especifeid by the number of rows) so that would work fine for
postgres result set, since I get it from row and cols coords (PQgetvalue),
but It might not work for a DBF files where I would have thousands/millions
of rows.

My question is. Is this the normal behavior? Is there any way to prevent it,
I mean, just go through or ask for those items that need to be visible only?

Yes, this is the normal behavior at this moment.  Unfortunately, this
is how things were designed in the past.  The get_iter()/get_value()
pairs that you are seeing are most probably being caused by the tree
view iterating over the entire list and measuring all values, it does
this in the background to get some sizing details exactly right.  This
can be avoided by using the "fixed height mode" (please refer to the
documentation and mailing list archives, a lot has been written about
this already).  With this it will basically only call get_value() for
visible items.

Beware that there is another pass over your entire model initiated by
the tree view to build its internal RBTree.  However, this pass only
calls the get_iter() function and the checks whether an iterator has
children or not.  These are rather inexpensive operations and should
scale pretty well (also into millions).  There is no way around this
until there is proper lazy loading support in the tree view.


regards,

-kris.



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