GtkTreeView



All,

I am a recent adopter of GTK+ and am having some difficulties with the GtkTreeView. The problem is that I need to display the contents of a file formatted into a TreeView. However, these files can be up to 50MB or more in size and I do not want to dump them into a list model in their entirety (as I assume the default models are entirely memory resident). I have developed a custom model that first indexes the file (storing a map from rows to byte offsets into the file) and then reads (and formats) the rows as required from the file. I have found
that when the TreeView is exposed it iterates over the entire model 3 times.
The first time it doesn't call anything of the custom model. The second time it calls get_value for each cell in the model. The third iteration calls get_children presumably trying to construct a tree from the model (I am just using a list model construct). It is this second iteration through the model that is causing me headaches as it results in file i/o for each cell. These issues were further complicated as we initially tried to include caching as a mechanism to prevent the file i/o. However, the caching actually slowed things down because nothing was ever requested out of the cache, always from the file.

My limited understanding is that these iterations are so that the TreeView
knows the maximum sizes/formatting of each cell (get_value is called from
gtk_tree_view_column_cell_set_cell_data) so as to calculate things such
as visibility etc. Is there any property or way to avoid these initial iterations through the model? How has everybody else delt
with displaying large datasets in a GtkTreeView?

Any help or advice would be greatly appreciated and I thank you all in advance.

cheers,
Tim Cleaver




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