New GTK+ Book

by havoc

Apress sent me a free copy of Foundations of GTK+ Development by
Andrew Krause. On gtkbook.com,
Andrew has some sample chapters, supplementary articles, and an eBook
version.

As far as I know, this is the only up-to-date GTK+ book. It’s
introductory-level and strikes a nice balance of tutorial and
reference. It goes through the major GTK+ features in a comprehensive
way and has simple examples for each one. If you’re new to GTK+ or
just want to be able to look up a new widget you haven’t used and get
an overview, this looks like the book to get.

While I don’t know him personally, based on his book I’d say Andrew is
a smart guy who writes well, and it’s obvious he put in a lot of
effort researching GTK+ and developing nice example code.

Either a pro or a con depending on what you’re looking for, the book
doesn’t include too much “deep secrets” or background commentary kind
of material; in other words, there isn’t a lot of “here is how this
subsystem works internally” or “this API sucks, don’t use it” kind of
information. On the macro scale, some recommendations might include
“never use gdk_draw_*, always use Cairo” or “use PyGTK+ rather than C
whenever possible,” for example. A more trivial example, it’s useful
to know that “gint” is historical cruft and just “int” is fine to use.

The book would risk being too long and too cluttered with that kind of
thing mixed in, though – one can only learn so many details at once,
and the book has quite a bit of detail already. It does mention major
“gotchas” that are likely to matter in real life, for example warning
about using gtk_scrolled_window_add_with_viewport() with widgets such
as TextView that support scrolling natively. Choosing the level of
detail and background info is a tough balance to strike and Andrew did
a nice job.

One chapter I feel could use more elaboration covers writing a
custom widget. I’d like to see more information on GdkWindow
double-buffering and invalidation, info on no-window widgets and why
they are preferred when possible, and more discussion of the default
implementations of the widget methods and when to override them or
not.

Two nice supplements to this book might be a “deep GTK+
secrets”/”design and implementation of GTK+” type of book, and a
“rapid development with PyGTK+ and Glade” type of book.

That said, if you want to get started with GTK+, you’ll do well with
Foundations of GTK+ Development.
Thanks to Andrew and Apress for offering us an up-to-date GTK+ guide.

(This post was originally found at http://log.ometer.com/2007-06.html#23.2)

My Twitter account is @havocp.
Interested in becoming a better software developer? Sign up for my email list and I'll let you know when I write something new.