Lazy NodeStore
Our prototype is finally starting to shape up. I spent the past few days figuring out how to do lazy loading into a GTK TreeView. Normally, you would pass all the data to the TreeStore which would then be the container that the TreeView would display but we wanted the data to stay in the database unless we asked for it. (The idea being that we might need to support a database of 30,000 entries and don’t want it to have to consume the memory that all of those would require.) What we wanted was a class that implemented TreeModel (so the TreeView would display it) but that either got it’s data directly from our database or used an adapter over our database but in any case did not actually store the data itself.
I started out by trying to implement the TreeModel interface but after a failed attempt there (the GTK# bindings don’t let you just implement the interface, you have to do C magic!). I decided to use the NodeStore and NodeView way of handling this as it was much more friendly to GTK#. I ended up writing a specialized class (TreeModelAdapter) in the fashion of NodeStore. The downside, is I also have to end up writing my own NodeView class since NodeView is bound directly to NodeStore and not to an interface.
What I really want was something like NodeStore but that used an interface to a store (IList maybe) instead. Sometime later when we aren’t in prototype mode, I’ll see about sitting this over an IList or other appropriate interface.
I found I had to use fixed column widths and fixed row heights if I didn’t want the view to poll the entire data set.
At the end of the day, John and I worked on figuring out how to handle configuring the app. And a discussion on adding entries and filtering summarized here.