Update to version 2.33.1
[profile/ivi/glib2.git] / docs / reference / glib / html / glib-changes.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Changes to GLib</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib.html" title="GLib Overview">
9 <link rel="prev" href="glib-running.html" title="Running GLib Applications">
10 <link rel="next" href="glib-resources.html" title="Mailing lists and bug reports">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16 <td><a accesskey="p" href="glib-running.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17 <td><a accesskey="u" href="glib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19 <th width="100%" align="center">GLib Reference Manual</th>
20 <td><a accesskey="n" href="glib-resources.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
21 </tr></table>
22 <div class="refentry">
23 <a name="glib-changes"></a><div class="titlepage"></div>
24 <div class="refnamediv"><table width="100%"><tr>
25 <td valign="top">
26 <h2><span class="refentrytitle">Changes to GLib</span></h2>
27 <p>Changes to GLib — 
28 Incompatible changes made between successing versions of GLib
29 </p>
30 </td>
31 <td valign="top" align="right"></td>
32 </tr></table></div>
33 <div class="refsect1">
34 <a name="idp8051136"></a><h2>Incompatible changes from 2.0 to 2.2</h2>
35 <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
36 <p>
37 GLib changed the seeding algorithm for the pseudo-random number
38 generator Mersenne Twister, as used by <span class="structname">GRand</span>
39 and <span class="structname">GRandom</span>. This was necessary, because some
40 seeds would yield very bad pseudo-random streams. Also the
41 pseudo-random integers generated by
42 <code class="function">g_rand*_int_range()</code> will have a
43 slightly better equal distribution with the new version of GLib.
44 </p>
45 <p>
46 Further information can be found at the website of the Mersenne
47 Twister random number generator at <a class="ulink" href="http://www.math.keio.ac.jp/~matumoto/emt.html" target="_top">http://www.math.keio.ac.jp/~matumoto/emt.html</a>.
48 </p>
49 <p>
50 The original seeding and generation algorithms, as found in GLib
51 2.0.x, can be used instead of the new ones by setting the environment
52 variable <code class="envar">G_RANDOM_VERSION</code> to the value of '2.0'. Use
53 the GLib-2.0 algorithms only if you have sequences of numbers generated
54 with Glib-2.0 that you need to reproduce exactly.  
55 </p>
56 </li></ul></div>
57 </div>
58 <div class="refsect1">
59 <a name="idp8005680"></a><h2>Incompatible changes from 1.2 to 2.0</h2>
60 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
61 <li class="listitem">
62 <p>
63 The event loop functionality <span class="structname">GMain</span> has extensively 
64 been revised to support multiple separate main loops in separate threads. 
65 All sources (timeouts, idle functions, etc.) are associated with a 
66 <span class="structname">GMainContext</span>.
67 </p>
68 <p>
69 Compatibility functions exist so that most application code dealing with
70 the main loop will continue to work. However, code that creates new custom 
71 types of sources will require modification.
72 </p>
73 <p>
74 The main changes here are:
75
76   </p>
77 <div class="itemizedlist"><ul class="itemizedlist" type="circle">
78 <li class="listitem"><p>
79    Sources are now exposed as <span class="type">GSource *</span>, rather than simply as 
80    numeric ids.
81   </p></li>
82 <li class="listitem"><p>
83    New types of sources are created by structure "derivation" from 
84    <span class="structname">GSource</span>, so the <code class="literal">source_data</code> 
85    parameter to the <span class="structname">GSource</span> virtual functions has been
86    replaced with a <span class="type">GSource *</span>.
87   </p></li>
88 <li class="listitem"><p>
89    Sources are first created, then later added to a specific 
90    <span class="structname">GMainContext</span>. 
91   </p></li>
92 <li class="listitem"><p>
93    Dispatching has been modified so both the callback and data are passed
94    in to the <code class="function">dispatch()</code> virtual function.
95   </p></li>
96 </ul></div>
97 <p>
98   To go along with this change, the vtable for 
99   <span class="structname">GIOChannel</span> has changed and
100   <code class="function">add_watch()</code> has been replaced by 
101   <code class="function">create_watch()</code>.
102 </p>
103 </li>
104 <li class="listitem">
105 <p>
106 <code class="function">g_list_foreach()</code> and 
107 <code class="function">g_slist_foreach()</code> have been changed so they
108 are now safe against removal of the current item, not the next item.
109 </p>
110 <p>
111 It's not recommended to mutate the list in the callback to these
112 functions in any case.
113 </p>
114 </li>
115 <li class="listitem"><p>
116 <span class="structname">GDate</span> now works in UTF-8, not in the current locale. 
117 If you want to use it with the encoding of the locale, you need to convert 
118 strings using <code class="function">g_locale_to_utf8()</code> first.
119 </p></li>
120 <li class="listitem">
121 <p>
122 <code class="function">g_strsplit()</code> has been fixed to:
123
124   </p>
125 <div class="itemizedlist"><ul class="itemizedlist" type="circle">
126 <li class="listitem"><p>
127    include trailing empty tokens, rather than stripping them
128   </p></li>
129 <li class="listitem"><p>
130    split into a maximum of <code class="literal">max_tokens</code> tokens, rather 
131    than <code class="literal">max_tokens + 1</code>
132   </p></li>
133 </ul></div>
134 <p>
135
136   Code depending on either of these bugs will need to be fixed.
137 </p>
138 </li>
139 <li class="listitem"><p>
140 Deprecated functions that got removed:
141 <code class="function">g_set_error_handler()</code>, 
142 <code class="function">g_set_warning_handler()</code>,
143 <code class="function">g_set_message_handler()</code>, use 
144 <code class="function">g_log_set_handler()</code> instead.
145 </p></li>
146 </ul></div>
147 </div>
148 </div>
149 <div class="footer">
150 <hr>
151           Generated by GTK-Doc V1.18</div>
152 </body>
153 </html>