Glade Interface Designer Manual

Vincent Geddes

GNOME Documentation Project

Sun GNOME Documentation Team

Sun Microsystems

Michael Vance

GNOME Documentation Project

This manual describes version 3.6.0 of Glade.

Feedback

To report a bug or make a suggestion regarding the Glade application or this manual, follow the directions in the GNOME Feedback Page.

Revision History
Revision Glade Manual 3.118 October 2009

Tadej Borovšak

Revision Glade Manual 3.05 December 2006

Vincent Geddes

GNOME Documentation Project

Revision Glade Manual 2.117 June 2004

Sun GNOME Documentation Team

GNOME Documentation Project

Revision Glade User Manual 2.025 February 2004

Sun GNOME Documentation Team

GNOME Documentation Project

Revision Glade User Manual 1.210 Feb 2004

Sun GNOME Documentation Team

GNOME Documentation Project

Revision Glade User Manual 1.130 Mar 2002

Michael Vance

GNOME Documentation Project

Revision Glade User Manual 1.011 May 2000

Michael Vance

GNOME Documentation Project

Abstract

Glade is a user interface designer for GTK+ applications.


Table of Contents

Introduction
Developing and running an application
Developing and running non-Glade application
Developing and running Glade application
Getting Started
To Start Glade
When You Start Glade
Working with Projects
Creating a New Project
Opening a Project
Saving a Project
Working with Widgets and Objects
To Select Widgets From the Palette Window
To Organize Widgets In Your Project
To Place a Widget on the Clipboard
To Copy a Widget to the Clipboard
To Paste a Widget From the Clipboard Into Your Project
To Delete a Widget
To Change a Property of a Widget
About Glade

Introduction

The Glade interface designer enables you to create and edit user interface designs for GTK+ applications.

The GTK+ library provides an extensive collection of user interface building blocks such as text boxes, dialog labels, numeric entries, check boxes and menus. These building blocks are called widgets. You can use Glade to place widgets in a GUI. Glade allows you to modify the layout and properties of these widgets. You can also use Glade to add connections between widgets and application source code.

Some of the widgets need auxiliary non-widget objects in order to be fully operational and Glade can construct some of those objects too.

The user interfaces designed in Glade are stored in an XML format, enabling easy integration with external tools.

Developing and running an application

In this part of manual you will learn about basic principles of developing and running GTK+ applications. Non-Glade application is GTK+ application that is developed without the help of Glade. Glade application is GTK+ application that is developed using Glade.

Developing and running non-Glade application

When developing application with Graphical User Interface (GUI), you need to write two distinct components. First component is code that is responsible for GUI creation. This part tends to be quite large, since you need to manually write every part of yout GUI. Second component is code that provides functionality of your application. In this part you write functions that will respond to GUI interaction.

GUI is connected to code by signals. When part of the GUI is modified, appropriate signal is emitted. If signal is connected to a function, this function is executed.

Schematically, things can be represented like this:

Figure 1. Components of non-Glade application

Shows main components of non-Glade application.

To run non-Glade application, all you need to do is compile the code and run it. Everything that application needs to create GUI is compiled in.

Developing and running Glade application

Similarly to non-Glade application, code of Glade application can also be separated into part that creates GUI and part that provides functionality. Glade application has an additional third componet: GUI design, which is a XML file with description of your GUI.

Main difference between non-Glade application and Glade application is in the amount of code that is used to create GUI. In Glade application, GUI creation code is very short, since majority of GUI creation is done automatically by builder.

Builder is, simply put, a code that reads GUI design and creates real GUI based on that. There are two builders available: libglade and GtkBuilder. Libglade is older of the two and is distributed as a separate library. GtkBuilder is newer and is part of the GTK+ itself. Libglade is being deprecated in favor of GtkBuilder. If you are starting new project, you should use GtkBuilder.

Libglade and GtkBuilder use slightly different GUI design format. Glade can handle both of them.

Your GUI and application code are interconneceted exactly the same way as in non-Glade application.

Glade application can be schematically represented like this:

Figure 2. Components of Glade application

Shows main components of Glade application.

To run your Glade application, you need to compile your code and make sure your builder will be able to find GUI design file when running. Or to rephrase it, GUI design file needs to be present in defined location when application is running.

Getting Started

To Start Glade

You can start Glade in the following ways:

Applications menu

Choose ProgrammingGlade Interface Designer.

Command line

To start Glade from a command line, type the following command, then press Return: glade-3.

When You Start Glade

When you start Glade, the following dialog is displayed.

Figure 3. Project preferences dialog

Shows preferences dialog.

In preference dialog you can set global settings of the project.

Project file format

You can select project format here. If you are not sure what to select, use GtkBuilder, since Libglade is being deprecated.

It is important to note that selecting format will automatically convert your project. This is especially important for projects with some widgets already present, since conversion can cause loss of data that cannot be converted.

Possible loss of data

Unlike most Glade actions, conversion cannot be undone. Once you convert your project, any data that has been lost during conversion cannot be retrieved again. You can convert project back into previous format, but data that has been lost durign first conversion is not regained.

Object names are unique

This option controls uniqueness of the widget names. Withing the project option will make widget names unique within the entire project. Inside toplevels option will make widget names unique within widget tree of a single toplevel window.

Image resources are loaded locally

From the project directory option will make Glade load images from the project directory. For example, if your project is saved in /home/user/my_app folder, images will also be loaded from this folder.

From a project relative directory option will make Glade load images from path, relative to the folder of your project. For example, if you type "images" into entry next to this option and your project is stored in /home/user/my_app folder, images should reside in /home/user/my_app/images folder.

