1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Changes from 1.0 to 1.2: GTK+ 2 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 2 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.33.0 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="migrating.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="checklist-named-icons.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-changes-2-0.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<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 class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="id-1.5.4.3"></a><h2>Incompatible changes from 1.0 to 1.2</h2>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
<span class="structname">GtkAcceleratorTable</span> has been replaced with
<span class="structname">GtkAccelGroup</span>.
</p></li>
<li class="listitem"><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 class="listitem">
<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 class="listitem">
<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 class="informaltable" 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 class="listitem">
<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 class="informaltable" 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 class="listitem"><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 class="listitem"><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 class="listitem">
<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 class="listitem"><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 class="listitem">
<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 class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><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 class="listitem"><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 class="listitem">
<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 class="listitem"><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 class="listitem"><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 class="listitem">
<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">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">gboolean</span> <span class="n">frozen</span><span class="p">;</span>
<span class="n">frozen</span> <span class="o">=</span> <span class="n">GTK_CLIST_FROZEN</span> <span class="p">(</span><span class="n">clist</span><span class="p">);</span>
<span class="n">gtk_clist_freeze</span> <span class="p">(</span><span class="n">clist</span><span class="p">);</span>
<span class="p">[...]</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">frozen</span><span class="p">)</span>
<span class="n">gtk_clist_thaw</span> <span class="p">(</span><span class="n">clist</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
it will not work anymore. It must be, simply:
</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">gtk_clist_freeze</span> <span class="p">(</span><span class="n">clist</span><span class="p">);</span>
<span class="p">[...]</span>
<span class="n">gtk_clist_thaw</span> <span class="p">(</span><span class="n">clist</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
</p>
</li>
<li class="listitem">
<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 class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem"><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 class="listitem">
<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 class="listitem">
<p>There is no longer a special <code class="option">--with-threads</code>
<span class="command"><strong>configure</strong></span> option for GTK+. To use threads in a GTK+
program, you must:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><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 class="listitem"><p>Link with the libraries returned by
<span class="command"><strong>gtk-config --libs gthread</strong></span>
and use the cflags from
<span class="command"><strong>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 class="listitem">
<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 class="orderedlist" type="1">
<li class="listitem">
<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 class="listitem">
<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>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.0</div>
</body>
</html>
|