gtk2/docs/reference/gtk/migrating-2to3.xml
Matthias Clasen d93b99a273 Remove old migration docs
This information will still be available in the 2.22 docs.
For 3.0, we'll do sortof a clean start.
2010-06-03 01:09:53 -04:00

81 lines
3.1 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-2-to-3">
<title>Migrating from GTK+ 2.x to GTK+ 3</title>
<para>
There are a number of steps that you can take to prepare your GTK+ 2.x
application for the switch to GTK+ 3.
</para>
<section>
<title>Only single includes</title>
<para>
Make sure your program only include the toplevel headers:
<programlisting>
make CFLAGS+="-DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
</programlisting>
</para>
</section>
<section>
<title>Do not use deprecated symbols</title>
<para>
Make sure your program doesn't use any functions that have been
deprecated in GTK+ 2.x:
<programlisting>
make CFLAGS+="-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
</programlisting>
</para>
</section>
<section>
<title>Use accessor functions instead direct access</title>
<para>
GTK+ 3 removes many implementation details and struct members from
its public headers. To ensure that your application does not have problems
with this, you define the preprocessor symbol GSEAL_ENABLE. This will
make the compiler catch all uses of direct access to struct fields so that
you can go through them one by one and replace them with a call to an
accessor function instead.
<programlisting>
make CFLAGS+="-DGSEAL_ENABLE"
</programlisting>
</para>
</section>
<section>
<title>GTK+ Modules</title>
<para>
Some software packages install loadable GTK+ modules such as theme engines,
gdk-pixbuf loaders or input methods. Since GTK+ 3 is parallel-installable
with GTK+ 2.x, the two GTK+ versions have separate locations for their
loadable modules. The location for GTK+ 2.x is
<filename><replaceable>libdir</replaceable>/gtk-2.0</filename>
(and its subdirectories), for GTK+ 3 the location is
<filename><replaceable>libdir</replaceable>/gtk-3.0</filename>
(and its subdirectories).
</para>
<para>
For some kinds of modules, namely input methods and pixbuf loaders,
GTK+ keeps a cache file with extra information about the modules.
For GTK+ 2.x, these cache files are located in
<filename><replaceable>sysconfdir</replaceable>/gtk-2.0</filename>.
For GTK+ 3, they have been moved to
<filename><replaceable>libdir</replaceable>/gtk-3.0/3.0.0/</filename>.
The commands that create these cache files have been renamed with a -3
suffix to make them parallel-installable.
</para>
<para>
Note that GTK+ modules often link against libgtk, libgdk-pixbuf, etc.
If that is the case for your module, you have to be careful to link the
GTK+ 2.x version of your module against the 2.x version of the libraries,
and the GTK+ 3 version against hte 3.x versions. Loading a module linked
against libgtk 2.x into an application using GTK+ 3 will lead to
unhappiness and must be avoided.
</para>
</section>
</chapter>