From this directory option will make Glade load images from the absolute path you select. For example, if you select /usr/share/my_app/images here, images will be loaded from this folder.

Note

Location of image resources only affects Glade image loading. To ensure your application will be able to find images when installed, you need to take other measures.

Toolkit version(s) required

By adjusting this option, you can control backwards compatibility of your project. For example, if you select 2.12 here, your project will work on systems that have GTK+ >= 2.12 installed.

Verify versions and deprecations

Verifying versions and deprecations is useless for new projects, since there are no widgets present in project yet. Project settings will prevent inserting incompatible or deprecated widget into you GUI.

This options is useful when you modify any of the settings in existing project, since this can introduce incompatibilities.

After you set preferences of the project and close dialog, you and up with empty project.

Figure 4. Glade main window

Shows main Glade window.

The Glade main window contains the following elements:

Menubar

The menus on the menubar contain all of the commands you need to work with files in Glade.

Toolbar

The toolbar contains a subset of the commands that you can access from the menubar.

Design Area

The design area is where a user interface can be visually edited.

Palette

The palette contains the widgets and objects that can be used to build a user interface.

Inspector

The inspector displays widget tree of a project. It also display auxiliary objects that widgets need to work properly.

Property Editor

The property editor is used to manipulate the properties of widgets and objects, as well as adding connections to source code.

Statusbar

The statusbar displays information about current Glade activity and contextual information about the menu items.

Working with Projects

Creating a New Project

When you start Glade with no initial project to be loaded, Glade will create new empty project for your and display you a preferences dialog.

To create a new project while Glade is running, choose FileNew. The application displays a new blank project in the Glade window and prompts you to set project properties.

Opening a Project

Normaly, when you select Glade project in your file manager, Glade will be started and selected project will be loaded for you.

To open an existing project whe Glade is already running, choose FileOpen. The application displays the project in the Glade window.

Saving a Project

You can save projects in the following ways:

  • To save changes to an existing project file, choose FileSave.

  • To save a new project file or to save an existing project file under a new filename, choose FileSave As. Enter a name for the project file in the Save As dialog, then click Save.

If you have a new project that has not been saved yet and you select FileSave, FileSave As will be called for you.

Working with Widgets and Objects

To Select Widgets From the Palette Window

You can work with the widgets in the Palette window in the following ways:

Selection mode

To use selection mode, click on the Selector arrow. The pointer changes to an arrow to indicate that selection mode is active. In this mode, you use the mouse to select widgets in your project. You can then use the Properties window to edit the properties of the widgets.

You can also use the widget context menu to select a widget. Right-click on a widget to open the widget context menu.

You can add multiple widgets of a specific type from the Palette to your project by holding down the Control key when you select a widget. You need to click on the Selector arrow or another widget in the Palette to return to normal mode.

Widget placement mode

To use widget placement mode, select a widget in the Palette window. When you select most widgets, the pointer changes to a pointer-plus-cross. You can then place the widget inside containers, top-level widgets, and so on. After you place a widget, the mode returns to selection mode.

Top-level placement mode

To use top level placement mode, select a defined top-level widget in the Palette window. When you select a top-level widget in the Palette window, the widget appears immediately on your desktop. You can then edit the widget. After you select a top-level widget, the mode returns to selection mode.

To Organize Widgets In Your Project

You use widget containers, or boxes, to layout and organize widgets in your project window. You can choose the following widget containers from the Palette window:

  • Horizontal Box

  • Vertical Box

  • Table

  • Fixed Positions

  • Horizontal Button Box

  • Vertical Button Box

  • Horizontal Panes

  • Vertical Panes

  • Notebook

  • Frame

  • Scrolled Window

  • Viewport

You can nest boxes to create complex layout structures. When you create horizontal and vertical boxes, Glade asks you how many rows or columns to create initially, though rows and columns can easily be added or deleted later.

When you have created all the boxes you require, you can add specific widgets like labels, buttons, and more complicated widgets into the boxes. Notice that Glade packs widgets into the layout which eliminates a lot of tedious work. The use of boxes enables windows to change size to accommodate different size labels in different languages when the application is localized.

To Place a Widget on the Clipboard

To remove a widget from a parent and place the widget on the clipboard, select the widget then choose EditCut.

To Copy a Widget to the Clipboard

To copy a widget to the clipboard, select the widget then choose EditCopy. The original widget remains attached to the parent.

To Paste a Widget From the Clipboard Into Your Project

To paste a widget that exists on the clipboard into your project, choose EditPaste.

All widgets must have a unique name within Glade. If you cut a widget, and then paste the widget into your project, then the widget and all of the children of the widget keep their original names. If you copy a widget, or paste the widget multiple times into your project, then Glade generates new names for the widget copies.

To Delete a Widget

To delete a widget from the parent without moving the widget to the clipboard, select the widget then choose EditDelete.

To Change a Property of a Widget

The property editor is used to edit the properties of a selected widget. To change a property of a widget, select the widget and then enter an appropriate value in one of the Property window's property fields.

About Glade

Glade is maintained by the Glade developers and GNOME community volunteers. To find more information about Glade, please visit the Glade Web site.

To report a bug or make a suggestion regarding this application or this manual, you can submit them using bugzilla.

Another excellent source of information are the Glade user and developer mailing lists. In addition to subscribing, you might also want to browse the list archives, available via these same links.

This program is distributed under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license can be found at this link, or in the file COPYING included with the source code of this program.