New upstream version 3.24.8
This commit is contained in:
@ -168,7 +168,7 @@ main (int argc,
|
||||
<p>When you exit the window, by for example pressing the X,
|
||||
the <code class="function">g_application_run()</code> in the main loop returns with a number
|
||||
which is saved inside an integer named "status". Afterwards, the
|
||||
<a class="link" href="GtkApplication.html" title="GtkApplication"><span class="type">GtkApplication</span></a> object is freed from memory with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.
|
||||
<a class="link" href="GtkApplication.html" title="GtkApplication"><span class="type">GtkApplication</span></a> object is freed from memory with <code class="function">g_object_unref()</code>.
|
||||
Finally the status integer is returned and the GTK application exits.</p>
|
||||
<p>While the program is running, GTK+ is receiving
|
||||
<em class="firstterm">events</em>. These are typically input events caused by
|
||||
@ -262,17 +262,17 @@ main (int argc,
|
||||
Using g_signal_connect the button is connected to a function in our app called
|
||||
<code class="function">print_hello()</code>, so that when the button is clicked, GTK will call this function.
|
||||
As the <code class="function">print_hello()</code> function does not use any data as input, NULL is passed
|
||||
to it. <code class="function">print_hello()</code> calls <a href="https://developer.gnome.org/glib/unstable/glib-Warnings-and-Assertions.html#g-print"><code class="function">g_print()</code></a> with the string "Hello World"
|
||||
to it. <code class="function">print_hello()</code> calls <code class="function">g_print()</code> with the string "Hello World"
|
||||
which will print Hello World in a terminal if the GTK application was started
|
||||
from one.</p>
|
||||
<p>After connecting <code class="function">print_hello()</code>, another signal is connected to the "clicked" state
|
||||
of the button using <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#g-signal-connect-swapped"><code class="function">g_signal_connect_swapped()</code></a>. This functions is similar to
|
||||
a <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#g-signal-connect"><code class="function">g_signal_connect()</code></a> with the difference lying in how the callback function is
|
||||
treated. <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#g-signal-connect-swapped"><code class="function">g_signal_connect_swapped()</code></a> allow you to specify what the callback
|
||||
of the button using <code class="function">g_signal_connect_swapped()</code>. This functions is similar to
|
||||
a <code class="function">g_signal_connect()</code> with the difference lying in how the callback function is
|
||||
treated. <code class="function">g_signal_connect_swapped()</code> allow you to specify what the callback
|
||||
function should take as parameter by letting you pass it as data. In this case
|
||||
the function being called back is <a class="link" href="GtkWidget.html#gtk-widget-destroy" title="gtk_widget_destroy ()"><code class="function">gtk_widget_destroy()</code></a> and the <code class="varname">window</code>
|
||||
pointer is passed to it. This has the effect that when the button is clicked,
|
||||
the whole GTK window is destroyed. In contrast if a normal <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#g-signal-connect"><code class="function">g_signal_connect()</code></a> were used
|
||||
the whole GTK window is destroyed. In contrast if a normal <code class="function">g_signal_connect()</code> were used
|
||||
to connect the "clicked" signal with <a class="link" href="GtkWidget.html#gtk-widget-destroy" title="gtk_widget_destroy ()"><code class="function">gtk_widget_destroy()</code></a>, then the <code class="varname">button</code>
|
||||
itself would have been destroyed, not the window.
|
||||
More information about creating buttons can be found
|
||||
|
Reference in New Issue
Block a user