86cb7727 |
1 | /* |
2 | * Generated by gdbus-codegen 2.40.0. DO NOT EDIT. |
3 | * |
4 | * The license of this code is the same as for the source it was derived from. |
5 | */ |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | # include "config.h" |
9 | #endif |
10 | |
ed99526e |
11 | #include "hostnamed-gen.h" |
86cb7727 |
12 | |
13 | #include <string.h> |
14 | #ifdef G_OS_UNIX |
15 | # include <gio/gunixfdlist.h> |
16 | #endif |
17 | |
18 | typedef struct |
19 | { |
20 | GDBusArgInfo parent_struct; |
21 | gboolean use_gvariant; |
22 | } _ExtendedGDBusArgInfo; |
23 | |
24 | typedef struct |
25 | { |
26 | GDBusMethodInfo parent_struct; |
27 | const gchar *signal_name; |
28 | gboolean pass_fdlist; |
29 | } _ExtendedGDBusMethodInfo; |
30 | |
31 | typedef struct |
32 | { |
33 | GDBusSignalInfo parent_struct; |
34 | const gchar *signal_name; |
35 | } _ExtendedGDBusSignalInfo; |
36 | |
37 | typedef struct |
38 | { |
39 | GDBusPropertyInfo parent_struct; |
40 | const gchar *hyphen_name; |
41 | gboolean use_gvariant; |
42 | } _ExtendedGDBusPropertyInfo; |
43 | |
44 | typedef struct |
45 | { |
46 | GDBusInterfaceInfo parent_struct; |
47 | const gchar *hyphen_name; |
48 | } _ExtendedGDBusInterfaceInfo; |
49 | |
50 | typedef struct |
51 | { |
52 | const _ExtendedGDBusPropertyInfo *info; |
53 | guint prop_id; |
54 | GValue orig_value; /* the value before the change */ |
55 | } ChangedProperty; |
56 | |
57 | static void |
58 | _changed_property_free (ChangedProperty *data) |
59 | { |
60 | g_value_unset (&data->orig_value); |
61 | g_free (data); |
62 | } |
63 | |
64 | static gboolean |
65 | _g_strv_equal0 (gchar **a, gchar **b) |
66 | { |
67 | gboolean ret = FALSE; |
68 | guint n; |
69 | if (a == NULL && b == NULL) |
70 | { |
71 | ret = TRUE; |
72 | goto out; |
73 | } |
74 | if (a == NULL || b == NULL) |
75 | goto out; |
76 | if (g_strv_length (a) != g_strv_length (b)) |
77 | goto out; |
78 | for (n = 0; a[n] != NULL; n++) |
79 | if (g_strcmp0 (a[n], b[n]) != 0) |
80 | goto out; |
81 | ret = TRUE; |
82 | out: |
83 | return ret; |
84 | } |
85 | |
86 | static gboolean |
87 | _g_variant_equal0 (GVariant *a, GVariant *b) |
88 | { |
89 | gboolean ret = FALSE; |
90 | if (a == NULL && b == NULL) |
91 | { |
92 | ret = TRUE; |
93 | goto out; |
94 | } |
95 | if (a == NULL || b == NULL) |
96 | goto out; |
97 | ret = g_variant_equal (a, b); |
98 | out: |
99 | return ret; |
100 | } |
101 | |
102 | G_GNUC_UNUSED static gboolean |
103 | _g_value_equal (const GValue *a, const GValue *b) |
104 | { |
105 | gboolean ret = FALSE; |
106 | g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
107 | switch (G_VALUE_TYPE (a)) |
108 | { |
109 | case G_TYPE_BOOLEAN: |
110 | ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
111 | break; |
112 | case G_TYPE_UCHAR: |
113 | ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
114 | break; |
115 | case G_TYPE_INT: |
116 | ret = (g_value_get_int (a) == g_value_get_int (b)); |
117 | break; |
118 | case G_TYPE_UINT: |
119 | ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
120 | break; |
121 | case G_TYPE_INT64: |
122 | ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
123 | break; |
124 | case G_TYPE_UINT64: |
125 | ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
126 | break; |
127 | case G_TYPE_DOUBLE: |
128 | { |
129 | /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
130 | gdouble da = g_value_get_double (a); |
131 | gdouble db = g_value_get_double (b); |
132 | ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
133 | } |
134 | break; |
135 | case G_TYPE_STRING: |
136 | ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
137 | break; |
138 | case G_TYPE_VARIANT: |
139 | ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
140 | break; |
141 | default: |
142 | if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
143 | ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
144 | else |
145 | g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
146 | break; |
147 | } |
148 | return ret; |
149 | } |
150 | |
151 | /* ------------------------------------------------------------------------ |
7ce16a35 |
152 | * Code for interface org.freedesktop.DBus.Peer |
86cb7727 |
153 | * ------------------------------------------------------------------------ |
154 | */ |
155 | |
156 | /** |
7ce16a35 |
157 | * SECTION:DBusPeer |
158 | * @title: DBusPeer |
159 | * @short_description: Generated C code for the org.freedesktop.DBus.Peer D-Bus interface |
86cb7727 |
160 | * |
7ce16a35 |
161 | * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link> D-Bus interface in C. |
86cb7727 |
162 | */ |
163 | |
7ce16a35 |
164 | /* ---- Introspection data for org.freedesktop.DBus.Peer ---- */ |
86cb7727 |
165 | |
7ce16a35 |
166 | static const _ExtendedGDBusMethodInfo _dbus_peer_method_info_ping = |
86cb7727 |
167 | { |
168 | { |
169 | -1, |
7ce16a35 |
170 | (gchar *) "Ping", |
86cb7727 |
171 | NULL, |
86cb7727 |
172 | NULL, |
173 | NULL |
174 | }, |
7ce16a35 |
175 | "handle-ping", |
86cb7727 |
176 | FALSE |
177 | }; |
178 | |
7ce16a35 |
179 | static const _ExtendedGDBusArgInfo _dbus_peer_method_info_get_machine_id_OUT_ARG_machine_uuid = |
86cb7727 |
180 | { |
181 | { |
182 | -1, |
7ce16a35 |
183 | (gchar *) "machine_uuid", |
86cb7727 |
184 | (gchar *) "s", |
185 | NULL |
186 | }, |
187 | FALSE |
188 | }; |
189 | |
7ce16a35 |
190 | static const _ExtendedGDBusArgInfo * const _dbus_peer_method_info_get_machine_id_OUT_ARG_pointers[] = |
86cb7727 |
191 | { |
7ce16a35 |
192 | &_dbus_peer_method_info_get_machine_id_OUT_ARG_machine_uuid, |
86cb7727 |
193 | NULL |
194 | }; |
195 | |
7ce16a35 |
196 | static const _ExtendedGDBusMethodInfo _dbus_peer_method_info_get_machine_id = |
86cb7727 |
197 | { |
198 | { |
199 | -1, |
7ce16a35 |
200 | (gchar *) "GetMachineId", |
86cb7727 |
201 | NULL, |
7ce16a35 |
202 | (GDBusArgInfo **) &_dbus_peer_method_info_get_machine_id_OUT_ARG_pointers, |
86cb7727 |
203 | NULL |
204 | }, |
7ce16a35 |
205 | "handle-get-machine-id", |
86cb7727 |
206 | FALSE |
207 | }; |
208 | |
7ce16a35 |
209 | static const _ExtendedGDBusMethodInfo * const _dbus_peer_method_info_pointers[] = |
86cb7727 |
210 | { |
7ce16a35 |
211 | &_dbus_peer_method_info_ping, |
212 | &_dbus_peer_method_info_get_machine_id, |
86cb7727 |
213 | NULL |
214 | }; |
215 | |
7ce16a35 |
216 | static const _ExtendedGDBusInterfaceInfo _dbus_peer_interface_info = |
86cb7727 |
217 | { |
218 | { |
219 | -1, |
7ce16a35 |
220 | (gchar *) "org.freedesktop.DBus.Peer", |
221 | (GDBusMethodInfo **) &_dbus_peer_method_info_pointers, |
86cb7727 |
222 | NULL, |
86cb7727 |
223 | NULL, |
86cb7727 |
224 | NULL |
225 | }, |
7ce16a35 |
226 | "dbus-peer", |
86cb7727 |
227 | }; |
228 | |
229 | |
230 | /** |
7ce16a35 |
231 | * dbus_peer_interface_info: |
86cb7727 |
232 | * |
7ce16a35 |
233 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link> D-Bus interface. |
86cb7727 |
234 | * |
235 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
236 | */ |
237 | GDBusInterfaceInfo * |
7ce16a35 |
238 | dbus_peer_interface_info (void) |
86cb7727 |
239 | { |
7ce16a35 |
240 | return (GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct; |
86cb7727 |
241 | } |
242 | |
243 | /** |
7ce16a35 |
244 | * dbus_peer_override_properties: |
86cb7727 |
245 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
246 | * @property_id_begin: The property id to assign to the first overridden property. |
247 | * |
7ce16a35 |
248 | * Overrides all #GObject properties in the #DBusPeer interface for a concrete class. |
86cb7727 |
249 | * The properties are overridden in the order they are defined. |
250 | * |
251 | * Returns: The last property id. |
252 | */ |
253 | guint |
7ce16a35 |
254 | dbus_peer_override_properties (GObjectClass *klass, guint property_id_begin) |
86cb7727 |
255 | { |
86cb7727 |
256 | return property_id_begin - 1; |
257 | } |
258 | |
259 | |
260 | |
261 | /** |
7ce16a35 |
262 | * DBusPeer: |
86cb7727 |
263 | * |
7ce16a35 |
264 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link>. |
86cb7727 |
265 | */ |
266 | |
267 | /** |
7ce16a35 |
268 | * DBusPeerIface: |
86cb7727 |
269 | * @parent_iface: The parent interface. |
7ce16a35 |
270 | * @handle_get_machine_id: Handler for the #DBusPeer::handle-get-machine-id signal. |
271 | * @handle_ping: Handler for the #DBusPeer::handle-ping signal. |
86cb7727 |
272 | * |
7ce16a35 |
273 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link>. |
86cb7727 |
274 | */ |
275 | |
7ce16a35 |
276 | typedef DBusPeerIface DBusPeerInterface; |
277 | G_DEFINE_INTERFACE (DBusPeer, dbus_peer, G_TYPE_OBJECT); |
86cb7727 |
278 | |
279 | static void |
7ce16a35 |
280 | dbus_peer_default_init (DBusPeerIface *iface) |
86cb7727 |
281 | { |
282 | /* GObject signals for incoming D-Bus method calls: */ |
283 | /** |
7ce16a35 |
284 | * DBusPeer::handle-ping: |
285 | * @object: A #DBusPeer. |
86cb7727 |
286 | * @invocation: A #GDBusMethodInvocation. |
86cb7727 |
287 | * |
7ce16a35 |
288 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.Ping">Ping()</link> D-Bus method. |
86cb7727 |
289 | * |
7ce16a35 |
290 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_peer_complete_ping() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
86cb7727 |
291 | * |
292 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
293 | */ |
7ce16a35 |
294 | g_signal_new ("handle-ping", |
86cb7727 |
295 | G_TYPE_FROM_INTERFACE (iface), |
296 | G_SIGNAL_RUN_LAST, |
7ce16a35 |
297 | G_STRUCT_OFFSET (DBusPeerIface, handle_ping), |
86cb7727 |
298 | g_signal_accumulator_true_handled, |
299 | NULL, |
300 | g_cclosure_marshal_generic, |
301 | G_TYPE_BOOLEAN, |
7ce16a35 |
302 | 1, |
303 | G_TYPE_DBUS_METHOD_INVOCATION); |
86cb7727 |
304 | |
305 | /** |
7ce16a35 |
306 | * DBusPeer::handle-get-machine-id: |
307 | * @object: A #DBusPeer. |
86cb7727 |
308 | * @invocation: A #GDBusMethodInvocation. |
86cb7727 |
309 | * |
7ce16a35 |
310 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.GetMachineId">GetMachineId()</link> D-Bus method. |
86cb7727 |
311 | * |
7ce16a35 |
312 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_peer_complete_get_machine_id() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
86cb7727 |
313 | * |
314 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
315 | */ |
7ce16a35 |
316 | g_signal_new ("handle-get-machine-id", |
86cb7727 |
317 | G_TYPE_FROM_INTERFACE (iface), |
318 | G_SIGNAL_RUN_LAST, |
7ce16a35 |
319 | G_STRUCT_OFFSET (DBusPeerIface, handle_get_machine_id), |
86cb7727 |
320 | g_signal_accumulator_true_handled, |
321 | NULL, |
322 | g_cclosure_marshal_generic, |
323 | G_TYPE_BOOLEAN, |
7ce16a35 |
324 | 1, |
325 | G_TYPE_DBUS_METHOD_INVOCATION); |
86cb7727 |
326 | |
7ce16a35 |
327 | } |
86cb7727 |
328 | |
7ce16a35 |
329 | /** |
330 | * dbus_peer_call_ping: |
331 | * @proxy: A #DBusPeerProxy. |
332 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
333 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
334 | * @user_data: User data to pass to @callback. |
335 | * |
336 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.Ping">Ping()</link> D-Bus method on @proxy. |
337 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
338 | * You can then call dbus_peer_call_ping_finish() to get the result of the operation. |
339 | * |
340 | * See dbus_peer_call_ping_sync() for the synchronous, blocking version of this method. |
341 | */ |
342 | void |
343 | dbus_peer_call_ping ( |
344 | DBusPeer *proxy, |
345 | GCancellable *cancellable, |
346 | GAsyncReadyCallback callback, |
347 | gpointer user_data) |
348 | { |
349 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
350 | "Ping", |
351 | g_variant_new ("()"), |
352 | G_DBUS_CALL_FLAGS_NONE, |
353 | -1, |
354 | cancellable, |
355 | callback, |
356 | user_data); |
357 | } |
358 | |
359 | /** |
360 | * dbus_peer_call_ping_finish: |
361 | * @proxy: A #DBusPeerProxy. |
362 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_peer_call_ping(). |
363 | * @error: Return location for error or %NULL. |
364 | * |
365 | * Finishes an operation started with dbus_peer_call_ping(). |
366 | * |
367 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
368 | */ |
369 | gboolean |
370 | dbus_peer_call_ping_finish ( |
371 | DBusPeer *proxy, |
372 | GAsyncResult *res, |
373 | GError **error) |
374 | { |
375 | GVariant *_ret; |
376 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
377 | if (_ret == NULL) |
378 | goto _out; |
379 | g_variant_get (_ret, |
380 | "()"); |
381 | g_variant_unref (_ret); |
382 | _out: |
383 | return _ret != NULL; |
384 | } |
385 | |
386 | /** |
387 | * dbus_peer_call_ping_sync: |
388 | * @proxy: A #DBusPeerProxy. |
389 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
390 | * @error: Return location for error or %NULL. |
391 | * |
392 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.Ping">Ping()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
393 | * |
394 | * See dbus_peer_call_ping() for the asynchronous version of this method. |
395 | * |
396 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
397 | */ |
398 | gboolean |
399 | dbus_peer_call_ping_sync ( |
400 | DBusPeer *proxy, |
401 | GCancellable *cancellable, |
402 | GError **error) |
403 | { |
404 | GVariant *_ret; |
405 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
406 | "Ping", |
407 | g_variant_new ("()"), |
408 | G_DBUS_CALL_FLAGS_NONE, |
409 | -1, |
410 | cancellable, |
411 | error); |
412 | if (_ret == NULL) |
413 | goto _out; |
414 | g_variant_get (_ret, |
415 | "()"); |
416 | g_variant_unref (_ret); |
417 | _out: |
418 | return _ret != NULL; |
419 | } |
420 | |
421 | /** |
422 | * dbus_peer_call_get_machine_id: |
423 | * @proxy: A #DBusPeerProxy. |
424 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
425 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
426 | * @user_data: User data to pass to @callback. |
427 | * |
428 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.GetMachineId">GetMachineId()</link> D-Bus method on @proxy. |
429 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
430 | * You can then call dbus_peer_call_get_machine_id_finish() to get the result of the operation. |
431 | * |
432 | * See dbus_peer_call_get_machine_id_sync() for the synchronous, blocking version of this method. |
433 | */ |
434 | void |
435 | dbus_peer_call_get_machine_id ( |
436 | DBusPeer *proxy, |
437 | GCancellable *cancellable, |
438 | GAsyncReadyCallback callback, |
439 | gpointer user_data) |
440 | { |
441 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
442 | "GetMachineId", |
443 | g_variant_new ("()"), |
444 | G_DBUS_CALL_FLAGS_NONE, |
445 | -1, |
446 | cancellable, |
447 | callback, |
448 | user_data); |
449 | } |
450 | |
451 | /** |
452 | * dbus_peer_call_get_machine_id_finish: |
453 | * @proxy: A #DBusPeerProxy. |
454 | * @out_machine_uuid: (out): Return location for return parameter or %NULL to ignore. |
455 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_peer_call_get_machine_id(). |
456 | * @error: Return location for error or %NULL. |
457 | * |
458 | * Finishes an operation started with dbus_peer_call_get_machine_id(). |
459 | * |
460 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
461 | */ |
462 | gboolean |
463 | dbus_peer_call_get_machine_id_finish ( |
464 | DBusPeer *proxy, |
465 | gchar **out_machine_uuid, |
466 | GAsyncResult *res, |
467 | GError **error) |
468 | { |
469 | GVariant *_ret; |
470 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
471 | if (_ret == NULL) |
472 | goto _out; |
473 | g_variant_get (_ret, |
474 | "(s)", |
475 | out_machine_uuid); |
476 | g_variant_unref (_ret); |
477 | _out: |
478 | return _ret != NULL; |
479 | } |
480 | |
481 | /** |
482 | * dbus_peer_call_get_machine_id_sync: |
483 | * @proxy: A #DBusPeerProxy. |
484 | * @out_machine_uuid: (out): Return location for return parameter or %NULL to ignore. |
485 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
486 | * @error: Return location for error or %NULL. |
487 | * |
488 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.GetMachineId">GetMachineId()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
489 | * |
490 | * See dbus_peer_call_get_machine_id() for the asynchronous version of this method. |
491 | * |
492 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
493 | */ |
494 | gboolean |
495 | dbus_peer_call_get_machine_id_sync ( |
496 | DBusPeer *proxy, |
497 | gchar **out_machine_uuid, |
498 | GCancellable *cancellable, |
499 | GError **error) |
500 | { |
501 | GVariant *_ret; |
502 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
503 | "GetMachineId", |
504 | g_variant_new ("()"), |
505 | G_DBUS_CALL_FLAGS_NONE, |
506 | -1, |
507 | cancellable, |
508 | error); |
509 | if (_ret == NULL) |
510 | goto _out; |
511 | g_variant_get (_ret, |
512 | "(s)", |
513 | out_machine_uuid); |
514 | g_variant_unref (_ret); |
515 | _out: |
516 | return _ret != NULL; |
517 | } |
518 | |
519 | /** |
520 | * dbus_peer_complete_ping: |
521 | * @object: A #DBusPeer. |
522 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
523 | * |
524 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.Ping">Ping()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
525 | * |
526 | * This method will free @invocation, you cannot use it afterwards. |
527 | */ |
528 | void |
529 | dbus_peer_complete_ping ( |
530 | DBusPeer *object, |
531 | GDBusMethodInvocation *invocation) |
532 | { |
533 | g_dbus_method_invocation_return_value (invocation, |
534 | g_variant_new ("()")); |
535 | } |
536 | |
537 | /** |
538 | * dbus_peer_complete_get_machine_id: |
539 | * @object: A #DBusPeer. |
540 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
541 | * @machine_uuid: Parameter to return. |
542 | * |
543 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Peer.GetMachineId">GetMachineId()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
544 | * |
545 | * This method will free @invocation, you cannot use it afterwards. |
546 | */ |
547 | void |
548 | dbus_peer_complete_get_machine_id ( |
549 | DBusPeer *object, |
550 | GDBusMethodInvocation *invocation, |
551 | const gchar *machine_uuid) |
552 | { |
553 | g_dbus_method_invocation_return_value (invocation, |
554 | g_variant_new ("(s)", |
555 | machine_uuid)); |
556 | } |
557 | |
558 | /* ------------------------------------------------------------------------ */ |
559 | |
560 | /** |
561 | * DBusPeerProxy: |
562 | * |
563 | * The #DBusPeerProxy structure contains only private data and should only be accessed using the provided API. |
564 | */ |
565 | |
566 | /** |
567 | * DBusPeerProxyClass: |
568 | * @parent_class: The parent class. |
569 | * |
570 | * Class structure for #DBusPeerProxy. |
571 | */ |
572 | |
573 | struct _DBusPeerProxyPrivate |
574 | { |
575 | GData *qdata; |
576 | }; |
577 | |
578 | static void dbus_peer_proxy_iface_init (DBusPeerIface *iface); |
579 | |
580 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
581 | G_DEFINE_TYPE_WITH_CODE (DBusPeerProxy, dbus_peer_proxy, G_TYPE_DBUS_PROXY, |
582 | G_ADD_PRIVATE (DBusPeerProxy) |
583 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PEER, dbus_peer_proxy_iface_init)); |
584 | |
585 | #else |
586 | G_DEFINE_TYPE_WITH_CODE (DBusPeerProxy, dbus_peer_proxy, G_TYPE_DBUS_PROXY, |
587 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PEER, dbus_peer_proxy_iface_init)); |
588 | |
589 | #endif |
590 | static void |
591 | dbus_peer_proxy_finalize (GObject *object) |
592 | { |
593 | DBusPeerProxy *proxy = DBUS_PEER_PROXY (object); |
594 | g_datalist_clear (&proxy->priv->qdata); |
595 | G_OBJECT_CLASS (dbus_peer_proxy_parent_class)->finalize (object); |
596 | } |
597 | |
598 | static void |
599 | dbus_peer_proxy_get_property (GObject *object, |
600 | guint prop_id, |
601 | GValue *value, |
602 | GParamSpec *pspec G_GNUC_UNUSED) |
603 | { |
604 | } |
605 | |
606 | static void |
607 | dbus_peer_proxy_set_property (GObject *object, |
608 | guint prop_id, |
609 | const GValue *value, |
610 | GParamSpec *pspec G_GNUC_UNUSED) |
611 | { |
612 | } |
613 | |
614 | static void |
615 | dbus_peer_proxy_g_signal (GDBusProxy *proxy, |
616 | const gchar *sender_name G_GNUC_UNUSED, |
617 | const gchar *signal_name, |
618 | GVariant *parameters) |
619 | { |
620 | _ExtendedGDBusSignalInfo *info; |
621 | GVariantIter iter; |
622 | GVariant *child; |
623 | GValue *paramv; |
624 | guint num_params; |
625 | guint n; |
626 | guint signal_id; |
627 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct, signal_name); |
628 | if (info == NULL) |
629 | return; |
630 | num_params = g_variant_n_children (parameters); |
631 | paramv = g_new0 (GValue, num_params + 1); |
632 | g_value_init (¶mv[0], TYPE_DBUS_PEER); |
633 | g_value_set_object (¶mv[0], proxy); |
634 | g_variant_iter_init (&iter, parameters); |
635 | n = 1; |
636 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
637 | { |
638 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
639 | if (arg_info->use_gvariant) |
640 | { |
641 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
642 | g_value_set_variant (¶mv[n], child); |
643 | n++; |
644 | } |
645 | else |
646 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
647 | g_variant_unref (child); |
648 | } |
649 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_PEER); |
650 | g_signal_emitv (paramv, signal_id, 0, NULL); |
651 | for (n = 0; n < num_params + 1; n++) |
652 | g_value_unset (¶mv[n]); |
653 | g_free (paramv); |
654 | } |
655 | |
656 | static void |
657 | dbus_peer_proxy_g_properties_changed (GDBusProxy *_proxy, |
658 | GVariant *changed_properties, |
659 | const gchar *const *invalidated_properties) |
660 | { |
661 | DBusPeerProxy *proxy = DBUS_PEER_PROXY (_proxy); |
662 | guint n; |
663 | const gchar *key; |
664 | GVariantIter *iter; |
665 | _ExtendedGDBusPropertyInfo *info; |
666 | g_variant_get (changed_properties, "a{sv}", &iter); |
667 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
668 | { |
669 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct, key); |
670 | g_datalist_remove_data (&proxy->priv->qdata, key); |
671 | if (info != NULL) |
672 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
673 | } |
674 | g_variant_iter_free (iter); |
675 | for (n = 0; invalidated_properties[n] != NULL; n++) |
676 | { |
677 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct, invalidated_properties[n]); |
678 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
679 | if (info != NULL) |
680 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
681 | } |
682 | } |
683 | |
684 | static void |
685 | dbus_peer_proxy_init (DBusPeerProxy *proxy) |
686 | { |
687 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
688 | proxy->priv = dbus_peer_proxy_get_instance_private (proxy); |
689 | #else |
690 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DBUS_PEER_PROXY, DBusPeerProxyPrivate); |
691 | #endif |
692 | |
693 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), dbus_peer_interface_info ()); |
694 | } |
695 | |
696 | static void |
697 | dbus_peer_proxy_class_init (DBusPeerProxyClass *klass) |
698 | { |
699 | GObjectClass *gobject_class; |
700 | GDBusProxyClass *proxy_class; |
701 | |
702 | gobject_class = G_OBJECT_CLASS (klass); |
703 | gobject_class->finalize = dbus_peer_proxy_finalize; |
704 | gobject_class->get_property = dbus_peer_proxy_get_property; |
705 | gobject_class->set_property = dbus_peer_proxy_set_property; |
706 | |
707 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
708 | proxy_class->g_signal = dbus_peer_proxy_g_signal; |
709 | proxy_class->g_properties_changed = dbus_peer_proxy_g_properties_changed; |
710 | |
711 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
712 | g_type_class_add_private (klass, sizeof (DBusPeerProxyPrivate)); |
713 | #endif |
714 | } |
715 | |
716 | static void |
717 | dbus_peer_proxy_iface_init (DBusPeerIface *iface) |
718 | { |
719 | } |
720 | |
721 | /** |
722 | * dbus_peer_proxy_new: |
723 | * @connection: A #GDBusConnection. |
724 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
725 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
726 | * @object_path: An object path. |
727 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
728 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
729 | * @user_data: User data to pass to @callback. |
730 | * |
731 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link>. See g_dbus_proxy_new() for more details. |
732 | * |
733 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
734 | * You can then call dbus_peer_proxy_new_finish() to get the result of the operation. |
735 | * |
736 | * See dbus_peer_proxy_new_sync() for the synchronous, blocking version of this constructor. |
737 | */ |
738 | void |
739 | dbus_peer_proxy_new ( |
740 | GDBusConnection *connection, |
741 | GDBusProxyFlags flags, |
742 | const gchar *name, |
743 | const gchar *object_path, |
744 | GCancellable *cancellable, |
745 | GAsyncReadyCallback callback, |
746 | gpointer user_data) |
747 | { |
748 | g_async_initable_new_async (TYPE_DBUS_PEER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Peer", NULL); |
749 | } |
750 | |
751 | /** |
752 | * dbus_peer_proxy_new_finish: |
753 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_peer_proxy_new(). |
754 | * @error: Return location for error or %NULL |
755 | * |
756 | * Finishes an operation started with dbus_peer_proxy_new(). |
757 | * |
758 | * Returns: (transfer full) (type DBusPeerProxy): The constructed proxy object or %NULL if @error is set. |
759 | */ |
760 | DBusPeer * |
761 | dbus_peer_proxy_new_finish ( |
762 | GAsyncResult *res, |
763 | GError **error) |
764 | { |
765 | GObject *ret; |
766 | GObject *source_object; |
767 | source_object = g_async_result_get_source_object (res); |
768 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
769 | g_object_unref (source_object); |
770 | if (ret != NULL) |
771 | return DBUS_PEER (ret); |
772 | else |
773 | return NULL; |
774 | } |
775 | |
776 | /** |
777 | * dbus_peer_proxy_new_sync: |
778 | * @connection: A #GDBusConnection. |
779 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
780 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
781 | * @object_path: An object path. |
782 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
783 | * @error: Return location for error or %NULL |
784 | * |
785 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link>. See g_dbus_proxy_new_sync() for more details. |
786 | * |
787 | * The calling thread is blocked until a reply is received. |
788 | * |
789 | * See dbus_peer_proxy_new() for the asynchronous version of this constructor. |
790 | * |
791 | * Returns: (transfer full) (type DBusPeerProxy): The constructed proxy object or %NULL if @error is set. |
792 | */ |
793 | DBusPeer * |
794 | dbus_peer_proxy_new_sync ( |
795 | GDBusConnection *connection, |
796 | GDBusProxyFlags flags, |
797 | const gchar *name, |
798 | const gchar *object_path, |
799 | GCancellable *cancellable, |
800 | GError **error) |
801 | { |
802 | GInitable *ret; |
803 | ret = g_initable_new (TYPE_DBUS_PEER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Peer", NULL); |
804 | if (ret != NULL) |
805 | return DBUS_PEER (ret); |
806 | else |
807 | return NULL; |
808 | } |
809 | |
810 | |
811 | /** |
812 | * dbus_peer_proxy_new_for_bus: |
813 | * @bus_type: A #GBusType. |
814 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
815 | * @name: A bus name (well-known or unique). |
816 | * @object_path: An object path. |
817 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
818 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
819 | * @user_data: User data to pass to @callback. |
820 | * |
821 | * Like dbus_peer_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
822 | * |
823 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
824 | * You can then call dbus_peer_proxy_new_for_bus_finish() to get the result of the operation. |
825 | * |
826 | * See dbus_peer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
827 | */ |
828 | void |
829 | dbus_peer_proxy_new_for_bus ( |
830 | GBusType bus_type, |
831 | GDBusProxyFlags flags, |
832 | const gchar *name, |
833 | const gchar *object_path, |
834 | GCancellable *cancellable, |
835 | GAsyncReadyCallback callback, |
836 | gpointer user_data) |
837 | { |
838 | g_async_initable_new_async (TYPE_DBUS_PEER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Peer", NULL); |
839 | } |
840 | |
841 | /** |
842 | * dbus_peer_proxy_new_for_bus_finish: |
843 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_peer_proxy_new_for_bus(). |
844 | * @error: Return location for error or %NULL |
845 | * |
846 | * Finishes an operation started with dbus_peer_proxy_new_for_bus(). |
847 | * |
848 | * Returns: (transfer full) (type DBusPeerProxy): The constructed proxy object or %NULL if @error is set. |
849 | */ |
850 | DBusPeer * |
851 | dbus_peer_proxy_new_for_bus_finish ( |
852 | GAsyncResult *res, |
853 | GError **error) |
854 | { |
855 | GObject *ret; |
856 | GObject *source_object; |
857 | source_object = g_async_result_get_source_object (res); |
858 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
859 | g_object_unref (source_object); |
860 | if (ret != NULL) |
861 | return DBUS_PEER (ret); |
862 | else |
863 | return NULL; |
864 | } |
865 | |
866 | /** |
867 | * dbus_peer_proxy_new_for_bus_sync: |
868 | * @bus_type: A #GBusType. |
869 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
870 | * @name: A bus name (well-known or unique). |
871 | * @object_path: An object path. |
872 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
873 | * @error: Return location for error or %NULL |
874 | * |
875 | * Like dbus_peer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
876 | * |
877 | * The calling thread is blocked until a reply is received. |
878 | * |
879 | * See dbus_peer_proxy_new_for_bus() for the asynchronous version of this constructor. |
880 | * |
881 | * Returns: (transfer full) (type DBusPeerProxy): The constructed proxy object or %NULL if @error is set. |
882 | */ |
883 | DBusPeer * |
884 | dbus_peer_proxy_new_for_bus_sync ( |
885 | GBusType bus_type, |
886 | GDBusProxyFlags flags, |
887 | const gchar *name, |
888 | const gchar *object_path, |
889 | GCancellable *cancellable, |
890 | GError **error) |
891 | { |
892 | GInitable *ret; |
893 | ret = g_initable_new (TYPE_DBUS_PEER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Peer", NULL); |
894 | if (ret != NULL) |
895 | return DBUS_PEER (ret); |
896 | else |
897 | return NULL; |
898 | } |
899 | |
900 | |
901 | /* ------------------------------------------------------------------------ */ |
902 | |
903 | /** |
904 | * DBusPeerSkeleton: |
905 | * |
906 | * The #DBusPeerSkeleton structure contains only private data and should only be accessed using the provided API. |
907 | */ |
908 | |
909 | /** |
910 | * DBusPeerSkeletonClass: |
911 | * @parent_class: The parent class. |
912 | * |
913 | * Class structure for #DBusPeerSkeleton. |
914 | */ |
915 | |
916 | struct _DBusPeerSkeletonPrivate |
917 | { |
918 | GValue *properties; |
919 | GList *changed_properties; |
920 | GSource *changed_properties_idle_source; |
921 | GMainContext *context; |
922 | GMutex lock; |
923 | }; |
924 | |
925 | static void |
926 | _dbus_peer_skeleton_handle_method_call ( |
927 | GDBusConnection *connection G_GNUC_UNUSED, |
928 | const gchar *sender G_GNUC_UNUSED, |
929 | const gchar *object_path G_GNUC_UNUSED, |
930 | const gchar *interface_name, |
931 | const gchar *method_name, |
932 | GVariant *parameters, |
933 | GDBusMethodInvocation *invocation, |
934 | gpointer user_data) |
935 | { |
936 | DBusPeerSkeleton *skeleton = DBUS_PEER_SKELETON (user_data); |
937 | _ExtendedGDBusMethodInfo *info; |
938 | GVariantIter iter; |
939 | GVariant *child; |
940 | GValue *paramv; |
941 | guint num_params; |
942 | guint num_extra; |
943 | guint n; |
944 | guint signal_id; |
945 | GValue return_value = G_VALUE_INIT; |
946 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
947 | g_assert (info != NULL); |
948 | num_params = g_variant_n_children (parameters); |
949 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
950 | n = 0; |
951 | g_value_init (¶mv[n], TYPE_DBUS_PEER); |
952 | g_value_set_object (¶mv[n++], skeleton); |
953 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
954 | g_value_set_object (¶mv[n++], invocation); |
955 | if (info->pass_fdlist) |
956 | { |
957 | #ifdef G_OS_UNIX |
958 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
959 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
960 | #else |
961 | g_assert_not_reached (); |
962 | #endif |
963 | } |
964 | g_variant_iter_init (&iter, parameters); |
965 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
966 | { |
967 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
968 | if (arg_info->use_gvariant) |
969 | { |
970 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
971 | g_value_set_variant (¶mv[n], child); |
972 | n++; |
973 | } |
974 | else |
975 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
976 | g_variant_unref (child); |
977 | } |
978 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_PEER); |
979 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
980 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
981 | if (!g_value_get_boolean (&return_value)) |
982 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
983 | g_value_unset (&return_value); |
984 | for (n = 0; n < num_params + num_extra; n++) |
985 | g_value_unset (¶mv[n]); |
986 | g_free (paramv); |
987 | } |
988 | |
989 | static GVariant * |
990 | _dbus_peer_skeleton_handle_get_property ( |
991 | GDBusConnection *connection G_GNUC_UNUSED, |
992 | const gchar *sender G_GNUC_UNUSED, |
993 | const gchar *object_path G_GNUC_UNUSED, |
994 | const gchar *interface_name G_GNUC_UNUSED, |
995 | const gchar *property_name, |
996 | GError **error, |
997 | gpointer user_data) |
998 | { |
999 | DBusPeerSkeleton *skeleton = DBUS_PEER_SKELETON (user_data); |
1000 | GValue value = G_VALUE_INIT; |
1001 | GParamSpec *pspec; |
1002 | _ExtendedGDBusPropertyInfo *info; |
1003 | GVariant *ret; |
1004 | ret = NULL; |
1005 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct, property_name); |
1006 | g_assert (info != NULL); |
1007 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1008 | if (pspec == NULL) |
1009 | { |
1010 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1011 | } |
1012 | else |
1013 | { |
1014 | g_value_init (&value, pspec->value_type); |
1015 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1016 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1017 | g_value_unset (&value); |
1018 | } |
1019 | return ret; |
1020 | } |
1021 | |
1022 | static gboolean |
1023 | _dbus_peer_skeleton_handle_set_property ( |
1024 | GDBusConnection *connection G_GNUC_UNUSED, |
1025 | const gchar *sender G_GNUC_UNUSED, |
1026 | const gchar *object_path G_GNUC_UNUSED, |
1027 | const gchar *interface_name G_GNUC_UNUSED, |
1028 | const gchar *property_name, |
1029 | GVariant *variant, |
1030 | GError **error, |
1031 | gpointer user_data) |
1032 | { |
1033 | DBusPeerSkeleton *skeleton = DBUS_PEER_SKELETON (user_data); |
1034 | GValue value = G_VALUE_INIT; |
1035 | GParamSpec *pspec; |
1036 | _ExtendedGDBusPropertyInfo *info; |
1037 | gboolean ret; |
1038 | ret = FALSE; |
1039 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_peer_interface_info.parent_struct, property_name); |
1040 | g_assert (info != NULL); |
1041 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1042 | if (pspec == NULL) |
1043 | { |
1044 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1045 | } |
1046 | else |
1047 | { |
1048 | if (info->use_gvariant) |
1049 | g_value_set_variant (&value, variant); |
1050 | else |
1051 | g_dbus_gvariant_to_gvalue (variant, &value); |
1052 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1053 | g_value_unset (&value); |
1054 | ret = TRUE; |
1055 | } |
1056 | return ret; |
1057 | } |
1058 | |
1059 | static const GDBusInterfaceVTable _dbus_peer_skeleton_vtable = |
1060 | { |
1061 | _dbus_peer_skeleton_handle_method_call, |
1062 | _dbus_peer_skeleton_handle_get_property, |
1063 | _dbus_peer_skeleton_handle_set_property, |
1064 | {NULL} |
1065 | }; |
1066 | |
1067 | static GDBusInterfaceInfo * |
1068 | dbus_peer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1069 | { |
1070 | return dbus_peer_interface_info (); |
1071 | } |
1072 | |
1073 | static GDBusInterfaceVTable * |
1074 | dbus_peer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1075 | { |
1076 | return (GDBusInterfaceVTable *) &_dbus_peer_skeleton_vtable; |
1077 | } |
1078 | |
1079 | static GVariant * |
1080 | dbus_peer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
1081 | { |
1082 | DBusPeerSkeleton *skeleton = DBUS_PEER_SKELETON (_skeleton); |
1083 | |
1084 | GVariantBuilder builder; |
1085 | guint n; |
1086 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
1087 | if (_dbus_peer_interface_info.parent_struct.properties == NULL) |
1088 | goto out; |
1089 | for (n = 0; _dbus_peer_interface_info.parent_struct.properties[n] != NULL; n++) |
1090 | { |
1091 | GDBusPropertyInfo *info = _dbus_peer_interface_info.parent_struct.properties[n]; |
1092 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
1093 | { |
1094 | GVariant *value; |
1095 | value = _dbus_peer_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Peer", info->name, NULL, skeleton); |
1096 | if (value != NULL) |
1097 | { |
1098 | g_variant_take_ref (value); |
1099 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
1100 | g_variant_unref (value); |
1101 | } |
1102 | } |
1103 | } |
1104 | out: |
1105 | return g_variant_builder_end (&builder); |
1106 | } |
1107 | |
1108 | static void |
1109 | dbus_peer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
1110 | { |
1111 | } |
1112 | |
1113 | static void dbus_peer_skeleton_iface_init (DBusPeerIface *iface); |
1114 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1115 | G_DEFINE_TYPE_WITH_CODE (DBusPeerSkeleton, dbus_peer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
1116 | G_ADD_PRIVATE (DBusPeerSkeleton) |
1117 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PEER, dbus_peer_skeleton_iface_init)); |
1118 | |
1119 | #else |
1120 | G_DEFINE_TYPE_WITH_CODE (DBusPeerSkeleton, dbus_peer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
1121 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PEER, dbus_peer_skeleton_iface_init)); |
1122 | |
1123 | #endif |
1124 | static void |
1125 | dbus_peer_skeleton_finalize (GObject *object) |
1126 | { |
1127 | DBusPeerSkeleton *skeleton = DBUS_PEER_SKELETON (object); |
1128 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
1129 | if (skeleton->priv->changed_properties_idle_source != NULL) |
1130 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
1131 | g_main_context_unref (skeleton->priv->context); |
1132 | g_mutex_clear (&skeleton->priv->lock); |
1133 | G_OBJECT_CLASS (dbus_peer_skeleton_parent_class)->finalize (object); |
1134 | } |
1135 | |
1136 | static void |
1137 | dbus_peer_skeleton_init (DBusPeerSkeleton *skeleton) |
1138 | { |
1139 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1140 | skeleton->priv = dbus_peer_skeleton_get_instance_private (skeleton); |
1141 | #else |
1142 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DBUS_PEER_SKELETON, DBusPeerSkeletonPrivate); |
1143 | #endif |
1144 | |
1145 | g_mutex_init (&skeleton->priv->lock); |
1146 | skeleton->priv->context = g_main_context_ref_thread_default (); |
1147 | } |
1148 | |
1149 | static void |
1150 | dbus_peer_skeleton_class_init (DBusPeerSkeletonClass *klass) |
1151 | { |
1152 | GObjectClass *gobject_class; |
1153 | GDBusInterfaceSkeletonClass *skeleton_class; |
1154 | |
1155 | gobject_class = G_OBJECT_CLASS (klass); |
1156 | gobject_class->finalize = dbus_peer_skeleton_finalize; |
1157 | |
1158 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
1159 | skeleton_class->get_info = dbus_peer_skeleton_dbus_interface_get_info; |
1160 | skeleton_class->get_properties = dbus_peer_skeleton_dbus_interface_get_properties; |
1161 | skeleton_class->flush = dbus_peer_skeleton_dbus_interface_flush; |
1162 | skeleton_class->get_vtable = dbus_peer_skeleton_dbus_interface_get_vtable; |
1163 | |
1164 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
1165 | g_type_class_add_private (klass, sizeof (DBusPeerSkeletonPrivate)); |
1166 | #endif |
1167 | } |
1168 | |
1169 | static void |
1170 | dbus_peer_skeleton_iface_init (DBusPeerIface *iface) |
1171 | { |
1172 | } |
1173 | |
1174 | /** |
1175 | * dbus_peer_skeleton_new: |
1176 | * |
1177 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Peer.top_of_page">org.freedesktop.DBus.Peer</link>. |
1178 | * |
1179 | * Returns: (transfer full) (type DBusPeerSkeleton): The skeleton object. |
1180 | */ |
1181 | DBusPeer * |
1182 | dbus_peer_skeleton_new (void) |
1183 | { |
1184 | return DBUS_PEER (g_object_new (TYPE_DBUS_PEER_SKELETON, NULL)); |
1185 | } |
1186 | |
1187 | /* ------------------------------------------------------------------------ |
1188 | * Code for interface org.freedesktop.DBus.Introspectable |
1189 | * ------------------------------------------------------------------------ |
1190 | */ |
1191 | |
1192 | /** |
1193 | * SECTION:DBusIntrospectable |
1194 | * @title: DBusIntrospectable |
1195 | * @short_description: Generated C code for the org.freedesktop.DBus.Introspectable D-Bus interface |
1196 | * |
1197 | * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link> D-Bus interface in C. |
1198 | */ |
1199 | |
1200 | /* ---- Introspection data for org.freedesktop.DBus.Introspectable ---- */ |
1201 | |
1202 | static const _ExtendedGDBusArgInfo _dbus_introspectable_method_info_introspect_OUT_ARG_data = |
1203 | { |
1204 | { |
1205 | -1, |
1206 | (gchar *) "data", |
1207 | (gchar *) "s", |
1208 | NULL |
1209 | }, |
1210 | FALSE |
1211 | }; |
1212 | |
1213 | static const _ExtendedGDBusArgInfo * const _dbus_introspectable_method_info_introspect_OUT_ARG_pointers[] = |
1214 | { |
1215 | &_dbus_introspectable_method_info_introspect_OUT_ARG_data, |
1216 | NULL |
1217 | }; |
1218 | |
1219 | static const _ExtendedGDBusMethodInfo _dbus_introspectable_method_info_introspect = |
1220 | { |
1221 | { |
1222 | -1, |
1223 | (gchar *) "Introspect", |
1224 | NULL, |
1225 | (GDBusArgInfo **) &_dbus_introspectable_method_info_introspect_OUT_ARG_pointers, |
1226 | NULL |
1227 | }, |
1228 | "handle-introspect", |
1229 | FALSE |
1230 | }; |
1231 | |
1232 | static const _ExtendedGDBusMethodInfo * const _dbus_introspectable_method_info_pointers[] = |
1233 | { |
1234 | &_dbus_introspectable_method_info_introspect, |
1235 | NULL |
1236 | }; |
1237 | |
1238 | static const _ExtendedGDBusInterfaceInfo _dbus_introspectable_interface_info = |
1239 | { |
1240 | { |
1241 | -1, |
1242 | (gchar *) "org.freedesktop.DBus.Introspectable", |
1243 | (GDBusMethodInfo **) &_dbus_introspectable_method_info_pointers, |
1244 | NULL, |
1245 | NULL, |
1246 | NULL |
1247 | }, |
1248 | "dbus-introspectable", |
1249 | }; |
1250 | |
1251 | |
1252 | /** |
1253 | * dbus_introspectable_interface_info: |
1254 | * |
1255 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link> D-Bus interface. |
1256 | * |
1257 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
1258 | */ |
1259 | GDBusInterfaceInfo * |
1260 | dbus_introspectable_interface_info (void) |
1261 | { |
1262 | return (GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct; |
1263 | } |
1264 | |
1265 | /** |
1266 | * dbus_introspectable_override_properties: |
1267 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
1268 | * @property_id_begin: The property id to assign to the first overridden property. |
1269 | * |
1270 | * Overrides all #GObject properties in the #DBusIntrospectable interface for a concrete class. |
1271 | * The properties are overridden in the order they are defined. |
1272 | * |
1273 | * Returns: The last property id. |
1274 | */ |
1275 | guint |
1276 | dbus_introspectable_override_properties (GObjectClass *klass, guint property_id_begin) |
1277 | { |
1278 | return property_id_begin - 1; |
1279 | } |
1280 | |
1281 | |
1282 | |
1283 | /** |
1284 | * DBusIntrospectable: |
1285 | * |
1286 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link>. |
1287 | */ |
1288 | |
1289 | /** |
1290 | * DBusIntrospectableIface: |
1291 | * @parent_iface: The parent interface. |
1292 | * @handle_introspect: Handler for the #DBusIntrospectable::handle-introspect signal. |
1293 | * |
1294 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link>. |
1295 | */ |
1296 | |
1297 | typedef DBusIntrospectableIface DBusIntrospectableInterface; |
1298 | G_DEFINE_INTERFACE (DBusIntrospectable, dbus_introspectable, G_TYPE_OBJECT); |
1299 | |
1300 | static void |
1301 | dbus_introspectable_default_init (DBusIntrospectableIface *iface) |
1302 | { |
1303 | /* GObject signals for incoming D-Bus method calls: */ |
1304 | /** |
1305 | * DBusIntrospectable::handle-introspect: |
1306 | * @object: A #DBusIntrospectable. |
1307 | * @invocation: A #GDBusMethodInvocation. |
1308 | * |
1309 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Introspectable.Introspect">Introspect()</link> D-Bus method. |
1310 | * |
1311 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_introspectable_complete_introspect() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
1312 | * |
1313 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
1314 | */ |
1315 | g_signal_new ("handle-introspect", |
1316 | G_TYPE_FROM_INTERFACE (iface), |
1317 | G_SIGNAL_RUN_LAST, |
1318 | G_STRUCT_OFFSET (DBusIntrospectableIface, handle_introspect), |
1319 | g_signal_accumulator_true_handled, |
1320 | NULL, |
1321 | g_cclosure_marshal_generic, |
1322 | G_TYPE_BOOLEAN, |
1323 | 1, |
1324 | G_TYPE_DBUS_METHOD_INVOCATION); |
1325 | |
1326 | } |
1327 | |
1328 | /** |
1329 | * dbus_introspectable_call_introspect: |
1330 | * @proxy: A #DBusIntrospectableProxy. |
1331 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1332 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1333 | * @user_data: User data to pass to @callback. |
1334 | * |
1335 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Introspectable.Introspect">Introspect()</link> D-Bus method on @proxy. |
1336 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1337 | * You can then call dbus_introspectable_call_introspect_finish() to get the result of the operation. |
1338 | * |
1339 | * See dbus_introspectable_call_introspect_sync() for the synchronous, blocking version of this method. |
1340 | */ |
1341 | void |
1342 | dbus_introspectable_call_introspect ( |
1343 | DBusIntrospectable *proxy, |
1344 | GCancellable *cancellable, |
1345 | GAsyncReadyCallback callback, |
1346 | gpointer user_data) |
1347 | { |
1348 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1349 | "Introspect", |
1350 | g_variant_new ("()"), |
1351 | G_DBUS_CALL_FLAGS_NONE, |
1352 | -1, |
1353 | cancellable, |
1354 | callback, |
1355 | user_data); |
1356 | } |
1357 | |
1358 | /** |
1359 | * dbus_introspectable_call_introspect_finish: |
1360 | * @proxy: A #DBusIntrospectableProxy. |
1361 | * @out_data: (out): Return location for return parameter or %NULL to ignore. |
1362 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_introspectable_call_introspect(). |
1363 | * @error: Return location for error or %NULL. |
1364 | * |
1365 | * Finishes an operation started with dbus_introspectable_call_introspect(). |
1366 | * |
1367 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1368 | */ |
1369 | gboolean |
1370 | dbus_introspectable_call_introspect_finish ( |
1371 | DBusIntrospectable *proxy, |
1372 | gchar **out_data, |
1373 | GAsyncResult *res, |
1374 | GError **error) |
1375 | { |
1376 | GVariant *_ret; |
1377 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1378 | if (_ret == NULL) |
1379 | goto _out; |
1380 | g_variant_get (_ret, |
1381 | "(s)", |
1382 | out_data); |
1383 | g_variant_unref (_ret); |
1384 | _out: |
1385 | return _ret != NULL; |
1386 | } |
1387 | |
1388 | /** |
1389 | * dbus_introspectable_call_introspect_sync: |
1390 | * @proxy: A #DBusIntrospectableProxy. |
1391 | * @out_data: (out): Return location for return parameter or %NULL to ignore. |
1392 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1393 | * @error: Return location for error or %NULL. |
1394 | * |
1395 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Introspectable.Introspect">Introspect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1396 | * |
1397 | * See dbus_introspectable_call_introspect() for the asynchronous version of this method. |
1398 | * |
1399 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1400 | */ |
1401 | gboolean |
1402 | dbus_introspectable_call_introspect_sync ( |
1403 | DBusIntrospectable *proxy, |
1404 | gchar **out_data, |
1405 | GCancellable *cancellable, |
1406 | GError **error) |
1407 | { |
1408 | GVariant *_ret; |
1409 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1410 | "Introspect", |
1411 | g_variant_new ("()"), |
1412 | G_DBUS_CALL_FLAGS_NONE, |
1413 | -1, |
1414 | cancellable, |
1415 | error); |
1416 | if (_ret == NULL) |
1417 | goto _out; |
1418 | g_variant_get (_ret, |
1419 | "(s)", |
1420 | out_data); |
1421 | g_variant_unref (_ret); |
1422 | _out: |
1423 | return _ret != NULL; |
1424 | } |
1425 | |
1426 | /** |
1427 | * dbus_introspectable_complete_introspect: |
1428 | * @object: A #DBusIntrospectable. |
1429 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1430 | * @data: Parameter to return. |
1431 | * |
1432 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Introspectable.Introspect">Introspect()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
1433 | * |
1434 | * This method will free @invocation, you cannot use it afterwards. |
1435 | */ |
1436 | void |
1437 | dbus_introspectable_complete_introspect ( |
1438 | DBusIntrospectable *object, |
1439 | GDBusMethodInvocation *invocation, |
1440 | const gchar *data) |
1441 | { |
1442 | g_dbus_method_invocation_return_value (invocation, |
1443 | g_variant_new ("(s)", |
1444 | data)); |
1445 | } |
1446 | |
1447 | /* ------------------------------------------------------------------------ */ |
1448 | |
1449 | /** |
1450 | * DBusIntrospectableProxy: |
1451 | * |
1452 | * The #DBusIntrospectableProxy structure contains only private data and should only be accessed using the provided API. |
1453 | */ |
1454 | |
1455 | /** |
1456 | * DBusIntrospectableProxyClass: |
1457 | * @parent_class: The parent class. |
1458 | * |
1459 | * Class structure for #DBusIntrospectableProxy. |
1460 | */ |
1461 | |
1462 | struct _DBusIntrospectableProxyPrivate |
1463 | { |
1464 | GData *qdata; |
1465 | }; |
1466 | |
1467 | static void dbus_introspectable_proxy_iface_init (DBusIntrospectableIface *iface); |
1468 | |
1469 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1470 | G_DEFINE_TYPE_WITH_CODE (DBusIntrospectableProxy, dbus_introspectable_proxy, G_TYPE_DBUS_PROXY, |
1471 | G_ADD_PRIVATE (DBusIntrospectableProxy) |
1472 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_INTROSPECTABLE, dbus_introspectable_proxy_iface_init)); |
1473 | |
1474 | #else |
1475 | G_DEFINE_TYPE_WITH_CODE (DBusIntrospectableProxy, dbus_introspectable_proxy, G_TYPE_DBUS_PROXY, |
1476 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_INTROSPECTABLE, dbus_introspectable_proxy_iface_init)); |
1477 | |
1478 | #endif |
1479 | static void |
1480 | dbus_introspectable_proxy_finalize (GObject *object) |
1481 | { |
1482 | DBusIntrospectableProxy *proxy = DBUS_INTROSPECTABLE_PROXY (object); |
1483 | g_datalist_clear (&proxy->priv->qdata); |
1484 | G_OBJECT_CLASS (dbus_introspectable_proxy_parent_class)->finalize (object); |
1485 | } |
1486 | |
1487 | static void |
1488 | dbus_introspectable_proxy_get_property (GObject *object, |
1489 | guint prop_id, |
1490 | GValue *value, |
1491 | GParamSpec *pspec G_GNUC_UNUSED) |
1492 | { |
1493 | } |
1494 | |
1495 | static void |
1496 | dbus_introspectable_proxy_set_property (GObject *object, |
1497 | guint prop_id, |
1498 | const GValue *value, |
1499 | GParamSpec *pspec G_GNUC_UNUSED) |
1500 | { |
1501 | } |
1502 | |
1503 | static void |
1504 | dbus_introspectable_proxy_g_signal (GDBusProxy *proxy, |
1505 | const gchar *sender_name G_GNUC_UNUSED, |
1506 | const gchar *signal_name, |
1507 | GVariant *parameters) |
1508 | { |
1509 | _ExtendedGDBusSignalInfo *info; |
1510 | GVariantIter iter; |
1511 | GVariant *child; |
1512 | GValue *paramv; |
1513 | guint num_params; |
1514 | guint n; |
1515 | guint signal_id; |
1516 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct, signal_name); |
1517 | if (info == NULL) |
1518 | return; |
1519 | num_params = g_variant_n_children (parameters); |
1520 | paramv = g_new0 (GValue, num_params + 1); |
1521 | g_value_init (¶mv[0], TYPE_DBUS_INTROSPECTABLE); |
1522 | g_value_set_object (¶mv[0], proxy); |
1523 | g_variant_iter_init (&iter, parameters); |
1524 | n = 1; |
1525 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1526 | { |
1527 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
1528 | if (arg_info->use_gvariant) |
1529 | { |
1530 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
1531 | g_value_set_variant (¶mv[n], child); |
1532 | n++; |
1533 | } |
1534 | else |
1535 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1536 | g_variant_unref (child); |
1537 | } |
1538 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_INTROSPECTABLE); |
1539 | g_signal_emitv (paramv, signal_id, 0, NULL); |
1540 | for (n = 0; n < num_params + 1; n++) |
1541 | g_value_unset (¶mv[n]); |
1542 | g_free (paramv); |
1543 | } |
1544 | |
1545 | static void |
1546 | dbus_introspectable_proxy_g_properties_changed (GDBusProxy *_proxy, |
1547 | GVariant *changed_properties, |
1548 | const gchar *const *invalidated_properties) |
1549 | { |
1550 | DBusIntrospectableProxy *proxy = DBUS_INTROSPECTABLE_PROXY (_proxy); |
1551 | guint n; |
1552 | const gchar *key; |
1553 | GVariantIter *iter; |
1554 | _ExtendedGDBusPropertyInfo *info; |
1555 | g_variant_get (changed_properties, "a{sv}", &iter); |
1556 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
1557 | { |
1558 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct, key); |
1559 | g_datalist_remove_data (&proxy->priv->qdata, key); |
1560 | if (info != NULL) |
1561 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1562 | } |
1563 | g_variant_iter_free (iter); |
1564 | for (n = 0; invalidated_properties[n] != NULL; n++) |
1565 | { |
1566 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct, invalidated_properties[n]); |
1567 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
1568 | if (info != NULL) |
1569 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1570 | } |
1571 | } |
1572 | |
1573 | static void |
1574 | dbus_introspectable_proxy_init (DBusIntrospectableProxy *proxy) |
1575 | { |
1576 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1577 | proxy->priv = dbus_introspectable_proxy_get_instance_private (proxy); |
1578 | #else |
1579 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DBUS_INTROSPECTABLE_PROXY, DBusIntrospectableProxyPrivate); |
1580 | #endif |
1581 | |
1582 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), dbus_introspectable_interface_info ()); |
1583 | } |
1584 | |
1585 | static void |
1586 | dbus_introspectable_proxy_class_init (DBusIntrospectableProxyClass *klass) |
1587 | { |
1588 | GObjectClass *gobject_class; |
1589 | GDBusProxyClass *proxy_class; |
1590 | |
1591 | gobject_class = G_OBJECT_CLASS (klass); |
1592 | gobject_class->finalize = dbus_introspectable_proxy_finalize; |
1593 | gobject_class->get_property = dbus_introspectable_proxy_get_property; |
1594 | gobject_class->set_property = dbus_introspectable_proxy_set_property; |
1595 | |
1596 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
1597 | proxy_class->g_signal = dbus_introspectable_proxy_g_signal; |
1598 | proxy_class->g_properties_changed = dbus_introspectable_proxy_g_properties_changed; |
1599 | |
1600 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
1601 | g_type_class_add_private (klass, sizeof (DBusIntrospectableProxyPrivate)); |
1602 | #endif |
1603 | } |
1604 | |
1605 | static void |
1606 | dbus_introspectable_proxy_iface_init (DBusIntrospectableIface *iface) |
1607 | { |
1608 | } |
1609 | |
1610 | /** |
1611 | * dbus_introspectable_proxy_new: |
1612 | * @connection: A #GDBusConnection. |
1613 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1614 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1615 | * @object_path: An object path. |
1616 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1617 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1618 | * @user_data: User data to pass to @callback. |
1619 | * |
1620 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link>. See g_dbus_proxy_new() for more details. |
1621 | * |
1622 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1623 | * You can then call dbus_introspectable_proxy_new_finish() to get the result of the operation. |
1624 | * |
1625 | * See dbus_introspectable_proxy_new_sync() for the synchronous, blocking version of this constructor. |
1626 | */ |
1627 | void |
1628 | dbus_introspectable_proxy_new ( |
1629 | GDBusConnection *connection, |
1630 | GDBusProxyFlags flags, |
1631 | const gchar *name, |
1632 | const gchar *object_path, |
1633 | GCancellable *cancellable, |
1634 | GAsyncReadyCallback callback, |
1635 | gpointer user_data) |
1636 | { |
1637 | g_async_initable_new_async (TYPE_DBUS_INTROSPECTABLE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); |
1638 | } |
1639 | |
1640 | /** |
1641 | * dbus_introspectable_proxy_new_finish: |
1642 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_introspectable_proxy_new(). |
1643 | * @error: Return location for error or %NULL |
1644 | * |
1645 | * Finishes an operation started with dbus_introspectable_proxy_new(). |
1646 | * |
1647 | * Returns: (transfer full) (type DBusIntrospectableProxy): The constructed proxy object or %NULL if @error is set. |
1648 | */ |
1649 | DBusIntrospectable * |
1650 | dbus_introspectable_proxy_new_finish ( |
1651 | GAsyncResult *res, |
1652 | GError **error) |
1653 | { |
1654 | GObject *ret; |
1655 | GObject *source_object; |
1656 | source_object = g_async_result_get_source_object (res); |
1657 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1658 | g_object_unref (source_object); |
1659 | if (ret != NULL) |
1660 | return DBUS_INTROSPECTABLE (ret); |
1661 | else |
1662 | return NULL; |
1663 | } |
1664 | |
1665 | /** |
1666 | * dbus_introspectable_proxy_new_sync: |
1667 | * @connection: A #GDBusConnection. |
1668 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1669 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1670 | * @object_path: An object path. |
1671 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1672 | * @error: Return location for error or %NULL |
1673 | * |
1674 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link>. See g_dbus_proxy_new_sync() for more details. |
1675 | * |
1676 | * The calling thread is blocked until a reply is received. |
1677 | * |
1678 | * See dbus_introspectable_proxy_new() for the asynchronous version of this constructor. |
1679 | * |
1680 | * Returns: (transfer full) (type DBusIntrospectableProxy): The constructed proxy object or %NULL if @error is set. |
1681 | */ |
1682 | DBusIntrospectable * |
1683 | dbus_introspectable_proxy_new_sync ( |
1684 | GDBusConnection *connection, |
1685 | GDBusProxyFlags flags, |
1686 | const gchar *name, |
1687 | const gchar *object_path, |
1688 | GCancellable *cancellable, |
1689 | GError **error) |
1690 | { |
1691 | GInitable *ret; |
1692 | ret = g_initable_new (TYPE_DBUS_INTROSPECTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); |
1693 | if (ret != NULL) |
1694 | return DBUS_INTROSPECTABLE (ret); |
1695 | else |
1696 | return NULL; |
1697 | } |
1698 | |
1699 | |
1700 | /** |
1701 | * dbus_introspectable_proxy_new_for_bus: |
1702 | * @bus_type: A #GBusType. |
1703 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1704 | * @name: A bus name (well-known or unique). |
1705 | * @object_path: An object path. |
1706 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1707 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1708 | * @user_data: User data to pass to @callback. |
1709 | * |
1710 | * Like dbus_introspectable_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
1711 | * |
1712 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1713 | * You can then call dbus_introspectable_proxy_new_for_bus_finish() to get the result of the operation. |
1714 | * |
1715 | * See dbus_introspectable_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
1716 | */ |
1717 | void |
1718 | dbus_introspectable_proxy_new_for_bus ( |
1719 | GBusType bus_type, |
1720 | GDBusProxyFlags flags, |
1721 | const gchar *name, |
1722 | const gchar *object_path, |
1723 | GCancellable *cancellable, |
1724 | GAsyncReadyCallback callback, |
1725 | gpointer user_data) |
1726 | { |
1727 | g_async_initable_new_async (TYPE_DBUS_INTROSPECTABLE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); |
1728 | } |
1729 | |
1730 | /** |
1731 | * dbus_introspectable_proxy_new_for_bus_finish: |
1732 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_introspectable_proxy_new_for_bus(). |
1733 | * @error: Return location for error or %NULL |
1734 | * |
1735 | * Finishes an operation started with dbus_introspectable_proxy_new_for_bus(). |
1736 | * |
1737 | * Returns: (transfer full) (type DBusIntrospectableProxy): The constructed proxy object or %NULL if @error is set. |
1738 | */ |
1739 | DBusIntrospectable * |
1740 | dbus_introspectable_proxy_new_for_bus_finish ( |
1741 | GAsyncResult *res, |
1742 | GError **error) |
1743 | { |
1744 | GObject *ret; |
1745 | GObject *source_object; |
1746 | source_object = g_async_result_get_source_object (res); |
1747 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1748 | g_object_unref (source_object); |
1749 | if (ret != NULL) |
1750 | return DBUS_INTROSPECTABLE (ret); |
1751 | else |
1752 | return NULL; |
1753 | } |
1754 | |
1755 | /** |
1756 | * dbus_introspectable_proxy_new_for_bus_sync: |
1757 | * @bus_type: A #GBusType. |
1758 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1759 | * @name: A bus name (well-known or unique). |
1760 | * @object_path: An object path. |
1761 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1762 | * @error: Return location for error or %NULL |
1763 | * |
1764 | * Like dbus_introspectable_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
1765 | * |
1766 | * The calling thread is blocked until a reply is received. |
1767 | * |
1768 | * See dbus_introspectable_proxy_new_for_bus() for the asynchronous version of this constructor. |
1769 | * |
1770 | * Returns: (transfer full) (type DBusIntrospectableProxy): The constructed proxy object or %NULL if @error is set. |
1771 | */ |
1772 | DBusIntrospectable * |
1773 | dbus_introspectable_proxy_new_for_bus_sync ( |
1774 | GBusType bus_type, |
1775 | GDBusProxyFlags flags, |
1776 | const gchar *name, |
1777 | const gchar *object_path, |
1778 | GCancellable *cancellable, |
1779 | GError **error) |
1780 | { |
1781 | GInitable *ret; |
1782 | ret = g_initable_new (TYPE_DBUS_INTROSPECTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); |
1783 | if (ret != NULL) |
1784 | return DBUS_INTROSPECTABLE (ret); |
1785 | else |
1786 | return NULL; |
1787 | } |
1788 | |
1789 | |
1790 | /* ------------------------------------------------------------------------ */ |
1791 | |
1792 | /** |
1793 | * DBusIntrospectableSkeleton: |
1794 | * |
1795 | * The #DBusIntrospectableSkeleton structure contains only private data and should only be accessed using the provided API. |
1796 | */ |
1797 | |
1798 | /** |
1799 | * DBusIntrospectableSkeletonClass: |
1800 | * @parent_class: The parent class. |
1801 | * |
1802 | * Class structure for #DBusIntrospectableSkeleton. |
1803 | */ |
1804 | |
1805 | struct _DBusIntrospectableSkeletonPrivate |
1806 | { |
1807 | GValue *properties; |
1808 | GList *changed_properties; |
1809 | GSource *changed_properties_idle_source; |
1810 | GMainContext *context; |
1811 | GMutex lock; |
1812 | }; |
1813 | |
1814 | static void |
1815 | _dbus_introspectable_skeleton_handle_method_call ( |
1816 | GDBusConnection *connection G_GNUC_UNUSED, |
1817 | const gchar *sender G_GNUC_UNUSED, |
1818 | const gchar *object_path G_GNUC_UNUSED, |
1819 | const gchar *interface_name, |
1820 | const gchar *method_name, |
1821 | GVariant *parameters, |
1822 | GDBusMethodInvocation *invocation, |
1823 | gpointer user_data) |
1824 | { |
1825 | DBusIntrospectableSkeleton *skeleton = DBUS_INTROSPECTABLE_SKELETON (user_data); |
1826 | _ExtendedGDBusMethodInfo *info; |
1827 | GVariantIter iter; |
1828 | GVariant *child; |
1829 | GValue *paramv; |
1830 | guint num_params; |
1831 | guint num_extra; |
1832 | guint n; |
1833 | guint signal_id; |
1834 | GValue return_value = G_VALUE_INIT; |
1835 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
1836 | g_assert (info != NULL); |
1837 | num_params = g_variant_n_children (parameters); |
1838 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
1839 | n = 0; |
1840 | g_value_init (¶mv[n], TYPE_DBUS_INTROSPECTABLE); |
1841 | g_value_set_object (¶mv[n++], skeleton); |
1842 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
1843 | g_value_set_object (¶mv[n++], invocation); |
1844 | if (info->pass_fdlist) |
1845 | { |
1846 | #ifdef G_OS_UNIX |
1847 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
1848 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
1849 | #else |
1850 | g_assert_not_reached (); |
1851 | #endif |
1852 | } |
1853 | g_variant_iter_init (&iter, parameters); |
1854 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1855 | { |
1856 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
1857 | if (arg_info->use_gvariant) |
1858 | { |
1859 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
1860 | g_value_set_variant (¶mv[n], child); |
1861 | n++; |
1862 | } |
1863 | else |
1864 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1865 | g_variant_unref (child); |
1866 | } |
1867 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_INTROSPECTABLE); |
1868 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
1869 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
1870 | if (!g_value_get_boolean (&return_value)) |
1871 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
1872 | g_value_unset (&return_value); |
1873 | for (n = 0; n < num_params + num_extra; n++) |
1874 | g_value_unset (¶mv[n]); |
1875 | g_free (paramv); |
1876 | } |
1877 | |
1878 | static GVariant * |
1879 | _dbus_introspectable_skeleton_handle_get_property ( |
1880 | GDBusConnection *connection G_GNUC_UNUSED, |
1881 | const gchar *sender G_GNUC_UNUSED, |
1882 | const gchar *object_path G_GNUC_UNUSED, |
1883 | const gchar *interface_name G_GNUC_UNUSED, |
1884 | const gchar *property_name, |
1885 | GError **error, |
1886 | gpointer user_data) |
1887 | { |
1888 | DBusIntrospectableSkeleton *skeleton = DBUS_INTROSPECTABLE_SKELETON (user_data); |
1889 | GValue value = G_VALUE_INIT; |
1890 | GParamSpec *pspec; |
1891 | _ExtendedGDBusPropertyInfo *info; |
1892 | GVariant *ret; |
1893 | ret = NULL; |
1894 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct, property_name); |
1895 | g_assert (info != NULL); |
1896 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1897 | if (pspec == NULL) |
1898 | { |
1899 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1900 | } |
1901 | else |
1902 | { |
1903 | g_value_init (&value, pspec->value_type); |
1904 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1905 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1906 | g_value_unset (&value); |
1907 | } |
1908 | return ret; |
1909 | } |
1910 | |
1911 | static gboolean |
1912 | _dbus_introspectable_skeleton_handle_set_property ( |
1913 | GDBusConnection *connection G_GNUC_UNUSED, |
1914 | const gchar *sender G_GNUC_UNUSED, |
1915 | const gchar *object_path G_GNUC_UNUSED, |
1916 | const gchar *interface_name G_GNUC_UNUSED, |
1917 | const gchar *property_name, |
1918 | GVariant *variant, |
1919 | GError **error, |
1920 | gpointer user_data) |
1921 | { |
1922 | DBusIntrospectableSkeleton *skeleton = DBUS_INTROSPECTABLE_SKELETON (user_data); |
1923 | GValue value = G_VALUE_INIT; |
1924 | GParamSpec *pspec; |
1925 | _ExtendedGDBusPropertyInfo *info; |
1926 | gboolean ret; |
1927 | ret = FALSE; |
1928 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_introspectable_interface_info.parent_struct, property_name); |
1929 | g_assert (info != NULL); |
1930 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1931 | if (pspec == NULL) |
1932 | { |
1933 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1934 | } |
1935 | else |
1936 | { |
1937 | if (info->use_gvariant) |
1938 | g_value_set_variant (&value, variant); |
1939 | else |
1940 | g_dbus_gvariant_to_gvalue (variant, &value); |
1941 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1942 | g_value_unset (&value); |
1943 | ret = TRUE; |
1944 | } |
1945 | return ret; |
1946 | } |
1947 | |
1948 | static const GDBusInterfaceVTable _dbus_introspectable_skeleton_vtable = |
1949 | { |
1950 | _dbus_introspectable_skeleton_handle_method_call, |
1951 | _dbus_introspectable_skeleton_handle_get_property, |
1952 | _dbus_introspectable_skeleton_handle_set_property, |
1953 | {NULL} |
1954 | }; |
1955 | |
1956 | static GDBusInterfaceInfo * |
1957 | dbus_introspectable_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1958 | { |
1959 | return dbus_introspectable_interface_info (); |
1960 | } |
1961 | |
1962 | static GDBusInterfaceVTable * |
1963 | dbus_introspectable_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1964 | { |
1965 | return (GDBusInterfaceVTable *) &_dbus_introspectable_skeleton_vtable; |
1966 | } |
1967 | |
1968 | static GVariant * |
1969 | dbus_introspectable_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
1970 | { |
1971 | DBusIntrospectableSkeleton *skeleton = DBUS_INTROSPECTABLE_SKELETON (_skeleton); |
1972 | |
1973 | GVariantBuilder builder; |
1974 | guint n; |
1975 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
1976 | if (_dbus_introspectable_interface_info.parent_struct.properties == NULL) |
1977 | goto out; |
1978 | for (n = 0; _dbus_introspectable_interface_info.parent_struct.properties[n] != NULL; n++) |
1979 | { |
1980 | GDBusPropertyInfo *info = _dbus_introspectable_interface_info.parent_struct.properties[n]; |
1981 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
1982 | { |
1983 | GVariant *value; |
1984 | value = _dbus_introspectable_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Introspectable", info->name, NULL, skeleton); |
1985 | if (value != NULL) |
1986 | { |
1987 | g_variant_take_ref (value); |
1988 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
1989 | g_variant_unref (value); |
1990 | } |
1991 | } |
1992 | } |
1993 | out: |
1994 | return g_variant_builder_end (&builder); |
1995 | } |
1996 | |
1997 | static void |
1998 | dbus_introspectable_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
1999 | { |
2000 | } |
2001 | |
2002 | static void dbus_introspectable_skeleton_iface_init (DBusIntrospectableIface *iface); |
2003 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2004 | G_DEFINE_TYPE_WITH_CODE (DBusIntrospectableSkeleton, dbus_introspectable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
2005 | G_ADD_PRIVATE (DBusIntrospectableSkeleton) |
2006 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_INTROSPECTABLE, dbus_introspectable_skeleton_iface_init)); |
2007 | |
2008 | #else |
2009 | G_DEFINE_TYPE_WITH_CODE (DBusIntrospectableSkeleton, dbus_introspectable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
2010 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_INTROSPECTABLE, dbus_introspectable_skeleton_iface_init)); |
2011 | |
2012 | #endif |
2013 | static void |
2014 | dbus_introspectable_skeleton_finalize (GObject *object) |
2015 | { |
2016 | DBusIntrospectableSkeleton *skeleton = DBUS_INTROSPECTABLE_SKELETON (object); |
2017 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2018 | if (skeleton->priv->changed_properties_idle_source != NULL) |
2019 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
2020 | g_main_context_unref (skeleton->priv->context); |
2021 | g_mutex_clear (&skeleton->priv->lock); |
2022 | G_OBJECT_CLASS (dbus_introspectable_skeleton_parent_class)->finalize (object); |
2023 | } |
2024 | |
2025 | static void |
2026 | dbus_introspectable_skeleton_init (DBusIntrospectableSkeleton *skeleton) |
2027 | { |
2028 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2029 | skeleton->priv = dbus_introspectable_skeleton_get_instance_private (skeleton); |
2030 | #else |
2031 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DBUS_INTROSPECTABLE_SKELETON, DBusIntrospectableSkeletonPrivate); |
2032 | #endif |
2033 | |
2034 | g_mutex_init (&skeleton->priv->lock); |
2035 | skeleton->priv->context = g_main_context_ref_thread_default (); |
2036 | } |
2037 | |
2038 | static void |
2039 | dbus_introspectable_skeleton_class_init (DBusIntrospectableSkeletonClass *klass) |
2040 | { |
2041 | GObjectClass *gobject_class; |
2042 | GDBusInterfaceSkeletonClass *skeleton_class; |
2043 | |
2044 | gobject_class = G_OBJECT_CLASS (klass); |
2045 | gobject_class->finalize = dbus_introspectable_skeleton_finalize; |
2046 | |
2047 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
2048 | skeleton_class->get_info = dbus_introspectable_skeleton_dbus_interface_get_info; |
2049 | skeleton_class->get_properties = dbus_introspectable_skeleton_dbus_interface_get_properties; |
2050 | skeleton_class->flush = dbus_introspectable_skeleton_dbus_interface_flush; |
2051 | skeleton_class->get_vtable = dbus_introspectable_skeleton_dbus_interface_get_vtable; |
2052 | |
2053 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2054 | g_type_class_add_private (klass, sizeof (DBusIntrospectableSkeletonPrivate)); |
2055 | #endif |
2056 | } |
2057 | |
2058 | static void |
2059 | dbus_introspectable_skeleton_iface_init (DBusIntrospectableIface *iface) |
2060 | { |
2061 | } |
2062 | |
2063 | /** |
2064 | * dbus_introspectable_skeleton_new: |
2065 | * |
2066 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Introspectable.top_of_page">org.freedesktop.DBus.Introspectable</link>. |
2067 | * |
2068 | * Returns: (transfer full) (type DBusIntrospectableSkeleton): The skeleton object. |
2069 | */ |
2070 | DBusIntrospectable * |
2071 | dbus_introspectable_skeleton_new (void) |
2072 | { |
2073 | return DBUS_INTROSPECTABLE (g_object_new (TYPE_DBUS_INTROSPECTABLE_SKELETON, NULL)); |
2074 | } |
2075 | |
2076 | /* ------------------------------------------------------------------------ |
2077 | * Code for interface org.freedesktop.DBus.Properties |
2078 | * ------------------------------------------------------------------------ |
2079 | */ |
2080 | |
2081 | /** |
2082 | * SECTION:DBusProperties |
2083 | * @title: DBusProperties |
2084 | * @short_description: Generated C code for the org.freedesktop.DBus.Properties D-Bus interface |
2085 | * |
2086 | * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link> D-Bus interface in C. |
2087 | */ |
2088 | |
2089 | /* ---- Introspection data for org.freedesktop.DBus.Properties ---- */ |
2090 | |
2091 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_get_IN_ARG_interface = |
2092 | { |
2093 | { |
2094 | -1, |
2095 | (gchar *) "interface", |
2096 | (gchar *) "s", |
2097 | NULL |
2098 | }, |
2099 | FALSE |
2100 | }; |
2101 | |
2102 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_get_IN_ARG_property = |
2103 | { |
2104 | { |
2105 | -1, |
2106 | (gchar *) "property", |
2107 | (gchar *) "s", |
2108 | NULL |
2109 | }, |
2110 | FALSE |
2111 | }; |
2112 | |
2113 | static const _ExtendedGDBusArgInfo * const _dbus_properties_method_info_get_IN_ARG_pointers[] = |
2114 | { |
2115 | &_dbus_properties_method_info_get_IN_ARG_interface, |
2116 | &_dbus_properties_method_info_get_IN_ARG_property, |
2117 | NULL |
2118 | }; |
2119 | |
2120 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_get_OUT_ARG_value = |
2121 | { |
2122 | { |
2123 | -1, |
2124 | (gchar *) "value", |
2125 | (gchar *) "v", |
2126 | NULL |
2127 | }, |
2128 | FALSE |
2129 | }; |
2130 | |
2131 | static const _ExtendedGDBusArgInfo * const _dbus_properties_method_info_get_OUT_ARG_pointers[] = |
2132 | { |
2133 | &_dbus_properties_method_info_get_OUT_ARG_value, |
2134 | NULL |
2135 | }; |
2136 | |
2137 | static const _ExtendedGDBusMethodInfo _dbus_properties_method_info_get = |
2138 | { |
2139 | { |
2140 | -1, |
2141 | (gchar *) "Get", |
2142 | (GDBusArgInfo **) &_dbus_properties_method_info_get_IN_ARG_pointers, |
2143 | (GDBusArgInfo **) &_dbus_properties_method_info_get_OUT_ARG_pointers, |
2144 | NULL |
2145 | }, |
2146 | "handle-get", |
2147 | FALSE |
2148 | }; |
2149 | |
2150 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_get_all_IN_ARG_interface = |
2151 | { |
2152 | { |
2153 | -1, |
2154 | (gchar *) "interface", |
2155 | (gchar *) "s", |
2156 | NULL |
2157 | }, |
2158 | FALSE |
2159 | }; |
2160 | |
2161 | static const _ExtendedGDBusArgInfo * const _dbus_properties_method_info_get_all_IN_ARG_pointers[] = |
2162 | { |
2163 | &_dbus_properties_method_info_get_all_IN_ARG_interface, |
2164 | NULL |
2165 | }; |
2166 | |
2167 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_get_all_OUT_ARG_properties = |
2168 | { |
2169 | { |
2170 | -1, |
2171 | (gchar *) "properties", |
2172 | (gchar *) "a{sv}", |
2173 | NULL |
2174 | }, |
2175 | FALSE |
2176 | }; |
2177 | |
2178 | static const _ExtendedGDBusArgInfo * const _dbus_properties_method_info_get_all_OUT_ARG_pointers[] = |
2179 | { |
2180 | &_dbus_properties_method_info_get_all_OUT_ARG_properties, |
2181 | NULL |
2182 | }; |
2183 | |
2184 | static const _ExtendedGDBusMethodInfo _dbus_properties_method_info_get_all = |
2185 | { |
2186 | { |
2187 | -1, |
2188 | (gchar *) "GetAll", |
2189 | (GDBusArgInfo **) &_dbus_properties_method_info_get_all_IN_ARG_pointers, |
2190 | (GDBusArgInfo **) &_dbus_properties_method_info_get_all_OUT_ARG_pointers, |
2191 | NULL |
2192 | }, |
2193 | "handle-get-all", |
2194 | FALSE |
2195 | }; |
2196 | |
2197 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_set_IN_ARG_interface = |
2198 | { |
2199 | { |
2200 | -1, |
2201 | (gchar *) "interface", |
2202 | (gchar *) "s", |
2203 | NULL |
2204 | }, |
2205 | FALSE |
2206 | }; |
2207 | |
2208 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_set_IN_ARG_property = |
2209 | { |
2210 | { |
2211 | -1, |
2212 | (gchar *) "property", |
2213 | (gchar *) "s", |
2214 | NULL |
2215 | }, |
2216 | FALSE |
2217 | }; |
2218 | |
2219 | static const _ExtendedGDBusArgInfo _dbus_properties_method_info_set_IN_ARG_value = |
2220 | { |
2221 | { |
2222 | -1, |
2223 | (gchar *) "value", |
2224 | (gchar *) "v", |
2225 | NULL |
2226 | }, |
2227 | FALSE |
2228 | }; |
2229 | |
2230 | static const _ExtendedGDBusArgInfo * const _dbus_properties_method_info_set_IN_ARG_pointers[] = |
2231 | { |
2232 | &_dbus_properties_method_info_set_IN_ARG_interface, |
2233 | &_dbus_properties_method_info_set_IN_ARG_property, |
2234 | &_dbus_properties_method_info_set_IN_ARG_value, |
2235 | NULL |
2236 | }; |
2237 | |
2238 | static const _ExtendedGDBusMethodInfo _dbus_properties_method_info_set = |
2239 | { |
2240 | { |
2241 | -1, |
2242 | (gchar *) "Set", |
2243 | (GDBusArgInfo **) &_dbus_properties_method_info_set_IN_ARG_pointers, |
2244 | NULL, |
2245 | NULL |
2246 | }, |
2247 | "handle-set", |
2248 | FALSE |
2249 | }; |
2250 | |
2251 | static const _ExtendedGDBusMethodInfo * const _dbus_properties_method_info_pointers[] = |
2252 | { |
2253 | &_dbus_properties_method_info_get, |
2254 | &_dbus_properties_method_info_get_all, |
2255 | &_dbus_properties_method_info_set, |
2256 | NULL |
2257 | }; |
2258 | |
2259 | static const _ExtendedGDBusArgInfo _dbus_properties_signal_info_properties_changed_ARG_interface = |
2260 | { |
2261 | { |
2262 | -1, |
2263 | (gchar *) "interface", |
2264 | (gchar *) "s", |
2265 | NULL |
2266 | }, |
2267 | FALSE |
2268 | }; |
2269 | |
2270 | static const _ExtendedGDBusArgInfo _dbus_properties_signal_info_properties_changed_ARG_changed_properties = |
2271 | { |
2272 | { |
2273 | -1, |
2274 | (gchar *) "changed_properties", |
2275 | (gchar *) "a{sv}", |
2276 | NULL |
2277 | }, |
2278 | FALSE |
2279 | }; |
2280 | |
2281 | static const _ExtendedGDBusArgInfo _dbus_properties_signal_info_properties_changed_ARG_invalidated_properties = |
2282 | { |
2283 | { |
2284 | -1, |
2285 | (gchar *) "invalidated_properties", |
2286 | (gchar *) "as", |
2287 | NULL |
2288 | }, |
2289 | FALSE |
2290 | }; |
2291 | |
2292 | static const _ExtendedGDBusArgInfo * const _dbus_properties_signal_info_properties_changed_ARG_pointers[] = |
2293 | { |
2294 | &_dbus_properties_signal_info_properties_changed_ARG_interface, |
2295 | &_dbus_properties_signal_info_properties_changed_ARG_changed_properties, |
2296 | &_dbus_properties_signal_info_properties_changed_ARG_invalidated_properties, |
2297 | NULL |
2298 | }; |
2299 | |
2300 | static const _ExtendedGDBusSignalInfo _dbus_properties_signal_info_properties_changed = |
2301 | { |
2302 | { |
2303 | -1, |
2304 | (gchar *) "PropertiesChanged", |
2305 | (GDBusArgInfo **) &_dbus_properties_signal_info_properties_changed_ARG_pointers, |
2306 | NULL |
2307 | }, |
2308 | "properties-changed" |
2309 | }; |
2310 | |
2311 | static const _ExtendedGDBusSignalInfo * const _dbus_properties_signal_info_pointers[] = |
2312 | { |
2313 | &_dbus_properties_signal_info_properties_changed, |
2314 | NULL |
2315 | }; |
2316 | |
2317 | static const _ExtendedGDBusInterfaceInfo _dbus_properties_interface_info = |
2318 | { |
2319 | { |
2320 | -1, |
2321 | (gchar *) "org.freedesktop.DBus.Properties", |
2322 | (GDBusMethodInfo **) &_dbus_properties_method_info_pointers, |
2323 | (GDBusSignalInfo **) &_dbus_properties_signal_info_pointers, |
2324 | NULL, |
2325 | NULL |
2326 | }, |
2327 | "dbus-properties", |
2328 | }; |
2329 | |
2330 | |
2331 | /** |
2332 | * dbus_properties_interface_info: |
2333 | * |
2334 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link> D-Bus interface. |
2335 | * |
2336 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
2337 | */ |
2338 | GDBusInterfaceInfo * |
2339 | dbus_properties_interface_info (void) |
2340 | { |
2341 | return (GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct; |
2342 | } |
2343 | |
2344 | /** |
2345 | * dbus_properties_override_properties: |
2346 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
2347 | * @property_id_begin: The property id to assign to the first overridden property. |
2348 | * |
2349 | * Overrides all #GObject properties in the #DBusProperties interface for a concrete class. |
2350 | * The properties are overridden in the order they are defined. |
2351 | * |
2352 | * Returns: The last property id. |
2353 | */ |
2354 | guint |
2355 | dbus_properties_override_properties (GObjectClass *klass, guint property_id_begin) |
2356 | { |
2357 | return property_id_begin - 1; |
2358 | } |
2359 | |
2360 | |
2361 | |
2362 | /** |
2363 | * DBusProperties: |
2364 | * |
2365 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link>. |
2366 | */ |
2367 | |
2368 | /** |
2369 | * DBusPropertiesIface: |
2370 | * @parent_iface: The parent interface. |
2371 | * @handle_get: Handler for the #DBusProperties::handle-get signal. |
2372 | * @handle_get_all: Handler for the #DBusProperties::handle-get-all signal. |
2373 | * @handle_set: Handler for the #DBusProperties::handle-set signal. |
2374 | * @properties_changed: Handler for the #DBusProperties::properties-changed signal. |
2375 | * |
2376 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link>. |
2377 | */ |
2378 | |
2379 | typedef DBusPropertiesIface DBusPropertiesInterface; |
2380 | G_DEFINE_INTERFACE (DBusProperties, dbus_properties, G_TYPE_OBJECT); |
2381 | |
2382 | static void |
2383 | dbus_properties_default_init (DBusPropertiesIface *iface) |
2384 | { |
2385 | /* GObject signals for incoming D-Bus method calls: */ |
2386 | /** |
2387 | * DBusProperties::handle-get: |
2388 | * @object: A #DBusProperties. |
2389 | * @invocation: A #GDBusMethodInvocation. |
2390 | * @arg_interface: Argument passed by remote caller. |
2391 | * @arg_property: Argument passed by remote caller. |
2392 | * |
2393 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Get">Get()</link> D-Bus method. |
2394 | * |
2395 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_properties_complete_get() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
2396 | * |
2397 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
2398 | */ |
2399 | g_signal_new ("handle-get", |
2400 | G_TYPE_FROM_INTERFACE (iface), |
2401 | G_SIGNAL_RUN_LAST, |
2402 | G_STRUCT_OFFSET (DBusPropertiesIface, handle_get), |
2403 | g_signal_accumulator_true_handled, |
2404 | NULL, |
2405 | g_cclosure_marshal_generic, |
2406 | G_TYPE_BOOLEAN, |
2407 | 3, |
2408 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); |
2409 | |
2410 | /** |
2411 | * DBusProperties::handle-get-all: |
2412 | * @object: A #DBusProperties. |
2413 | * @invocation: A #GDBusMethodInvocation. |
2414 | * @arg_interface: Argument passed by remote caller. |
2415 | * |
2416 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.GetAll">GetAll()</link> D-Bus method. |
2417 | * |
2418 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_properties_complete_get_all() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
2419 | * |
2420 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
2421 | */ |
2422 | g_signal_new ("handle-get-all", |
2423 | G_TYPE_FROM_INTERFACE (iface), |
2424 | G_SIGNAL_RUN_LAST, |
2425 | G_STRUCT_OFFSET (DBusPropertiesIface, handle_get_all), |
2426 | g_signal_accumulator_true_handled, |
2427 | NULL, |
2428 | g_cclosure_marshal_generic, |
2429 | G_TYPE_BOOLEAN, |
2430 | 2, |
2431 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
2432 | |
2433 | /** |
2434 | * DBusProperties::handle-set: |
2435 | * @object: A #DBusProperties. |
2436 | * @invocation: A #GDBusMethodInvocation. |
2437 | * @arg_interface: Argument passed by remote caller. |
2438 | * @arg_property: Argument passed by remote caller. |
2439 | * @arg_value: Argument passed by remote caller. |
2440 | * |
2441 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Set">Set()</link> D-Bus method. |
2442 | * |
2443 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call dbus_properties_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
2444 | * |
2445 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
2446 | */ |
2447 | g_signal_new ("handle-set", |
2448 | G_TYPE_FROM_INTERFACE (iface), |
2449 | G_SIGNAL_RUN_LAST, |
2450 | G_STRUCT_OFFSET (DBusPropertiesIface, handle_set), |
2451 | g_signal_accumulator_true_handled, |
2452 | NULL, |
2453 | g_cclosure_marshal_generic, |
2454 | G_TYPE_BOOLEAN, |
2455 | 4, |
2456 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT); |
2457 | |
2458 | /* GObject signals for received D-Bus signals: */ |
2459 | /** |
2460 | * DBusProperties::properties-changed: |
2461 | * @object: A #DBusProperties. |
2462 | * @arg_interface: Argument. |
2463 | * @arg_changed_properties: Argument. |
2464 | * @arg_invalidated_properties: Argument. |
2465 | * |
2466 | * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-DBus-Properties.PropertiesChanged">"PropertiesChanged"</link> is received. |
2467 | * |
2468 | * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. |
2469 | */ |
2470 | g_signal_new ("properties-changed", |
2471 | G_TYPE_FROM_INTERFACE (iface), |
2472 | G_SIGNAL_RUN_LAST, |
2473 | G_STRUCT_OFFSET (DBusPropertiesIface, properties_changed), |
2474 | NULL, |
2475 | NULL, |
2476 | g_cclosure_marshal_generic, |
2477 | G_TYPE_NONE, |
2478 | 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_STRV); |
2479 | |
2480 | } |
2481 | |
2482 | /** |
2483 | * dbus_properties_emit_properties_changed: |
2484 | * @object: A #DBusProperties. |
2485 | * @arg_interface: Argument to pass with the signal. |
2486 | * @arg_changed_properties: Argument to pass with the signal. |
2487 | * @arg_invalidated_properties: Argument to pass with the signal. |
2488 | * |
2489 | * Emits the <link linkend="gdbus-signal-org-freedesktop-DBus-Properties.PropertiesChanged">"PropertiesChanged"</link> D-Bus signal. |
2490 | */ |
2491 | void |
2492 | dbus_properties_emit_properties_changed ( |
2493 | DBusProperties *object, |
2494 | const gchar *arg_interface, |
2495 | GVariant *arg_changed_properties, |
2496 | const gchar *const *arg_invalidated_properties) |
2497 | { |
2498 | g_signal_emit_by_name (object, "properties-changed", arg_interface, arg_changed_properties, arg_invalidated_properties); |
2499 | } |
2500 | |
2501 | /** |
2502 | * dbus_properties_call_get: |
2503 | * @proxy: A #DBusPropertiesProxy. |
2504 | * @arg_interface: Argument to pass with the method invocation. |
2505 | * @arg_property: Argument to pass with the method invocation. |
2506 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2507 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2508 | * @user_data: User data to pass to @callback. |
2509 | * |
2510 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Get">Get()</link> D-Bus method on @proxy. |
2511 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2512 | * You can then call dbus_properties_call_get_finish() to get the result of the operation. |
2513 | * |
2514 | * See dbus_properties_call_get_sync() for the synchronous, blocking version of this method. |
2515 | */ |
2516 | void |
2517 | dbus_properties_call_get ( |
2518 | DBusProperties *proxy, |
2519 | const gchar *arg_interface, |
2520 | const gchar *arg_property, |
2521 | GCancellable *cancellable, |
2522 | GAsyncReadyCallback callback, |
2523 | gpointer user_data) |
2524 | { |
2525 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2526 | "Get", |
2527 | g_variant_new ("(ss)", |
2528 | arg_interface, |
2529 | arg_property), |
2530 | G_DBUS_CALL_FLAGS_NONE, |
2531 | -1, |
2532 | cancellable, |
2533 | callback, |
2534 | user_data); |
2535 | } |
2536 | |
2537 | /** |
2538 | * dbus_properties_call_get_finish: |
2539 | * @proxy: A #DBusPropertiesProxy. |
2540 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
2541 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_properties_call_get(). |
2542 | * @error: Return location for error or %NULL. |
2543 | * |
2544 | * Finishes an operation started with dbus_properties_call_get(). |
2545 | * |
2546 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2547 | */ |
2548 | gboolean |
2549 | dbus_properties_call_get_finish ( |
2550 | DBusProperties *proxy, |
2551 | GVariant **out_value, |
2552 | GAsyncResult *res, |
2553 | GError **error) |
2554 | { |
2555 | GVariant *_ret; |
2556 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2557 | if (_ret == NULL) |
2558 | goto _out; |
2559 | g_variant_get (_ret, |
2560 | "(@v)", |
2561 | out_value); |
2562 | g_variant_unref (_ret); |
2563 | _out: |
2564 | return _ret != NULL; |
2565 | } |
2566 | |
2567 | /** |
2568 | * dbus_properties_call_get_sync: |
2569 | * @proxy: A #DBusPropertiesProxy. |
2570 | * @arg_interface: Argument to pass with the method invocation. |
2571 | * @arg_property: Argument to pass with the method invocation. |
2572 | * @out_value: (out): Return location for return parameter or %NULL to ignore. |
2573 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2574 | * @error: Return location for error or %NULL. |
2575 | * |
2576 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Get">Get()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2577 | * |
2578 | * See dbus_properties_call_get() for the asynchronous version of this method. |
2579 | * |
2580 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2581 | */ |
2582 | gboolean |
2583 | dbus_properties_call_get_sync ( |
2584 | DBusProperties *proxy, |
2585 | const gchar *arg_interface, |
2586 | const gchar *arg_property, |
2587 | GVariant **out_value, |
2588 | GCancellable *cancellable, |
2589 | GError **error) |
2590 | { |
2591 | GVariant *_ret; |
2592 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2593 | "Get", |
2594 | g_variant_new ("(ss)", |
2595 | arg_interface, |
2596 | arg_property), |
2597 | G_DBUS_CALL_FLAGS_NONE, |
2598 | -1, |
2599 | cancellable, |
2600 | error); |
2601 | if (_ret == NULL) |
2602 | goto _out; |
2603 | g_variant_get (_ret, |
2604 | "(@v)", |
2605 | out_value); |
2606 | g_variant_unref (_ret); |
2607 | _out: |
2608 | return _ret != NULL; |
2609 | } |
2610 | |
2611 | /** |
2612 | * dbus_properties_call_get_all: |
2613 | * @proxy: A #DBusPropertiesProxy. |
2614 | * @arg_interface: Argument to pass with the method invocation. |
2615 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2616 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2617 | * @user_data: User data to pass to @callback. |
2618 | * |
2619 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.GetAll">GetAll()</link> D-Bus method on @proxy. |
2620 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2621 | * You can then call dbus_properties_call_get_all_finish() to get the result of the operation. |
2622 | * |
2623 | * See dbus_properties_call_get_all_sync() for the synchronous, blocking version of this method. |
2624 | */ |
2625 | void |
2626 | dbus_properties_call_get_all ( |
2627 | DBusProperties *proxy, |
2628 | const gchar *arg_interface, |
2629 | GCancellable *cancellable, |
2630 | GAsyncReadyCallback callback, |
2631 | gpointer user_data) |
2632 | { |
2633 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2634 | "GetAll", |
2635 | g_variant_new ("(s)", |
2636 | arg_interface), |
2637 | G_DBUS_CALL_FLAGS_NONE, |
2638 | -1, |
2639 | cancellable, |
2640 | callback, |
2641 | user_data); |
2642 | } |
2643 | |
2644 | /** |
2645 | * dbus_properties_call_get_all_finish: |
2646 | * @proxy: A #DBusPropertiesProxy. |
2647 | * @out_properties: (out): Return location for return parameter or %NULL to ignore. |
2648 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_properties_call_get_all(). |
2649 | * @error: Return location for error or %NULL. |
2650 | * |
2651 | * Finishes an operation started with dbus_properties_call_get_all(). |
2652 | * |
2653 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2654 | */ |
2655 | gboolean |
2656 | dbus_properties_call_get_all_finish ( |
2657 | DBusProperties *proxy, |
2658 | GVariant **out_properties, |
2659 | GAsyncResult *res, |
2660 | GError **error) |
2661 | { |
2662 | GVariant *_ret; |
2663 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2664 | if (_ret == NULL) |
2665 | goto _out; |
2666 | g_variant_get (_ret, |
2667 | "(@a{sv})", |
2668 | out_properties); |
2669 | g_variant_unref (_ret); |
2670 | _out: |
2671 | return _ret != NULL; |
2672 | } |
2673 | |
2674 | /** |
2675 | * dbus_properties_call_get_all_sync: |
2676 | * @proxy: A #DBusPropertiesProxy. |
2677 | * @arg_interface: Argument to pass with the method invocation. |
2678 | * @out_properties: (out): Return location for return parameter or %NULL to ignore. |
2679 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2680 | * @error: Return location for error or %NULL. |
2681 | * |
2682 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.GetAll">GetAll()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2683 | * |
2684 | * See dbus_properties_call_get_all() for the asynchronous version of this method. |
2685 | * |
2686 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2687 | */ |
2688 | gboolean |
2689 | dbus_properties_call_get_all_sync ( |
2690 | DBusProperties *proxy, |
2691 | const gchar *arg_interface, |
2692 | GVariant **out_properties, |
2693 | GCancellable *cancellable, |
2694 | GError **error) |
2695 | { |
2696 | GVariant *_ret; |
2697 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2698 | "GetAll", |
2699 | g_variant_new ("(s)", |
2700 | arg_interface), |
2701 | G_DBUS_CALL_FLAGS_NONE, |
2702 | -1, |
2703 | cancellable, |
2704 | error); |
2705 | if (_ret == NULL) |
2706 | goto _out; |
2707 | g_variant_get (_ret, |
2708 | "(@a{sv})", |
2709 | out_properties); |
2710 | g_variant_unref (_ret); |
2711 | _out: |
2712 | return _ret != NULL; |
2713 | } |
2714 | |
2715 | /** |
2716 | * dbus_properties_call_set: |
2717 | * @proxy: A #DBusPropertiesProxy. |
2718 | * @arg_interface: Argument to pass with the method invocation. |
2719 | * @arg_property: Argument to pass with the method invocation. |
2720 | * @arg_value: Argument to pass with the method invocation. |
2721 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2722 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2723 | * @user_data: User data to pass to @callback. |
2724 | * |
2725 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Set">Set()</link> D-Bus method on @proxy. |
2726 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2727 | * You can then call dbus_properties_call_set_finish() to get the result of the operation. |
2728 | * |
2729 | * See dbus_properties_call_set_sync() for the synchronous, blocking version of this method. |
2730 | */ |
2731 | void |
2732 | dbus_properties_call_set ( |
2733 | DBusProperties *proxy, |
2734 | const gchar *arg_interface, |
2735 | const gchar *arg_property, |
2736 | GVariant *arg_value, |
2737 | GCancellable *cancellable, |
2738 | GAsyncReadyCallback callback, |
2739 | gpointer user_data) |
2740 | { |
2741 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2742 | "Set", |
2743 | g_variant_new ("(ss@v)", |
2744 | arg_interface, |
2745 | arg_property, |
2746 | arg_value), |
2747 | G_DBUS_CALL_FLAGS_NONE, |
2748 | -1, |
2749 | cancellable, |
2750 | callback, |
2751 | user_data); |
2752 | } |
2753 | |
2754 | /** |
2755 | * dbus_properties_call_set_finish: |
2756 | * @proxy: A #DBusPropertiesProxy. |
2757 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_properties_call_set(). |
2758 | * @error: Return location for error or %NULL. |
2759 | * |
2760 | * Finishes an operation started with dbus_properties_call_set(). |
2761 | * |
2762 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2763 | */ |
2764 | gboolean |
2765 | dbus_properties_call_set_finish ( |
2766 | DBusProperties *proxy, |
2767 | GAsyncResult *res, |
2768 | GError **error) |
2769 | { |
2770 | GVariant *_ret; |
2771 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2772 | if (_ret == NULL) |
2773 | goto _out; |
2774 | g_variant_get (_ret, |
2775 | "()"); |
2776 | g_variant_unref (_ret); |
2777 | _out: |
2778 | return _ret != NULL; |
2779 | } |
2780 | |
2781 | /** |
2782 | * dbus_properties_call_set_sync: |
2783 | * @proxy: A #DBusPropertiesProxy. |
2784 | * @arg_interface: Argument to pass with the method invocation. |
2785 | * @arg_property: Argument to pass with the method invocation. |
2786 | * @arg_value: Argument to pass with the method invocation. |
2787 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
2788 | * @error: Return location for error or %NULL. |
2789 | * |
2790 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Set">Set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
2791 | * |
2792 | * See dbus_properties_call_set() for the asynchronous version of this method. |
2793 | * |
2794 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2795 | */ |
2796 | gboolean |
2797 | dbus_properties_call_set_sync ( |
2798 | DBusProperties *proxy, |
2799 | const gchar *arg_interface, |
2800 | const gchar *arg_property, |
2801 | GVariant *arg_value, |
2802 | GCancellable *cancellable, |
2803 | GError **error) |
2804 | { |
2805 | GVariant *_ret; |
2806 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2807 | "Set", |
2808 | g_variant_new ("(ss@v)", |
2809 | arg_interface, |
2810 | arg_property, |
2811 | arg_value), |
2812 | G_DBUS_CALL_FLAGS_NONE, |
2813 | -1, |
2814 | cancellable, |
2815 | error); |
2816 | if (_ret == NULL) |
2817 | goto _out; |
2818 | g_variant_get (_ret, |
2819 | "()"); |
2820 | g_variant_unref (_ret); |
2821 | _out: |
2822 | return _ret != NULL; |
2823 | } |
2824 | |
2825 | /** |
2826 | * dbus_properties_complete_get: |
2827 | * @object: A #DBusProperties. |
2828 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2829 | * @value: Parameter to return. |
2830 | * |
2831 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Get">Get()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
2832 | * |
2833 | * This method will free @invocation, you cannot use it afterwards. |
2834 | */ |
2835 | void |
2836 | dbus_properties_complete_get ( |
2837 | DBusProperties *object, |
2838 | GDBusMethodInvocation *invocation, |
2839 | GVariant *value) |
2840 | { |
2841 | g_dbus_method_invocation_return_value (invocation, |
2842 | g_variant_new ("(@v)", |
2843 | value)); |
2844 | } |
2845 | |
2846 | /** |
2847 | * dbus_properties_complete_get_all: |
2848 | * @object: A #DBusProperties. |
2849 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2850 | * @properties: Parameter to return. |
2851 | * |
2852 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.GetAll">GetAll()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
2853 | * |
2854 | * This method will free @invocation, you cannot use it afterwards. |
2855 | */ |
2856 | void |
2857 | dbus_properties_complete_get_all ( |
2858 | DBusProperties *object, |
2859 | GDBusMethodInvocation *invocation, |
2860 | GVariant *properties) |
2861 | { |
2862 | g_dbus_method_invocation_return_value (invocation, |
2863 | g_variant_new ("(@a{sv})", |
2864 | properties)); |
2865 | } |
2866 | |
2867 | /** |
2868 | * dbus_properties_complete_set: |
2869 | * @object: A #DBusProperties. |
2870 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2871 | * |
2872 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-DBus-Properties.Set">Set()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
2873 | * |
2874 | * This method will free @invocation, you cannot use it afterwards. |
2875 | */ |
2876 | void |
2877 | dbus_properties_complete_set ( |
2878 | DBusProperties *object, |
2879 | GDBusMethodInvocation *invocation) |
2880 | { |
2881 | g_dbus_method_invocation_return_value (invocation, |
2882 | g_variant_new ("()")); |
2883 | } |
2884 | |
2885 | /* ------------------------------------------------------------------------ */ |
2886 | |
2887 | /** |
2888 | * DBusPropertiesProxy: |
2889 | * |
2890 | * The #DBusPropertiesProxy structure contains only private data and should only be accessed using the provided API. |
2891 | */ |
2892 | |
2893 | /** |
2894 | * DBusPropertiesProxyClass: |
2895 | * @parent_class: The parent class. |
2896 | * |
2897 | * Class structure for #DBusPropertiesProxy. |
2898 | */ |
2899 | |
2900 | struct _DBusPropertiesProxyPrivate |
2901 | { |
2902 | GData *qdata; |
2903 | }; |
2904 | |
2905 | static void dbus_properties_proxy_iface_init (DBusPropertiesIface *iface); |
2906 | |
2907 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2908 | G_DEFINE_TYPE_WITH_CODE (DBusPropertiesProxy, dbus_properties_proxy, G_TYPE_DBUS_PROXY, |
2909 | G_ADD_PRIVATE (DBusPropertiesProxy) |
2910 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PROPERTIES, dbus_properties_proxy_iface_init)); |
2911 | |
2912 | #else |
2913 | G_DEFINE_TYPE_WITH_CODE (DBusPropertiesProxy, dbus_properties_proxy, G_TYPE_DBUS_PROXY, |
2914 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PROPERTIES, dbus_properties_proxy_iface_init)); |
2915 | |
2916 | #endif |
2917 | static void |
2918 | dbus_properties_proxy_finalize (GObject *object) |
2919 | { |
2920 | DBusPropertiesProxy *proxy = DBUS_PROPERTIES_PROXY (object); |
2921 | g_datalist_clear (&proxy->priv->qdata); |
2922 | G_OBJECT_CLASS (dbus_properties_proxy_parent_class)->finalize (object); |
2923 | } |
2924 | |
2925 | static void |
2926 | dbus_properties_proxy_get_property (GObject *object, |
2927 | guint prop_id, |
2928 | GValue *value, |
2929 | GParamSpec *pspec G_GNUC_UNUSED) |
2930 | { |
2931 | } |
2932 | |
2933 | static void |
2934 | dbus_properties_proxy_set_property (GObject *object, |
2935 | guint prop_id, |
2936 | const GValue *value, |
2937 | GParamSpec *pspec G_GNUC_UNUSED) |
2938 | { |
2939 | } |
2940 | |
2941 | static void |
2942 | dbus_properties_proxy_g_signal (GDBusProxy *proxy, |
2943 | const gchar *sender_name G_GNUC_UNUSED, |
2944 | const gchar *signal_name, |
2945 | GVariant *parameters) |
2946 | { |
2947 | _ExtendedGDBusSignalInfo *info; |
2948 | GVariantIter iter; |
2949 | GVariant *child; |
2950 | GValue *paramv; |
2951 | guint num_params; |
2952 | guint n; |
2953 | guint signal_id; |
2954 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct, signal_name); |
2955 | if (info == NULL) |
2956 | return; |
2957 | num_params = g_variant_n_children (parameters); |
2958 | paramv = g_new0 (GValue, num_params + 1); |
2959 | g_value_init (¶mv[0], TYPE_DBUS_PROPERTIES); |
2960 | g_value_set_object (¶mv[0], proxy); |
2961 | g_variant_iter_init (&iter, parameters); |
2962 | n = 1; |
2963 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
2964 | { |
2965 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
2966 | if (arg_info->use_gvariant) |
2967 | { |
2968 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
2969 | g_value_set_variant (¶mv[n], child); |
2970 | n++; |
2971 | } |
2972 | else |
2973 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
2974 | g_variant_unref (child); |
2975 | } |
2976 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_PROPERTIES); |
2977 | g_signal_emitv (paramv, signal_id, 0, NULL); |
2978 | for (n = 0; n < num_params + 1; n++) |
2979 | g_value_unset (¶mv[n]); |
2980 | g_free (paramv); |
2981 | } |
2982 | |
2983 | static void |
2984 | dbus_properties_proxy_g_properties_changed (GDBusProxy *_proxy, |
2985 | GVariant *changed_properties, |
2986 | const gchar *const *invalidated_properties) |
2987 | { |
2988 | DBusPropertiesProxy *proxy = DBUS_PROPERTIES_PROXY (_proxy); |
2989 | guint n; |
2990 | const gchar *key; |
2991 | GVariantIter *iter; |
2992 | _ExtendedGDBusPropertyInfo *info; |
2993 | g_variant_get (changed_properties, "a{sv}", &iter); |
2994 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
2995 | { |
2996 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct, key); |
2997 | g_datalist_remove_data (&proxy->priv->qdata, key); |
2998 | if (info != NULL) |
2999 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
3000 | } |
3001 | g_variant_iter_free (iter); |
3002 | for (n = 0; invalidated_properties[n] != NULL; n++) |
3003 | { |
3004 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct, invalidated_properties[n]); |
3005 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
3006 | if (info != NULL) |
3007 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
3008 | } |
3009 | } |
3010 | |
3011 | static void |
3012 | dbus_properties_proxy_init (DBusPropertiesProxy *proxy) |
3013 | { |
3014 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3015 | proxy->priv = dbus_properties_proxy_get_instance_private (proxy); |
3016 | #else |
3017 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DBUS_PROPERTIES_PROXY, DBusPropertiesProxyPrivate); |
3018 | #endif |
3019 | |
3020 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), dbus_properties_interface_info ()); |
3021 | } |
3022 | |
3023 | static void |
3024 | dbus_properties_proxy_class_init (DBusPropertiesProxyClass *klass) |
3025 | { |
3026 | GObjectClass *gobject_class; |
3027 | GDBusProxyClass *proxy_class; |
3028 | |
3029 | gobject_class = G_OBJECT_CLASS (klass); |
3030 | gobject_class->finalize = dbus_properties_proxy_finalize; |
3031 | gobject_class->get_property = dbus_properties_proxy_get_property; |
3032 | gobject_class->set_property = dbus_properties_proxy_set_property; |
3033 | |
3034 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
3035 | proxy_class->g_signal = dbus_properties_proxy_g_signal; |
3036 | proxy_class->g_properties_changed = dbus_properties_proxy_g_properties_changed; |
3037 | |
3038 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
3039 | g_type_class_add_private (klass, sizeof (DBusPropertiesProxyPrivate)); |
3040 | #endif |
3041 | } |
3042 | |
3043 | static void |
3044 | dbus_properties_proxy_iface_init (DBusPropertiesIface *iface) |
3045 | { |
3046 | } |
3047 | |
3048 | /** |
3049 | * dbus_properties_proxy_new: |
3050 | * @connection: A #GDBusConnection. |
3051 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
3052 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
3053 | * @object_path: An object path. |
3054 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
3055 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
3056 | * @user_data: User data to pass to @callback. |
3057 | * |
3058 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link>. See g_dbus_proxy_new() for more details. |
3059 | * |
3060 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
3061 | * You can then call dbus_properties_proxy_new_finish() to get the result of the operation. |
3062 | * |
3063 | * See dbus_properties_proxy_new_sync() for the synchronous, blocking version of this constructor. |
3064 | */ |
3065 | void |
3066 | dbus_properties_proxy_new ( |
3067 | GDBusConnection *connection, |
3068 | GDBusProxyFlags flags, |
3069 | const gchar *name, |
3070 | const gchar *object_path, |
3071 | GCancellable *cancellable, |
3072 | GAsyncReadyCallback callback, |
3073 | gpointer user_data) |
3074 | { |
3075 | g_async_initable_new_async (TYPE_DBUS_PROPERTIES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Properties", NULL); |
3076 | } |
3077 | |
3078 | /** |
3079 | * dbus_properties_proxy_new_finish: |
3080 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_properties_proxy_new(). |
3081 | * @error: Return location for error or %NULL |
3082 | * |
3083 | * Finishes an operation started with dbus_properties_proxy_new(). |
3084 | * |
3085 | * Returns: (transfer full) (type DBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. |
3086 | */ |
3087 | DBusProperties * |
3088 | dbus_properties_proxy_new_finish ( |
3089 | GAsyncResult *res, |
3090 | GError **error) |
3091 | { |
3092 | GObject *ret; |
3093 | GObject *source_object; |
3094 | source_object = g_async_result_get_source_object (res); |
3095 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
3096 | g_object_unref (source_object); |
3097 | if (ret != NULL) |
3098 | return DBUS_PROPERTIES (ret); |
3099 | else |
3100 | return NULL; |
3101 | } |
3102 | |
3103 | /** |
3104 | * dbus_properties_proxy_new_sync: |
3105 | * @connection: A #GDBusConnection. |
3106 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
3107 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
3108 | * @object_path: An object path. |
3109 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
3110 | * @error: Return location for error or %NULL |
3111 | * |
3112 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link>. See g_dbus_proxy_new_sync() for more details. |
3113 | * |
3114 | * The calling thread is blocked until a reply is received. |
3115 | * |
3116 | * See dbus_properties_proxy_new() for the asynchronous version of this constructor. |
3117 | * |
3118 | * Returns: (transfer full) (type DBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. |
3119 | */ |
3120 | DBusProperties * |
3121 | dbus_properties_proxy_new_sync ( |
3122 | GDBusConnection *connection, |
3123 | GDBusProxyFlags flags, |
3124 | const gchar *name, |
3125 | const gchar *object_path, |
3126 | GCancellable *cancellable, |
3127 | GError **error) |
3128 | { |
3129 | GInitable *ret; |
3130 | ret = g_initable_new (TYPE_DBUS_PROPERTIES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Properties", NULL); |
3131 | if (ret != NULL) |
3132 | return DBUS_PROPERTIES (ret); |
3133 | else |
3134 | return NULL; |
3135 | } |
3136 | |
3137 | |
3138 | /** |
3139 | * dbus_properties_proxy_new_for_bus: |
3140 | * @bus_type: A #GBusType. |
3141 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
3142 | * @name: A bus name (well-known or unique). |
3143 | * @object_path: An object path. |
3144 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
3145 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
3146 | * @user_data: User data to pass to @callback. |
3147 | * |
3148 | * Like dbus_properties_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
3149 | * |
3150 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
3151 | * You can then call dbus_properties_proxy_new_for_bus_finish() to get the result of the operation. |
3152 | * |
3153 | * See dbus_properties_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
3154 | */ |
3155 | void |
3156 | dbus_properties_proxy_new_for_bus ( |
3157 | GBusType bus_type, |
3158 | GDBusProxyFlags flags, |
3159 | const gchar *name, |
3160 | const gchar *object_path, |
3161 | GCancellable *cancellable, |
3162 | GAsyncReadyCallback callback, |
3163 | gpointer user_data) |
3164 | { |
3165 | g_async_initable_new_async (TYPE_DBUS_PROPERTIES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Properties", NULL); |
3166 | } |
3167 | |
3168 | /** |
3169 | * dbus_properties_proxy_new_for_bus_finish: |
3170 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to dbus_properties_proxy_new_for_bus(). |
3171 | * @error: Return location for error or %NULL |
3172 | * |
3173 | * Finishes an operation started with dbus_properties_proxy_new_for_bus(). |
3174 | * |
3175 | * Returns: (transfer full) (type DBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. |
3176 | */ |
3177 | DBusProperties * |
3178 | dbus_properties_proxy_new_for_bus_finish ( |
3179 | GAsyncResult *res, |
3180 | GError **error) |
3181 | { |
3182 | GObject *ret; |
3183 | GObject *source_object; |
3184 | source_object = g_async_result_get_source_object (res); |
3185 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
3186 | g_object_unref (source_object); |
3187 | if (ret != NULL) |
3188 | return DBUS_PROPERTIES (ret); |
3189 | else |
3190 | return NULL; |
3191 | } |
3192 | |
3193 | /** |
3194 | * dbus_properties_proxy_new_for_bus_sync: |
3195 | * @bus_type: A #GBusType. |
3196 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
3197 | * @name: A bus name (well-known or unique). |
3198 | * @object_path: An object path. |
3199 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
3200 | * @error: Return location for error or %NULL |
3201 | * |
3202 | * Like dbus_properties_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
3203 | * |
3204 | * The calling thread is blocked until a reply is received. |
3205 | * |
3206 | * See dbus_properties_proxy_new_for_bus() for the asynchronous version of this constructor. |
3207 | * |
3208 | * Returns: (transfer full) (type DBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. |
3209 | */ |
3210 | DBusProperties * |
3211 | dbus_properties_proxy_new_for_bus_sync ( |
3212 | GBusType bus_type, |
3213 | GDBusProxyFlags flags, |
3214 | const gchar *name, |
3215 | const gchar *object_path, |
3216 | GCancellable *cancellable, |
3217 | GError **error) |
3218 | { |
3219 | GInitable *ret; |
3220 | ret = g_initable_new (TYPE_DBUS_PROPERTIES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.DBus.Properties", NULL); |
3221 | if (ret != NULL) |
3222 | return DBUS_PROPERTIES (ret); |
3223 | else |
3224 | return NULL; |
3225 | } |
3226 | |
3227 | |
3228 | /* ------------------------------------------------------------------------ */ |
3229 | |
3230 | /** |
3231 | * DBusPropertiesSkeleton: |
3232 | * |
3233 | * The #DBusPropertiesSkeleton structure contains only private data and should only be accessed using the provided API. |
3234 | */ |
3235 | |
3236 | /** |
3237 | * DBusPropertiesSkeletonClass: |
3238 | * @parent_class: The parent class. |
3239 | * |
3240 | * Class structure for #DBusPropertiesSkeleton. |
3241 | */ |
3242 | |
3243 | struct _DBusPropertiesSkeletonPrivate |
3244 | { |
3245 | GValue *properties; |
3246 | GList *changed_properties; |
3247 | GSource *changed_properties_idle_source; |
3248 | GMainContext *context; |
3249 | GMutex lock; |
3250 | }; |
3251 | |
3252 | static void |
3253 | _dbus_properties_skeleton_handle_method_call ( |
3254 | GDBusConnection *connection G_GNUC_UNUSED, |
3255 | const gchar *sender G_GNUC_UNUSED, |
3256 | const gchar *object_path G_GNUC_UNUSED, |
3257 | const gchar *interface_name, |
3258 | const gchar *method_name, |
3259 | GVariant *parameters, |
3260 | GDBusMethodInvocation *invocation, |
3261 | gpointer user_data) |
3262 | { |
3263 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (user_data); |
3264 | _ExtendedGDBusMethodInfo *info; |
3265 | GVariantIter iter; |
3266 | GVariant *child; |
3267 | GValue *paramv; |
3268 | guint num_params; |
3269 | guint num_extra; |
3270 | guint n; |
3271 | guint signal_id; |
3272 | GValue return_value = G_VALUE_INIT; |
3273 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
3274 | g_assert (info != NULL); |
3275 | num_params = g_variant_n_children (parameters); |
3276 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
3277 | n = 0; |
3278 | g_value_init (¶mv[n], TYPE_DBUS_PROPERTIES); |
3279 | g_value_set_object (¶mv[n++], skeleton); |
3280 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
3281 | g_value_set_object (¶mv[n++], invocation); |
3282 | if (info->pass_fdlist) |
3283 | { |
3284 | #ifdef G_OS_UNIX |
3285 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
3286 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
3287 | #else |
3288 | g_assert_not_reached (); |
3289 | #endif |
3290 | } |
3291 | g_variant_iter_init (&iter, parameters); |
3292 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
3293 | { |
3294 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
3295 | if (arg_info->use_gvariant) |
3296 | { |
3297 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
3298 | g_value_set_variant (¶mv[n], child); |
3299 | n++; |
3300 | } |
3301 | else |
3302 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
3303 | g_variant_unref (child); |
3304 | } |
3305 | signal_id = g_signal_lookup (info->signal_name, TYPE_DBUS_PROPERTIES); |
3306 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
3307 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
3308 | if (!g_value_get_boolean (&return_value)) |
3309 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
3310 | g_value_unset (&return_value); |
3311 | for (n = 0; n < num_params + num_extra; n++) |
3312 | g_value_unset (¶mv[n]); |
3313 | g_free (paramv); |
3314 | } |
3315 | |
3316 | static GVariant * |
3317 | _dbus_properties_skeleton_handle_get_property ( |
3318 | GDBusConnection *connection G_GNUC_UNUSED, |
3319 | const gchar *sender G_GNUC_UNUSED, |
3320 | const gchar *object_path G_GNUC_UNUSED, |
3321 | const gchar *interface_name G_GNUC_UNUSED, |
3322 | const gchar *property_name, |
3323 | GError **error, |
3324 | gpointer user_data) |
3325 | { |
3326 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (user_data); |
3327 | GValue value = G_VALUE_INIT; |
3328 | GParamSpec *pspec; |
3329 | _ExtendedGDBusPropertyInfo *info; |
3330 | GVariant *ret; |
3331 | ret = NULL; |
3332 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct, property_name); |
3333 | g_assert (info != NULL); |
3334 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3335 | if (pspec == NULL) |
3336 | { |
3337 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3338 | } |
3339 | else |
3340 | { |
3341 | g_value_init (&value, pspec->value_type); |
3342 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3343 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
3344 | g_value_unset (&value); |
3345 | } |
3346 | return ret; |
3347 | } |
3348 | |
3349 | static gboolean |
3350 | _dbus_properties_skeleton_handle_set_property ( |
3351 | GDBusConnection *connection G_GNUC_UNUSED, |
3352 | const gchar *sender G_GNUC_UNUSED, |
3353 | const gchar *object_path G_GNUC_UNUSED, |
3354 | const gchar *interface_name G_GNUC_UNUSED, |
3355 | const gchar *property_name, |
3356 | GVariant *variant, |
3357 | GError **error, |
3358 | gpointer user_data) |
3359 | { |
3360 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (user_data); |
3361 | GValue value = G_VALUE_INIT; |
3362 | GParamSpec *pspec; |
3363 | _ExtendedGDBusPropertyInfo *info; |
3364 | gboolean ret; |
3365 | ret = FALSE; |
3366 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_dbus_properties_interface_info.parent_struct, property_name); |
3367 | g_assert (info != NULL); |
3368 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3369 | if (pspec == NULL) |
3370 | { |
3371 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3372 | } |
3373 | else |
3374 | { |
3375 | if (info->use_gvariant) |
3376 | g_value_set_variant (&value, variant); |
3377 | else |
3378 | g_dbus_gvariant_to_gvalue (variant, &value); |
3379 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3380 | g_value_unset (&value); |
3381 | ret = TRUE; |
3382 | } |
3383 | return ret; |
3384 | } |
3385 | |
3386 | static const GDBusInterfaceVTable _dbus_properties_skeleton_vtable = |
3387 | { |
3388 | _dbus_properties_skeleton_handle_method_call, |
3389 | _dbus_properties_skeleton_handle_get_property, |
3390 | _dbus_properties_skeleton_handle_set_property, |
3391 | {NULL} |
3392 | }; |
3393 | |
3394 | static GDBusInterfaceInfo * |
3395 | dbus_properties_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3396 | { |
3397 | return dbus_properties_interface_info (); |
3398 | } |
3399 | |
3400 | static GDBusInterfaceVTable * |
3401 | dbus_properties_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3402 | { |
3403 | return (GDBusInterfaceVTable *) &_dbus_properties_skeleton_vtable; |
3404 | } |
3405 | |
3406 | static GVariant * |
3407 | dbus_properties_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
3408 | { |
3409 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (_skeleton); |
3410 | |
3411 | GVariantBuilder builder; |
3412 | guint n; |
3413 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
3414 | if (_dbus_properties_interface_info.parent_struct.properties == NULL) |
3415 | goto out; |
3416 | for (n = 0; _dbus_properties_interface_info.parent_struct.properties[n] != NULL; n++) |
3417 | { |
3418 | GDBusPropertyInfo *info = _dbus_properties_interface_info.parent_struct.properties[n]; |
3419 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
3420 | { |
3421 | GVariant *value; |
3422 | value = _dbus_properties_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", info->name, NULL, skeleton); |
3423 | if (value != NULL) |
3424 | { |
3425 | g_variant_take_ref (value); |
3426 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
3427 | g_variant_unref (value); |
3428 | } |
3429 | } |
3430 | } |
3431 | out: |
3432 | return g_variant_builder_end (&builder); |
3433 | } |
3434 | |
3435 | static void |
3436 | dbus_properties_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
3437 | { |
3438 | } |
3439 | |
3440 | static void |
3441 | _dbus_properties_on_signal_properties_changed ( |
3442 | DBusProperties *object, |
3443 | const gchar *arg_interface, |
3444 | GVariant *arg_changed_properties, |
3445 | const gchar *const *arg_invalidated_properties) |
3446 | { |
3447 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (object); |
3448 | |
3449 | GList *connections, *l; |
3450 | GVariant *signal_variant; |
3451 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
3452 | |
3453 | signal_variant = g_variant_ref_sink (g_variant_new ("(s@a{sv}^as)", |
3454 | arg_interface, |
3455 | arg_changed_properties, |
3456 | arg_invalidated_properties)); |
3457 | for (l = connections; l != NULL; l = l->next) |
3458 | { |
3459 | GDBusConnection *connection = l->data; |
3460 | g_dbus_connection_emit_signal (connection, |
3461 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.DBus.Properties", "PropertiesChanged", |
3462 | signal_variant, NULL); |
3463 | } |
3464 | g_variant_unref (signal_variant); |
3465 | g_list_free_full (connections, g_object_unref); |
3466 | } |
3467 | |
3468 | static void dbus_properties_skeleton_iface_init (DBusPropertiesIface *iface); |
3469 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3470 | G_DEFINE_TYPE_WITH_CODE (DBusPropertiesSkeleton, dbus_properties_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3471 | G_ADD_PRIVATE (DBusPropertiesSkeleton) |
3472 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PROPERTIES, dbus_properties_skeleton_iface_init)); |
3473 | |
3474 | #else |
3475 | G_DEFINE_TYPE_WITH_CODE (DBusPropertiesSkeleton, dbus_properties_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3476 | G_IMPLEMENT_INTERFACE (TYPE_DBUS_PROPERTIES, dbus_properties_skeleton_iface_init)); |
3477 | |
3478 | #endif |
3479 | static void |
3480 | dbus_properties_skeleton_finalize (GObject *object) |
3481 | { |
3482 | DBusPropertiesSkeleton *skeleton = DBUS_PROPERTIES_SKELETON (object); |
3483 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
3484 | if (skeleton->priv->changed_properties_idle_source != NULL) |
3485 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
3486 | g_main_context_unref (skeleton->priv->context); |
3487 | g_mutex_clear (&skeleton->priv->lock); |
3488 | G_OBJECT_CLASS (dbus_properties_skeleton_parent_class)->finalize (object); |
3489 | } |
3490 | |
3491 | static void |
3492 | dbus_properties_skeleton_init (DBusPropertiesSkeleton *skeleton) |
3493 | { |
3494 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3495 | skeleton->priv = dbus_properties_skeleton_get_instance_private (skeleton); |
3496 | #else |
3497 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DBUS_PROPERTIES_SKELETON, DBusPropertiesSkeletonPrivate); |
3498 | #endif |
3499 | |
3500 | g_mutex_init (&skeleton->priv->lock); |
3501 | skeleton->priv->context = g_main_context_ref_thread_default (); |
3502 | } |
3503 | |
3504 | static void |
3505 | dbus_properties_skeleton_class_init (DBusPropertiesSkeletonClass *klass) |
3506 | { |
3507 | GObjectClass *gobject_class; |
3508 | GDBusInterfaceSkeletonClass *skeleton_class; |
3509 | |
3510 | gobject_class = G_OBJECT_CLASS (klass); |
3511 | gobject_class->finalize = dbus_properties_skeleton_finalize; |
3512 | |
3513 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
3514 | skeleton_class->get_info = dbus_properties_skeleton_dbus_interface_get_info; |
3515 | skeleton_class->get_properties = dbus_properties_skeleton_dbus_interface_get_properties; |
3516 | skeleton_class->flush = dbus_properties_skeleton_dbus_interface_flush; |
3517 | skeleton_class->get_vtable = dbus_properties_skeleton_dbus_interface_get_vtable; |
3518 | |
3519 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
3520 | g_type_class_add_private (klass, sizeof (DBusPropertiesSkeletonPrivate)); |
3521 | #endif |
3522 | } |
3523 | |
3524 | static void |
3525 | dbus_properties_skeleton_iface_init (DBusPropertiesIface *iface) |
3526 | { |
3527 | iface->properties_changed = _dbus_properties_on_signal_properties_changed; |
3528 | } |
3529 | |
3530 | /** |
3531 | * dbus_properties_skeleton_new: |
3532 | * |
3533 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-DBus-Properties.top_of_page">org.freedesktop.DBus.Properties</link>. |
3534 | * |
3535 | * Returns: (transfer full) (type DBusPropertiesSkeleton): The skeleton object. |
3536 | */ |
3537 | DBusProperties * |
3538 | dbus_properties_skeleton_new (void) |
3539 | { |
3540 | return DBUS_PROPERTIES (g_object_new (TYPE_DBUS_PROPERTIES_SKELETON, NULL)); |
3541 | } |
3542 | |
3543 | /* ------------------------------------------------------------------------ |
3544 | * Code for interface org.freedesktop.hostname1 |
3545 | * ------------------------------------------------------------------------ |
3546 | */ |
3547 | |
3548 | /** |
3549 | * SECTION:Hostname1 |
3550 | * @title: Hostname1 |
3551 | * @short_description: Generated C code for the org.freedesktop.hostname1 D-Bus interface |
3552 | * |
3553 | * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link> D-Bus interface in C. |
3554 | */ |
3555 | |
3556 | /* ---- Introspection data for org.freedesktop.hostname1 ---- */ |
3557 | |
3558 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_unnamed_arg0 = |
3559 | { |
3560 | { |
3561 | -1, |
3562 | (gchar *) "unnamed_arg0", |
3563 | (gchar *) "s", |
3564 | NULL |
3565 | }, |
3566 | FALSE |
3567 | }; |
3568 | |
3569 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_unnamed_arg1 = |
3570 | { |
3571 | { |
3572 | -1, |
3573 | (gchar *) "unnamed_arg1", |
3574 | (gchar *) "b", |
3575 | NULL |
3576 | }, |
3577 | FALSE |
3578 | }; |
3579 | |
3580 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_hostname_IN_ARG_pointers[] = |
3581 | { |
3582 | &_hostname1_method_info_set_hostname_IN_ARG_unnamed_arg0, |
3583 | &_hostname1_method_info_set_hostname_IN_ARG_unnamed_arg1, |
3584 | NULL |
3585 | }; |
3586 | |
3587 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_hostname = |
3588 | { |
3589 | { |
3590 | -1, |
3591 | (gchar *) "SetHostname", |
3592 | (GDBusArgInfo **) &_hostname1_method_info_set_hostname_IN_ARG_pointers, |
3593 | NULL, |
3594 | NULL |
3595 | }, |
3596 | "handle-set-hostname", |
3597 | FALSE |
3598 | }; |
3599 | |
3600 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_unnamed_arg0 = |
3601 | { |
3602 | { |
3603 | -1, |
3604 | (gchar *) "unnamed_arg0", |
3605 | (gchar *) "s", |
3606 | NULL |
3607 | }, |
3608 | FALSE |
3609 | }; |
3610 | |
3611 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_unnamed_arg1 = |
3612 | { |
3613 | { |
3614 | -1, |
3615 | (gchar *) "unnamed_arg1", |
3616 | (gchar *) "b", |
3617 | NULL |
3618 | }, |
3619 | FALSE |
3620 | }; |
3621 | |
3622 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_static_hostname_IN_ARG_pointers[] = |
3623 | { |
3624 | &_hostname1_method_info_set_static_hostname_IN_ARG_unnamed_arg0, |
3625 | &_hostname1_method_info_set_static_hostname_IN_ARG_unnamed_arg1, |
3626 | NULL |
3627 | }; |
3628 | |
3629 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_static_hostname = |
3630 | { |
3631 | { |
3632 | -1, |
3633 | (gchar *) "SetStaticHostname", |
3634 | (GDBusArgInfo **) &_hostname1_method_info_set_static_hostname_IN_ARG_pointers, |
3635 | NULL, |
3636 | NULL |
3637 | }, |
3638 | "handle-set-static-hostname", |
3639 | FALSE |
3640 | }; |
3641 | |
3642 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_unnamed_arg0 = |
3643 | { |
3644 | { |
3645 | -1, |
3646 | (gchar *) "unnamed_arg0", |
3647 | (gchar *) "s", |
3648 | NULL |
3649 | }, |
3650 | FALSE |
3651 | }; |
3652 | |
3653 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_unnamed_arg1 = |
3654 | { |
3655 | { |
3656 | -1, |
3657 | (gchar *) "unnamed_arg1", |
3658 | (gchar *) "b", |
3659 | NULL |
3660 | }, |
3661 | FALSE |
3662 | }; |
3663 | |
3664 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_pretty_hostname_IN_ARG_pointers[] = |
3665 | { |
3666 | &_hostname1_method_info_set_pretty_hostname_IN_ARG_unnamed_arg0, |
3667 | &_hostname1_method_info_set_pretty_hostname_IN_ARG_unnamed_arg1, |
3668 | NULL |
3669 | }; |
3670 | |
3671 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_pretty_hostname = |
3672 | { |
3673 | { |
3674 | -1, |
3675 | (gchar *) "SetPrettyHostname", |
3676 | (GDBusArgInfo **) &_hostname1_method_info_set_pretty_hostname_IN_ARG_pointers, |
3677 | NULL, |
3678 | NULL |
3679 | }, |
3680 | "handle-set-pretty-hostname", |
3681 | FALSE |
3682 | }; |
3683 | |
3684 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_unnamed_arg0 = |
3685 | { |
3686 | { |
3687 | -1, |
3688 | (gchar *) "unnamed_arg0", |
3689 | (gchar *) "s", |
3690 | NULL |
3691 | }, |
3692 | FALSE |
3693 | }; |
3694 | |
3695 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_unnamed_arg1 = |
3696 | { |
3697 | { |
3698 | -1, |
3699 | (gchar *) "unnamed_arg1", |
3700 | (gchar *) "b", |
3701 | NULL |
3702 | }, |
3703 | FALSE |
3704 | }; |
3705 | |
3706 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_icon_name_IN_ARG_pointers[] = |
3707 | { |
3708 | &_hostname1_method_info_set_icon_name_IN_ARG_unnamed_arg0, |
3709 | &_hostname1_method_info_set_icon_name_IN_ARG_unnamed_arg1, |
3710 | NULL |
3711 | }; |
3712 | |
3713 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_icon_name = |
3714 | { |
3715 | { |
3716 | -1, |
3717 | (gchar *) "SetIconName", |
3718 | (GDBusArgInfo **) &_hostname1_method_info_set_icon_name_IN_ARG_pointers, |
3719 | NULL, |
3720 | NULL |
3721 | }, |
3722 | "handle-set-icon-name", |
3723 | FALSE |
3724 | }; |
3725 | |
3726 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_chassis_IN_ARG_unnamed_arg0 = |
3727 | { |
3728 | { |
3729 | -1, |
3730 | (gchar *) "unnamed_arg0", |
3731 | (gchar *) "s", |
3732 | NULL |
3733 | }, |
3734 | FALSE |
3735 | }; |
3736 | |
3737 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_chassis_IN_ARG_unnamed_arg1 = |
3738 | { |
3739 | { |
3740 | -1, |
3741 | (gchar *) "unnamed_arg1", |
3742 | (gchar *) "b", |
3743 | NULL |
3744 | }, |
3745 | FALSE |
3746 | }; |
3747 | |
3748 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_chassis_IN_ARG_pointers[] = |
3749 | { |
3750 | &_hostname1_method_info_set_chassis_IN_ARG_unnamed_arg0, |
3751 | &_hostname1_method_info_set_chassis_IN_ARG_unnamed_arg1, |
3752 | NULL |
3753 | }; |
3754 | |
3755 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_chassis = |
3756 | { |
3757 | { |
3758 | -1, |
3759 | (gchar *) "SetChassis", |
3760 | (GDBusArgInfo **) &_hostname1_method_info_set_chassis_IN_ARG_pointers, |
3761 | NULL, |
3762 | NULL |
3763 | }, |
3764 | "handle-set-chassis", |
3765 | FALSE |
3766 | }; |
3767 | |
3768 | static const _ExtendedGDBusMethodInfo * const _hostname1_method_info_pointers[] = |
3769 | { |
3770 | &_hostname1_method_info_set_hostname, |
3771 | &_hostname1_method_info_set_static_hostname, |
3772 | &_hostname1_method_info_set_pretty_hostname, |
3773 | &_hostname1_method_info_set_icon_name, |
3774 | &_hostname1_method_info_set_chassis, |
3775 | NULL |
3776 | }; |
3777 | |
3778 | static const GDBusAnnotationInfo _hostname1_property_hostname_annotation_info_0 = |
3779 | { |
3780 | -1, |
3781 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3782 | (gchar *) "false", |
3783 | NULL |
3784 | }; |
3785 | |
3786 | static const GDBusAnnotationInfo * const _hostname1_property_hostname_annotation_info_pointers[] = |
3787 | { |
3788 | &_hostname1_property_hostname_annotation_info_0, |
3789 | NULL |
3790 | }; |
3791 | |
3792 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_hostname = |
3793 | { |
3794 | { |
3795 | -1, |
3796 | (gchar *) "Hostname", |
3797 | (gchar *) "s", |
3798 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3799 | (GDBusAnnotationInfo **) &_hostname1_property_hostname_annotation_info_pointers |
3800 | }, |
3801 | "hostname", |
3802 | FALSE |
3803 | }; |
3804 | |
3805 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_static_hostname = |
3806 | { |
3807 | { |
3808 | -1, |
3809 | (gchar *) "StaticHostname", |
3810 | (gchar *) "s", |
3811 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3812 | NULL |
3813 | }, |
3814 | "static-hostname", |
3815 | FALSE |
3816 | }; |
3817 | |
3818 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_pretty_hostname = |
3819 | { |
3820 | { |
3821 | -1, |
3822 | (gchar *) "PrettyHostname", |
3823 | (gchar *) "s", |
3824 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3825 | NULL |
3826 | }, |
3827 | "pretty-hostname", |
3828 | FALSE |
3829 | }; |
3830 | |
3831 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_icon_name = |
3832 | { |
3833 | { |
3834 | -1, |
3835 | (gchar *) "IconName", |
3836 | (gchar *) "s", |
3837 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3838 | NULL |
3839 | }, |
3840 | "icon-name", |
3841 | FALSE |
3842 | }; |
3843 | |
3844 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_chassis = |
3845 | { |
3846 | { |
3847 | -1, |
3848 | (gchar *) "Chassis", |
3849 | (gchar *) "s", |
3850 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3851 | NULL |
3852 | }, |
3853 | "chassis", |
3854 | FALSE |
3855 | }; |
3856 | |
3857 | static const GDBusAnnotationInfo _hostname1_property_kernel_name_annotation_info_0 = |
3858 | { |
3859 | -1, |
3860 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3861 | (gchar *) "const", |
3862 | NULL |
3863 | }; |
3864 | |
3865 | static const GDBusAnnotationInfo * const _hostname1_property_kernel_name_annotation_info_pointers[] = |
3866 | { |
3867 | &_hostname1_property_kernel_name_annotation_info_0, |
3868 | NULL |
3869 | }; |
3870 | |
3871 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_kernel_name = |
3872 | { |
3873 | { |
3874 | -1, |
3875 | (gchar *) "KernelName", |
3876 | (gchar *) "s", |
3877 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3878 | (GDBusAnnotationInfo **) &_hostname1_property_kernel_name_annotation_info_pointers |
3879 | }, |
3880 | "kernel-name", |
3881 | FALSE |
3882 | }; |
3883 | |
3884 | static const GDBusAnnotationInfo _hostname1_property_kernel_release_annotation_info_0 = |
3885 | { |
3886 | -1, |
3887 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3888 | (gchar *) "const", |
3889 | NULL |
3890 | }; |
3891 | |
3892 | static const GDBusAnnotationInfo * const _hostname1_property_kernel_release_annotation_info_pointers[] = |
3893 | { |
3894 | &_hostname1_property_kernel_release_annotation_info_0, |
3895 | NULL |
3896 | }; |
3897 | |
3898 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_kernel_release = |
3899 | { |
3900 | { |
3901 | -1, |
3902 | (gchar *) "KernelRelease", |
3903 | (gchar *) "s", |
3904 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3905 | (GDBusAnnotationInfo **) &_hostname1_property_kernel_release_annotation_info_pointers |
3906 | }, |
3907 | "kernel-release", |
3908 | FALSE |
3909 | }; |
3910 | |
3911 | static const GDBusAnnotationInfo _hostname1_property_kernel_version_annotation_info_0 = |
3912 | { |
3913 | -1, |
3914 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3915 | (gchar *) "const", |
3916 | NULL |
3917 | }; |
3918 | |
3919 | static const GDBusAnnotationInfo * const _hostname1_property_kernel_version_annotation_info_pointers[] = |
3920 | { |
3921 | &_hostname1_property_kernel_version_annotation_info_0, |
3922 | NULL |
3923 | }; |
3924 | |
3925 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_kernel_version = |
3926 | { |
3927 | { |
3928 | -1, |
3929 | (gchar *) "KernelVersion", |
3930 | (gchar *) "s", |
3931 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3932 | (GDBusAnnotationInfo **) &_hostname1_property_kernel_version_annotation_info_pointers |
3933 | }, |
3934 | "kernel-version", |
3935 | FALSE |
3936 | }; |
3937 | |
3938 | static const GDBusAnnotationInfo _hostname1_property_operating_system_pretty_name_annotation_info_0 = |
3939 | { |
3940 | -1, |
3941 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3942 | (gchar *) "const", |
3943 | NULL |
3944 | }; |
3945 | |
3946 | static const GDBusAnnotationInfo * const _hostname1_property_operating_system_pretty_name_annotation_info_pointers[] = |
3947 | { |
3948 | &_hostname1_property_operating_system_pretty_name_annotation_info_0, |
3949 | NULL |
3950 | }; |
3951 | |
3952 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_operating_system_pretty_name = |
3953 | { |
3954 | { |
3955 | -1, |
3956 | (gchar *) "OperatingSystemPrettyName", |
3957 | (gchar *) "s", |
3958 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3959 | (GDBusAnnotationInfo **) &_hostname1_property_operating_system_pretty_name_annotation_info_pointers |
3960 | }, |
3961 | "operating-system-pretty-name", |
3962 | FALSE |
3963 | }; |
3964 | |
3965 | static const GDBusAnnotationInfo _hostname1_property_operating_system_cpename_annotation_info_0 = |
3966 | { |
3967 | -1, |
3968 | (gchar *) "org.freedesktop.DBus.Property.EmitsChangedSignal", |
3969 | (gchar *) "const", |
3970 | NULL |
3971 | }; |
3972 | |
3973 | static const GDBusAnnotationInfo * const _hostname1_property_operating_system_cpename_annotation_info_pointers[] = |
3974 | { |
3975 | &_hostname1_property_operating_system_cpename_annotation_info_0, |
3976 | NULL |
3977 | }; |
3978 | |
3979 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_operating_system_cpename = |
3980 | { |
3981 | { |
3982 | -1, |
3983 | (gchar *) "OperatingSystemCPEName", |
3984 | (gchar *) "s", |
3985 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3986 | (GDBusAnnotationInfo **) &_hostname1_property_operating_system_cpename_annotation_info_pointers |
3987 | }, |
3988 | "operating-system-cpename", |
3989 | FALSE |
3990 | }; |
3991 | |
3992 | static const _ExtendedGDBusPropertyInfo * const _hostname1_property_info_pointers[] = |
3993 | { |
3994 | &_hostname1_property_info_hostname, |
3995 | &_hostname1_property_info_static_hostname, |
3996 | &_hostname1_property_info_pretty_hostname, |
3997 | &_hostname1_property_info_icon_name, |
3998 | &_hostname1_property_info_chassis, |
3999 | &_hostname1_property_info_kernel_name, |
4000 | &_hostname1_property_info_kernel_release, |
4001 | &_hostname1_property_info_kernel_version, |
4002 | &_hostname1_property_info_operating_system_pretty_name, |
4003 | &_hostname1_property_info_operating_system_cpename, |
4004 | NULL |
4005 | }; |
4006 | |
4007 | static const _ExtendedGDBusInterfaceInfo _hostname1_interface_info = |
4008 | { |
4009 | { |
4010 | -1, |
4011 | (gchar *) "org.freedesktop.hostname1", |
4012 | (GDBusMethodInfo **) &_hostname1_method_info_pointers, |
4013 | NULL, |
4014 | (GDBusPropertyInfo **) &_hostname1_property_info_pointers, |
4015 | NULL |
4016 | }, |
4017 | "hostname1", |
4018 | }; |
4019 | |
4020 | |
4021 | /** |
4022 | * hostname1_interface_info: |
4023 | * |
4024 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link> D-Bus interface. |
4025 | * |
4026 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
4027 | */ |
4028 | GDBusInterfaceInfo * |
4029 | hostname1_interface_info (void) |
4030 | { |
4031 | return (GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct; |
4032 | } |
4033 | |
4034 | /** |
4035 | * hostname1_override_properties: |
4036 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
4037 | * @property_id_begin: The property id to assign to the first overridden property. |
4038 | * |
4039 | * Overrides all #GObject properties in the #Hostname1 interface for a concrete class. |
4040 | * The properties are overridden in the order they are defined. |
4041 | * |
4042 | * Returns: The last property id. |
4043 | */ |
4044 | guint |
4045 | hostname1_override_properties (GObjectClass *klass, guint property_id_begin) |
4046 | { |
4047 | g_object_class_override_property (klass, property_id_begin++, "hostname"); |
4048 | g_object_class_override_property (klass, property_id_begin++, "static-hostname"); |
4049 | g_object_class_override_property (klass, property_id_begin++, "pretty-hostname"); |
4050 | g_object_class_override_property (klass, property_id_begin++, "icon-name"); |
4051 | g_object_class_override_property (klass, property_id_begin++, "chassis"); |
4052 | g_object_class_override_property (klass, property_id_begin++, "kernel-name"); |
4053 | g_object_class_override_property (klass, property_id_begin++, "kernel-release"); |
4054 | g_object_class_override_property (klass, property_id_begin++, "kernel-version"); |
4055 | g_object_class_override_property (klass, property_id_begin++, "operating-system-pretty-name"); |
4056 | g_object_class_override_property (klass, property_id_begin++, "operating-system-cpename"); |
4057 | return property_id_begin - 1; |
4058 | } |
4059 | |
4060 | |
4061 | |
4062 | /** |
4063 | * Hostname1: |
4064 | * |
4065 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
4066 | */ |
4067 | |
4068 | /** |
4069 | * Hostname1Iface: |
4070 | * @parent_iface: The parent interface. |
4071 | * @handle_set_chassis: Handler for the #Hostname1::handle-set-chassis signal. |
4072 | * @handle_set_hostname: Handler for the #Hostname1::handle-set-hostname signal. |
4073 | * @handle_set_icon_name: Handler for the #Hostname1::handle-set-icon-name signal. |
4074 | * @handle_set_pretty_hostname: Handler for the #Hostname1::handle-set-pretty-hostname signal. |
4075 | * @handle_set_static_hostname: Handler for the #Hostname1::handle-set-static-hostname signal. |
4076 | * @get_chassis: Getter for the #Hostname1:chassis property. |
4077 | * @get_hostname: Getter for the #Hostname1:hostname property. |
4078 | * @get_icon_name: Getter for the #Hostname1:icon-name property. |
4079 | * @get_kernel_name: Getter for the #Hostname1:kernel-name property. |
4080 | * @get_kernel_release: Getter for the #Hostname1:kernel-release property. |
4081 | * @get_kernel_version: Getter for the #Hostname1:kernel-version property. |
4082 | * @get_operating_system_cpename: Getter for the #Hostname1:operating-system-cpename property. |
4083 | * @get_operating_system_pretty_name: Getter for the #Hostname1:operating-system-pretty-name property. |
4084 | * @get_pretty_hostname: Getter for the #Hostname1:pretty-hostname property. |
4085 | * @get_static_hostname: Getter for the #Hostname1:static-hostname property. |
4086 | * |
4087 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
4088 | */ |
4089 | |
4090 | typedef Hostname1Iface Hostname1Interface; |
4091 | G_DEFINE_INTERFACE (Hostname1, hostname1, G_TYPE_OBJECT); |
4092 | |
4093 | static void |
4094 | hostname1_default_init (Hostname1Iface *iface) |
4095 | { |
4096 | /* GObject signals for incoming D-Bus method calls: */ |
4097 | /** |
4098 | * Hostname1::handle-set-hostname: |
4099 | * @object: A #Hostname1. |
4100 | * @invocation: A #GDBusMethodInvocation. |
4101 | * @arg_unnamed_arg0: Argument passed by remote caller. |
4102 | * @arg_unnamed_arg1: Argument passed by remote caller. |
4103 | * |
4104 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method. |
4105 | * |
4106 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call hostname1_complete_set_hostname() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
4107 | * |
4108 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
4109 | */ |
4110 | g_signal_new ("handle-set-hostname", |
4111 | G_TYPE_FROM_INTERFACE (iface), |
4112 | G_SIGNAL_RUN_LAST, |
4113 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_hostname), |
4114 | g_signal_accumulator_true_handled, |
4115 | NULL, |
4116 | g_cclosure_marshal_generic, |
4117 | G_TYPE_BOOLEAN, |
4118 | 3, |
4119 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
4120 | |
4121 | /** |
4122 | * Hostname1::handle-set-static-hostname: |
4123 | * @object: A #Hostname1. |
4124 | * @invocation: A #GDBusMethodInvocation. |
4125 | * @arg_unnamed_arg0: Argument passed by remote caller. |
4126 | * @arg_unnamed_arg1: Argument passed by remote caller. |
4127 | * |
4128 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method. |
4129 | * |
4130 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call hostname1_complete_set_static_hostname() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
4131 | * |
4132 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
4133 | */ |
4134 | g_signal_new ("handle-set-static-hostname", |
4135 | G_TYPE_FROM_INTERFACE (iface), |
4136 | G_SIGNAL_RUN_LAST, |
4137 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_static_hostname), |
4138 | g_signal_accumulator_true_handled, |
4139 | NULL, |
4140 | g_cclosure_marshal_generic, |
4141 | G_TYPE_BOOLEAN, |
4142 | 3, |
4143 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
4144 | |
4145 | /** |
4146 | * Hostname1::handle-set-pretty-hostname: |
4147 | * @object: A #Hostname1. |
4148 | * @invocation: A #GDBusMethodInvocation. |
4149 | * @arg_unnamed_arg0: Argument passed by remote caller. |
4150 | * @arg_unnamed_arg1: Argument passed by remote caller. |
4151 | * |
4152 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method. |
4153 | * |
4154 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call hostname1_complete_set_pretty_hostname() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
4155 | * |
4156 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
4157 | */ |
4158 | g_signal_new ("handle-set-pretty-hostname", |
4159 | G_TYPE_FROM_INTERFACE (iface), |
4160 | G_SIGNAL_RUN_LAST, |
4161 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_pretty_hostname), |
4162 | g_signal_accumulator_true_handled, |
4163 | NULL, |
4164 | g_cclosure_marshal_generic, |
4165 | G_TYPE_BOOLEAN, |
4166 | 3, |
4167 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
4168 | |
4169 | /** |
4170 | * Hostname1::handle-set-icon-name: |
4171 | * @object: A #Hostname1. |
4172 | * @invocation: A #GDBusMethodInvocation. |
4173 | * @arg_unnamed_arg0: Argument passed by remote caller. |
4174 | * @arg_unnamed_arg1: Argument passed by remote caller. |
86cb7727 |
4175 | * |
4176 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method. |
4177 | * |
4178 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call hostname1_complete_set_icon_name() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
4179 | * |
4180 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
4181 | */ |
4182 | g_signal_new ("handle-set-icon-name", |
4183 | G_TYPE_FROM_INTERFACE (iface), |
4184 | G_SIGNAL_RUN_LAST, |
4185 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_icon_name), |
4186 | g_signal_accumulator_true_handled, |
4187 | NULL, |
4188 | g_cclosure_marshal_generic, |
4189 | G_TYPE_BOOLEAN, |
4190 | 3, |
4191 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
4192 | |
7ce16a35 |
4193 | /** |
4194 | * Hostname1::handle-set-chassis: |
4195 | * @object: A #Hostname1. |
4196 | * @invocation: A #GDBusMethodInvocation. |
4197 | * @arg_unnamed_arg0: Argument passed by remote caller. |
4198 | * @arg_unnamed_arg1: Argument passed by remote caller. |
4199 | * |
4200 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetChassis">SetChassis()</link> D-Bus method. |
4201 | * |
4202 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call hostname1_complete_set_chassis() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. |
4203 | * |
4204 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
4205 | */ |
4206 | g_signal_new ("handle-set-chassis", |
4207 | G_TYPE_FROM_INTERFACE (iface), |
4208 | G_SIGNAL_RUN_LAST, |
4209 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_chassis), |
4210 | g_signal_accumulator_true_handled, |
4211 | NULL, |
4212 | g_cclosure_marshal_generic, |
4213 | G_TYPE_BOOLEAN, |
4214 | 3, |
4215 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
4216 | |
4217 | /* GObject properties for D-Bus properties: */ |
4218 | /** |
4219 | * Hostname1:hostname: |
4220 | * |
4221 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link>. |
4222 | * |
4223 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4224 | */ |
4225 | g_object_interface_install_property (iface, |
4226 | g_param_spec_string ("hostname", "Hostname", "Hostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4227 | /** |
4228 | * Hostname1:static-hostname: |
4229 | * |
4230 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link>. |
4231 | * |
4232 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4233 | */ |
4234 | g_object_interface_install_property (iface, |
4235 | g_param_spec_string ("static-hostname", "StaticHostname", "StaticHostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4236 | /** |
4237 | * Hostname1:pretty-hostname: |
4238 | * |
4239 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link>. |
4240 | * |
4241 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4242 | */ |
4243 | g_object_interface_install_property (iface, |
4244 | g_param_spec_string ("pretty-hostname", "PrettyHostname", "PrettyHostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4245 | /** |
4246 | * Hostname1:icon-name: |
4247 | * |
4248 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link>. |
4249 | * |
4250 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4251 | */ |
4252 | g_object_interface_install_property (iface, |
4253 | g_param_spec_string ("icon-name", "IconName", "IconName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4254 | /** |
4255 | * Hostname1:chassis: |
4256 | * |
4257 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.Chassis">"Chassis"</link>. |
4258 | * |
4259 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4260 | */ |
4261 | g_object_interface_install_property (iface, |
4262 | g_param_spec_string ("chassis", "Chassis", "Chassis", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4263 | /** |
4264 | * Hostname1:kernel-name: |
4265 | * |
4266 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.KernelName">"KernelName"</link>. |
4267 | * |
4268 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4269 | */ |
4270 | g_object_interface_install_property (iface, |
4271 | g_param_spec_string ("kernel-name", "KernelName", "KernelName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4272 | /** |
4273 | * Hostname1:kernel-release: |
4274 | * |
4275 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.KernelRelease">"KernelRelease"</link>. |
4276 | * |
4277 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4278 | */ |
4279 | g_object_interface_install_property (iface, |
4280 | g_param_spec_string ("kernel-release", "KernelRelease", "KernelRelease", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4281 | /** |
4282 | * Hostname1:kernel-version: |
4283 | * |
4284 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.KernelVersion">"KernelVersion"</link>. |
4285 | * |
4286 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4287 | */ |
4288 | g_object_interface_install_property (iface, |
4289 | g_param_spec_string ("kernel-version", "KernelVersion", "KernelVersion", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4290 | /** |
4291 | * Hostname1:operating-system-pretty-name: |
4292 | * |
4293 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemPrettyName">"OperatingSystemPrettyName"</link>. |
4294 | * |
4295 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4296 | */ |
4297 | g_object_interface_install_property (iface, |
4298 | g_param_spec_string ("operating-system-pretty-name", "OperatingSystemPrettyName", "OperatingSystemPrettyName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4299 | /** |
4300 | * Hostname1:operating-system-cpename: |
4301 | * |
4302 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemCPEName">"OperatingSystemCPEName"</link>. |
4303 | * |
4304 | * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. |
4305 | */ |
4306 | g_object_interface_install_property (iface, |
4307 | g_param_spec_string ("operating-system-cpename", "OperatingSystemCPEName", "OperatingSystemCPEName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
4308 | } |
4309 | |
4310 | /** |
4311 | * hostname1_get_hostname: (skip) |
4312 | * @object: A #Hostname1. |
4313 | * |
4314 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property. |
4315 | * |
4316 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4317 | * |
4318 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_hostname() if on another thread.</warning> |
4319 | * |
4320 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4321 | */ |
4322 | const gchar * |
4323 | hostname1_get_hostname (Hostname1 *object) |
4324 | { |
4325 | return HOSTNAME1_GET_IFACE (object)->get_hostname (object); |
4326 | } |
4327 | |
4328 | /** |
4329 | * hostname1_dup_hostname: (skip) |
4330 | * @object: A #Hostname1. |
4331 | * |
4332 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property. |
4333 | * |
4334 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4335 | * |
4336 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4337 | */ |
4338 | gchar * |
4339 | hostname1_dup_hostname (Hostname1 *object) |
4340 | { |
4341 | gchar *value; |
4342 | g_object_get (G_OBJECT (object), "hostname", &value, NULL); |
4343 | return value; |
4344 | } |
4345 | |
4346 | /** |
4347 | * hostname1_set_hostname: (skip) |
4348 | * @object: A #Hostname1. |
4349 | * @value: The value to set. |
4350 | * |
4351 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property to @value. |
4352 | * |
4353 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4354 | */ |
4355 | void |
4356 | hostname1_set_hostname (Hostname1 *object, const gchar *value) |
4357 | { |
4358 | g_object_set (G_OBJECT (object), "hostname", value, NULL); |
4359 | } |
4360 | |
4361 | /** |
4362 | * hostname1_get_static_hostname: (skip) |
4363 | * @object: A #Hostname1. |
4364 | * |
4365 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property. |
4366 | * |
4367 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4368 | * |
4369 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_static_hostname() if on another thread.</warning> |
4370 | * |
4371 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4372 | */ |
4373 | const gchar * |
4374 | hostname1_get_static_hostname (Hostname1 *object) |
4375 | { |
4376 | return HOSTNAME1_GET_IFACE (object)->get_static_hostname (object); |
4377 | } |
4378 | |
4379 | /** |
4380 | * hostname1_dup_static_hostname: (skip) |
4381 | * @object: A #Hostname1. |
4382 | * |
4383 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property. |
4384 | * |
4385 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4386 | * |
4387 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4388 | */ |
4389 | gchar * |
4390 | hostname1_dup_static_hostname (Hostname1 *object) |
4391 | { |
4392 | gchar *value; |
4393 | g_object_get (G_OBJECT (object), "static-hostname", &value, NULL); |
4394 | return value; |
4395 | } |
4396 | |
4397 | /** |
4398 | * hostname1_set_static_hostname: (skip) |
4399 | * @object: A #Hostname1. |
4400 | * @value: The value to set. |
4401 | * |
4402 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property to @value. |
4403 | * |
4404 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4405 | */ |
4406 | void |
4407 | hostname1_set_static_hostname (Hostname1 *object, const gchar *value) |
4408 | { |
4409 | g_object_set (G_OBJECT (object), "static-hostname", value, NULL); |
86cb7727 |
4410 | } |
4411 | |
4412 | /** |
7ce16a35 |
4413 | * hostname1_get_pretty_hostname: (skip) |
86cb7727 |
4414 | * @object: A #Hostname1. |
4415 | * |
7ce16a35 |
4416 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property. |
86cb7727 |
4417 | * |
4418 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4419 | * |
7ce16a35 |
4420 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_pretty_hostname() if on another thread.</warning> |
86cb7727 |
4421 | * |
4422 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4423 | */ |
4424 | const gchar * |
7ce16a35 |
4425 | hostname1_get_pretty_hostname (Hostname1 *object) |
86cb7727 |
4426 | { |
7ce16a35 |
4427 | return HOSTNAME1_GET_IFACE (object)->get_pretty_hostname (object); |
86cb7727 |
4428 | } |
4429 | |
4430 | /** |
7ce16a35 |
4431 | * hostname1_dup_pretty_hostname: (skip) |
86cb7727 |
4432 | * @object: A #Hostname1. |
4433 | * |
7ce16a35 |
4434 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property. |
86cb7727 |
4435 | * |
4436 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4437 | * |
4438 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4439 | */ |
4440 | gchar * |
7ce16a35 |
4441 | hostname1_dup_pretty_hostname (Hostname1 *object) |
86cb7727 |
4442 | { |
4443 | gchar *value; |
7ce16a35 |
4444 | g_object_get (G_OBJECT (object), "pretty-hostname", &value, NULL); |
86cb7727 |
4445 | return value; |
4446 | } |
4447 | |
4448 | /** |
7ce16a35 |
4449 | * hostname1_set_pretty_hostname: (skip) |
86cb7727 |
4450 | * @object: A #Hostname1. |
4451 | * @value: The value to set. |
4452 | * |
7ce16a35 |
4453 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property to @value. |
86cb7727 |
4454 | * |
4455 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4456 | */ |
4457 | void |
7ce16a35 |
4458 | hostname1_set_pretty_hostname (Hostname1 *object, const gchar *value) |
86cb7727 |
4459 | { |
7ce16a35 |
4460 | g_object_set (G_OBJECT (object), "pretty-hostname", value, NULL); |
86cb7727 |
4461 | } |
4462 | |
4463 | /** |
7ce16a35 |
4464 | * hostname1_get_icon_name: (skip) |
86cb7727 |
4465 | * @object: A #Hostname1. |
4466 | * |
7ce16a35 |
4467 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property. |
86cb7727 |
4468 | * |
4469 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4470 | * |
7ce16a35 |
4471 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_icon_name() if on another thread.</warning> |
86cb7727 |
4472 | * |
4473 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4474 | */ |
4475 | const gchar * |
7ce16a35 |
4476 | hostname1_get_icon_name (Hostname1 *object) |
86cb7727 |
4477 | { |
7ce16a35 |
4478 | return HOSTNAME1_GET_IFACE (object)->get_icon_name (object); |
86cb7727 |
4479 | } |
4480 | |
4481 | /** |
7ce16a35 |
4482 | * hostname1_dup_icon_name: (skip) |
86cb7727 |
4483 | * @object: A #Hostname1. |
4484 | * |
7ce16a35 |
4485 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property. |
4486 | * |
4487 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4488 | * |
4489 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4490 | */ |
4491 | gchar * |
4492 | hostname1_dup_icon_name (Hostname1 *object) |
4493 | { |
4494 | gchar *value; |
4495 | g_object_get (G_OBJECT (object), "icon-name", &value, NULL); |
4496 | return value; |
4497 | } |
4498 | |
4499 | /** |
4500 | * hostname1_set_icon_name: (skip) |
4501 | * @object: A #Hostname1. |
4502 | * @value: The value to set. |
4503 | * |
4504 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property to @value. |
4505 | * |
4506 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4507 | */ |
4508 | void |
4509 | hostname1_set_icon_name (Hostname1 *object, const gchar *value) |
4510 | { |
4511 | g_object_set (G_OBJECT (object), "icon-name", value, NULL); |
4512 | } |
4513 | |
4514 | /** |
4515 | * hostname1_get_chassis: (skip) |
4516 | * @object: A #Hostname1. |
4517 | * |
4518 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.Chassis">"Chassis"</link> D-Bus property. |
4519 | * |
4520 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4521 | * |
4522 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_chassis() if on another thread.</warning> |
4523 | * |
4524 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4525 | */ |
4526 | const gchar * |
4527 | hostname1_get_chassis (Hostname1 *object) |
4528 | { |
4529 | return HOSTNAME1_GET_IFACE (object)->get_chassis (object); |
4530 | } |
4531 | |
4532 | /** |
4533 | * hostname1_dup_chassis: (skip) |
4534 | * @object: A #Hostname1. |
4535 | * |
4536 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.Chassis">"Chassis"</link> D-Bus property. |
4537 | * |
4538 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4539 | * |
4540 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4541 | */ |
4542 | gchar * |
4543 | hostname1_dup_chassis (Hostname1 *object) |
4544 | { |
4545 | gchar *value; |
4546 | g_object_get (G_OBJECT (object), "chassis", &value, NULL); |
4547 | return value; |
4548 | } |
4549 | |
4550 | /** |
4551 | * hostname1_set_chassis: (skip) |
4552 | * @object: A #Hostname1. |
4553 | * @value: The value to set. |
4554 | * |
4555 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.Chassis">"Chassis"</link> D-Bus property to @value. |
4556 | * |
4557 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4558 | */ |
4559 | void |
4560 | hostname1_set_chassis (Hostname1 *object, const gchar *value) |
4561 | { |
4562 | g_object_set (G_OBJECT (object), "chassis", value, NULL); |
4563 | } |
4564 | |
4565 | /** |
4566 | * hostname1_get_kernel_name: (skip) |
4567 | * @object: A #Hostname1. |
4568 | * |
4569 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelName">"KernelName"</link> D-Bus property. |
4570 | * |
4571 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4572 | * |
4573 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_kernel_name() if on another thread.</warning> |
4574 | * |
4575 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4576 | */ |
4577 | const gchar * |
4578 | hostname1_get_kernel_name (Hostname1 *object) |
4579 | { |
4580 | return HOSTNAME1_GET_IFACE (object)->get_kernel_name (object); |
4581 | } |
4582 | |
4583 | /** |
4584 | * hostname1_dup_kernel_name: (skip) |
4585 | * @object: A #Hostname1. |
4586 | * |
4587 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelName">"KernelName"</link> D-Bus property. |
4588 | * |
4589 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4590 | * |
4591 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4592 | */ |
4593 | gchar * |
4594 | hostname1_dup_kernel_name (Hostname1 *object) |
4595 | { |
4596 | gchar *value; |
4597 | g_object_get (G_OBJECT (object), "kernel-name", &value, NULL); |
4598 | return value; |
4599 | } |
4600 | |
4601 | /** |
4602 | * hostname1_set_kernel_name: (skip) |
4603 | * @object: A #Hostname1. |
4604 | * @value: The value to set. |
4605 | * |
4606 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelName">"KernelName"</link> D-Bus property to @value. |
4607 | * |
4608 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4609 | */ |
4610 | void |
4611 | hostname1_set_kernel_name (Hostname1 *object, const gchar *value) |
4612 | { |
4613 | g_object_set (G_OBJECT (object), "kernel-name", value, NULL); |
4614 | } |
4615 | |
4616 | /** |
4617 | * hostname1_get_kernel_release: (skip) |
4618 | * @object: A #Hostname1. |
4619 | * |
4620 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelRelease">"KernelRelease"</link> D-Bus property. |
4621 | * |
4622 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4623 | * |
4624 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_kernel_release() if on another thread.</warning> |
4625 | * |
4626 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4627 | */ |
4628 | const gchar * |
4629 | hostname1_get_kernel_release (Hostname1 *object) |
4630 | { |
4631 | return HOSTNAME1_GET_IFACE (object)->get_kernel_release (object); |
4632 | } |
4633 | |
4634 | /** |
4635 | * hostname1_dup_kernel_release: (skip) |
4636 | * @object: A #Hostname1. |
4637 | * |
4638 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelRelease">"KernelRelease"</link> D-Bus property. |
4639 | * |
4640 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4641 | * |
4642 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4643 | */ |
4644 | gchar * |
4645 | hostname1_dup_kernel_release (Hostname1 *object) |
4646 | { |
4647 | gchar *value; |
4648 | g_object_get (G_OBJECT (object), "kernel-release", &value, NULL); |
4649 | return value; |
4650 | } |
4651 | |
4652 | /** |
4653 | * hostname1_set_kernel_release: (skip) |
4654 | * @object: A #Hostname1. |
4655 | * @value: The value to set. |
4656 | * |
4657 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelRelease">"KernelRelease"</link> D-Bus property to @value. |
4658 | * |
4659 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4660 | */ |
4661 | void |
4662 | hostname1_set_kernel_release (Hostname1 *object, const gchar *value) |
4663 | { |
4664 | g_object_set (G_OBJECT (object), "kernel-release", value, NULL); |
4665 | } |
4666 | |
4667 | /** |
4668 | * hostname1_get_kernel_version: (skip) |
4669 | * @object: A #Hostname1. |
4670 | * |
4671 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelVersion">"KernelVersion"</link> D-Bus property. |
4672 | * |
4673 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4674 | * |
4675 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_kernel_version() if on another thread.</warning> |
4676 | * |
4677 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4678 | */ |
4679 | const gchar * |
4680 | hostname1_get_kernel_version (Hostname1 *object) |
4681 | { |
4682 | return HOSTNAME1_GET_IFACE (object)->get_kernel_version (object); |
4683 | } |
4684 | |
4685 | /** |
4686 | * hostname1_dup_kernel_version: (skip) |
4687 | * @object: A #Hostname1. |
4688 | * |
4689 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelVersion">"KernelVersion"</link> D-Bus property. |
86cb7727 |
4690 | * |
4691 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4692 | * |
4693 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4694 | */ |
4695 | gchar * |
7ce16a35 |
4696 | hostname1_dup_kernel_version (Hostname1 *object) |
86cb7727 |
4697 | { |
4698 | gchar *value; |
7ce16a35 |
4699 | g_object_get (G_OBJECT (object), "kernel-version", &value, NULL); |
86cb7727 |
4700 | return value; |
4701 | } |
4702 | |
4703 | /** |
7ce16a35 |
4704 | * hostname1_set_kernel_version: (skip) |
86cb7727 |
4705 | * @object: A #Hostname1. |
4706 | * @value: The value to set. |
4707 | * |
7ce16a35 |
4708 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.KernelVersion">"KernelVersion"</link> D-Bus property to @value. |
86cb7727 |
4709 | * |
4710 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4711 | */ |
4712 | void |
7ce16a35 |
4713 | hostname1_set_kernel_version (Hostname1 *object, const gchar *value) |
86cb7727 |
4714 | { |
7ce16a35 |
4715 | g_object_set (G_OBJECT (object), "kernel-version", value, NULL); |
86cb7727 |
4716 | } |
4717 | |
4718 | /** |
7ce16a35 |
4719 | * hostname1_get_operating_system_pretty_name: (skip) |
86cb7727 |
4720 | * @object: A #Hostname1. |
4721 | * |
7ce16a35 |
4722 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemPrettyName">"OperatingSystemPrettyName"</link> D-Bus property. |
86cb7727 |
4723 | * |
4724 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4725 | * |
7ce16a35 |
4726 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_operating_system_pretty_name() if on another thread.</warning> |
86cb7727 |
4727 | * |
4728 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4729 | */ |
4730 | const gchar * |
7ce16a35 |
4731 | hostname1_get_operating_system_pretty_name (Hostname1 *object) |
86cb7727 |
4732 | { |
7ce16a35 |
4733 | return HOSTNAME1_GET_IFACE (object)->get_operating_system_pretty_name (object); |
86cb7727 |
4734 | } |
4735 | |
4736 | /** |
7ce16a35 |
4737 | * hostname1_dup_operating_system_pretty_name: (skip) |
86cb7727 |
4738 | * @object: A #Hostname1. |
4739 | * |
7ce16a35 |
4740 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemPrettyName">"OperatingSystemPrettyName"</link> D-Bus property. |
86cb7727 |
4741 | * |
4742 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4743 | * |
4744 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4745 | */ |
4746 | gchar * |
7ce16a35 |
4747 | hostname1_dup_operating_system_pretty_name (Hostname1 *object) |
86cb7727 |
4748 | { |
4749 | gchar *value; |
7ce16a35 |
4750 | g_object_get (G_OBJECT (object), "operating-system-pretty-name", &value, NULL); |
86cb7727 |
4751 | return value; |
4752 | } |
4753 | |
4754 | /** |
7ce16a35 |
4755 | * hostname1_set_operating_system_pretty_name: (skip) |
86cb7727 |
4756 | * @object: A #Hostname1. |
4757 | * @value: The value to set. |
4758 | * |
7ce16a35 |
4759 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemPrettyName">"OperatingSystemPrettyName"</link> D-Bus property to @value. |
86cb7727 |
4760 | * |
4761 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4762 | */ |
4763 | void |
7ce16a35 |
4764 | hostname1_set_operating_system_pretty_name (Hostname1 *object, const gchar *value) |
86cb7727 |
4765 | { |
7ce16a35 |
4766 | g_object_set (G_OBJECT (object), "operating-system-pretty-name", value, NULL); |
86cb7727 |
4767 | } |
4768 | |
4769 | /** |
7ce16a35 |
4770 | * hostname1_get_operating_system_cpename: (skip) |
86cb7727 |
4771 | * @object: A #Hostname1. |
4772 | * |
7ce16a35 |
4773 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemCPEName">"OperatingSystemCPEName"</link> D-Bus property. |
86cb7727 |
4774 | * |
4775 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4776 | * |
7ce16a35 |
4777 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use hostname1_dup_operating_system_cpename() if on another thread.</warning> |
86cb7727 |
4778 | * |
4779 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
4780 | */ |
4781 | const gchar * |
7ce16a35 |
4782 | hostname1_get_operating_system_cpename (Hostname1 *object) |
86cb7727 |
4783 | { |
7ce16a35 |
4784 | return HOSTNAME1_GET_IFACE (object)->get_operating_system_cpename (object); |
86cb7727 |
4785 | } |
4786 | |
4787 | /** |
7ce16a35 |
4788 | * hostname1_dup_operating_system_cpename: (skip) |
86cb7727 |
4789 | * @object: A #Hostname1. |
4790 | * |
7ce16a35 |
4791 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemCPEName">"OperatingSystemCPEName"</link> D-Bus property. |
86cb7727 |
4792 | * |
4793 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
4794 | * |
4795 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
4796 | */ |
4797 | gchar * |
7ce16a35 |
4798 | hostname1_dup_operating_system_cpename (Hostname1 *object) |
86cb7727 |
4799 | { |
4800 | gchar *value; |
7ce16a35 |
4801 | g_object_get (G_OBJECT (object), "operating-system-cpename", &value, NULL); |
86cb7727 |
4802 | return value; |
4803 | } |
4804 | |
4805 | /** |
7ce16a35 |
4806 | * hostname1_set_operating_system_cpename: (skip) |
86cb7727 |
4807 | * @object: A #Hostname1. |
4808 | * @value: The value to set. |
4809 | * |
7ce16a35 |
4810 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.OperatingSystemCPEName">"OperatingSystemCPEName"</link> D-Bus property to @value. |
86cb7727 |
4811 | * |
4812 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
4813 | */ |
4814 | void |
7ce16a35 |
4815 | hostname1_set_operating_system_cpename (Hostname1 *object, const gchar *value) |
86cb7727 |
4816 | { |
7ce16a35 |
4817 | g_object_set (G_OBJECT (object), "operating-system-cpename", value, NULL); |
86cb7727 |
4818 | } |
4819 | |
4820 | /** |
4821 | * hostname1_call_set_hostname: |
4822 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
4823 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
4824 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
4825 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
4826 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
4827 | * @user_data: User data to pass to @callback. |
4828 | * |
4829 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method on @proxy. |
4830 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
4831 | * You can then call hostname1_call_set_hostname_finish() to get the result of the operation. |
4832 | * |
4833 | * See hostname1_call_set_hostname_sync() for the synchronous, blocking version of this method. |
4834 | */ |
4835 | void |
4836 | hostname1_call_set_hostname ( |
4837 | Hostname1 *proxy, |
7ce16a35 |
4838 | const gchar *arg_unnamed_arg0, |
4839 | gboolean arg_unnamed_arg1, |
86cb7727 |
4840 | GCancellable *cancellable, |
4841 | GAsyncReadyCallback callback, |
4842 | gpointer user_data) |
4843 | { |
4844 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
4845 | "SetHostname", |
4846 | g_variant_new ("(sb)", |
7ce16a35 |
4847 | arg_unnamed_arg0, |
4848 | arg_unnamed_arg1), |
86cb7727 |
4849 | G_DBUS_CALL_FLAGS_NONE, |
4850 | -1, |
4851 | cancellable, |
4852 | callback, |
4853 | user_data); |
4854 | } |
4855 | |
4856 | /** |
4857 | * hostname1_call_set_hostname_finish: |
4858 | * @proxy: A #Hostname1Proxy. |
4859 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_hostname(). |
4860 | * @error: Return location for error or %NULL. |
4861 | * |
4862 | * Finishes an operation started with hostname1_call_set_hostname(). |
4863 | * |
4864 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
4865 | */ |
4866 | gboolean |
4867 | hostname1_call_set_hostname_finish ( |
4868 | Hostname1 *proxy, |
4869 | GAsyncResult *res, |
4870 | GError **error) |
4871 | { |
4872 | GVariant *_ret; |
4873 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
4874 | if (_ret == NULL) |
4875 | goto _out; |
4876 | g_variant_get (_ret, |
4877 | "()"); |
4878 | g_variant_unref (_ret); |
4879 | _out: |
4880 | return _ret != NULL; |
4881 | } |
4882 | |
4883 | /** |
4884 | * hostname1_call_set_hostname_sync: |
4885 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
4886 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
4887 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
4888 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
4889 | * @error: Return location for error or %NULL. |
4890 | * |
4891 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
4892 | * |
4893 | * See hostname1_call_set_hostname() for the asynchronous version of this method. |
4894 | * |
4895 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
4896 | */ |
4897 | gboolean |
4898 | hostname1_call_set_hostname_sync ( |
4899 | Hostname1 *proxy, |
7ce16a35 |
4900 | const gchar *arg_unnamed_arg0, |
4901 | gboolean arg_unnamed_arg1, |
86cb7727 |
4902 | GCancellable *cancellable, |
4903 | GError **error) |
4904 | { |
4905 | GVariant *_ret; |
4906 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
4907 | "SetHostname", |
4908 | g_variant_new ("(sb)", |
7ce16a35 |
4909 | arg_unnamed_arg0, |
4910 | arg_unnamed_arg1), |
86cb7727 |
4911 | G_DBUS_CALL_FLAGS_NONE, |
4912 | -1, |
4913 | cancellable, |
4914 | error); |
4915 | if (_ret == NULL) |
4916 | goto _out; |
4917 | g_variant_get (_ret, |
4918 | "()"); |
4919 | g_variant_unref (_ret); |
4920 | _out: |
4921 | return _ret != NULL; |
4922 | } |
4923 | |
4924 | /** |
4925 | * hostname1_call_set_static_hostname: |
4926 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
4927 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
4928 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
4929 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
4930 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
4931 | * @user_data: User data to pass to @callback. |
4932 | * |
4933 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method on @proxy. |
4934 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
4935 | * You can then call hostname1_call_set_static_hostname_finish() to get the result of the operation. |
4936 | * |
4937 | * See hostname1_call_set_static_hostname_sync() for the synchronous, blocking version of this method. |
4938 | */ |
4939 | void |
4940 | hostname1_call_set_static_hostname ( |
4941 | Hostname1 *proxy, |
7ce16a35 |
4942 | const gchar *arg_unnamed_arg0, |
4943 | gboolean arg_unnamed_arg1, |
86cb7727 |
4944 | GCancellable *cancellable, |
4945 | GAsyncReadyCallback callback, |
4946 | gpointer user_data) |
4947 | { |
4948 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
4949 | "SetStaticHostname", |
4950 | g_variant_new ("(sb)", |
7ce16a35 |
4951 | arg_unnamed_arg0, |
4952 | arg_unnamed_arg1), |
86cb7727 |
4953 | G_DBUS_CALL_FLAGS_NONE, |
4954 | -1, |
4955 | cancellable, |
4956 | callback, |
4957 | user_data); |
4958 | } |
4959 | |
4960 | /** |
4961 | * hostname1_call_set_static_hostname_finish: |
4962 | * @proxy: A #Hostname1Proxy. |
4963 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_static_hostname(). |
4964 | * @error: Return location for error or %NULL. |
4965 | * |
4966 | * Finishes an operation started with hostname1_call_set_static_hostname(). |
4967 | * |
4968 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
4969 | */ |
4970 | gboolean |
4971 | hostname1_call_set_static_hostname_finish ( |
4972 | Hostname1 *proxy, |
4973 | GAsyncResult *res, |
4974 | GError **error) |
4975 | { |
4976 | GVariant *_ret; |
4977 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
4978 | if (_ret == NULL) |
4979 | goto _out; |
4980 | g_variant_get (_ret, |
4981 | "()"); |
4982 | g_variant_unref (_ret); |
4983 | _out: |
4984 | return _ret != NULL; |
4985 | } |
4986 | |
4987 | /** |
4988 | * hostname1_call_set_static_hostname_sync: |
4989 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
4990 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
4991 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
4992 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
4993 | * @error: Return location for error or %NULL. |
4994 | * |
4995 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
4996 | * |
4997 | * See hostname1_call_set_static_hostname() for the asynchronous version of this method. |
4998 | * |
4999 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5000 | */ |
5001 | gboolean |
5002 | hostname1_call_set_static_hostname_sync ( |
5003 | Hostname1 *proxy, |
7ce16a35 |
5004 | const gchar *arg_unnamed_arg0, |
5005 | gboolean arg_unnamed_arg1, |
86cb7727 |
5006 | GCancellable *cancellable, |
5007 | GError **error) |
5008 | { |
5009 | GVariant *_ret; |
5010 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
5011 | "SetStaticHostname", |
5012 | g_variant_new ("(sb)", |
7ce16a35 |
5013 | arg_unnamed_arg0, |
5014 | arg_unnamed_arg1), |
86cb7727 |
5015 | G_DBUS_CALL_FLAGS_NONE, |
5016 | -1, |
5017 | cancellable, |
5018 | error); |
5019 | if (_ret == NULL) |
5020 | goto _out; |
5021 | g_variant_get (_ret, |
5022 | "()"); |
5023 | g_variant_unref (_ret); |
5024 | _out: |
5025 | return _ret != NULL; |
5026 | } |
5027 | |
5028 | /** |
5029 | * hostname1_call_set_pretty_hostname: |
5030 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
5031 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5032 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
5033 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5034 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
5035 | * @user_data: User data to pass to @callback. |
5036 | * |
5037 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method on @proxy. |
5038 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5039 | * You can then call hostname1_call_set_pretty_hostname_finish() to get the result of the operation. |
5040 | * |
5041 | * See hostname1_call_set_pretty_hostname_sync() for the synchronous, blocking version of this method. |
5042 | */ |
5043 | void |
5044 | hostname1_call_set_pretty_hostname ( |
5045 | Hostname1 *proxy, |
7ce16a35 |
5046 | const gchar *arg_unnamed_arg0, |
5047 | gboolean arg_unnamed_arg1, |
86cb7727 |
5048 | GCancellable *cancellable, |
5049 | GAsyncReadyCallback callback, |
5050 | gpointer user_data) |
5051 | { |
5052 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
5053 | "SetPrettyHostname", |
5054 | g_variant_new ("(sb)", |
7ce16a35 |
5055 | arg_unnamed_arg0, |
5056 | arg_unnamed_arg1), |
86cb7727 |
5057 | G_DBUS_CALL_FLAGS_NONE, |
5058 | -1, |
5059 | cancellable, |
5060 | callback, |
5061 | user_data); |
5062 | } |
5063 | |
5064 | /** |
5065 | * hostname1_call_set_pretty_hostname_finish: |
5066 | * @proxy: A #Hostname1Proxy. |
5067 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_pretty_hostname(). |
5068 | * @error: Return location for error or %NULL. |
5069 | * |
5070 | * Finishes an operation started with hostname1_call_set_pretty_hostname(). |
5071 | * |
5072 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5073 | */ |
5074 | gboolean |
5075 | hostname1_call_set_pretty_hostname_finish ( |
5076 | Hostname1 *proxy, |
5077 | GAsyncResult *res, |
5078 | GError **error) |
5079 | { |
5080 | GVariant *_ret; |
5081 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
5082 | if (_ret == NULL) |
5083 | goto _out; |
5084 | g_variant_get (_ret, |
5085 | "()"); |
5086 | g_variant_unref (_ret); |
5087 | _out: |
5088 | return _ret != NULL; |
5089 | } |
5090 | |
5091 | /** |
5092 | * hostname1_call_set_pretty_hostname_sync: |
5093 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
5094 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5095 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
5096 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5097 | * @error: Return location for error or %NULL. |
5098 | * |
5099 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
5100 | * |
5101 | * See hostname1_call_set_pretty_hostname() for the asynchronous version of this method. |
5102 | * |
5103 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5104 | */ |
5105 | gboolean |
5106 | hostname1_call_set_pretty_hostname_sync ( |
5107 | Hostname1 *proxy, |
7ce16a35 |
5108 | const gchar *arg_unnamed_arg0, |
5109 | gboolean arg_unnamed_arg1, |
86cb7727 |
5110 | GCancellable *cancellable, |
5111 | GError **error) |
5112 | { |
5113 | GVariant *_ret; |
5114 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
5115 | "SetPrettyHostname", |
5116 | g_variant_new ("(sb)", |
7ce16a35 |
5117 | arg_unnamed_arg0, |
5118 | arg_unnamed_arg1), |
86cb7727 |
5119 | G_DBUS_CALL_FLAGS_NONE, |
5120 | -1, |
5121 | cancellable, |
5122 | error); |
5123 | if (_ret == NULL) |
5124 | goto _out; |
5125 | g_variant_get (_ret, |
5126 | "()"); |
5127 | g_variant_unref (_ret); |
5128 | _out: |
5129 | return _ret != NULL; |
5130 | } |
5131 | |
5132 | /** |
5133 | * hostname1_call_set_icon_name: |
5134 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
5135 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5136 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
5137 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5138 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
5139 | * @user_data: User data to pass to @callback. |
5140 | * |
5141 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method on @proxy. |
5142 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5143 | * You can then call hostname1_call_set_icon_name_finish() to get the result of the operation. |
5144 | * |
5145 | * See hostname1_call_set_icon_name_sync() for the synchronous, blocking version of this method. |
5146 | */ |
5147 | void |
5148 | hostname1_call_set_icon_name ( |
5149 | Hostname1 *proxy, |
7ce16a35 |
5150 | const gchar *arg_unnamed_arg0, |
5151 | gboolean arg_unnamed_arg1, |
86cb7727 |
5152 | GCancellable *cancellable, |
5153 | GAsyncReadyCallback callback, |
5154 | gpointer user_data) |
5155 | { |
5156 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
5157 | "SetIconName", |
5158 | g_variant_new ("(sb)", |
7ce16a35 |
5159 | arg_unnamed_arg0, |
5160 | arg_unnamed_arg1), |
86cb7727 |
5161 | G_DBUS_CALL_FLAGS_NONE, |
5162 | -1, |
5163 | cancellable, |
5164 | callback, |
5165 | user_data); |
5166 | } |
5167 | |
5168 | /** |
5169 | * hostname1_call_set_icon_name_finish: |
5170 | * @proxy: A #Hostname1Proxy. |
5171 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_icon_name(). |
5172 | * @error: Return location for error or %NULL. |
5173 | * |
5174 | * Finishes an operation started with hostname1_call_set_icon_name(). |
5175 | * |
5176 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5177 | */ |
5178 | gboolean |
5179 | hostname1_call_set_icon_name_finish ( |
5180 | Hostname1 *proxy, |
5181 | GAsyncResult *res, |
5182 | GError **error) |
5183 | { |
5184 | GVariant *_ret; |
5185 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
5186 | if (_ret == NULL) |
5187 | goto _out; |
5188 | g_variant_get (_ret, |
5189 | "()"); |
5190 | g_variant_unref (_ret); |
5191 | _out: |
5192 | return _ret != NULL; |
5193 | } |
5194 | |
5195 | /** |
5196 | * hostname1_call_set_icon_name_sync: |
5197 | * @proxy: A #Hostname1Proxy. |
7ce16a35 |
5198 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5199 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
86cb7727 |
5200 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5201 | * @error: Return location for error or %NULL. |
5202 | * |
5203 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
5204 | * |
5205 | * See hostname1_call_set_icon_name() for the asynchronous version of this method. |
5206 | * |
5207 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5208 | */ |
5209 | gboolean |
5210 | hostname1_call_set_icon_name_sync ( |
5211 | Hostname1 *proxy, |
7ce16a35 |
5212 | const gchar *arg_unnamed_arg0, |
5213 | gboolean arg_unnamed_arg1, |
86cb7727 |
5214 | GCancellable *cancellable, |
5215 | GError **error) |
5216 | { |
5217 | GVariant *_ret; |
5218 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
5219 | "SetIconName", |
5220 | g_variant_new ("(sb)", |
7ce16a35 |
5221 | arg_unnamed_arg0, |
5222 | arg_unnamed_arg1), |
5223 | G_DBUS_CALL_FLAGS_NONE, |
5224 | -1, |
5225 | cancellable, |
5226 | error); |
5227 | if (_ret == NULL) |
5228 | goto _out; |
5229 | g_variant_get (_ret, |
5230 | "()"); |
5231 | g_variant_unref (_ret); |
5232 | _out: |
5233 | return _ret != NULL; |
5234 | } |
5235 | |
5236 | /** |
5237 | * hostname1_call_set_chassis: |
5238 | * @proxy: A #Hostname1Proxy. |
5239 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5240 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
5241 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5242 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
5243 | * @user_data: User data to pass to @callback. |
5244 | * |
5245 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetChassis">SetChassis()</link> D-Bus method on @proxy. |
5246 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5247 | * You can then call hostname1_call_set_chassis_finish() to get the result of the operation. |
5248 | * |
5249 | * See hostname1_call_set_chassis_sync() for the synchronous, blocking version of this method. |
5250 | */ |
5251 | void |
5252 | hostname1_call_set_chassis ( |
5253 | Hostname1 *proxy, |
5254 | const gchar *arg_unnamed_arg0, |
5255 | gboolean arg_unnamed_arg1, |
5256 | GCancellable *cancellable, |
5257 | GAsyncReadyCallback callback, |
5258 | gpointer user_data) |
5259 | { |
5260 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
5261 | "SetChassis", |
5262 | g_variant_new ("(sb)", |
5263 | arg_unnamed_arg0, |
5264 | arg_unnamed_arg1), |
5265 | G_DBUS_CALL_FLAGS_NONE, |
5266 | -1, |
5267 | cancellable, |
5268 | callback, |
5269 | user_data); |
5270 | } |
5271 | |
5272 | /** |
5273 | * hostname1_call_set_chassis_finish: |
5274 | * @proxy: A #Hostname1Proxy. |
5275 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_chassis(). |
5276 | * @error: Return location for error or %NULL. |
5277 | * |
5278 | * Finishes an operation started with hostname1_call_set_chassis(). |
5279 | * |
5280 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5281 | */ |
5282 | gboolean |
5283 | hostname1_call_set_chassis_finish ( |
5284 | Hostname1 *proxy, |
5285 | GAsyncResult *res, |
5286 | GError **error) |
5287 | { |
5288 | GVariant *_ret; |
5289 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
5290 | if (_ret == NULL) |
5291 | goto _out; |
5292 | g_variant_get (_ret, |
5293 | "()"); |
5294 | g_variant_unref (_ret); |
5295 | _out: |
5296 | return _ret != NULL; |
5297 | } |
5298 | |
5299 | /** |
5300 | * hostname1_call_set_chassis_sync: |
5301 | * @proxy: A #Hostname1Proxy. |
5302 | * @arg_unnamed_arg0: Argument to pass with the method invocation. |
5303 | * @arg_unnamed_arg1: Argument to pass with the method invocation. |
5304 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5305 | * @error: Return location for error or %NULL. |
5306 | * |
5307 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetChassis">SetChassis()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
5308 | * |
5309 | * See hostname1_call_set_chassis() for the asynchronous version of this method. |
5310 | * |
5311 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5312 | */ |
5313 | gboolean |
5314 | hostname1_call_set_chassis_sync ( |
5315 | Hostname1 *proxy, |
5316 | const gchar *arg_unnamed_arg0, |
5317 | gboolean arg_unnamed_arg1, |
5318 | GCancellable *cancellable, |
5319 | GError **error) |
5320 | { |
5321 | GVariant *_ret; |
5322 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
5323 | "SetChassis", |
5324 | g_variant_new ("(sb)", |
5325 | arg_unnamed_arg0, |
5326 | arg_unnamed_arg1), |
86cb7727 |
5327 | G_DBUS_CALL_FLAGS_NONE, |
5328 | -1, |
5329 | cancellable, |
5330 | error); |
5331 | if (_ret == NULL) |
5332 | goto _out; |
5333 | g_variant_get (_ret, |
5334 | "()"); |
5335 | g_variant_unref (_ret); |
5336 | _out: |
5337 | return _ret != NULL; |
5338 | } |
5339 | |
5340 | /** |
5341 | * hostname1_complete_set_hostname: |
5342 | * @object: A #Hostname1. |
5343 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5344 | * |
5345 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
5346 | * |
5347 | * This method will free @invocation, you cannot use it afterwards. |
5348 | */ |
5349 | void |
5350 | hostname1_complete_set_hostname ( |
5351 | Hostname1 *object, |
5352 | GDBusMethodInvocation *invocation) |
5353 | { |
5354 | g_dbus_method_invocation_return_value (invocation, |
5355 | g_variant_new ("()")); |
5356 | } |
5357 | |
5358 | /** |
5359 | * hostname1_complete_set_static_hostname: |
5360 | * @object: A #Hostname1. |
5361 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5362 | * |
5363 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
5364 | * |
5365 | * This method will free @invocation, you cannot use it afterwards. |
5366 | */ |
5367 | void |
5368 | hostname1_complete_set_static_hostname ( |
5369 | Hostname1 *object, |
5370 | GDBusMethodInvocation *invocation) |
5371 | { |
5372 | g_dbus_method_invocation_return_value (invocation, |
5373 | g_variant_new ("()")); |
5374 | } |
5375 | |
5376 | /** |
5377 | * hostname1_complete_set_pretty_hostname: |
5378 | * @object: A #Hostname1. |
5379 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5380 | * |
5381 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
5382 | * |
5383 | * This method will free @invocation, you cannot use it afterwards. |
5384 | */ |
5385 | void |
5386 | hostname1_complete_set_pretty_hostname ( |
5387 | Hostname1 *object, |
5388 | GDBusMethodInvocation *invocation) |
5389 | { |
5390 | g_dbus_method_invocation_return_value (invocation, |
5391 | g_variant_new ("()")); |
5392 | } |
5393 | |
5394 | /** |
5395 | * hostname1_complete_set_icon_name: |
5396 | * @object: A #Hostname1. |
5397 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5398 | * |
5399 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
5400 | * |
5401 | * This method will free @invocation, you cannot use it afterwards. |
5402 | */ |
5403 | void |
5404 | hostname1_complete_set_icon_name ( |
5405 | Hostname1 *object, |
5406 | GDBusMethodInvocation *invocation) |
5407 | { |
5408 | g_dbus_method_invocation_return_value (invocation, |
5409 | g_variant_new ("()")); |
5410 | } |
5411 | |
7ce16a35 |
5412 | /** |
5413 | * hostname1_complete_set_chassis: |
5414 | * @object: A #Hostname1. |
5415 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5416 | * |
5417 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-hostname1.SetChassis">SetChassis()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. |
5418 | * |
5419 | * This method will free @invocation, you cannot use it afterwards. |
5420 | */ |
5421 | void |
5422 | hostname1_complete_set_chassis ( |
5423 | Hostname1 *object, |
5424 | GDBusMethodInvocation *invocation) |
5425 | { |
5426 | g_dbus_method_invocation_return_value (invocation, |
5427 | g_variant_new ("()")); |
5428 | } |
5429 | |
86cb7727 |
5430 | /* ------------------------------------------------------------------------ */ |
5431 | |
5432 | /** |
5433 | * Hostname1Proxy: |
5434 | * |
5435 | * The #Hostname1Proxy structure contains only private data and should only be accessed using the provided API. |
5436 | */ |
5437 | |
5438 | /** |
5439 | * Hostname1ProxyClass: |
5440 | * @parent_class: The parent class. |
5441 | * |
5442 | * Class structure for #Hostname1Proxy. |
5443 | */ |
5444 | |
5445 | struct _Hostname1ProxyPrivate |
5446 | { |
5447 | GData *qdata; |
5448 | }; |
5449 | |
5450 | static void hostname1_proxy_iface_init (Hostname1Iface *iface); |
5451 | |
5452 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5453 | G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy, hostname1_proxy, G_TYPE_DBUS_PROXY, |
5454 | G_ADD_PRIVATE (Hostname1Proxy) |
5455 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_proxy_iface_init)); |
5456 | |
5457 | #else |
5458 | G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy, hostname1_proxy, G_TYPE_DBUS_PROXY, |
5459 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_proxy_iface_init)); |
5460 | |
5461 | #endif |
5462 | static void |
5463 | hostname1_proxy_finalize (GObject *object) |
5464 | { |
5465 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5466 | g_datalist_clear (&proxy->priv->qdata); |
5467 | G_OBJECT_CLASS (hostname1_proxy_parent_class)->finalize (object); |
5468 | } |
5469 | |
5470 | static void |
5471 | hostname1_proxy_get_property (GObject *object, |
5472 | guint prop_id, |
5473 | GValue *value, |
5474 | GParamSpec *pspec G_GNUC_UNUSED) |
5475 | { |
5476 | const _ExtendedGDBusPropertyInfo *info; |
5477 | GVariant *variant; |
7ce16a35 |
5478 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
86cb7727 |
5479 | info = _hostname1_property_info_pointers[prop_id - 1]; |
5480 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
5481 | if (info->use_gvariant) |
5482 | { |
5483 | g_value_set_variant (value, variant); |
5484 | } |
5485 | else |
5486 | { |
5487 | if (variant != NULL) |
5488 | g_dbus_gvariant_to_gvalue (variant, value); |
5489 | } |
5490 | if (variant != NULL) |
5491 | g_variant_unref (variant); |
5492 | } |
5493 | |
5494 | static void |
5495 | hostname1_proxy_set_property_cb (GDBusProxy *proxy, |
5496 | GAsyncResult *res, |
5497 | gpointer user_data) |
5498 | { |
5499 | const _ExtendedGDBusPropertyInfo *info = user_data; |
5500 | GError *error; |
5501 | GVariant *_ret; |
5502 | error = NULL; |
5503 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
5504 | if (!_ret) |
5505 | { |
5506 | g_warning ("Error setting property '%s' on interface org.freedesktop.hostname1: %s (%s, %d)", |
5507 | info->parent_struct.name, |
5508 | error->message, g_quark_to_string (error->domain), error->code); |
5509 | g_error_free (error); |
5510 | } |
5511 | else |
5512 | { |
5513 | g_variant_unref (_ret); |
5514 | } |
5515 | } |
5516 | |
5517 | static void |
5518 | hostname1_proxy_set_property (GObject *object, |
5519 | guint prop_id, |
5520 | const GValue *value, |
5521 | GParamSpec *pspec G_GNUC_UNUSED) |
5522 | { |
5523 | const _ExtendedGDBusPropertyInfo *info; |
5524 | GVariant *variant; |
7ce16a35 |
5525 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
86cb7727 |
5526 | info = _hostname1_property_info_pointers[prop_id - 1]; |
5527 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
5528 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
5529 | "org.freedesktop.DBus.Properties.Set", |
5530 | g_variant_new ("(ssv)", "org.freedesktop.hostname1", info->parent_struct.name, variant), |
5531 | G_DBUS_CALL_FLAGS_NONE, |
5532 | -1, |
5533 | NULL, (GAsyncReadyCallback) hostname1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
5534 | g_variant_unref (variant); |
5535 | } |
5536 | |
5537 | static void |
5538 | hostname1_proxy_g_signal (GDBusProxy *proxy, |
5539 | const gchar *sender_name G_GNUC_UNUSED, |
5540 | const gchar *signal_name, |
5541 | GVariant *parameters) |
5542 | { |
5543 | _ExtendedGDBusSignalInfo *info; |
5544 | GVariantIter iter; |
5545 | GVariant *child; |
5546 | GValue *paramv; |
5547 | guint num_params; |
5548 | guint n; |
5549 | guint signal_id; |
5550 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, signal_name); |
5551 | if (info == NULL) |
5552 | return; |
5553 | num_params = g_variant_n_children (parameters); |
5554 | paramv = g_new0 (GValue, num_params + 1); |
5555 | g_value_init (¶mv[0], TYPE_HOSTNAME1); |
5556 | g_value_set_object (¶mv[0], proxy); |
5557 | g_variant_iter_init (&iter, parameters); |
5558 | n = 1; |
5559 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
5560 | { |
5561 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
5562 | if (arg_info->use_gvariant) |
5563 | { |
5564 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
5565 | g_value_set_variant (¶mv[n], child); |
5566 | n++; |
5567 | } |
5568 | else |
5569 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
5570 | g_variant_unref (child); |
5571 | } |
5572 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOSTNAME1); |
5573 | g_signal_emitv (paramv, signal_id, 0, NULL); |
5574 | for (n = 0; n < num_params + 1; n++) |
5575 | g_value_unset (¶mv[n]); |
5576 | g_free (paramv); |
5577 | } |
5578 | |
5579 | static void |
5580 | hostname1_proxy_g_properties_changed (GDBusProxy *_proxy, |
5581 | GVariant *changed_properties, |
5582 | const gchar *const *invalidated_properties) |
5583 | { |
5584 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (_proxy); |
5585 | guint n; |
5586 | const gchar *key; |
5587 | GVariantIter *iter; |
5588 | _ExtendedGDBusPropertyInfo *info; |
5589 | g_variant_get (changed_properties, "a{sv}", &iter); |
5590 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
5591 | { |
5592 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, key); |
5593 | g_datalist_remove_data (&proxy->priv->qdata, key); |
5594 | if (info != NULL) |
5595 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
5596 | } |
5597 | g_variant_iter_free (iter); |
5598 | for (n = 0; invalidated_properties[n] != NULL; n++) |
5599 | { |
5600 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, invalidated_properties[n]); |
5601 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
5602 | if (info != NULL) |
5603 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
5604 | } |
5605 | } |
5606 | |
5607 | static const gchar * |
5608 | hostname1_proxy_get_hostname (Hostname1 *object) |
5609 | { |
5610 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5611 | GVariant *variant; |
5612 | const gchar *value = NULL; |
5613 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Hostname"); |
5614 | if (variant != NULL) |
5615 | { |
5616 | value = g_variant_get_string (variant, NULL); |
5617 | g_variant_unref (variant); |
5618 | } |
5619 | return value; |
5620 | } |
5621 | |
5622 | static const gchar * |
5623 | hostname1_proxy_get_static_hostname (Hostname1 *object) |
5624 | { |
5625 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5626 | GVariant *variant; |
5627 | const gchar *value = NULL; |
5628 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "StaticHostname"); |
5629 | if (variant != NULL) |
5630 | { |
5631 | value = g_variant_get_string (variant, NULL); |
5632 | g_variant_unref (variant); |
5633 | } |
5634 | return value; |
5635 | } |
5636 | |
5637 | static const gchar * |
5638 | hostname1_proxy_get_pretty_hostname (Hostname1 *object) |
5639 | { |
5640 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5641 | GVariant *variant; |
5642 | const gchar *value = NULL; |
5643 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PrettyHostname"); |
5644 | if (variant != NULL) |
5645 | { |
5646 | value = g_variant_get_string (variant, NULL); |
5647 | g_variant_unref (variant); |
5648 | } |
5649 | return value; |
5650 | } |
5651 | |
5652 | static const gchar * |
5653 | hostname1_proxy_get_icon_name (Hostname1 *object) |
5654 | { |
5655 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5656 | GVariant *variant; |
5657 | const gchar *value = NULL; |
5658 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IconName"); |
5659 | if (variant != NULL) |
5660 | { |
5661 | value = g_variant_get_string (variant, NULL); |
5662 | g_variant_unref (variant); |
5663 | } |
5664 | return value; |
5665 | } |
5666 | |
7ce16a35 |
5667 | static const gchar * |
5668 | hostname1_proxy_get_chassis (Hostname1 *object) |
5669 | { |
5670 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5671 | GVariant *variant; |
5672 | const gchar *value = NULL; |
5673 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Chassis"); |
5674 | if (variant != NULL) |
5675 | { |
5676 | value = g_variant_get_string (variant, NULL); |
5677 | g_variant_unref (variant); |
5678 | } |
5679 | return value; |
5680 | } |
5681 | |
5682 | static const gchar * |
5683 | hostname1_proxy_get_kernel_name (Hostname1 *object) |
5684 | { |
5685 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5686 | GVariant *variant; |
5687 | const gchar *value = NULL; |
5688 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "KernelName"); |
5689 | if (variant != NULL) |
5690 | { |
5691 | value = g_variant_get_string (variant, NULL); |
5692 | g_variant_unref (variant); |
5693 | } |
5694 | return value; |
5695 | } |
5696 | |
5697 | static const gchar * |
5698 | hostname1_proxy_get_kernel_release (Hostname1 *object) |
5699 | { |
5700 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5701 | GVariant *variant; |
5702 | const gchar *value = NULL; |
5703 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "KernelRelease"); |
5704 | if (variant != NULL) |
5705 | { |
5706 | value = g_variant_get_string (variant, NULL); |
5707 | g_variant_unref (variant); |
5708 | } |
5709 | return value; |
5710 | } |
5711 | |
5712 | static const gchar * |
5713 | hostname1_proxy_get_kernel_version (Hostname1 *object) |
5714 | { |
5715 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5716 | GVariant *variant; |
5717 | const gchar *value = NULL; |
5718 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "KernelVersion"); |
5719 | if (variant != NULL) |
5720 | { |
5721 | value = g_variant_get_string (variant, NULL); |
5722 | g_variant_unref (variant); |
5723 | } |
5724 | return value; |
5725 | } |
5726 | |
5727 | static const gchar * |
5728 | hostname1_proxy_get_operating_system_pretty_name (Hostname1 *object) |
5729 | { |
5730 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5731 | GVariant *variant; |
5732 | const gchar *value = NULL; |
5733 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "OperatingSystemPrettyName"); |
5734 | if (variant != NULL) |
5735 | { |
5736 | value = g_variant_get_string (variant, NULL); |
5737 | g_variant_unref (variant); |
5738 | } |
5739 | return value; |
5740 | } |
5741 | |
5742 | static const gchar * |
5743 | hostname1_proxy_get_operating_system_cpename (Hostname1 *object) |
5744 | { |
5745 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
5746 | GVariant *variant; |
5747 | const gchar *value = NULL; |
5748 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "OperatingSystemCPEName"); |
5749 | if (variant != NULL) |
5750 | { |
5751 | value = g_variant_get_string (variant, NULL); |
5752 | g_variant_unref (variant); |
5753 | } |
5754 | return value; |
5755 | } |
5756 | |
86cb7727 |
5757 | static void |
5758 | hostname1_proxy_init (Hostname1Proxy *proxy) |
5759 | { |
5760 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5761 | proxy->priv = hostname1_proxy_get_instance_private (proxy); |
5762 | #else |
5763 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOSTNAME1_PROXY, Hostname1ProxyPrivate); |
5764 | #endif |
5765 | |
5766 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hostname1_interface_info ()); |
5767 | } |
5768 | |
5769 | static void |
5770 | hostname1_proxy_class_init (Hostname1ProxyClass *klass) |
5771 | { |
5772 | GObjectClass *gobject_class; |
5773 | GDBusProxyClass *proxy_class; |
5774 | |
5775 | gobject_class = G_OBJECT_CLASS (klass); |
5776 | gobject_class->finalize = hostname1_proxy_finalize; |
5777 | gobject_class->get_property = hostname1_proxy_get_property; |
5778 | gobject_class->set_property = hostname1_proxy_set_property; |
5779 | |
5780 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
5781 | proxy_class->g_signal = hostname1_proxy_g_signal; |
5782 | proxy_class->g_properties_changed = hostname1_proxy_g_properties_changed; |
5783 | |
5784 | hostname1_override_properties (gobject_class, 1); |
5785 | |
5786 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
5787 | g_type_class_add_private (klass, sizeof (Hostname1ProxyPrivate)); |
5788 | #endif |
5789 | } |
5790 | |
5791 | static void |
5792 | hostname1_proxy_iface_init (Hostname1Iface *iface) |
5793 | { |
5794 | iface->get_hostname = hostname1_proxy_get_hostname; |
5795 | iface->get_static_hostname = hostname1_proxy_get_static_hostname; |
5796 | iface->get_pretty_hostname = hostname1_proxy_get_pretty_hostname; |
5797 | iface->get_icon_name = hostname1_proxy_get_icon_name; |
7ce16a35 |
5798 | iface->get_chassis = hostname1_proxy_get_chassis; |
5799 | iface->get_kernel_name = hostname1_proxy_get_kernel_name; |
5800 | iface->get_kernel_release = hostname1_proxy_get_kernel_release; |
5801 | iface->get_kernel_version = hostname1_proxy_get_kernel_version; |
5802 | iface->get_operating_system_pretty_name = hostname1_proxy_get_operating_system_pretty_name; |
5803 | iface->get_operating_system_cpename = hostname1_proxy_get_operating_system_cpename; |
86cb7727 |
5804 | } |
5805 | |
5806 | /** |
5807 | * hostname1_proxy_new: |
5808 | * @connection: A #GDBusConnection. |
5809 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5810 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
5811 | * @object_path: An object path. |
5812 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5813 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
5814 | * @user_data: User data to pass to @callback. |
5815 | * |
5816 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. See g_dbus_proxy_new() for more details. |
5817 | * |
5818 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5819 | * You can then call hostname1_proxy_new_finish() to get the result of the operation. |
5820 | * |
5821 | * See hostname1_proxy_new_sync() for the synchronous, blocking version of this constructor. |
5822 | */ |
5823 | void |
5824 | hostname1_proxy_new ( |
5825 | GDBusConnection *connection, |
5826 | GDBusProxyFlags flags, |
5827 | const gchar *name, |
5828 | const gchar *object_path, |
5829 | GCancellable *cancellable, |
5830 | GAsyncReadyCallback callback, |
5831 | gpointer user_data) |
5832 | { |
5833 | g_async_initable_new_async (TYPE_HOSTNAME1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.hostname1", NULL); |
5834 | } |
5835 | |
5836 | /** |
5837 | * hostname1_proxy_new_finish: |
5838 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new(). |
5839 | * @error: Return location for error or %NULL |
5840 | * |
5841 | * Finishes an operation started with hostname1_proxy_new(). |
5842 | * |
5843 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
5844 | */ |
5845 | Hostname1 * |
5846 | hostname1_proxy_new_finish ( |
5847 | GAsyncResult *res, |
5848 | GError **error) |
5849 | { |
5850 | GObject *ret; |
5851 | GObject *source_object; |
5852 | source_object = g_async_result_get_source_object (res); |
5853 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
5854 | g_object_unref (source_object); |
5855 | if (ret != NULL) |
5856 | return HOSTNAME1 (ret); |
5857 | else |
5858 | return NULL; |
5859 | } |
5860 | |
5861 | /** |
5862 | * hostname1_proxy_new_sync: |
5863 | * @connection: A #GDBusConnection. |
5864 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5865 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
5866 | * @object_path: An object path. |
5867 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5868 | * @error: Return location for error or %NULL |
5869 | * |
5870 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. See g_dbus_proxy_new_sync() for more details. |
5871 | * |
5872 | * The calling thread is blocked until a reply is received. |
5873 | * |
5874 | * See hostname1_proxy_new() for the asynchronous version of this constructor. |
5875 | * |
5876 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
5877 | */ |
5878 | Hostname1 * |
5879 | hostname1_proxy_new_sync ( |
5880 | GDBusConnection *connection, |
5881 | GDBusProxyFlags flags, |
5882 | const gchar *name, |
5883 | const gchar *object_path, |
5884 | GCancellable *cancellable, |
5885 | GError **error) |
5886 | { |
5887 | GInitable *ret; |
5888 | ret = g_initable_new (TYPE_HOSTNAME1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.hostname1", NULL); |
5889 | if (ret != NULL) |
5890 | return HOSTNAME1 (ret); |
5891 | else |
5892 | return NULL; |
5893 | } |
5894 | |
5895 | |
5896 | /** |
5897 | * hostname1_proxy_new_for_bus: |
5898 | * @bus_type: A #GBusType. |
5899 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5900 | * @name: A bus name (well-known or unique). |
5901 | * @object_path: An object path. |
5902 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5903 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
5904 | * @user_data: User data to pass to @callback. |
5905 | * |
5906 | * Like hostname1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
5907 | * |
5908 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5909 | * You can then call hostname1_proxy_new_for_bus_finish() to get the result of the operation. |
5910 | * |
5911 | * See hostname1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
5912 | */ |
5913 | void |
5914 | hostname1_proxy_new_for_bus ( |
5915 | GBusType bus_type, |
5916 | GDBusProxyFlags flags, |
5917 | const gchar *name, |
5918 | const gchar *object_path, |
5919 | GCancellable *cancellable, |
5920 | GAsyncReadyCallback callback, |
5921 | gpointer user_data) |
5922 | { |
5923 | g_async_initable_new_async (TYPE_HOSTNAME1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.hostname1", NULL); |
5924 | } |
5925 | |
5926 | /** |
5927 | * hostname1_proxy_new_for_bus_finish: |
5928 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new_for_bus(). |
5929 | * @error: Return location for error or %NULL |
5930 | * |
5931 | * Finishes an operation started with hostname1_proxy_new_for_bus(). |
5932 | * |
5933 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
5934 | */ |
5935 | Hostname1 * |
5936 | hostname1_proxy_new_for_bus_finish ( |
5937 | GAsyncResult *res, |
5938 | GError **error) |
5939 | { |
5940 | GObject *ret; |
5941 | GObject *source_object; |
5942 | source_object = g_async_result_get_source_object (res); |
5943 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
5944 | g_object_unref (source_object); |
5945 | if (ret != NULL) |
5946 | return HOSTNAME1 (ret); |
5947 | else |
5948 | return NULL; |
5949 | } |
5950 | |
5951 | /** |
5952 | * hostname1_proxy_new_for_bus_sync: |
5953 | * @bus_type: A #GBusType. |
5954 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5955 | * @name: A bus name (well-known or unique). |
5956 | * @object_path: An object path. |
5957 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
5958 | * @error: Return location for error or %NULL |
5959 | * |
5960 | * Like hostname1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
5961 | * |
5962 | * The calling thread is blocked until a reply is received. |
5963 | * |
5964 | * See hostname1_proxy_new_for_bus() for the asynchronous version of this constructor. |
5965 | * |
5966 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
5967 | */ |
5968 | Hostname1 * |
5969 | hostname1_proxy_new_for_bus_sync ( |
5970 | GBusType bus_type, |
5971 | GDBusProxyFlags flags, |
5972 | const gchar *name, |
5973 | const gchar *object_path, |
5974 | GCancellable *cancellable, |
5975 | GError **error) |
5976 | { |
5977 | GInitable *ret; |
5978 | ret = g_initable_new (TYPE_HOSTNAME1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.hostname1", NULL); |
5979 | if (ret != NULL) |
5980 | return HOSTNAME1 (ret); |
5981 | else |
5982 | return NULL; |
5983 | } |
5984 | |
5985 | |
5986 | /* ------------------------------------------------------------------------ */ |
5987 | |
5988 | /** |
5989 | * Hostname1Skeleton: |
5990 | * |
5991 | * The #Hostname1Skeleton structure contains only private data and should only be accessed using the provided API. |
5992 | */ |
5993 | |
5994 | /** |
5995 | * Hostname1SkeletonClass: |
5996 | * @parent_class: The parent class. |
5997 | * |
5998 | * Class structure for #Hostname1Skeleton. |
5999 | */ |
6000 | |
6001 | struct _Hostname1SkeletonPrivate |
6002 | { |
6003 | GValue *properties; |
6004 | GList *changed_properties; |
6005 | GSource *changed_properties_idle_source; |
6006 | GMainContext *context; |
6007 | GMutex lock; |
6008 | }; |
6009 | |
6010 | static void |
6011 | _hostname1_skeleton_handle_method_call ( |
6012 | GDBusConnection *connection G_GNUC_UNUSED, |
6013 | const gchar *sender G_GNUC_UNUSED, |
6014 | const gchar *object_path G_GNUC_UNUSED, |
6015 | const gchar *interface_name, |
6016 | const gchar *method_name, |
6017 | GVariant *parameters, |
6018 | GDBusMethodInvocation *invocation, |
6019 | gpointer user_data) |
6020 | { |
6021 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
6022 | _ExtendedGDBusMethodInfo *info; |
6023 | GVariantIter iter; |
6024 | GVariant *child; |
6025 | GValue *paramv; |
6026 | guint num_params; |
6027 | guint num_extra; |
6028 | guint n; |
6029 | guint signal_id; |
6030 | GValue return_value = G_VALUE_INIT; |
6031 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
6032 | g_assert (info != NULL); |
6033 | num_params = g_variant_n_children (parameters); |
6034 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
6035 | n = 0; |
6036 | g_value_init (¶mv[n], TYPE_HOSTNAME1); |
6037 | g_value_set_object (¶mv[n++], skeleton); |
6038 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
6039 | g_value_set_object (¶mv[n++], invocation); |
6040 | if (info->pass_fdlist) |
6041 | { |
6042 | #ifdef G_OS_UNIX |
6043 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
6044 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
6045 | #else |
6046 | g_assert_not_reached (); |
6047 | #endif |
6048 | } |
6049 | g_variant_iter_init (&iter, parameters); |
6050 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
6051 | { |
6052 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
6053 | if (arg_info->use_gvariant) |
6054 | { |
6055 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
6056 | g_value_set_variant (¶mv[n], child); |
6057 | n++; |
6058 | } |
6059 | else |
6060 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
6061 | g_variant_unref (child); |
6062 | } |
6063 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOSTNAME1); |
6064 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
6065 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
6066 | if (!g_value_get_boolean (&return_value)) |
6067 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); |
6068 | g_value_unset (&return_value); |
6069 | for (n = 0; n < num_params + num_extra; n++) |
6070 | g_value_unset (¶mv[n]); |
6071 | g_free (paramv); |
6072 | } |
6073 | |
6074 | static GVariant * |
6075 | _hostname1_skeleton_handle_get_property ( |
6076 | GDBusConnection *connection G_GNUC_UNUSED, |
6077 | const gchar *sender G_GNUC_UNUSED, |
6078 | const gchar *object_path G_GNUC_UNUSED, |
6079 | const gchar *interface_name G_GNUC_UNUSED, |
6080 | const gchar *property_name, |
6081 | GError **error, |
6082 | gpointer user_data) |
6083 | { |
6084 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
6085 | GValue value = G_VALUE_INIT; |
6086 | GParamSpec *pspec; |
6087 | _ExtendedGDBusPropertyInfo *info; |
6088 | GVariant *ret; |
6089 | ret = NULL; |
6090 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, property_name); |
6091 | g_assert (info != NULL); |
6092 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
6093 | if (pspec == NULL) |
6094 | { |
6095 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
6096 | } |
6097 | else |
6098 | { |
6099 | g_value_init (&value, pspec->value_type); |
6100 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
6101 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
6102 | g_value_unset (&value); |
6103 | } |
6104 | return ret; |
6105 | } |
6106 | |
6107 | static gboolean |
6108 | _hostname1_skeleton_handle_set_property ( |
6109 | GDBusConnection *connection G_GNUC_UNUSED, |
6110 | const gchar *sender G_GNUC_UNUSED, |
6111 | const gchar *object_path G_GNUC_UNUSED, |
6112 | const gchar *interface_name G_GNUC_UNUSED, |
6113 | const gchar *property_name, |
6114 | GVariant *variant, |
6115 | GError **error, |
6116 | gpointer user_data) |
6117 | { |
6118 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
6119 | GValue value = G_VALUE_INIT; |
6120 | GParamSpec *pspec; |
6121 | _ExtendedGDBusPropertyInfo *info; |
6122 | gboolean ret; |
6123 | ret = FALSE; |
6124 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, property_name); |
6125 | g_assert (info != NULL); |
6126 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
6127 | if (pspec == NULL) |
6128 | { |
6129 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
6130 | } |
6131 | else |
6132 | { |
6133 | if (info->use_gvariant) |
6134 | g_value_set_variant (&value, variant); |
6135 | else |
6136 | g_dbus_gvariant_to_gvalue (variant, &value); |
6137 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
6138 | g_value_unset (&value); |
6139 | ret = TRUE; |
6140 | } |
6141 | return ret; |
6142 | } |
6143 | |
6144 | static const GDBusInterfaceVTable _hostname1_skeleton_vtable = |
6145 | { |
6146 | _hostname1_skeleton_handle_method_call, |
6147 | _hostname1_skeleton_handle_get_property, |
6148 | _hostname1_skeleton_handle_set_property, |
6149 | {NULL} |
6150 | }; |
6151 | |
6152 | static GDBusInterfaceInfo * |
6153 | hostname1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
6154 | { |
6155 | return hostname1_interface_info (); |
6156 | } |
6157 | |
6158 | static GDBusInterfaceVTable * |
6159 | hostname1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
6160 | { |
6161 | return (GDBusInterfaceVTable *) &_hostname1_skeleton_vtable; |
6162 | } |
6163 | |
6164 | static GVariant * |
6165 | hostname1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
6166 | { |
6167 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (_skeleton); |
6168 | |
6169 | GVariantBuilder builder; |
6170 | guint n; |
6171 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
6172 | if (_hostname1_interface_info.parent_struct.properties == NULL) |
6173 | goto out; |
6174 | for (n = 0; _hostname1_interface_info.parent_struct.properties[n] != NULL; n++) |
6175 | { |
6176 | GDBusPropertyInfo *info = _hostname1_interface_info.parent_struct.properties[n]; |
6177 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
6178 | { |
6179 | GVariant *value; |
6180 | value = _hostname1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.hostname1", info->name, NULL, skeleton); |
6181 | if (value != NULL) |
6182 | { |
6183 | g_variant_take_ref (value); |
6184 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
6185 | g_variant_unref (value); |
6186 | } |
6187 | } |
6188 | } |
6189 | out: |
6190 | return g_variant_builder_end (&builder); |
6191 | } |
6192 | |
6193 | static gboolean _hostname1_emit_changed (gpointer user_data); |
6194 | |
6195 | static void |
6196 | hostname1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
6197 | { |
6198 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (_skeleton); |
6199 | gboolean emit_changed = FALSE; |
6200 | |
6201 | g_mutex_lock (&skeleton->priv->lock); |
6202 | if (skeleton->priv->changed_properties_idle_source != NULL) |
6203 | { |
6204 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
6205 | skeleton->priv->changed_properties_idle_source = NULL; |
6206 | emit_changed = TRUE; |
6207 | } |
6208 | g_mutex_unlock (&skeleton->priv->lock); |
6209 | |
6210 | if (emit_changed) |
6211 | _hostname1_emit_changed (skeleton); |
6212 | } |
6213 | |
6214 | static void hostname1_skeleton_iface_init (Hostname1Iface *iface); |
6215 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
6216 | G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton, hostname1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
6217 | G_ADD_PRIVATE (Hostname1Skeleton) |
6218 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_skeleton_iface_init)); |
6219 | |
6220 | #else |
6221 | G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton, hostname1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
6222 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_skeleton_iface_init)); |
6223 | |
6224 | #endif |
6225 | static void |
6226 | hostname1_skeleton_finalize (GObject *object) |
6227 | { |
6228 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6229 | guint n; |
7ce16a35 |
6230 | for (n = 0; n < 10; n++) |
86cb7727 |
6231 | g_value_unset (&skeleton->priv->properties[n]); |
6232 | g_free (skeleton->priv->properties); |
6233 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
6234 | if (skeleton->priv->changed_properties_idle_source != NULL) |
6235 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
6236 | g_main_context_unref (skeleton->priv->context); |
6237 | g_mutex_clear (&skeleton->priv->lock); |
6238 | G_OBJECT_CLASS (hostname1_skeleton_parent_class)->finalize (object); |
6239 | } |
6240 | |
6241 | static void |
6242 | hostname1_skeleton_get_property (GObject *object, |
6243 | guint prop_id, |
6244 | GValue *value, |
6245 | GParamSpec *pspec G_GNUC_UNUSED) |
6246 | { |
6247 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
7ce16a35 |
6248 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
86cb7727 |
6249 | g_mutex_lock (&skeleton->priv->lock); |
6250 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
6251 | g_mutex_unlock (&skeleton->priv->lock); |
6252 | } |
6253 | |
6254 | static gboolean |
6255 | _hostname1_emit_changed (gpointer user_data) |
6256 | { |
6257 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
6258 | GList *l; |
6259 | GVariantBuilder builder; |
6260 | GVariantBuilder invalidated_builder; |
6261 | guint num_changes; |
6262 | |
6263 | g_mutex_lock (&skeleton->priv->lock); |
6264 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
6265 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
6266 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
6267 | { |
6268 | ChangedProperty *cp = l->data; |
6269 | GVariant *variant; |
6270 | const GValue *cur_value; |
6271 | |
6272 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
6273 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
6274 | { |
6275 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
6276 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
6277 | g_variant_unref (variant); |
6278 | num_changes++; |
6279 | } |
6280 | } |
6281 | if (num_changes > 0) |
6282 | { |
6283 | GList *connections, *ll; |
6284 | GVariant *signal_variant; |
6285 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.hostname1", |
6286 | &builder, &invalidated_builder)); |
6287 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
6288 | for (ll = connections; ll != NULL; ll = ll->next) |
6289 | { |
6290 | GDBusConnection *connection = ll->data; |
6291 | |
6292 | g_dbus_connection_emit_signal (connection, |
6293 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
6294 | "org.freedesktop.DBus.Properties", |
6295 | "PropertiesChanged", |
6296 | signal_variant, |
6297 | NULL); |
6298 | } |
6299 | g_variant_unref (signal_variant); |
6300 | g_list_free_full (connections, g_object_unref); |
6301 | } |
6302 | else |
6303 | { |
6304 | g_variant_builder_clear (&builder); |
6305 | g_variant_builder_clear (&invalidated_builder); |
6306 | } |
6307 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
6308 | skeleton->priv->changed_properties = NULL; |
6309 | skeleton->priv->changed_properties_idle_source = NULL; |
6310 | g_mutex_unlock (&skeleton->priv->lock); |
6311 | return FALSE; |
6312 | } |
6313 | |
6314 | static void |
6315 | _hostname1_schedule_emit_changed (Hostname1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
6316 | { |
6317 | ChangedProperty *cp; |
6318 | GList *l; |
6319 | cp = NULL; |
6320 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
6321 | { |
6322 | ChangedProperty *i_cp = l->data; |
6323 | if (i_cp->info == info) |
6324 | { |
6325 | cp = i_cp; |
6326 | break; |
6327 | } |
6328 | } |
6329 | if (cp == NULL) |
6330 | { |
6331 | cp = g_new0 (ChangedProperty, 1); |
6332 | cp->prop_id = prop_id; |
6333 | cp->info = info; |
6334 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
6335 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
6336 | g_value_copy (orig_value, &cp->orig_value); |
6337 | } |
6338 | } |
6339 | |
6340 | static void |
6341 | hostname1_skeleton_notify (GObject *object, |
6342 | GParamSpec *pspec G_GNUC_UNUSED) |
6343 | { |
6344 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6345 | g_mutex_lock (&skeleton->priv->lock); |
6346 | if (skeleton->priv->changed_properties != NULL && |
6347 | skeleton->priv->changed_properties_idle_source == NULL) |
6348 | { |
6349 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
6350 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
6351 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hostname1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
6352 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
6353 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
6354 | } |
6355 | g_mutex_unlock (&skeleton->priv->lock); |
6356 | } |
6357 | |
6358 | static void |
6359 | hostname1_skeleton_set_property (GObject *object, |
6360 | guint prop_id, |
6361 | const GValue *value, |
6362 | GParamSpec *pspec) |
6363 | { |
6364 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
7ce16a35 |
6365 | g_assert (prop_id != 0 && prop_id - 1 < 10); |
86cb7727 |
6366 | g_mutex_lock (&skeleton->priv->lock); |
6367 | g_object_freeze_notify (object); |
6368 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
6369 | { |
6370 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
6371 | _hostname1_schedule_emit_changed (skeleton, _hostname1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
6372 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
6373 | g_object_notify_by_pspec (object, pspec); |
6374 | } |
6375 | g_mutex_unlock (&skeleton->priv->lock); |
6376 | g_object_thaw_notify (object); |
6377 | } |
6378 | |
6379 | static void |
6380 | hostname1_skeleton_init (Hostname1Skeleton *skeleton) |
6381 | { |
6382 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
6383 | skeleton->priv = hostname1_skeleton_get_instance_private (skeleton); |
6384 | #else |
6385 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOSTNAME1_SKELETON, Hostname1SkeletonPrivate); |
6386 | #endif |
6387 | |
6388 | g_mutex_init (&skeleton->priv->lock); |
6389 | skeleton->priv->context = g_main_context_ref_thread_default (); |
7ce16a35 |
6390 | skeleton->priv->properties = g_new0 (GValue, 10); |
86cb7727 |
6391 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
6392 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
6393 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
6394 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
7ce16a35 |
6395 | g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
6396 | g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); |
6397 | g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); |
6398 | g_value_init (&skeleton->priv->properties[7], G_TYPE_STRING); |
6399 | g_value_init (&skeleton->priv->properties[8], G_TYPE_STRING); |
6400 | g_value_init (&skeleton->priv->properties[9], G_TYPE_STRING); |
86cb7727 |
6401 | } |
6402 | |
6403 | static const gchar * |
6404 | hostname1_skeleton_get_hostname (Hostname1 *object) |
6405 | { |
6406 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6407 | const gchar *value; |
6408 | g_mutex_lock (&skeleton->priv->lock); |
6409 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
6410 | g_mutex_unlock (&skeleton->priv->lock); |
6411 | return value; |
6412 | } |
6413 | |
6414 | static const gchar * |
6415 | hostname1_skeleton_get_static_hostname (Hostname1 *object) |
6416 | { |
6417 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6418 | const gchar *value; |
6419 | g_mutex_lock (&skeleton->priv->lock); |
6420 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
6421 | g_mutex_unlock (&skeleton->priv->lock); |
6422 | return value; |
6423 | } |
6424 | |
6425 | static const gchar * |
6426 | hostname1_skeleton_get_pretty_hostname (Hostname1 *object) |
6427 | { |
6428 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6429 | const gchar *value; |
6430 | g_mutex_lock (&skeleton->priv->lock); |
6431 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
6432 | g_mutex_unlock (&skeleton->priv->lock); |
6433 | return value; |
6434 | } |
6435 | |
6436 | static const gchar * |
6437 | hostname1_skeleton_get_icon_name (Hostname1 *object) |
6438 | { |
6439 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6440 | const gchar *value; |
6441 | g_mutex_lock (&skeleton->priv->lock); |
6442 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
6443 | g_mutex_unlock (&skeleton->priv->lock); |
6444 | return value; |
6445 | } |
6446 | |
7ce16a35 |
6447 | static const gchar * |
6448 | hostname1_skeleton_get_chassis (Hostname1 *object) |
6449 | { |
6450 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6451 | const gchar *value; |
6452 | g_mutex_lock (&skeleton->priv->lock); |
6453 | value = g_value_get_string (&(skeleton->priv->properties[4])); |
6454 | g_mutex_unlock (&skeleton->priv->lock); |
6455 | return value; |
6456 | } |
6457 | |
6458 | static const gchar * |
6459 | hostname1_skeleton_get_kernel_name (Hostname1 *object) |
6460 | { |
6461 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6462 | const gchar *value; |
6463 | g_mutex_lock (&skeleton->priv->lock); |
6464 | value = g_value_get_string (&(skeleton->priv->properties[5])); |
6465 | g_mutex_unlock (&skeleton->priv->lock); |
6466 | return value; |
6467 | } |
6468 | |
6469 | static const gchar * |
6470 | hostname1_skeleton_get_kernel_release (Hostname1 *object) |
6471 | { |
6472 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6473 | const gchar *value; |
6474 | g_mutex_lock (&skeleton->priv->lock); |
6475 | value = g_value_get_string (&(skeleton->priv->properties[6])); |
6476 | g_mutex_unlock (&skeleton->priv->lock); |
6477 | return value; |
6478 | } |
6479 | |
6480 | static const gchar * |
6481 | hostname1_skeleton_get_kernel_version (Hostname1 *object) |
6482 | { |
6483 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6484 | const gchar *value; |
6485 | g_mutex_lock (&skeleton->priv->lock); |
6486 | value = g_value_get_string (&(skeleton->priv->properties[7])); |
6487 | g_mutex_unlock (&skeleton->priv->lock); |
6488 | return value; |
6489 | } |
6490 | |
6491 | static const gchar * |
6492 | hostname1_skeleton_get_operating_system_pretty_name (Hostname1 *object) |
6493 | { |
6494 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6495 | const gchar *value; |
6496 | g_mutex_lock (&skeleton->priv->lock); |
6497 | value = g_value_get_string (&(skeleton->priv->properties[8])); |
6498 | g_mutex_unlock (&skeleton->priv->lock); |
6499 | return value; |
6500 | } |
6501 | |
6502 | static const gchar * |
6503 | hostname1_skeleton_get_operating_system_cpename (Hostname1 *object) |
6504 | { |
6505 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
6506 | const gchar *value; |
6507 | g_mutex_lock (&skeleton->priv->lock); |
6508 | value = g_value_get_string (&(skeleton->priv->properties[9])); |
6509 | g_mutex_unlock (&skeleton->priv->lock); |
6510 | return value; |
6511 | } |
6512 | |
86cb7727 |
6513 | static void |
6514 | hostname1_skeleton_class_init (Hostname1SkeletonClass *klass) |
6515 | { |
6516 | GObjectClass *gobject_class; |
6517 | GDBusInterfaceSkeletonClass *skeleton_class; |
6518 | |
6519 | gobject_class = G_OBJECT_CLASS (klass); |
6520 | gobject_class->finalize = hostname1_skeleton_finalize; |
6521 | gobject_class->get_property = hostname1_skeleton_get_property; |
6522 | gobject_class->set_property = hostname1_skeleton_set_property; |
6523 | gobject_class->notify = hostname1_skeleton_notify; |
6524 | |
6525 | |
6526 | hostname1_override_properties (gobject_class, 1); |
6527 | |
6528 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
6529 | skeleton_class->get_info = hostname1_skeleton_dbus_interface_get_info; |
6530 | skeleton_class->get_properties = hostname1_skeleton_dbus_interface_get_properties; |
6531 | skeleton_class->flush = hostname1_skeleton_dbus_interface_flush; |
6532 | skeleton_class->get_vtable = hostname1_skeleton_dbus_interface_get_vtable; |
6533 | |
6534 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
6535 | g_type_class_add_private (klass, sizeof (Hostname1SkeletonPrivate)); |
6536 | #endif |
6537 | } |
6538 | |
6539 | static void |
6540 | hostname1_skeleton_iface_init (Hostname1Iface *iface) |
6541 | { |
6542 | iface->get_hostname = hostname1_skeleton_get_hostname; |
6543 | iface->get_static_hostname = hostname1_skeleton_get_static_hostname; |
6544 | iface->get_pretty_hostname = hostname1_skeleton_get_pretty_hostname; |
6545 | iface->get_icon_name = hostname1_skeleton_get_icon_name; |
7ce16a35 |
6546 | iface->get_chassis = hostname1_skeleton_get_chassis; |
6547 | iface->get_kernel_name = hostname1_skeleton_get_kernel_name; |
6548 | iface->get_kernel_release = hostname1_skeleton_get_kernel_release; |
6549 | iface->get_kernel_version = hostname1_skeleton_get_kernel_version; |
6550 | iface->get_operating_system_pretty_name = hostname1_skeleton_get_operating_system_pretty_name; |
6551 | iface->get_operating_system_cpename = hostname1_skeleton_get_operating_system_cpename; |
86cb7727 |
6552 | } |
6553 | |
6554 | /** |
6555 | * hostname1_skeleton_new: |
6556 | * |
6557 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
6558 | * |
6559 | * Returns: (transfer full) (type Hostname1Skeleton): The skeleton object. |
6560 | */ |
6561 | Hostname1 * |
6562 | hostname1_skeleton_new (void) |
6563 | { |
6564 | return HOSTNAME1 (g_object_new (TYPE_HOSTNAME1_SKELETON, NULL)); |
6565 | } |
6566 | |