Claws Mail’s Printing support is implemented, optionally, via libgnomeprint. Output looks rather good, but it has the drawback of requiring an extra library. It was still better than the old ‘lpr’ support :)
Anyway, we now had the possibility to remove this dependancy without removing the feature, as the GTK developers added a new API, GtkPrintOperation, to do printing. This is available with GTK+ 2.10 or greater.
We’ve waited a few monthes before implementing that, because their API is quite generic, and they didn’t provide a way for application developers to easily print a GtkTextBuffer — the GTK widget used texts spanning multiple lines. We thought it would be nice for a lot of application developers to be able to do that easily, and that it would spare them reimplementing the same thing again and again, in every app wanting print support.
I submitted the idea on their Bugzilla, but almost six monthes later with no activity at all on the bug, it’s quite clear that they don’t care.
So, Holger Berndt, one of our developers – author of the Notification plugin, the Perl plugin and the Synce plugin – decided to stop waiting, and implemented text printing of emails via GtkPrintOperation. His patch went into CVS, and the next day I added support for image printing, and a crappy preview. The next day again, Holger rewrote my preview code and turned it into a really nice preview. (Yes, one has to write the preview code, because the GTK developers decided it was better, by default, to do previews using « print-to-pdf-file and run Evince », thus forcing a runtime dependancy on Evince.
Here’s the mandatory screenshot of the new preview:
So, I must say that even if GtkPrintOperation works fine, it feels half-done. The GTK developers did the bare minimum, in my opinion, to help application developers. We had to write 994 lines of code to implement that, and other people will write other 1000 lines of code to do the same thing…