Chapter 2. Programming Tutorials

Table of Contents

Language bindings
Learning more
Using the GConf library
Language bindings
Learning more

Here I cover some tools and libraries that you will use to develop applications using Gnome libraries. When I cover libraries, I discuss them from the point of view of the C bindings, but I try to keep the discussion general. Also, there will be a link for each language binding (at least, for each one that I present the examples in) after discussing each library to provide important details for that language binding.


Glade is a GUI (Graphical User Interface) for creating GUIs. It is a tool that generates an XML description of an interface. I think the best way to learn to use glade is to start using it. So I will provide a few pointers on how to get started, what to avoid, and where to look for more information.

To start glade, run the command glade-2. Note that glade-3 is in development and you should keep an eye out for it when it becomes released. When you launch Glade, you will see three windows that appear: the main window, the palette, and the property editor. These are shown below.

Most things in glade you can learn by experimentation. That is also the most fun way to learn. So begin a new project. However, here are some things to keep in mind:

  • When you try to create a new project, Glade will ask you whether you want to make a Gtk+ Project or a Gnome one. The only difference between the two is that Gnome has more widgets available for you from which you can build your interface.
  • To facilitate dynamic resizing, you must first place container widgets (such as horizontal or vertical boxes) in your windows and then place widgets inside those (or place more containers within the outer containers).
  • Glade-2 made the mistake of allowing (and even encouraging) automatic code-generation. Automatic code-generation can be good in other contexts, but is not good in this context. This means that
    • You should not use the "Build" option.
    • When you save your project, you can ignore most the options under the "General" tab (all you care about is the .glade filename, though glade-2 forces you to specify the directory where it will be saved too) and you can ignore all the options under the "C Options" tab.
  • Under the View menu in the main window, there is an option for "Show Widget Tree". I always turn this on, and am puzzled why it is off by default (other than the fact that it is empty when you start since you have no widgets and an empty window can be confusing).
  • You may find that you do not know what all the options in the property editor are for. The best places to learn about these are in the GTK tutorial and the Human Interface Guidelines.

A great way to get started is to try to mimick other examples. You can find several example screenshots of various interfaces in the Human Interface Guidelines. Another great thing to do is to take existing .glade files, load them up in Glade, and then look through how it is built and also modify it yourself. I am including several such examples that you can download below. To learn how to make these interface descriptions into functioning programs, move on to the next section in the tutorial about Libglade.

For more information, check out the Glade homepage.