Lazy cell renderer



Hello,

I have a TreeView with lots of rows, one its column is
pixbuf and the pixbufs it displays may need to be loaded
from disk which is quite slow. Moreover, in most cases user
sees only a small fraction of them and then closes the view.
So I want to load the pixbufs only when/if they are actually
exposed.

I set the pixbuf renderer to fixed size and loaded the pixbufs
in cell data func.  Unfortunately, the cell data func was
called for each row when the TreeView was being created, so
all pixbufs had to be loaded before the TreeView was shown
and it was as slow as before.

Since all the unwanted calls to cell data func happen before
the TreeView is realized, my cell data func simply ignores
all calls to it if the TreeView is not realized now.  This
seems to work quite well.  But is it a good idea?  Can I
assume it will work with future Gtk+ versions?

Yeti


--
Dynamic IP address is not a crime.



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