Whole document tree

Glade Turbo-Start

1. Glade Turbo-Start

This is just enough info to get started. I would also recommend reading the Glade FAQ which comes with the distribution and check out the screenshots.

1.3. The Palette

The Palette displays the widgets that are available for user interface design. They are divided into three categories:

The window icon in the upper left corner is the place to start. Click on it to create a new window. Glade will draw the new window and now you can choose other widgets from the Palette and add them to the window.

Glade uses "boxes" to organize and layout widgets. If you intend to add more than one widget to your window (and you probably will!), choose and place boxes in the window. Your choices are:

  • Horizontal box

  • Vertical box

  • Table

  • Fixed positions

  • Horizontal button box

  • Vertical button box

Boxes can be nested to create complex layout structures. When creating horizontal and vertical boxes, you'll be asked how many rows or columns (subdivisions) to create.

Once boxes have been put down, you can add specific widgets like labels, buttons and other, more complicated widgets into the boxes. Notice that Glade "packs" widgets into the layout which eliminates a lot of tedious work. When you select a widget, the Properties window will display its current properties such as the widget's name. The Signals tabbed page within the Property Editor is the place to attach signal handler functions to the widget.

The example project that I created has one window divided into two parts using the Vertical box layout. The top box contains a menu bar and the bottom box is subdivided into (two) left and right parts using a Horizontal box layout. The menu bar contains a File and Help menu with some menu items beneath each menu. The left part of the Horizontal layout contains a scrolled window which, in turn, contains a viewport with a tree widget inside. The right part contains a Notebook widget with three tabbed pages.

The widget tree can be shown choosing Show Widget Tree under the View menu in the main Glade window. The widget tree for my example application has the overall shape:

  • Window

    • Vertical Box

      • Menu Bar

      • Horizontal Box

        • Scrolled Window

          • Viewport

            • Tree

        • Notebook

The Menu Bar and Notebook can be expanded further to view individual menus, menu items, pages, etc. The widget tree is good way to browse and examine the way that widgets nest.

1.5. Generating Code

After the window looks the way you want it, click on the Build button to generate code. Glade also generates information for autoconf making it easy to build the application on your platform. The following files and directories are created for a simple project:

The src subdirectory contains the source files for the application. Six of these files were mentioned earlier:

  • Interface creation functions — (interface.c, interface.h)

  • Signal handler and callback functions — (callbacks.c, callbacks.h)

  • Support functions — (support.c, support.h)

Glade also generates main.c. Glade does *not* overwrite the following files:

  • main.c

  • callbacks.h

  • callbacks.c

Feel free to edit these files. callbacks.c contain the stubbed signal handling functions which respond to user actions. This is where you need to hook in your application code.

To prepare to build the application, just enter autogen.sh at the shell prompt. Autoconf will create configuration information and makefiles will be generated. Now just enter make to actually build the application. Make will recursively work its way through the build process leaving the final executable program in the src subdirectory. Run the program and check out your interface!

1.8. Authors

Glade was written by Damon Chaplin (). This guide was written by Paul J. Drongowski (). Conversion to DocBook was done by Dan Mueth ().