55
55
<td class="function_type">
56
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
56
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
58
58
<td class="function_name">
59
59
<a class="link" href="GNetworkMonitor.html#g-network-monitor-get-network-available" title="g_network_monitor_get_network_available ()">g_network_monitor_get_network_available</a> <span class="c_punctuation">()</span>
63
63
<td class="function_type">
64
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
64
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
66
66
<td class="function_name">
67
67
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()">g_network_monitor_can_reach</a> <span class="c_punctuation">()</span>
79
79
<td class="function_type">
80
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
80
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
82
82
<td class="function_name">
83
83
<a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-finish" title="g_network_monitor_can_reach_finish ()">g_network_monitor_can_reach_finish</a> <span class="c_punctuation">()</span>
95
95
<col width="200px" class="properties_flags">
98
<td class="property_type"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
98
<td class="property_type"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
99
99
<td class="property_name"><a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property">network-available</a></td>
100
100
<td class="property_flags">Read</td>
149
149
<a name="GNetworkMonitor.prerequisites"></a><h2>Prerequisites</h2>
151
151
GNetworkMonitor requires
152
<a class="link" href="GInitable.html" title="GInitable">GInitable</a> and <a href="../gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
152
<a class="link" href="GInitable.html" title="GInitable">GInitable</a> and <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
154
154
<div class="refsect1">
155
155
<a name="GNetworkMonitor.includes"></a><h2>Includes</h2>
180
180
<div class="refsect2">
181
181
<a name="g-network-monitor-get-network-available"></a><h3>g_network_monitor_get_network_available ()</h3>
182
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
182
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
183
183
g_network_monitor_get_network_available
184
184
(<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>);</pre>
185
185
<p>Checks if the network is available. "Available" here means that the
212
212
<div class="refsect2">
213
213
<a name="g-network-monitor-can-reach"></a><h3>g_network_monitor_can_reach ()</h3>
214
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
214
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
215
215
g_network_monitor_can_reach (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>,
216
216
<em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>,
217
217
<em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
218
<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
218
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
219
219
<p>Attempts to determine whether or not the host pointed to by
220
220
<em class="parameter"><code>connectable</code></em>
221
221
can be reached, without actually trying to connect to
223
<p>This may return <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> even when <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a>
224
is <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, if, for example, <em class="parameter"><code>monitor</code></em>
223
<p>This may return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> even when <a class="link" href="GNetworkMonitor.html#GNetworkMonitor--network-available" title="The “network-available” property"><span class="type">“network-available”</span></a>
224
is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, if, for example, <em class="parameter"><code>monitor</code></em>
225
225
can determine that
226
226
<em class="parameter"><code>connectable</code></em>
227
227
refers to a host on a local network.</p>
228
228
<p>If <em class="parameter"><code>monitor</code></em>
229
229
believes that an attempt to connect to <em class="parameter"><code>connectable</code></em>
231
will succeed, it will return <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. Otherwise, it will return
232
<a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
231
will succeed, it will return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. Otherwise, it will return
232
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and set <em class="parameter"><code>error</code></em>
233
233
to an appropriate error (such as
234
234
<a class="link" href="gio-GIOError.html#G-IO-ERROR-HOST-UNREACHABLE:CAPS"><code class="literal">G_IO_ERROR_HOST_UNREACHABLE</code></a>).</p>
235
235
<p>Note that although this does not attempt to connect to
260
260
<td class="parameter_name"><p>cancellable</p></td>
261
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
261
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
262
262
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
265
265
<td class="parameter_name"><p>error</p></td>
266
<td class="parameter_description"><p>return location for a <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
266
<td class="parameter_description"><p>return location for a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
267
267
<td class="parameter_annotations"> </td>
272
272
<div class="refsect3">
273
273
<a name="id-1.4.14.10.11.4.9"></a><h4>Returns</h4>
274
<p> <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>connectable</code></em>
275
is reachable, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
274
<p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>connectable</code></em>
275
is reachable, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
278
278
<p class="since">Since 2.32</p>
285
285
<em class="parameter"><code><a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> *connectable</code></em>,
286
286
<em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
287
287
<em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
288
<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
288
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
289
289
<p>Asynchronously attempts to determine whether or not the host
290
290
pointed to by <em class="parameter"><code>connectable</code></em>
291
291
can be reached, without actually
318
318
<td class="parameter_name"><p>cancellable</p></td>
319
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
319
<td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
320
320
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
338
338
<div class="refsect2">
339
339
<a name="g-network-monitor-can-reach-finish"></a><h3>g_network_monitor_can_reach_finish ()</h3>
340
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
340
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
341
341
g_network_monitor_can_reach_finish (<em class="parameter"><code><a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor</code></em>,
342
342
<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
343
<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
343
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
344
344
<p>Finishes an async network connectivity test.
345
345
See <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a>.</p>
346
346
<div class="refsect3">
366
366
<td class="parameter_name"><p>error</p></td>
367
<td class="parameter_description"><p>return location for errors, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
367
<td class="parameter_description"><p>return location for errors, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
368
368
<td class="parameter_annotations"> </td>
373
373
<div class="refsect3">
374
374
<a name="id-1.4.14.10.11.6.6"></a><h4>Returns</h4>
375
<p> <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if network is reachable, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
375
<p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if network is reachable, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</p>
424
424
<a name="GNetworkMonitor.property-details"></a><h2>Property Details</h2>
425
425
<div class="refsect2">
426
426
<a name="GNetworkMonitor--network-available"></a><h3>The <code class="literal">“network-available”</code> property</h3>
427
<pre class="programlisting"> “network-available” <a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
427
<pre class="programlisting"> “network-available” <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
428
428
<p>Whether the network is considered available. That is, whether the
429
429
system has a default route for at least one of IPv4 or IPv6.</p>
430
430
<p>Real-world networks are of course much more complicated than
436
436
not active. Thus, it is best to use <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach" title="g_network_monitor_can_reach ()"><code class="function">g_network_monitor_can_reach()</code></a>
437
437
or <a class="link" href="GNetworkMonitor.html#g-network-monitor-can-reach-async" title="g_network_monitor_can_reach_async ()"><code class="function">g_network_monitor_can_reach_async()</code></a> to test for reachability
438
438
on a host-by-host basis. (On the other hand, when the property is
439
<a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, the application can reasonably expect that no remote
439
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, the application can reasonably expect that no remote
440
440
hosts at all are reachable, and should indicate this to the user
442
442
<p>See also <a class="link" href="GNetworkMonitor.html#GNetworkMonitor-network-changed" title="The “network-changed” signal"><span class="type">“network-changed”</span></a>.</p>
451
451
<a name="GNetworkMonitor-network-changed"></a><h3>The <code class="literal">“network-changed”</code> signal</h3>
452
452
<pre class="programlisting"><span class="returnvalue">void</span>
453
453
user_function (<a class="link" href="GNetworkMonitor.html" title="GNetworkMonitor"><span class="type">GNetworkMonitor</span></a> *monitor,
454
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> available,
455
<a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
454
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> available,
455
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data)</pre>
456
456
<p>Emitted when the network configuration changes. If <em class="parameter"><code>available</code></em>
458
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then some hosts may be reachable that were not reachable
458
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then some hosts may be reachable that were not reachable
459
459
before, while others that were reachable before may no longer be
460
460
reachable. If <em class="parameter"><code>available</code></em>
461
is <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then no remote hosts are
461
is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then no remote hosts are
463
463
<div class="refsect3">
464
464
<a name="id-1.4.14.10.14.2.5"></a><h4>Parameters</h4>