This manual describes version 3.6.0 of Glade.
Copyright © 2009 Tadej Borovšak
Copyright © 2006 Vincent Geddes
Copyright © 2004, 2003 Sun Microsystems
Copyright © 2002, 2000 Michael Vance
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.1 | 18 October 2009 |
| Revision Glade Manual 3.0 | 5 December 2006 |
|
GNOME Documentation Project | |
| Revision Glade Manual 2.1 | 17 June 2004 |
|
GNOME Documentation Project | |
| Revision Glade User Manual 2.0 | 25 February 2004 |
|
GNOME Documentation Project | |
| Revision Glade User Manual 1.2 | 10 Feb 2004 |
|
GNOME Documentation Project | |
| Revision Glade User Manual 1.1 | 30 Mar 2002 |
|
GNOME Documentation Project | |
| Revision Glade User Manual 1.0 | 11 May 2000 |
|
GNOME Documentation Project | |
Abstract
Glade is a user interface designer for GTK+ applications.
Table of Contents
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.
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.
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:
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.
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:
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.
You can start Glade in the following ways:
Choose → .
To start Glade from a command line, type the following command, then press Return: glade-3.
When you start Glade, the following dialog is displayed.
In preference dialog you can set global settings of the project.
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.
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.
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.
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.
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.
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.
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.
The Glade main window contains the following elements:
The menus on the menubar contain all of the commands you need to work with files in Glade.
The toolbar contains a subset of the commands that you can access from the menubar.
The design area is where a user interface can be visually edited.
The palette contains the widgets and objects that can be used to build a user interface.
The inspector displays widget tree of a project. It also display auxiliary objects that widgets need to work properly.
The property editor is used to manipulate the properties of widgets and objects, as well as adding connections to source code.
The statusbar displays information about current Glade activity and contextual information about the menu items.
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 → . The application displays a new blank project in the Glade window and prompts you to set project properties.
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 → . The application displays the project in the Glade window.
You can save projects in the following ways:
To save changes to an existing project file, choose → .
To save a new project file or to save an existing project file under a new filename, choose → . Enter a name for the project file in the Save As dialog, then click .
If you have a new project that has not been saved yet and you select → , → will be called for you.
You can work with the widgets in the Palette window in the following ways:
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.
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.
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.
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 remove a widget from a parent and place the widget on the clipboard, select the widget then choose → .
To copy a widget to the clipboard, select the widget then choose → . The original widget remains attached to the parent.
To paste a widget that exists on the clipboard into your project, choose → .
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 from the parent without moving the widget to the clipboard, select the widget then choose → .
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.