Preface

This document is part of the Campcaster project, Copyright © 2007 Media Development Loan Fund, under the GNU GPL.

Scope

This document describes the conventions used for the Glade window design files.

Introduction

The following are spacing and other conventions observed in the Glade files src/products/gLiveSupport/var/glade/*.glade. They are loosely based on the design documentation styleguide.pdf.

Structural conventions

Each toplevel has its own file, named the same as the C++ class which controls it, with the extension .glade. For example: ScratchpadWindow.glade, LiveModeWindow.glade. Pop-up dialogs which do not have their own class go into the Glade file of the toplevel which pops them up.

Each toplevel should be a GtkWindow, except for pop-ups like the Login window, confirmation dialogs etc., which are GtkDialogs or subclasses of it.

Always use boxes, because this assures that the widgets get positioned and resized properly when the window is resized. Each toplevel should contain a single GtkVBox, which contains some number of GtkHBoxes and GtkHButtonBoxes, which in turn contain the widgets.

If a group of widgets belong logically together, put them in their own GtkHBox or GtkVBox.

Naming conventions

Widgets which need to be referred to from the controlling class should have a camelCased name followed by "1", with the function of the widget first and the kind of the widget second: e.g., playButton1, fileNameEntry1, scratchpadTreeView1. Such names must be unique in their own Glade file. If there is a group of widgets with same function, they should be numbered starting with 1, like this: myGroupButton1, myGroupButton2, myGroupButton3 etc.

The reason for the "1" at the end of names, and for the unusual 1-based numbering for groups of widgets is that this is how Glade does it. If you follow these guidelines, and copy or move part of the window using copy-paste, the widget names will stay correct. If a widget had a name without a number, and you cut and then repasted it, its name would get an extra "1" at the end.

Widgets which do not need to be referred can keep their Glade-assigned names like treeview3; these do not need to be unique.

Sizing conventions

Each toplevel should have a border width of 8 pixels.

Use spacing, not padding. For example, if some widgets are packed into hbox1, and we want 8 pixels between each widget, set the spacing of hbox1 to 8 pixels; leave the padding of the widgets at 0. To put some space before the first and after the last widget, set the spacing of the outer box which contains hbox1. For finetuning, if spacing can not be used, you can add padding to boxes, but not to widgets.

Normal spacing between widgets is 8 pixels. Spacing between related widgets (e.g., an input field and its label) is 3 pixels.

Other conventions

Use stock buttons whenever possible. This makes the application behave much nicer with themes.