File: //usr/local/ssl/share/gtk-doc/html/gtk/gtk-changes-1-2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Changes from 1.0 to 1.2</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GTK+ Reference Manual">
<link rel="up" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="prev" href="checklist-named-icons.html" title="Use named icons">
<link rel="next" href="gtk-changes-2-0.html" title="Changes from 1.2 to 2.0">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
<link rel="chapter" href="ch02.html" title="Widget Gallery">
<link rel="chapter" href="WindowWidgets.html" title="Windows">
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
<link rel="chapter" href="Ornaments.html" title="Ornaments">
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
<link rel="chapter" href="Printing.html" title="Printing">
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and
GtkComboBoxEntry">
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
<link rel="glossary" href="glossary.html" title="Glossary">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="checklist-named-icons.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="migrating.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ Reference Manual</th>
<td><a accesskey="n" href="gtk-changes-2-0.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" lang="en">
<a name="gtk-changes-1-2"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Changes from 1.0 to 1.2</span></h2>
<p>Changes from 1.0 to 1.2 —
Incompatible changes made between version 1.0 and version 1.2
</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" lang="en">
<a name="id3949705"></a><h2>Incompatible changes from 1.0 to 1.2</h2>
<div class="itemizedlist"><ul type="disc">
<li><p>
<span class="structname">GtkAcceleratorTable</span> has been replaced with
<span class="structname">GtkAccelGroup</span>.
</p></li>
<li><p>
<span class="structname">GtkMenuFactory</span> has been replaced with
<span class="structname">GtkItemFactory</span>, although
a version of <span class="structname">GtkMenuFactory</span> is currently still
provided to ease the migration phase.
</p></li>
<li>
<p>
The <span class="structname">GtkTypeInfo</span> structures used in the
<code class="function">gtk_*_type_init()</code> functions have
changed a bit, the old format:
</p>
<pre class="programlisting">
GtkTypeInfo bin_info =
{
"GtkBin",
sizeof (GtkBin),
sizeof (GtkBinClass),
(GtkClassInitFunc) gtk_bin_class_init,
(GtkObjectInitFunc) gtk_bin_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
};
</pre>
<p>
needs to be converted to:
</p>
<pre class="programlisting">
static const GtkTypeInfo bin_info =
{
"GtkBin",
sizeof (GtkBin),
sizeof (GtkBinClass),
(GtkClassInitFunc) gtk_bin_class_init,
(GtkObjectInitFunc) gtk_bin_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
</pre>
<p>
the <code class="function">GtkArgSetFunc</code> and <code class="function">GtkArgGetFunc</code>
functions are not supported from the type system anymore, and you should make
sure that your code only fills in these fields with <code class="literal">NULL</code>
and doesn't use the deprecated function typedefs
<code class="literal">(GtkArgSetFunc)</code> and <code class="literal">(GtkArgGetFunc)</code>
anymore.
</p>
</li>
<li>
<p>
A number of GTK+ functions were renamed. For compatibility,
<code class="filename">gtkcompat.h</code> #define's the old 1.0.x function names in
terms of the new names. To assure your GTK+ program doesn't rely on outdated
function variants, compile your program with
<code class="option">-DGTK_DISABLE_COMPAT_H</code> to disable
the compatibility aliases.
Here is the list of the old names and replacements:
</p>
<div class="informaltable"><table border="1">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>Old</th>
<th>Replacement</th>
</tr></thead>
<tbody>
<tr>
<td><code class="function">gtk_accel_label_accelerator_width</code></td>
<td><code class="function">gtk_accel_label_get_accel_width</code></td>
</tr>
<tr>
<td><code class="function">gtk_check_menu_item_set_state</code></td>
<td><code class="function">gtk_check_menu_item_set_active</code></td>
</tr>
<tr>
<td><code class="function">gtk_container_border_width</code></td>
<td><code class="function">gtk_container_set_border_width</code></td>
</tr>
<tr>
<td><code class="function">gtk_label_set</code></td>
<td><code class="function">gtk_label_set_text</code></td>
</tr>
<tr>
<td><code class="function">gtk_notebook_current_page</code></td>
<td><code class="function">gtk_notebook_get_current_page</code></td>
</tr>
<tr>
<td><code class="function">gtk_packer_configure</code></td>
<td><code class="function">gtk_packer_set_child_packing</code></td>
</tr>
<tr>
<td><code class="function">gtk_paned_gutter_size</code></td>
<td><code class="function">gtk_paned_set_gutter_size</code></td>
</tr>
<tr>
<td><code class="function">gtk_paned_handle_size</code></td>
<td><code class="function">gtk_paned_set_handle_size</code></td>
</tr>
<tr>
<td><code class="function">gtk_scale_value_width</code></td>
<td><code class="function">gtk_scale_get_value_width</code></td>
</tr>
<tr>
<td><code class="function">gtk_style_apply_default_pixmap</code></td>
<td><code class="function">gtk_style_apply_default_background</code></td>
</tr>
<tr>
<td><code class="function">gtk_toggle_button_set_state</code></td>
<td><code class="function">gtk_toggle_button_set_active</code></td>
</tr>
<tr>
<td><code class="function">gtk_window_position</code></td>
<td><code class="function">gtk_window_set_position</code></td>
</tr>
</tbody>
</table></div>
<p>
Note that <code class="function">gtk_style_apply_default_background()</code> has an
additional argument, <code class="literal">set_bg</code>. This parameter should be
<code class="literal">FALSE</code> if the background is being set for a
<code class="literal">NO_WINDOW</code> widget, otherwise <code class="literal">TRUE</code>.
</p>
</li>
<li>
<p>
During the development phase of the 1.1.x line of GTK+ certain functions
were deprecated and later removed. Functions affected are:
</p>
<div class="informaltable"><table border="1">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>Removed</th>
<th>Replacement</th>
</tr></thead>
<tbody>
<tr>
<td><code class="function">gtk_clist_set_border</code></td>
<td><code class="function">gtk_clist_set_shadow_type</code></td>
</tr>
<tr>
<td><code class="function">gtk_container_block_resize</code></td>
<td><code class="function">gtk_container_set_resize_mode</code></td>
</tr>
<tr>
<td><code class="function">gtk_container_unblock_resize</code></td>
<td><code class="function">gtk_container_set_resize_mode</code></td>
</tr>
<tr>
<td><code class="function">gtk_container_need_resize</code></td>
<td><code class="function">gtk_container_check_resize</code></td>
</tr>
<tr>
<td><code class="function">gtk_ctree_show_stub</code></td>
<td><code class="function">gtk_ctree_set_show_stub</code></td>
</tr>
<tr>
<td><code class="function">gtk_ctree_set_reorderable</code></td>
<td><code class="function">gtk_clist_set_reorderable</code></td>
</tr>
<tr>
<td><code class="function">gtk_ctree_set_use_drag_icons</code></td>
<td><code class="function">gtk_clist_set_use_drag_icons</code></td>
</tr>
<tr>
<td><code class="function">gtk_entry_adjust_scroll</code></td>
<td><code class="function">-</code></td>
</tr>
<tr>
<td><code class="function">gtk_object_class_add_user_signal</code></td>
<td><code class="function">gtk_object_class_user_signal_new</code></td>
</tr>
<tr>
<td><code class="function">gtk_preview_put_row</code></td>
<td><code class="function">gtk_preview_put</code></td>
</tr>
<tr>
<td><code class="function">gtk_progress_bar_construct</code></td>
<td><code class="function">gtk_progress_set_adjustment</code></td>
</tr>
<tr>
<td><code class="function">gtk_scrolled_window_construct</code></td>
<td><code class="function">gtk_scrolled_window_set_{h|v}adjustment</code></td>
</tr>
<tr>
<td><code class="function">gtk_spin_button_construct</code></td>
<td><code class="function">gtk_spin_button_configure</code></td>
</tr>
<tr>
<td><code class="function">gtk_widget_thaw_accelerators</code></td>
<td><code class="function">gtk_widget_unlock_accelerators</code></td>
</tr>
<tr>
<td><code class="function">gtk_widget_freeze_accelerators</code></td>
<td><code class="function">gtk_widget_lock_accelerators</code></td>
</tr>
</tbody>
</table></div>
<p>
Note that <code class="function">gtk_entry_adjust_scroll()</code> is no longer needed
as <span class="structname">GtkEntry</span> should automatically keep the scroll
adjusted properly.
</p>
</li>
<li><p>
Additionally, all <code class="function">gtk_*_interp()</code> functions were removed.
<code class="function">gtk_*_full()</code> versions were provided as of GTK+ 1.0 and
should be used instead.
</p></li>
<li><p>
<span class="structname">GtkButton</span> has been changed to derive from
<span class="structname">GtkBin</span>.
To access a button's child, use <code class="literal">GTK_BIN (button)->child</code>,
instead of the old <code class="literal">GTK_BUTTON (button)->child</code>.
</p></li>
<li>
<p>
The selection API has been slightly modified:
<code class="function">gtk_selection_add_handler()</code> and
<code class="function">gtk_selection_add_handler_full()</code>
have been removed. To supply the selection, one now registers
the targets one is interested in with:
</p>
<pre class="programlisting">
void gtk_selection_add_target (GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
guint info);
</pre>
<p>
or:
</p>
<pre class="programlisting">
void gtk_selection_add_targets (GtkWidget *widget,
GdkAtom selection,
GtkTargetEntry *targets,
guint ntargets);
</pre>
<p>
When a request for a selection is received, the new "selection_get"
signal will be called:
</p>
<pre class="programlisting">
void "selection_get" (GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
guint time);
</pre>
<p>
A "time" parameter has also been added to the "selection_received"
signal.
</p>
<pre class="programlisting">
void "selection_received" (GtkWidget *widget,
GtkSelectionData *selection_data,
guint time);
</pre>
<p>
</p>
</li>
<li><p>
The old drag and drop API has been completely removed and replaced.
See the reference documentation for details on the new API.
</p></li>
<li>
<p>
Support for Themes has been added. In general, this does
not affect application code, however, a few new rules should
be observed:
</p>
<div class="itemizedlist"><ul type="circle">
<li><p>To set a shape for a window, you must use
<code class="function">gtk_widget_shape_combine_mask()</code> instead of
<code class="function">gdk_window_shape_combine_mask()</code>, or the shape will be
reset when switching themes.
</p></li>
<li><p>It is no longer permissable to draw directly on an arbitrary
widget, or to set an arbitrary widget's background pixmap.
If you need to do that, use a <span class="structname">GtkDrawingArea</span> or
(for a toplevel) a <span class="structname">GtkWindow</span> where
<code class="function">gtk_widget_set_app_paintable()</code>
has been called.
</p></li>
</ul></div>
<p>
</p>
</li>
<li>
<p>
The <span class="structname">GtkScrolledWindow</span> widget no longer creates a
<span class="structname">GtkViewport</span> automatically. Instead, it has been
generalized to accept any "self-scrolling" widget.
</p>
<p>
The self-scrolling widgets in the GTK+ core are
<span class="structname">GtkViewport</span>,
<span class="structname">GtkCList</span>, <span class="structname">GtkCTree</span>,
<span class="structname">GtkText</span>, and <span class="structname">GtkLayout</span>.
All of these widgets can be added to a scrolled window as normal children with
<code class="function">gtk_container_add()</code> and scrollbars will be set up
automatically.
</p>
<p>
To add scrollbars to a non self-scrolling widget, (such as a
<span class="structname">GtkList</span>),
first add it to a viewport, then add the viewport to a scrolled window.
The scrolled window code provides a convenience function to do this:
</p>
<pre class="programlisting">
void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,
GtkWidget *child);
</pre>
<p>
This does exactly what it says - it creates a viewport, adds the child
widget to it, then adds the viewport to the scrolled window.
</p>
<p>
The scrollbars have been removed from the <span class="structname">GtkCList</span>
and <span class="structname">GtkCTree</span>, because they are now scrolled by simply
adding them to a scrolled window. The scrollbar policy is set on the scrolled
window with <code class="function">gtk_scrolled_window_set_policy()</code> and not on
the child widgets (e.g. <span class="structname">GtkCList</span>'s
<code class="function">gtk_clist_set_policy()</code> was removed).
</p>
</li>
<li><p>
The "main loop" of GTK+ has been moved to GLib. This should not
affect existing programs, since compatibility functions have
been provided. However, you may want to consider migrating
your code to use the GLib main loop directly.
</p></li>
<li><p>
the <code class="literal">GTK_BASIC</code> flag was removed, and with it the corresponding
macro and function <code class="function">GTK_WIDGET_BASIC()</code> and
<code class="function">gtk_widget_basic()</code>.
</p></li>
<li>
<p>
All freeze/thaw methods are now recursive - that is, if you
freeze a widget n times, you must also thaw it n times.
Therefore, if you have code like:
</p>
<div class="informalexample"><pre class="programlisting">
gboolean frozen;
frozen = GTK_CLIST_FROZEN (clist);
gtk_clist_freeze (clist);
[...]
if (!frozen)
gtk_clist_thaw (clist);
</pre></div>
<p>
it will not work anymore. It must be, simply:
</p>
<div class="informalexample"><pre class="programlisting">
gtk_clist_freeze (clist);
[...]
gtk_clist_thaw (clist);
</pre></div>
<p>
</p>
</li>
<li>
<p>
The thread safety in GTK+ 1.2 is slightly different than
that which appeared in early versions in the 1.1
development track. The main difference is that it relies on
the thread primitives in GLib, and on the thread-safe
GLib main loop.
</p>
<p>
This means:
</p>
<div class="itemizedlist"><ul type="circle">
<li><p>You must call <code class="function">g_thread_init()</code> before
executing any other GTK+ or GDK functions in a threaded GTK+ program.
</p></li>
<li>
<p>Idles, timeouts, and input functions are executed outside
of the main GTK+ lock. So, if you need to call GTK+
inside of such a callback, you must surround the callback
with a <code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>
pair.
</p>
<p>However, signals are still executed within the main
GTK+ lock.
</p>
<p>In particular, this means, if you are writing widgets
that might be used in threaded programs, you <span class="emphasis"><em>must</em></span>
surround timeouts and idle functions in this matter.
</p>
<p>As always, you must also surround any calls to GTK+
not made within a signal handler with a
<code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>
pair.
</p>
</li>
<li>
<p>There is no longer a special <code class="option">--with-threads</code>
<span><strong class="command">configure</strong></span> option for GTK+. To use threads in a GTK+
program, you must:
</p>
<div class="orderedlist"><ol type="1">
<li><p>If you want to use the native thread implementation,
make sure GLib found this in configuration, otherwise,
call you must provide a thread implementation to
<code class="function">g_thread_init()</code>.
</p></li>
<li><p>Link with the libraries returned by
<span><strong class="command">gtk-config --libs gthread</strong></span>
and use the cflags from
<span><strong class="command">gtk-config --cflags gthread</strong></span>.
You can get these <code class="envar">CFLAGS</code> and <code class="envar">LIBS</code> by
passing <code class="literal">gthread</code> as the fourth parameter to the
<code class="literal">AM_PATH_GTK</code> <span class="application">automake</span>
macro.
</p></li>
</ol></div>
<p>
</p>
</li>
</ul></div>
<p>
</p>
</li>
<li>
<p>
Prior to GTK+ 1.2, there were two conflicting interpretations
of <code class="literal">widget->requisition</code>. It was either taken to be
the size that the widget requested, or that size modified by calls to
<code class="function">gtk_widget_set_usize()</code>. In GTK+ 1.2,
it is always interpreted the first way.
</p>
<p>
Container widgets are affected in two ways by this:
</p>
<div class="orderedlist"><ol type="1">
<li>
<p>Container widgets should not pass
<code class="literal">widget->requisition</code> as the second parameter to
<code class="function">gtk_widget_size_request()</code>.
Instead they should call it like:
</p>
<pre class="programlisting">
GtkRequisition child_requisition;
gtk_widget_size_request (widget, &child_requisition);
</pre>
<p>
</p>
</li>
<li>
<p>Container widgets should not access
<code class="literal">child->requisition</code> directly. Either they should use
the values returned by <code class="function">gtk_widget_size_request()</code>,
or they should call the new function:
</p>
<pre class="programlisting">
void gtk_widget_get_child_requisition (GtkWidget *widget,
GtkRequisition *requisition);
</pre>
<p>
which returns the requisition of the given widget, modified
by calls to <code class="function">gtk_widget_set_usize()</code>.
</p>
</li>
</ol></div>
<p>
</p>
</li>
</ul></div>
</div>
</div>
</body>
</html>