Introduction to GTK+ 2

The GTK+ 2 package contains libraries used for creating graphical user interfaces for applications.

This package is known to build and work properly using an LFS 7.8-systemd platform.

Package Information

GTK+ 2 Dependencies


ATK-2.18.0, gdk-pixbuf-2.32.1 and Pango-1.38.0



Cups-2.1.0, DocBook-utils-0.6.14, docbook-xml-4.5, docbook-xsl-1.78.1 and libxslt-1.1.28 (to build the manual pages), gobject-introspection-1.46.0 and GTK-Doc-1.24

User Notes:

Installation of GTK+ 2

Install GTK+ 2 by running the following commands:

sed -i "s#l \(gtk-.*\).sgml#& -o \1#" docs/{faq,tutorial}/ &&
./configure --prefix=/usr --sysconfdir=/etc                           &&

To test the results, issue: make check from an X terminal emulator.

Now, as the root user:

make install


If you installed the package on to your system using a “DESTDIR” method, an important file was not installed and must be copied and/or generated. Generate it using the following command as the root user:

gtk-query-immodules-2.0 --update-cache

Command Explanations

sed -e "s#l \(gtk-.*\).sgml#& -o \1#" -i docs/{faq,tutorial}/ If you have DocBook-utils-0.6.14 installed (specifically, if configure finds db2html) then it will try to use it to rebuild some of its HTML documentation and fail due to bugs in some of the Makefiles. This sed fixes the Makefiles.

--enable-gtk-doc: Use this parameter if GTK-Doc is installed and you wish to rebuild and install the API documentation.

--enable-man: Use this switch if you have installed docbook-xml-4.5, docbook-xsl-1.78.1 and libxslt-1.1.28 and want to build and install manual pages for the programs provided by this package.

Configuring GTK+ 2

Config Files

~/.gtkrc-2.0, /etc/gtk-2.0/gtkrc, and /usr/share/gtk-2.0/gtkrc

Configuration Information

GTK+ 2 themes change the way a GTK+ 2 application looks. A GTK+ 2 icon theme can be used to change the icons that appear on the application's toolbar. If you have installed a GTK+ 2 theme (such as gnome-themes-standard-3.16.2) or a GTK+ 2 icon theme (such as adwaita-icon-theme-3.18.0) you can set your preferences in ~/.gtkrc-2.0:

cat > ~/.gtkrc-2.0 << "EOF"
include "/usr/share/themes/Adwaita/gtk-2.0/gtkrc"
gtk-icon-theme-name = "Adwaita"

There are many more themes available at and other places.

Once you've settled on themes you like, you can (as the root user) make them the default system wide:

cat > /etc/gtk-2.0/gtkrc << "EOF"
include "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc"
gtk-icon-theme-name = "elementary"

LXAppearance-0.6.1 is a GTK+ 2 application that can help you choose the themes you like.


Installed Programs: gtk-builder-convert, gtk-demo, gtk-query-immodules-2.0, and gtk-update-icon-cache
Installed Libraries:,, and
Installed Directories: /etc/gtk-2.0, /usr/include/{gail-1.0,gtk-2.0,gtk-unix-print-2.0}, /usr/lib/gtk-2.0, /usr/share/doc/gtk+-2.24.28, /usr/share/gtk-2.0, /usr/share/gtk-doc/html/{gail-libgail-util,gdk2,gtk2}, and /usr/share/themes/{Default,Emacs,Raleigh}

Short Descriptions


converts glade files into XML files which can be loaded with GtkBuilder.


demonstrates GTK+ 2 functionality and provides code for the examples.


collects information about loadable input method modules for GTK+ 2 and writes it to standard output.


creates mmap()able cache files for icon themes. Starting with gtk+-2.24.24, add the flag “--include-image-data” to this command, if you wish previous behavior, with image data in the cache.

contains functions that act as a wrapper around the low-level drawing and windowing functions provided by the underlying graphics system.

contains functions that provide an API to implement graphical user interfaces.

Last updated on 2015-10-08 03:00:22 +0000