Re: Good book on GTK+ 2.0



>   Is there a good book on GTK+ 2.0?
>
>I am assuming that a GTK 1.2 book isn't going to
> help me that much with 2.0.

Hi,

Since no one else has responded, I thought that I would give it a try (also 
being a newbie).  I apologize in advance for the lengthy reply.

1) In my opinion, the books written for GTK+-1.2 are still a good place to 
start, given the lack of books for -2.0.  Even though many things changed 
with -2.0, the basics are still the same.  While there is obviously a lot of 
duplication in the various books. I find that the repetition from studying 
several books helped to drive the basic points home.  In addition, each book 
covered things not covered in other books, and this was very helpful.  I 
picked up numerous tips in this way.

2) There are obviously a lot of places where deprecated functions are used in 
the examples, and numerous places where old functions/structure elements are 
no longer valid.  I had to manually convert some of this code in the examples 
that I wanted to study.  It would be great if someone has already done this 
for the examples in the books - especially the areas dealing with Pango, 
fonts, colors, etc.

3) Learning GTK+ is a lot like looking at a fractal - every time that you 
focus on a single small area, you find out that there is a very large and 
complicated world underneath the surface.  Focus on a small area of that new 
world and the same thing happens.  Those who have been working with GTK+ for 
a long time make GTK+ seem easy, but there are so many features and options 
that it requires a lot of time and effort to learn.

4) There IS a lot of on-line documentation available, but it took a long time 
to find it and to learn to use it.  If you installed your gtk source in:
       "/usr/src/gtk/gtk+-2.2.2"
and installed gtk+ in the default "/usr/local" directory, then add the 
following bookmarks to your browser: (link/description)
    file:/usr/local/share/gtk-doc/html/gtk/index.html
		The GTK+ Reference Manual
    file:/usr/local/share/gtk-doc/html/gdk/index.html
		The GDK Reference Manual
    file:/usr/local/share/gtk-doc/html/gobject/index.html
		The GObject Reference Manual
    file:/usr/local/share/gtk-doc/html/glib/index.html
		The GLib Reference Manual
    file:/usr/local/share/gtk-doc/html/pango/index.html
		The Pango Reference Manual
    file:/usr/local/share/gtk-doc/html/gdk-pixbuf/index.html
		The gdk-pixbuf Library
    file:/usr/local/share/gtk-doc/html/atk/atk.html
		The ATK Library
    file:/usr/src/gtk/gtk+-2.2.2/docs/tutorial/html/book1.html
		The GTK+ Tutorial
    file:/usr/src/gtk/gtk+-2.2.2/docs/faq/html/book1.html
		GTK+ FAQ
    http://developer.gnome.org/dotplan/porting/index.html
		Porting from GTK+-1.2 to GTK+-2.0
    http://mail.gnome.org/archives/gtk-list/
		GTK archives
    http://mail.gnome.org/archives/gtk-app-devel-list/
		GTK App-Devel Archives

5) I also find the .html file available at 
:http://mail.gnome.org/archives/gtk-app-devel-list/2003-August/msg00106.html
to be very helpful when searching for a topic when I don't know where the 
topic is defined (it could be in any of 350 .html files linked to the first 7 
files listed above).

6) Go to the "/usr/src/gtk" directory (or wherever you have your source files) 
and enter:
    find . -name "*.[ch]" -print > taglist
    ctags -L taglist
    rm taglist
This creates a rather large (approx 4M) "tags" file in the current directory 
containing a list of all of the functions and definitions declared in all of 
the GTK+, Pango, Glib, etc. source files.  If you need to look at the source 
code for (say) "gtk_notebook_set_show_tabs", go back to the "/usr/src/gtk" 
directory and enter:
    vi -t gtk_notebook_set_show_tabs
This will open the appropriate source file and move the cursor to the start of 
the desired function/definition.  (This information is from the "Gnome/GTK+ 
Programming Bible", page 16)  If there is a way to do this as a link from a 
.html file, I would appreciate it if someone would give an example.

7) There are a number of example programs in the
    "/usr/src/gtk/gtk+-2.2.2/examples"
directory.  What I specifically like about these examples is that they are 
compiled with options such as:
    -DG_DISABLE_DEPRECATED
    -DGDK_DISABLE_DEPRECATED
    -DGDK_PIXBUF_DISABLE_DEPRECATED
    -DGTK_DISABLE_DEPRECATED
so that there should not be any deprecated code in the examples.

8) There are additional examples in the
    "/usr/src/gtk/gtk+-2.2.2/tests"
directory.  These programs are compiled when gtk+ is compiled, so you have to 
install them somewhere else before doing a "make clean".  Be sure to copy the 
hidden ".libs" directory along with the visible files.  However some of these 
files include statements such as:
     #undef GTK_DISABLE_DEPRECATED
     #define GTK_ENABLE_BROKEN
which indicates that they contain deprecated and broken code (in fact I copied 
these statements to get some of the 1.2 code from the books to compile)..

9) There is also a "gtk-demo" program that is installed with gtk+ (the source 
can be displayed as part of the program).  I don't know if this program uses 
any deprecated code.

I hope that this shortens your learning curve.  If anyone has additional hints 
on navigating the on-line documentation, I would appreciate hearing their 
tips.

Dave Smith



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]