Alex Rivera | Logout

Lazy loaded list view in GTK#

Asked 2010-07-02T08:41:58.270
18

I'm looking to display a large dataset via a list view in GTK# and performance is an issue here. I'm currently using a TreeView backed with a ListStore, but adding all my data to the ListStore takes forever. Is there a list view widget of some sort in GTK that supports lazy loading of data? In Winforms, you can use the VirtualMode property of DataGridView to handle this, but I don't see anything of the sort for GTK.

Edit
Report

1 Answer

2

It makes a huge difference if you insert the data into the model while it is hooked up to the view, or you insert all data while it is "offline", and only connect it to the view when you are done. The later is a lot faster, because otherwise the treeview has to regenerate it's internal structures all the time.

If inserting is not the main problem, but fetching the data from your data source is the actual slow part, then what helps a lot is if you can retrieve the amount of rows for the model quickly. If that's the case, then I'd suggest to first create a liststore with all rows allocated with empty contents which you can hook to the view and then fill the actual contents from a idle-callback or thread. Unfortunately there is no batch-api to update the model, so that several rows could be updated at once.

answered 2011-06-28T19:01:44.420

Your Answer