Writing Really Rad GTK and GNOME Applications in C, Python, or Java
The linux.conf.au GTK tutorial, part I
This was first given as the GTK and GNOME tutorial at linux.conf.au, Australia's Linux and Open Source conference, by Andrew Cowie and Davyd Madeley on 18 Jan 2007 at Sydney and again for LCA 2008 at Melbourne.
You can view the slides online here.
The source code we wrote live during the presentation is also here in the in the in the in the
Video was taken of the 2008 presentation and you can watch via
piece A and
GNOME is the best desktop on the planet, so everyone wants to write applications for it!
Writing GTK programs to work on Linux and other Unix operating systems is actually much easier than common perception would have you believe. The basic concepts involved are fairly straight forward, but the GNOME universe is an extensive one and figuring out where to start can be a bit daunting.
Actually what's involved is:
- Having a development environment and getting all the necessary prerequisite pieces installed
- Knowing how GUI programs work
- Figuring out a way to build the code you've written
- Learning how to test and debug your software
So we'll go through all this with our audience. Somewhat unexpectedly, we will cover three different programming environments. We will show how its done in C because that's what so many of the existing GNOME programs are written in. The whole problem with C, however is that GNOME programs written in it are verbose and arcane, and without prior Glib/GTK/GNOME programming experience very difficult to debug. The good news is you don't have to work in C if you don't want to. So as a contrast, we'll also present GTK in two other languages: Python and Java.
People justifiably laud Python for the ability to rapidly prototype and implement programs. The same extends into writing GUI programs. Once they understand the underlying GTK concepts, anyone with a basic understanding of Python can quickly have a GUI interface to their script or application.
At the other end of the spectrum is Java. Until now the free desktop world hasn't had too much to do with Java, but huge numbers of computer professionals have experience in Java and they too can do rapid application development of GTK and GNOME applications if they wish. There are powerful tools for writing and debugging applications available; even hard nosed experienced hackers will be surprised to see the impressive level of productivity that can arise when these are brought to bear - and the result are fast, tight applications that are "native" GNOME programs, not some lookalike.
GNOME is about more than just writing software. It's about writing rocking software that is:
- highly intuitive and has a well thought out interface focused on usabilty,
- follows a consistent style so it meshes well with other GNOME applications,
- is able to be translated so that people all over the world can use it, and most importantly,
- has that irresistible bling factor that makes all your friends jealous.
Without overwhelming our audience, we'll give a basic overview of what's involved in each of these. We'll quickly run through the landscape of GNOME libraries (just so we can get people focused on the few that will be immediately important), Finally, throughout the tutorial we'll demo lots of examples and to plenty of hands on coding right there.
This tutorial will not try to cover everything, but rather will give people a solid head start down the road of making their own amazing contributions to GNOME.