Beginning GTK+/Gnome Programming

ISBN 1-861003-81-1  Price £28.99 UK
Peter Wright           19 Chapters, 5 Appendices and Index in 593 pages

Chapter List

        1    Welcome to GTK+/GNOME
        2    Glib
        3    Introducing GTK+
        4    Controlling the User Interface Layout
        5    Widget Wonders
        6    List and Bulk Data Widgets
        7    Dialogs
        8    Menus
        9    Advanced Widgets
        10  Graphics, Colours and Fonts
        11  Introducing GNOME
        12  GNOME Dialogs
        13  GNOME Widgets
        14  Further GNOME
        15  The GNOME Canvas
        16  The GNOME Integrated Development Environment (gIDE)
        17  Glade
        18  Application:  Image Viewer
        19  Application:  Balls and Springs

    Appendix A
        Signal Callbacks

    Appendix B
        Events

    Appendix C
        GNOME User Interface API Reference

    Appendix D
        ImageViewer

    Appendix E
        Balls and springs
 

Synopsis

This is the best book about the subject of GTK+/GNOME programming that has been produced so far.  From the beginning you get a strong sense of being directly in touch with the subject.  There's also the advantage of being able to subscribe to a GNOME internet list to ask the sort of questions that you wouldn't have been able to ask before you read the book.

Review

Peter Wright is the main author of this book with some technical help from other people.  His ideas and his writing style are easy to understand and make for interesting reading if you want to know more about GNOME programming methods.  He has written ten international best sellers and his talent for writing technical publications shines through in this book as well.  Other contributing authors are Andrew Froggatt.  I think I met him once after hearing that he played cello and knew a thing or two about physics.   Also George Lebl from San Diego and Jaco Prinsloo in South Africa.  As we all know, most open source software is produced with the help of the internet without which operating systems like FreeBSD and Linux would never have become sophisticated or possibly even been invented.

The welcome at the front of the book says it all and it gives a clear explanation of any introductory topics that may be helpful before progressing into the later chapters.  Even the Free Software Foundation and Richard Stallman are mentioned in order to help you to understand some basic ideas.  The rest of the book goes into some detail about libraries, widgets and other parts of the sophisticated programming language that GNOME really is.

Chapter two starts out with thirty pages of introduction to Glib.  All of the introductory subjects that you won't see anywhere else are here and can be understood.  Next is introducing GTK+.  This is enormously useful and gives some simple ideas about code and how to use it properly.  Below is an example from this chapter.........

   /**  " [begin quote]
  *  basicgtk.c
  * 
  *   The most basic, non functioning GTK+ application
  *   you'll ever come across
  */

  #include <gtk/gtk.h>

   gint main (gint argc, gchar * argv [ ] )
   {
        /* Declare a GtkWidget to use as the main window */
        GtkWidget * TheWindow;

        /*  Start GTK+ up, and let it process  any arguments that were */
        /*  passed on in the command line */
        gtk_init  ( &argc, &argv  ) ;

        /*  Create the window itself */
        TheWindow = gtk_window_new  (  GTK_WINDOW_TOPLEVEL );

        /*  Show the window, as far as GTK+ is concerned though, we just want
         /*  to make a widget visible  */
        gtk_widget_show  ( TheWindow ) ;

        /*  Start GTK+ running so that it can catch any signals  */
        gtk_main  () ;

        /*  This line will never be reached in this app  */
        return 0 ;
    }    " [end quote]
 

"Now compile the application and run it.  Type the following into your command line.

# gcc   -Wall   -o  basicgtk   basicgtk.c  'gtk-config  --cflags   --libs'

Then type the following command to run it, assuming the compile goes without a hitch.

# ./basicgtk"

All Wrox Press books are laid out in this way and it does make them easy to understand.  The next part of the book goes into the subject of controlling the user interface layout.  There are plenty of examples of code and below you can see one of those examples.....
 

" [begin quote]
  /** Show the box, which in turn makes certain any visible widgets it holds
      * come into view **/
  gtk_widget_show  ( box  ) ;
  
  /**  Show the window, thus showing the box and any visible widgets in it  **/
  gtk_widget_show  ( window ) ;

  gtk_main  ( ) ;
  return 0 ;

  }
" [end quote]
 

It was at about this point that I was beginning to think something like "I wonder why you can't get visual basic books that are as good as this ?"  Also, "It would have cost me thousands of pounds to have done this with MS Windows programming tools".  I moved on to Widget Wonders and things began to swing along a bit more.  Widgets are the things that make Unix systems tick.  The GTK+ version of widgets is quick and easy making me think that perhaps I should forget VB altogether.  Widgets are indeed a wonder when seen through the pages of a Wrox Press book.  List and bulk data widgets follow on next and even parts of the Gimp are shown and demonstrated.

Dialogs are an important part of every application with a graphical user interface and chapter seven goes into this but not as much as it should.  Building your own dialogs is shown as an introductory subject though and perhaps you can get something from this ?  Menus goes into the part of designing a GUI that most people take for granted.  However, I think there is enough here to help out the beginner.  Advanced widgets puts the rest of the book in perspective and you begin to get some more ideas.  The dew begins to shine on the morning mist over the moor ?

Graphics, Colours and Fonts goes into the GDK and Gimp and shows how it is an integral part of GTK+.  This basically is the Gimp drawing kit which handles graphics and fonts.  It is useful to know more about this but chapter ten is a bit short on the sort of facts that would have been helpful.

Finally after the ten chapter preamble comes the tour de force.  Introducing GNOME takes you from the roadside at Glencoe and up through the heavens and finally to the Lost Glen where miracles are seen to be performed.    GNOME dialogs goes into the quick creation of dialogs with GNOME.  GNOME widgets and Further GNOME are everything that I needed to learn.  The GNOME canvas is also very useful.

I thought that the last two chapters which are about gIDE and Glade were the best part of the book.  This is where I discovered that only Red Hat users are catered for and the other Linux users can just drop dead.  I use SuSE 6.4 myself and I found that it doesn't do what the book claims it does.  This does show you how thorough this publication really is ??  Without it I wouldn't have known.  I also found out that no one on the GNOME development list knew anything about the SuSE distribution either.

I haven't tried the applications that are described at the back of the book.  I assume *that_they_do_work_? *  I found the various appendices to be very useful.

All in all I would have liked a bit more.  I nearly always find that the docs that come with the software that can be downloaded are spartan and it is assumed that you can read someone else's mind at a distance of 15 000 miles or kilometres.

If you haven't done much with GTK+ then do go ahead and buy this book.  Your world will change :-)
 

Review by Richard Ibbotson


Click here for the GNOME site