Lazy loading

Little post about a useful design pattern in GLib and GTK, written down after a question on the + channel

While I’m not Philip and I won’t go as far as talking about this in public, I wrote down a simple design pattern for lazy loading stuff from a list into a GtkTreeView without blocking your interface or using threads.

Lazy loading using the main loop.

The API has landed

The GtkRecent code is finally in gtk+ HEAD branch.

A couple of things are still missing, mostly documentation and examples (the exact list is here, if you want to check).

The code needed a year to take shape (I was beginning to mull over it a bit too much), but it is cleaner, more efficient and works better than the EggRecent code, that has been copied and pasted all around the world.

The heroes of this tale are undoubtedly: James Willcox, for writing the original code (even if he didn’t reply to my email about its state bad boy, bad boy); Federico Mena-Quintero, for listening to me while we were waiting at a terrible restourant in Stuttgart, and for saying: Go ahead, implement it, and everyone will love you!; Matthias Clasen (still no blog, Matthias?), for helping and suggesting and asking and for maintaining the Best. Toolkit. Ever.

This work is dedicated to my soon-to-be wife, Marta, and for the patience she had while I hacked till the wee hours of the morning. I love you.

And this is just the beginning… I sense bug reports coming…

Merger

Seems that I’m being syndacated… aggregated… whatever… on a Planet, so hi!

I’m starting merging the GBookmarkFile parser into my local copy of GLib’s HEAD branch (the tracker bug is #327662). I’ve created a testb suite and a bunch of invalid and valid bookmark files, in order to test it – and they actually helped me find a couple of stupid regressions that I had introduced.

Pending review of the patch by Matthias, the code should go in GLib first thing next week; once GBookmarkFile is in, the recent manager and the related widgets are due to go in the following days. Right now, I’m writing a patch for GTK’s HEAD branch – stay tuned for a tracker bug about it. Update 2006-03-27@00:31: bug #336121.

Whoa, just a couple weeks shy on a year since I began writing the Perl bindings for the egg-recent code – which is the reason that forced me to open that can of worms and where all the recent files rewrite really began. Never thought that it would take this long, or that it would take me this far. Well, actually I never really thought I had some chances of actually contributing something to the platform libraries at all.

Now listening: Burning down the house, Talking Heads

ChangeLog

Long time, no blog.

Here’s a brief recap of what happened in the last three weeks:

  • Matthias Clasen has began reviewing the Recent Documents code, and we are planning to get it merged beginning next week; I sent a recap to the gtk-devel mailing list, and I’ll send the draft for the Desktop Bookmark specification on the xdg mailing list at fd.o (like I did a year ago, but now I have a working implementation);
  • GNOME 2.14 is out!
  • gnome-utils 2.14.0 is out too!
  • Me and Marta went to London, last week: she went to look the premises of the London School of Economics, as she’ll be taking a MSc there starting from September; me, I met with Matthew Allum, and following the arrengements we made at FOSDEM last Februrary, I signed a contract for working with the great guys at OpenedHand.
  • And last, but not least (or I would be in trouble), I’m getting married!

Gnome-utils 2.13.95 – “Escape Velocity”

Seems like I forgot to announce the new release of gnome-utils; actually, this week-end I had a bad cold (I’m not completely cured, though), and standing in front of my laptop made my eyes sore after two or three minutes.

Anyway, the last release before March 15th is out. It should have been 2.13.94 (and it’s advertised as such inside the README and the NEWS files of the tarball, but who reads those files anyway?), but there has been some misunderstanding between the working copy I checked out from CVS in order to build the release and me. Well, it’s not the first time I fuck up something in the release process – and I’ve got the feeling that it won’t be the last.

The release contains just a couple of last minute fixes, like the handling of the transparency of the applet when the panel is set to a solid color and low opacity; also, the applet’s window can be closed using the Esc key.

Go get it and try it out.