Flylib.com

Books Software

 
 
 

Conventions


Conventions

The typographical style of this book is similar to that of other programming books:

  • File, library, GConf keys, and URLs , such as gobject.h , /apps/gconfdemo/ pictures_as_words , and http://www.gnome.org/ are set in italic.

  • Glossary terms appear in boldface italic at first mention.

  • Menu commands are in boldface , separated by an angle bracket (>): for example, File > Open or Help > Info .

  • C code, shell commands, function names, and variable names are in a monospaced typeface:

    GtkWidget *foo = gtk_widget_new();
    

    Note that you can distinguish a function by its trailing parentheses:

    g_timer_new()
    

  • Class names like GtkWidget are set in boldface.

  • Object names also appear in monospace . Therefore, you might see phrases like "The object gconf belongs to the GConfClient class" and " gconf is a GConfClient ." However, you will frequently see "a GConfClient object" used to refer to an indefinite object of a class.

  • Parameters such as object in G_OBJECT( object ) are in monospaced italic .

  • Properties and signals such as changed , set- size , and shadow-type appear in monospaced bold .

  • Pseudocode such as << save humanity >> is monospaced between two sets of angle brackets. You will often see << ... >> . This means that there's no reason to say what this pseudocode does, because it's either obvious or undefined .

  • References to literature such as [Wirth] and [Pennington] appear in brackets. Appendix C is a bibliography.

Note  

There are note indicators in the margin to denote material that is particularly helpful or important.

Warning  

Likewise, if you see a warning in the margin, you should read the material carefully , or there's a good chance that you might shoot yourself in the foot .

Because the text in this book has a maximum width of 83 monospaced characters , all programs and file listings that exceed this limit must be split. A backslash ( \ ) at the end of a line indicates that the next line is a continuation. Unfortunately, not all C compilers understand line continuation in the same way, and some programs that work with the other file listings in this book don't support it at all. You should always consider split lines to be a single line, other than notable exceptions such as Makefiles and shell scripts.



Platform

GTK+ and GNOME have gradually become platform independent. In spite of this, the primary working environment for this book is Unix. When there is a difference among Unix systems, this book leans toward a GNU system with a Linux kernel ( otherwise known as GNU/Linux or just Linux). In general, this book tries to avoid operating system dependencies, but in the interest of space and clarity, it leans toward the GNU platform because it has the overwhelming majority of GNOME installations.



Programming Examples

The examples in this book are quite important. At the very least, you should skim them, acquiring a good idea of what they do and a fundamental understanding of how they work. This text presents many concepts that seem somewhat awkward in words alone but are clear when presented in conjunction with an example.

In the continuing effort to keep this book's page count down, many of the examples here are not complete valid C programs. The first few chapters contain primarily short multiline fragments , demonstrating function calls described in the surrounding text. There are many full programs within the text, though, and you can get them at http://www.nostarch.com/gnome.htm .

If you come across a variable that doesn't seem to have a declaration and you don't know its type or significance, take a look at the previous pages; you should find it there. For instance, the listings accompanying the description of GList don't always contain the line

GList *list;

When a preprocessor directive such as #include appears just before some function calls, then you must use the directive somewhere at the beginning of your source code. This is similar to the style of the online Unix programming manual; run man gethostbyname and look at the SYNOPSIS section.