A few months ago we announced libmodel to the masses, the shiny data model API for GObject, one of our pet projects from Codethink Labs.
Last week we decided to spend some time doing R&D at the company and I asked Ryan how hard would it be to come up with a generic GtkTreeModel implementation, in two days he put together libmodel-gtk!
This solves a quite important problem, GtkTreeModel, and abstract Model APIs are meant to be implemented pretty much for every use case unless you are doing extremely simple stuff, so that you can add smart filtering and sorting from the data source. However, the GtkTreeModel has an API quite hard to implement so everyone end up using List and TreeStore.
Now that we have a libmodel implementation, doing TheRightThing(TM) and wrap the API around the real data store becomes trivial. I quickly put together this twitter client using libsoup-2.4 and json-glib, and it is the first time that I have fun writting an data driven (let alone online) app for GTK+ in quite some time :-)
Grab the source here, it's only 230 lines of Vala, most of it picture retreival/treemodel code actually, to compile it you'll need a fairly recent vala release. Copile using this command line:
~$ valac -g --thread --pkg gtk+-2.0 --pkg json-glib-1.0 --pkg libsoup-2.4 --pkg model-gtk model-twittfeed.vala
We are already planning having some standard set of providers, there's already a filesystem implementation in the model-examples repository, we are cooking a Tracker one and I should be adding a JSON one soon, other implementations are welcome! I would be quite excited to see SQLite, XML, CouchDB ones as well.
This is the kind of things that makes me really proud of working at Codethink, there's an exceptional bunch of smart guys willing to kick the complexity out of the way with elegance and simplicity!
Kudos to Ryan for this one, we should be putting together another release soon.