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 | /* ------------------------------------------------------------------------ |
152 | * Code for interface org.freedesktop.hostname1 |
153 | * ------------------------------------------------------------------------ |
154 | */ |
155 | |
156 | /** |
157 | * SECTION:Hostname1 |
158 | * @title: Hostname1 |
159 | * @short_description: Generated C code for the org.freedesktop.hostname1 D-Bus interface |
160 | * |
161 | * 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. |
162 | */ |
163 | |
164 | /* ---- Introspection data for org.freedesktop.hostname1 ---- */ |
165 | |
166 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_name = |
167 | { |
168 | { |
169 | -1, |
170 | (gchar *) "name", |
171 | (gchar *) "s", |
172 | NULL |
173 | }, |
174 | FALSE |
175 | }; |
176 | |
177 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_hostname_IN_ARG_user_interaction = |
178 | { |
179 | { |
180 | -1, |
181 | (gchar *) "user_interaction", |
182 | (gchar *) "b", |
183 | NULL |
184 | }, |
185 | FALSE |
186 | }; |
187 | |
188 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_hostname_IN_ARG_pointers[] = |
189 | { |
190 | &_hostname1_method_info_set_hostname_IN_ARG_name, |
191 | &_hostname1_method_info_set_hostname_IN_ARG_user_interaction, |
192 | NULL |
193 | }; |
194 | |
195 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_hostname = |
196 | { |
197 | { |
198 | -1, |
199 | (gchar *) "SetHostname", |
200 | (GDBusArgInfo **) &_hostname1_method_info_set_hostname_IN_ARG_pointers, |
201 | NULL, |
202 | NULL |
203 | }, |
204 | "handle-set-hostname", |
205 | FALSE |
206 | }; |
207 | |
208 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_name = |
209 | { |
210 | { |
211 | -1, |
212 | (gchar *) "name", |
213 | (gchar *) "s", |
214 | NULL |
215 | }, |
216 | FALSE |
217 | }; |
218 | |
219 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_static_hostname_IN_ARG_user_interaction = |
220 | { |
221 | { |
222 | -1, |
223 | (gchar *) "user_interaction", |
224 | (gchar *) "b", |
225 | NULL |
226 | }, |
227 | FALSE |
228 | }; |
229 | |
230 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_static_hostname_IN_ARG_pointers[] = |
231 | { |
232 | &_hostname1_method_info_set_static_hostname_IN_ARG_name, |
233 | &_hostname1_method_info_set_static_hostname_IN_ARG_user_interaction, |
234 | NULL |
235 | }; |
236 | |
237 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_static_hostname = |
238 | { |
239 | { |
240 | -1, |
241 | (gchar *) "SetStaticHostname", |
242 | (GDBusArgInfo **) &_hostname1_method_info_set_static_hostname_IN_ARG_pointers, |
243 | NULL, |
244 | NULL |
245 | }, |
246 | "handle-set-static-hostname", |
247 | FALSE |
248 | }; |
249 | |
250 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_name = |
251 | { |
252 | { |
253 | -1, |
254 | (gchar *) "name", |
255 | (gchar *) "s", |
256 | NULL |
257 | }, |
258 | FALSE |
259 | }; |
260 | |
261 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_pretty_hostname_IN_ARG_user_interaction = |
262 | { |
263 | { |
264 | -1, |
265 | (gchar *) "user_interaction", |
266 | (gchar *) "b", |
267 | NULL |
268 | }, |
269 | FALSE |
270 | }; |
271 | |
272 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_pretty_hostname_IN_ARG_pointers[] = |
273 | { |
274 | &_hostname1_method_info_set_pretty_hostname_IN_ARG_name, |
275 | &_hostname1_method_info_set_pretty_hostname_IN_ARG_user_interaction, |
276 | NULL |
277 | }; |
278 | |
279 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_pretty_hostname = |
280 | { |
281 | { |
282 | -1, |
283 | (gchar *) "SetPrettyHostname", |
284 | (GDBusArgInfo **) &_hostname1_method_info_set_pretty_hostname_IN_ARG_pointers, |
285 | NULL, |
286 | NULL |
287 | }, |
288 | "handle-set-pretty-hostname", |
289 | FALSE |
290 | }; |
291 | |
292 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_name = |
293 | { |
294 | { |
295 | -1, |
296 | (gchar *) "name", |
297 | (gchar *) "s", |
298 | NULL |
299 | }, |
300 | FALSE |
301 | }; |
302 | |
303 | static const _ExtendedGDBusArgInfo _hostname1_method_info_set_icon_name_IN_ARG_user_interaction = |
304 | { |
305 | { |
306 | -1, |
307 | (gchar *) "user_interaction", |
308 | (gchar *) "b", |
309 | NULL |
310 | }, |
311 | FALSE |
312 | }; |
313 | |
314 | static const _ExtendedGDBusArgInfo * const _hostname1_method_info_set_icon_name_IN_ARG_pointers[] = |
315 | { |
316 | &_hostname1_method_info_set_icon_name_IN_ARG_name, |
317 | &_hostname1_method_info_set_icon_name_IN_ARG_user_interaction, |
318 | NULL |
319 | }; |
320 | |
321 | static const _ExtendedGDBusMethodInfo _hostname1_method_info_set_icon_name = |
322 | { |
323 | { |
324 | -1, |
325 | (gchar *) "SetIconName", |
326 | (GDBusArgInfo **) &_hostname1_method_info_set_icon_name_IN_ARG_pointers, |
327 | NULL, |
328 | NULL |
329 | }, |
330 | "handle-set-icon-name", |
331 | FALSE |
332 | }; |
333 | |
334 | static const _ExtendedGDBusMethodInfo * const _hostname1_method_info_pointers[] = |
335 | { |
336 | &_hostname1_method_info_set_hostname, |
337 | &_hostname1_method_info_set_static_hostname, |
338 | &_hostname1_method_info_set_pretty_hostname, |
339 | &_hostname1_method_info_set_icon_name, |
340 | NULL |
341 | }; |
342 | |
343 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_hostname = |
344 | { |
345 | { |
346 | -1, |
347 | (gchar *) "Hostname", |
348 | (gchar *) "s", |
349 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
350 | NULL |
351 | }, |
352 | "hostname", |
353 | FALSE |
354 | }; |
355 | |
356 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_static_hostname = |
357 | { |
358 | { |
359 | -1, |
360 | (gchar *) "StaticHostname", |
361 | (gchar *) "s", |
362 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
363 | NULL |
364 | }, |
365 | "static-hostname", |
366 | FALSE |
367 | }; |
368 | |
369 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_pretty_hostname = |
370 | { |
371 | { |
372 | -1, |
373 | (gchar *) "PrettyHostname", |
374 | (gchar *) "s", |
375 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
376 | NULL |
377 | }, |
378 | "pretty-hostname", |
379 | FALSE |
380 | }; |
381 | |
382 | static const _ExtendedGDBusPropertyInfo _hostname1_property_info_icon_name = |
383 | { |
384 | { |
385 | -1, |
386 | (gchar *) "IconName", |
387 | (gchar *) "s", |
388 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
389 | NULL |
390 | }, |
391 | "icon-name", |
392 | FALSE |
393 | }; |
394 | |
395 | static const _ExtendedGDBusPropertyInfo * const _hostname1_property_info_pointers[] = |
396 | { |
397 | &_hostname1_property_info_hostname, |
398 | &_hostname1_property_info_static_hostname, |
399 | &_hostname1_property_info_pretty_hostname, |
400 | &_hostname1_property_info_icon_name, |
401 | NULL |
402 | }; |
403 | |
404 | static const _ExtendedGDBusInterfaceInfo _hostname1_interface_info = |
405 | { |
406 | { |
407 | -1, |
408 | (gchar *) "org.freedesktop.hostname1", |
409 | (GDBusMethodInfo **) &_hostname1_method_info_pointers, |
410 | NULL, |
411 | (GDBusPropertyInfo **) &_hostname1_property_info_pointers, |
412 | NULL |
413 | }, |
414 | "hostname1", |
415 | }; |
416 | |
417 | |
418 | /** |
419 | * hostname1_interface_info: |
420 | * |
421 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link> D-Bus interface. |
422 | * |
423 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
424 | */ |
425 | GDBusInterfaceInfo * |
426 | hostname1_interface_info (void) |
427 | { |
428 | return (GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct; |
429 | } |
430 | |
431 | /** |
432 | * hostname1_override_properties: |
433 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
434 | * @property_id_begin: The property id to assign to the first overridden property. |
435 | * |
436 | * Overrides all #GObject properties in the #Hostname1 interface for a concrete class. |
437 | * The properties are overridden in the order they are defined. |
438 | * |
439 | * Returns: The last property id. |
440 | */ |
441 | guint |
442 | hostname1_override_properties (GObjectClass *klass, guint property_id_begin) |
443 | { |
444 | g_object_class_override_property (klass, property_id_begin++, "hostname"); |
445 | g_object_class_override_property (klass, property_id_begin++, "static-hostname"); |
446 | g_object_class_override_property (klass, property_id_begin++, "pretty-hostname"); |
447 | g_object_class_override_property (klass, property_id_begin++, "icon-name"); |
448 | return property_id_begin - 1; |
449 | } |
450 | |
451 | |
452 | |
453 | /** |
454 | * Hostname1: |
455 | * |
456 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
457 | */ |
458 | |
459 | /** |
460 | * Hostname1Iface: |
461 | * @parent_iface: The parent interface. |
462 | * @handle_set_hostname: Handler for the #Hostname1::handle-set-hostname signal. |
463 | * @handle_set_icon_name: Handler for the #Hostname1::handle-set-icon-name signal. |
464 | * @handle_set_pretty_hostname: Handler for the #Hostname1::handle-set-pretty-hostname signal. |
465 | * @handle_set_static_hostname: Handler for the #Hostname1::handle-set-static-hostname signal. |
466 | * @get_hostname: Getter for the #Hostname1:hostname property. |
467 | * @get_icon_name: Getter for the #Hostname1:icon-name property. |
468 | * @get_pretty_hostname: Getter for the #Hostname1:pretty-hostname property. |
469 | * @get_static_hostname: Getter for the #Hostname1:static-hostname property. |
470 | * |
471 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
472 | */ |
473 | |
474 | typedef Hostname1Iface Hostname1Interface; |
475 | G_DEFINE_INTERFACE (Hostname1, hostname1, G_TYPE_OBJECT); |
476 | |
477 | static void |
478 | hostname1_default_init (Hostname1Iface *iface) |
479 | { |
480 | /* GObject signals for incoming D-Bus method calls: */ |
481 | /** |
482 | * Hostname1::handle-set-hostname: |
483 | * @object: A #Hostname1. |
484 | * @invocation: A #GDBusMethodInvocation. |
485 | * @arg_name: Argument passed by remote caller. |
486 | * @arg_user_interaction: Argument passed by remote caller. |
487 | * |
488 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method. |
489 | * |
490 | * 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. |
491 | * |
492 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
493 | */ |
494 | g_signal_new ("handle-set-hostname", |
495 | G_TYPE_FROM_INTERFACE (iface), |
496 | G_SIGNAL_RUN_LAST, |
497 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_hostname), |
498 | g_signal_accumulator_true_handled, |
499 | NULL, |
500 | g_cclosure_marshal_generic, |
501 | G_TYPE_BOOLEAN, |
502 | 3, |
503 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
504 | |
505 | /** |
506 | * Hostname1::handle-set-static-hostname: |
507 | * @object: A #Hostname1. |
508 | * @invocation: A #GDBusMethodInvocation. |
509 | * @arg_name: Argument passed by remote caller. |
510 | * @arg_user_interaction: Argument passed by remote caller. |
511 | * |
512 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method. |
513 | * |
514 | * 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. |
515 | * |
516 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
517 | */ |
518 | g_signal_new ("handle-set-static-hostname", |
519 | G_TYPE_FROM_INTERFACE (iface), |
520 | G_SIGNAL_RUN_LAST, |
521 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_static_hostname), |
522 | g_signal_accumulator_true_handled, |
523 | NULL, |
524 | g_cclosure_marshal_generic, |
525 | G_TYPE_BOOLEAN, |
526 | 3, |
527 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
528 | |
529 | /** |
530 | * Hostname1::handle-set-pretty-hostname: |
531 | * @object: A #Hostname1. |
532 | * @invocation: A #GDBusMethodInvocation. |
533 | * @arg_name: Argument passed by remote caller. |
534 | * @arg_user_interaction: Argument passed by remote caller. |
535 | * |
536 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method. |
537 | * |
538 | * 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. |
539 | * |
540 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
541 | */ |
542 | g_signal_new ("handle-set-pretty-hostname", |
543 | G_TYPE_FROM_INTERFACE (iface), |
544 | G_SIGNAL_RUN_LAST, |
545 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_pretty_hostname), |
546 | g_signal_accumulator_true_handled, |
547 | NULL, |
548 | g_cclosure_marshal_generic, |
549 | G_TYPE_BOOLEAN, |
550 | 3, |
551 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
552 | |
553 | /** |
554 | * Hostname1::handle-set-icon-name: |
555 | * @object: A #Hostname1. |
556 | * @invocation: A #GDBusMethodInvocation. |
557 | * @arg_name: Argument passed by remote caller. |
558 | * @arg_user_interaction: Argument passed by remote caller. |
559 | * |
560 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method. |
561 | * |
562 | * 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. |
563 | * |
564 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
565 | */ |
566 | g_signal_new ("handle-set-icon-name", |
567 | G_TYPE_FROM_INTERFACE (iface), |
568 | G_SIGNAL_RUN_LAST, |
569 | G_STRUCT_OFFSET (Hostname1Iface, handle_set_icon_name), |
570 | g_signal_accumulator_true_handled, |
571 | NULL, |
572 | g_cclosure_marshal_generic, |
573 | G_TYPE_BOOLEAN, |
574 | 3, |
575 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN); |
576 | |
577 | /* GObject properties for D-Bus properties: */ |
578 | /** |
579 | * Hostname1:hostname: |
580 | * |
581 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link>. |
582 | * |
583 | * 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. |
584 | */ |
585 | g_object_interface_install_property (iface, |
586 | g_param_spec_string ("hostname", "Hostname", "Hostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
587 | /** |
588 | * Hostname1:static-hostname: |
589 | * |
590 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link>. |
591 | * |
592 | * 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. |
593 | */ |
594 | g_object_interface_install_property (iface, |
595 | g_param_spec_string ("static-hostname", "StaticHostname", "StaticHostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
596 | /** |
597 | * Hostname1:pretty-hostname: |
598 | * |
599 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link>. |
600 | * |
601 | * 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. |
602 | */ |
603 | g_object_interface_install_property (iface, |
604 | g_param_spec_string ("pretty-hostname", "PrettyHostname", "PrettyHostname", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
605 | /** |
606 | * Hostname1:icon-name: |
607 | * |
608 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link>. |
609 | * |
610 | * 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. |
611 | */ |
612 | g_object_interface_install_property (iface, |
613 | g_param_spec_string ("icon-name", "IconName", "IconName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
614 | } |
615 | |
616 | /** |
617 | * hostname1_get_hostname: (skip) |
618 | * @object: A #Hostname1. |
619 | * |
620 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property. |
621 | * |
622 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
623 | * |
624 | * <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> |
625 | * |
626 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
627 | */ |
628 | const gchar * |
629 | hostname1_get_hostname (Hostname1 *object) |
630 | { |
631 | return HOSTNAME1_GET_IFACE (object)->get_hostname (object); |
632 | } |
633 | |
634 | /** |
635 | * hostname1_dup_hostname: (skip) |
636 | * @object: A #Hostname1. |
637 | * |
638 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property. |
639 | * |
640 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
641 | * |
642 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
643 | */ |
644 | gchar * |
645 | hostname1_dup_hostname (Hostname1 *object) |
646 | { |
647 | gchar *value; |
648 | g_object_get (G_OBJECT (object), "hostname", &value, NULL); |
649 | return value; |
650 | } |
651 | |
652 | /** |
653 | * hostname1_set_hostname: (skip) |
654 | * @object: A #Hostname1. |
655 | * @value: The value to set. |
656 | * |
657 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.Hostname">"Hostname"</link> D-Bus property to @value. |
658 | * |
659 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
660 | */ |
661 | void |
662 | hostname1_set_hostname (Hostname1 *object, const gchar *value) |
663 | { |
664 | g_object_set (G_OBJECT (object), "hostname", value, NULL); |
665 | } |
666 | |
667 | /** |
668 | * hostname1_get_static_hostname: (skip) |
669 | * @object: A #Hostname1. |
670 | * |
671 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property. |
672 | * |
673 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
674 | * |
675 | * <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> |
676 | * |
677 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
678 | */ |
679 | const gchar * |
680 | hostname1_get_static_hostname (Hostname1 *object) |
681 | { |
682 | return HOSTNAME1_GET_IFACE (object)->get_static_hostname (object); |
683 | } |
684 | |
685 | /** |
686 | * hostname1_dup_static_hostname: (skip) |
687 | * @object: A #Hostname1. |
688 | * |
689 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property. |
690 | * |
691 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
692 | * |
693 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
694 | */ |
695 | gchar * |
696 | hostname1_dup_static_hostname (Hostname1 *object) |
697 | { |
698 | gchar *value; |
699 | g_object_get (G_OBJECT (object), "static-hostname", &value, NULL); |
700 | return value; |
701 | } |
702 | |
703 | /** |
704 | * hostname1_set_static_hostname: (skip) |
705 | * @object: A #Hostname1. |
706 | * @value: The value to set. |
707 | * |
708 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.StaticHostname">"StaticHostname"</link> D-Bus property to @value. |
709 | * |
710 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
711 | */ |
712 | void |
713 | hostname1_set_static_hostname (Hostname1 *object, const gchar *value) |
714 | { |
715 | g_object_set (G_OBJECT (object), "static-hostname", value, NULL); |
716 | } |
717 | |
718 | /** |
719 | * hostname1_get_pretty_hostname: (skip) |
720 | * @object: A #Hostname1. |
721 | * |
722 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property. |
723 | * |
724 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
725 | * |
726 | * <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> |
727 | * |
728 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
729 | */ |
730 | const gchar * |
731 | hostname1_get_pretty_hostname (Hostname1 *object) |
732 | { |
733 | return HOSTNAME1_GET_IFACE (object)->get_pretty_hostname (object); |
734 | } |
735 | |
736 | /** |
737 | * hostname1_dup_pretty_hostname: (skip) |
738 | * @object: A #Hostname1. |
739 | * |
740 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property. |
741 | * |
742 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
743 | * |
744 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
745 | */ |
746 | gchar * |
747 | hostname1_dup_pretty_hostname (Hostname1 *object) |
748 | { |
749 | gchar *value; |
750 | g_object_get (G_OBJECT (object), "pretty-hostname", &value, NULL); |
751 | return value; |
752 | } |
753 | |
754 | /** |
755 | * hostname1_set_pretty_hostname: (skip) |
756 | * @object: A #Hostname1. |
757 | * @value: The value to set. |
758 | * |
759 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.PrettyHostname">"PrettyHostname"</link> D-Bus property to @value. |
760 | * |
761 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
762 | */ |
763 | void |
764 | hostname1_set_pretty_hostname (Hostname1 *object, const gchar *value) |
765 | { |
766 | g_object_set (G_OBJECT (object), "pretty-hostname", value, NULL); |
767 | } |
768 | |
769 | /** |
770 | * hostname1_get_icon_name: (skip) |
771 | * @object: A #Hostname1. |
772 | * |
773 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property. |
774 | * |
775 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
776 | * |
777 | * <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> |
778 | * |
779 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
780 | */ |
781 | const gchar * |
782 | hostname1_get_icon_name (Hostname1 *object) |
783 | { |
784 | return HOSTNAME1_GET_IFACE (object)->get_icon_name (object); |
785 | } |
786 | |
787 | /** |
788 | * hostname1_dup_icon_name: (skip) |
789 | * @object: A #Hostname1. |
790 | * |
791 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property. |
792 | * |
793 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
794 | * |
795 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
796 | */ |
797 | gchar * |
798 | hostname1_dup_icon_name (Hostname1 *object) |
799 | { |
800 | gchar *value; |
801 | g_object_get (G_OBJECT (object), "icon-name", &value, NULL); |
802 | return value; |
803 | } |
804 | |
805 | /** |
806 | * hostname1_set_icon_name: (skip) |
807 | * @object: A #Hostname1. |
808 | * @value: The value to set. |
809 | * |
810 | * Sets the <link linkend="gdbus-property-org-freedesktop-hostname1.IconName">"IconName"</link> D-Bus property to @value. |
811 | * |
812 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
813 | */ |
814 | void |
815 | hostname1_set_icon_name (Hostname1 *object, const gchar *value) |
816 | { |
817 | g_object_set (G_OBJECT (object), "icon-name", value, NULL); |
818 | } |
819 | |
820 | /** |
821 | * hostname1_call_set_hostname: |
822 | * @proxy: A #Hostname1Proxy. |
823 | * @arg_name: Argument to pass with the method invocation. |
824 | * @arg_user_interaction: Argument to pass with the method invocation. |
825 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
826 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
827 | * @user_data: User data to pass to @callback. |
828 | * |
829 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetHostname">SetHostname()</link> D-Bus method on @proxy. |
830 | * 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. |
831 | * You can then call hostname1_call_set_hostname_finish() to get the result of the operation. |
832 | * |
833 | * See hostname1_call_set_hostname_sync() for the synchronous, blocking version of this method. |
834 | */ |
835 | void |
836 | hostname1_call_set_hostname ( |
837 | Hostname1 *proxy, |
838 | const gchar *arg_name, |
839 | gboolean arg_user_interaction, |
840 | GCancellable *cancellable, |
841 | GAsyncReadyCallback callback, |
842 | gpointer user_data) |
843 | { |
844 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
845 | "SetHostname", |
846 | g_variant_new ("(sb)", |
847 | arg_name, |
848 | arg_user_interaction), |
849 | G_DBUS_CALL_FLAGS_NONE, |
850 | -1, |
851 | cancellable, |
852 | callback, |
853 | user_data); |
854 | } |
855 | |
856 | /** |
857 | * hostname1_call_set_hostname_finish: |
858 | * @proxy: A #Hostname1Proxy. |
859 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_hostname(). |
860 | * @error: Return location for error or %NULL. |
861 | * |
862 | * Finishes an operation started with hostname1_call_set_hostname(). |
863 | * |
864 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
865 | */ |
866 | gboolean |
867 | hostname1_call_set_hostname_finish ( |
868 | Hostname1 *proxy, |
869 | GAsyncResult *res, |
870 | GError **error) |
871 | { |
872 | GVariant *_ret; |
873 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
874 | if (_ret == NULL) |
875 | goto _out; |
876 | g_variant_get (_ret, |
877 | "()"); |
878 | g_variant_unref (_ret); |
879 | _out: |
880 | return _ret != NULL; |
881 | } |
882 | |
883 | /** |
884 | * hostname1_call_set_hostname_sync: |
885 | * @proxy: A #Hostname1Proxy. |
886 | * @arg_name: Argument to pass with the method invocation. |
887 | * @arg_user_interaction: Argument to pass with the method invocation. |
888 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
889 | * @error: Return location for error or %NULL. |
890 | * |
891 | * 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. |
892 | * |
893 | * See hostname1_call_set_hostname() for the asynchronous version of this method. |
894 | * |
895 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
896 | */ |
897 | gboolean |
898 | hostname1_call_set_hostname_sync ( |
899 | Hostname1 *proxy, |
900 | const gchar *arg_name, |
901 | gboolean arg_user_interaction, |
902 | GCancellable *cancellable, |
903 | GError **error) |
904 | { |
905 | GVariant *_ret; |
906 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
907 | "SetHostname", |
908 | g_variant_new ("(sb)", |
909 | arg_name, |
910 | arg_user_interaction), |
911 | G_DBUS_CALL_FLAGS_NONE, |
912 | -1, |
913 | cancellable, |
914 | error); |
915 | if (_ret == NULL) |
916 | goto _out; |
917 | g_variant_get (_ret, |
918 | "()"); |
919 | g_variant_unref (_ret); |
920 | _out: |
921 | return _ret != NULL; |
922 | } |
923 | |
924 | /** |
925 | * hostname1_call_set_static_hostname: |
926 | * @proxy: A #Hostname1Proxy. |
927 | * @arg_name: Argument to pass with the method invocation. |
928 | * @arg_user_interaction: Argument to pass with the method invocation. |
929 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
930 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
931 | * @user_data: User data to pass to @callback. |
932 | * |
933 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetStaticHostname">SetStaticHostname()</link> D-Bus method on @proxy. |
934 | * 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. |
935 | * You can then call hostname1_call_set_static_hostname_finish() to get the result of the operation. |
936 | * |
937 | * See hostname1_call_set_static_hostname_sync() for the synchronous, blocking version of this method. |
938 | */ |
939 | void |
940 | hostname1_call_set_static_hostname ( |
941 | Hostname1 *proxy, |
942 | const gchar *arg_name, |
943 | gboolean arg_user_interaction, |
944 | GCancellable *cancellable, |
945 | GAsyncReadyCallback callback, |
946 | gpointer user_data) |
947 | { |
948 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
949 | "SetStaticHostname", |
950 | g_variant_new ("(sb)", |
951 | arg_name, |
952 | arg_user_interaction), |
953 | G_DBUS_CALL_FLAGS_NONE, |
954 | -1, |
955 | cancellable, |
956 | callback, |
957 | user_data); |
958 | } |
959 | |
960 | /** |
961 | * hostname1_call_set_static_hostname_finish: |
962 | * @proxy: A #Hostname1Proxy. |
963 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_static_hostname(). |
964 | * @error: Return location for error or %NULL. |
965 | * |
966 | * Finishes an operation started with hostname1_call_set_static_hostname(). |
967 | * |
968 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
969 | */ |
970 | gboolean |
971 | hostname1_call_set_static_hostname_finish ( |
972 | Hostname1 *proxy, |
973 | GAsyncResult *res, |
974 | GError **error) |
975 | { |
976 | GVariant *_ret; |
977 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
978 | if (_ret == NULL) |
979 | goto _out; |
980 | g_variant_get (_ret, |
981 | "()"); |
982 | g_variant_unref (_ret); |
983 | _out: |
984 | return _ret != NULL; |
985 | } |
986 | |
987 | /** |
988 | * hostname1_call_set_static_hostname_sync: |
989 | * @proxy: A #Hostname1Proxy. |
990 | * @arg_name: Argument to pass with the method invocation. |
991 | * @arg_user_interaction: Argument to pass with the method invocation. |
992 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
993 | * @error: Return location for error or %NULL. |
994 | * |
995 | * 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. |
996 | * |
997 | * See hostname1_call_set_static_hostname() for the asynchronous version of this method. |
998 | * |
999 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1000 | */ |
1001 | gboolean |
1002 | hostname1_call_set_static_hostname_sync ( |
1003 | Hostname1 *proxy, |
1004 | const gchar *arg_name, |
1005 | gboolean arg_user_interaction, |
1006 | GCancellable *cancellable, |
1007 | GError **error) |
1008 | { |
1009 | GVariant *_ret; |
1010 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1011 | "SetStaticHostname", |
1012 | g_variant_new ("(sb)", |
1013 | arg_name, |
1014 | arg_user_interaction), |
1015 | G_DBUS_CALL_FLAGS_NONE, |
1016 | -1, |
1017 | cancellable, |
1018 | error); |
1019 | if (_ret == NULL) |
1020 | goto _out; |
1021 | g_variant_get (_ret, |
1022 | "()"); |
1023 | g_variant_unref (_ret); |
1024 | _out: |
1025 | return _ret != NULL; |
1026 | } |
1027 | |
1028 | /** |
1029 | * hostname1_call_set_pretty_hostname: |
1030 | * @proxy: A #Hostname1Proxy. |
1031 | * @arg_name: Argument to pass with the method invocation. |
1032 | * @arg_user_interaction: Argument to pass with the method invocation. |
1033 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1034 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1035 | * @user_data: User data to pass to @callback. |
1036 | * |
1037 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetPrettyHostname">SetPrettyHostname()</link> D-Bus method on @proxy. |
1038 | * 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. |
1039 | * You can then call hostname1_call_set_pretty_hostname_finish() to get the result of the operation. |
1040 | * |
1041 | * See hostname1_call_set_pretty_hostname_sync() for the synchronous, blocking version of this method. |
1042 | */ |
1043 | void |
1044 | hostname1_call_set_pretty_hostname ( |
1045 | Hostname1 *proxy, |
1046 | const gchar *arg_name, |
1047 | gboolean arg_user_interaction, |
1048 | GCancellable *cancellable, |
1049 | GAsyncReadyCallback callback, |
1050 | gpointer user_data) |
1051 | { |
1052 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1053 | "SetPrettyHostname", |
1054 | g_variant_new ("(sb)", |
1055 | arg_name, |
1056 | arg_user_interaction), |
1057 | G_DBUS_CALL_FLAGS_NONE, |
1058 | -1, |
1059 | cancellable, |
1060 | callback, |
1061 | user_data); |
1062 | } |
1063 | |
1064 | /** |
1065 | * hostname1_call_set_pretty_hostname_finish: |
1066 | * @proxy: A #Hostname1Proxy. |
1067 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_pretty_hostname(). |
1068 | * @error: Return location for error or %NULL. |
1069 | * |
1070 | * Finishes an operation started with hostname1_call_set_pretty_hostname(). |
1071 | * |
1072 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1073 | */ |
1074 | gboolean |
1075 | hostname1_call_set_pretty_hostname_finish ( |
1076 | Hostname1 *proxy, |
1077 | GAsyncResult *res, |
1078 | GError **error) |
1079 | { |
1080 | GVariant *_ret; |
1081 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1082 | if (_ret == NULL) |
1083 | goto _out; |
1084 | g_variant_get (_ret, |
1085 | "()"); |
1086 | g_variant_unref (_ret); |
1087 | _out: |
1088 | return _ret != NULL; |
1089 | } |
1090 | |
1091 | /** |
1092 | * hostname1_call_set_pretty_hostname_sync: |
1093 | * @proxy: A #Hostname1Proxy. |
1094 | * @arg_name: Argument to pass with the method invocation. |
1095 | * @arg_user_interaction: Argument to pass with the method invocation. |
1096 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1097 | * @error: Return location for error or %NULL. |
1098 | * |
1099 | * 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. |
1100 | * |
1101 | * See hostname1_call_set_pretty_hostname() for the asynchronous version of this method. |
1102 | * |
1103 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1104 | */ |
1105 | gboolean |
1106 | hostname1_call_set_pretty_hostname_sync ( |
1107 | Hostname1 *proxy, |
1108 | const gchar *arg_name, |
1109 | gboolean arg_user_interaction, |
1110 | GCancellable *cancellable, |
1111 | GError **error) |
1112 | { |
1113 | GVariant *_ret; |
1114 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1115 | "SetPrettyHostname", |
1116 | g_variant_new ("(sb)", |
1117 | arg_name, |
1118 | arg_user_interaction), |
1119 | G_DBUS_CALL_FLAGS_NONE, |
1120 | -1, |
1121 | cancellable, |
1122 | error); |
1123 | if (_ret == NULL) |
1124 | goto _out; |
1125 | g_variant_get (_ret, |
1126 | "()"); |
1127 | g_variant_unref (_ret); |
1128 | _out: |
1129 | return _ret != NULL; |
1130 | } |
1131 | |
1132 | /** |
1133 | * hostname1_call_set_icon_name: |
1134 | * @proxy: A #Hostname1Proxy. |
1135 | * @arg_name: Argument to pass with the method invocation. |
1136 | * @arg_user_interaction: Argument to pass with the method invocation. |
1137 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1138 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1139 | * @user_data: User data to pass to @callback. |
1140 | * |
1141 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-hostname1.SetIconName">SetIconName()</link> D-Bus method on @proxy. |
1142 | * 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. |
1143 | * You can then call hostname1_call_set_icon_name_finish() to get the result of the operation. |
1144 | * |
1145 | * See hostname1_call_set_icon_name_sync() for the synchronous, blocking version of this method. |
1146 | */ |
1147 | void |
1148 | hostname1_call_set_icon_name ( |
1149 | Hostname1 *proxy, |
1150 | const gchar *arg_name, |
1151 | gboolean arg_user_interaction, |
1152 | GCancellable *cancellable, |
1153 | GAsyncReadyCallback callback, |
1154 | gpointer user_data) |
1155 | { |
1156 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1157 | "SetIconName", |
1158 | g_variant_new ("(sb)", |
1159 | arg_name, |
1160 | arg_user_interaction), |
1161 | G_DBUS_CALL_FLAGS_NONE, |
1162 | -1, |
1163 | cancellable, |
1164 | callback, |
1165 | user_data); |
1166 | } |
1167 | |
1168 | /** |
1169 | * hostname1_call_set_icon_name_finish: |
1170 | * @proxy: A #Hostname1Proxy. |
1171 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_call_set_icon_name(). |
1172 | * @error: Return location for error or %NULL. |
1173 | * |
1174 | * Finishes an operation started with hostname1_call_set_icon_name(). |
1175 | * |
1176 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1177 | */ |
1178 | gboolean |
1179 | hostname1_call_set_icon_name_finish ( |
1180 | Hostname1 *proxy, |
1181 | GAsyncResult *res, |
1182 | GError **error) |
1183 | { |
1184 | GVariant *_ret; |
1185 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1186 | if (_ret == NULL) |
1187 | goto _out; |
1188 | g_variant_get (_ret, |
1189 | "()"); |
1190 | g_variant_unref (_ret); |
1191 | _out: |
1192 | return _ret != NULL; |
1193 | } |
1194 | |
1195 | /** |
1196 | * hostname1_call_set_icon_name_sync: |
1197 | * @proxy: A #Hostname1Proxy. |
1198 | * @arg_name: Argument to pass with the method invocation. |
1199 | * @arg_user_interaction: Argument to pass with the method invocation. |
1200 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1201 | * @error: Return location for error or %NULL. |
1202 | * |
1203 | * 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. |
1204 | * |
1205 | * See hostname1_call_set_icon_name() for the asynchronous version of this method. |
1206 | * |
1207 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1208 | */ |
1209 | gboolean |
1210 | hostname1_call_set_icon_name_sync ( |
1211 | Hostname1 *proxy, |
1212 | const gchar *arg_name, |
1213 | gboolean arg_user_interaction, |
1214 | GCancellable *cancellable, |
1215 | GError **error) |
1216 | { |
1217 | GVariant *_ret; |
1218 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1219 | "SetIconName", |
1220 | g_variant_new ("(sb)", |
1221 | arg_name, |
1222 | arg_user_interaction), |
1223 | G_DBUS_CALL_FLAGS_NONE, |
1224 | -1, |
1225 | cancellable, |
1226 | error); |
1227 | if (_ret == NULL) |
1228 | goto _out; |
1229 | g_variant_get (_ret, |
1230 | "()"); |
1231 | g_variant_unref (_ret); |
1232 | _out: |
1233 | return _ret != NULL; |
1234 | } |
1235 | |
1236 | /** |
1237 | * hostname1_complete_set_hostname: |
1238 | * @object: A #Hostname1. |
1239 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1240 | * |
1241 | * 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. |
1242 | * |
1243 | * This method will free @invocation, you cannot use it afterwards. |
1244 | */ |
1245 | void |
1246 | hostname1_complete_set_hostname ( |
1247 | Hostname1 *object, |
1248 | GDBusMethodInvocation *invocation) |
1249 | { |
1250 | g_dbus_method_invocation_return_value (invocation, |
1251 | g_variant_new ("()")); |
1252 | } |
1253 | |
1254 | /** |
1255 | * hostname1_complete_set_static_hostname: |
1256 | * @object: A #Hostname1. |
1257 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1258 | * |
1259 | * 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. |
1260 | * |
1261 | * This method will free @invocation, you cannot use it afterwards. |
1262 | */ |
1263 | void |
1264 | hostname1_complete_set_static_hostname ( |
1265 | Hostname1 *object, |
1266 | GDBusMethodInvocation *invocation) |
1267 | { |
1268 | g_dbus_method_invocation_return_value (invocation, |
1269 | g_variant_new ("()")); |
1270 | } |
1271 | |
1272 | /** |
1273 | * hostname1_complete_set_pretty_hostname: |
1274 | * @object: A #Hostname1. |
1275 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1276 | * |
1277 | * 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. |
1278 | * |
1279 | * This method will free @invocation, you cannot use it afterwards. |
1280 | */ |
1281 | void |
1282 | hostname1_complete_set_pretty_hostname ( |
1283 | Hostname1 *object, |
1284 | GDBusMethodInvocation *invocation) |
1285 | { |
1286 | g_dbus_method_invocation_return_value (invocation, |
1287 | g_variant_new ("()")); |
1288 | } |
1289 | |
1290 | /** |
1291 | * hostname1_complete_set_icon_name: |
1292 | * @object: A #Hostname1. |
1293 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1294 | * |
1295 | * 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. |
1296 | * |
1297 | * This method will free @invocation, you cannot use it afterwards. |
1298 | */ |
1299 | void |
1300 | hostname1_complete_set_icon_name ( |
1301 | Hostname1 *object, |
1302 | GDBusMethodInvocation *invocation) |
1303 | { |
1304 | g_dbus_method_invocation_return_value (invocation, |
1305 | g_variant_new ("()")); |
1306 | } |
1307 | |
1308 | /* ------------------------------------------------------------------------ */ |
1309 | |
1310 | /** |
1311 | * Hostname1Proxy: |
1312 | * |
1313 | * The #Hostname1Proxy structure contains only private data and should only be accessed using the provided API. |
1314 | */ |
1315 | |
1316 | /** |
1317 | * Hostname1ProxyClass: |
1318 | * @parent_class: The parent class. |
1319 | * |
1320 | * Class structure for #Hostname1Proxy. |
1321 | */ |
1322 | |
1323 | struct _Hostname1ProxyPrivate |
1324 | { |
1325 | GData *qdata; |
1326 | }; |
1327 | |
1328 | static void hostname1_proxy_iface_init (Hostname1Iface *iface); |
1329 | |
1330 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1331 | G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy, hostname1_proxy, G_TYPE_DBUS_PROXY, |
1332 | G_ADD_PRIVATE (Hostname1Proxy) |
1333 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_proxy_iface_init)); |
1334 | |
1335 | #else |
1336 | G_DEFINE_TYPE_WITH_CODE (Hostname1Proxy, hostname1_proxy, G_TYPE_DBUS_PROXY, |
1337 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_proxy_iface_init)); |
1338 | |
1339 | #endif |
1340 | static void |
1341 | hostname1_proxy_finalize (GObject *object) |
1342 | { |
1343 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
1344 | g_datalist_clear (&proxy->priv->qdata); |
1345 | G_OBJECT_CLASS (hostname1_proxy_parent_class)->finalize (object); |
1346 | } |
1347 | |
1348 | static void |
1349 | hostname1_proxy_get_property (GObject *object, |
1350 | guint prop_id, |
1351 | GValue *value, |
1352 | GParamSpec *pspec G_GNUC_UNUSED) |
1353 | { |
1354 | const _ExtendedGDBusPropertyInfo *info; |
1355 | GVariant *variant; |
1356 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
1357 | info = _hostname1_property_info_pointers[prop_id - 1]; |
1358 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
1359 | if (info->use_gvariant) |
1360 | { |
1361 | g_value_set_variant (value, variant); |
1362 | } |
1363 | else |
1364 | { |
1365 | if (variant != NULL) |
1366 | g_dbus_gvariant_to_gvalue (variant, value); |
1367 | } |
1368 | if (variant != NULL) |
1369 | g_variant_unref (variant); |
1370 | } |
1371 | |
1372 | static void |
1373 | hostname1_proxy_set_property_cb (GDBusProxy *proxy, |
1374 | GAsyncResult *res, |
1375 | gpointer user_data) |
1376 | { |
1377 | const _ExtendedGDBusPropertyInfo *info = user_data; |
1378 | GError *error; |
1379 | GVariant *_ret; |
1380 | error = NULL; |
1381 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
1382 | if (!_ret) |
1383 | { |
1384 | g_warning ("Error setting property '%s' on interface org.freedesktop.hostname1: %s (%s, %d)", |
1385 | info->parent_struct.name, |
1386 | error->message, g_quark_to_string (error->domain), error->code); |
1387 | g_error_free (error); |
1388 | } |
1389 | else |
1390 | { |
1391 | g_variant_unref (_ret); |
1392 | } |
1393 | } |
1394 | |
1395 | static void |
1396 | hostname1_proxy_set_property (GObject *object, |
1397 | guint prop_id, |
1398 | const GValue *value, |
1399 | GParamSpec *pspec G_GNUC_UNUSED) |
1400 | { |
1401 | const _ExtendedGDBusPropertyInfo *info; |
1402 | GVariant *variant; |
1403 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
1404 | info = _hostname1_property_info_pointers[prop_id - 1]; |
1405 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1406 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
1407 | "org.freedesktop.DBus.Properties.Set", |
1408 | g_variant_new ("(ssv)", "org.freedesktop.hostname1", info->parent_struct.name, variant), |
1409 | G_DBUS_CALL_FLAGS_NONE, |
1410 | -1, |
1411 | NULL, (GAsyncReadyCallback) hostname1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
1412 | g_variant_unref (variant); |
1413 | } |
1414 | |
1415 | static void |
1416 | hostname1_proxy_g_signal (GDBusProxy *proxy, |
1417 | const gchar *sender_name G_GNUC_UNUSED, |
1418 | const gchar *signal_name, |
1419 | GVariant *parameters) |
1420 | { |
1421 | _ExtendedGDBusSignalInfo *info; |
1422 | GVariantIter iter; |
1423 | GVariant *child; |
1424 | GValue *paramv; |
1425 | guint num_params; |
1426 | guint n; |
1427 | guint signal_id; |
1428 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, signal_name); |
1429 | if (info == NULL) |
1430 | return; |
1431 | num_params = g_variant_n_children (parameters); |
1432 | paramv = g_new0 (GValue, num_params + 1); |
1433 | g_value_init (¶mv[0], TYPE_HOSTNAME1); |
1434 | g_value_set_object (¶mv[0], proxy); |
1435 | g_variant_iter_init (&iter, parameters); |
1436 | n = 1; |
1437 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1438 | { |
1439 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
1440 | if (arg_info->use_gvariant) |
1441 | { |
1442 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
1443 | g_value_set_variant (¶mv[n], child); |
1444 | n++; |
1445 | } |
1446 | else |
1447 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1448 | g_variant_unref (child); |
1449 | } |
1450 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOSTNAME1); |
1451 | g_signal_emitv (paramv, signal_id, 0, NULL); |
1452 | for (n = 0; n < num_params + 1; n++) |
1453 | g_value_unset (¶mv[n]); |
1454 | g_free (paramv); |
1455 | } |
1456 | |
1457 | static void |
1458 | hostname1_proxy_g_properties_changed (GDBusProxy *_proxy, |
1459 | GVariant *changed_properties, |
1460 | const gchar *const *invalidated_properties) |
1461 | { |
1462 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (_proxy); |
1463 | guint n; |
1464 | const gchar *key; |
1465 | GVariantIter *iter; |
1466 | _ExtendedGDBusPropertyInfo *info; |
1467 | g_variant_get (changed_properties, "a{sv}", &iter); |
1468 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
1469 | { |
1470 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, key); |
1471 | g_datalist_remove_data (&proxy->priv->qdata, key); |
1472 | if (info != NULL) |
1473 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1474 | } |
1475 | g_variant_iter_free (iter); |
1476 | for (n = 0; invalidated_properties[n] != NULL; n++) |
1477 | { |
1478 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, invalidated_properties[n]); |
1479 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
1480 | if (info != NULL) |
1481 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1482 | } |
1483 | } |
1484 | |
1485 | static const gchar * |
1486 | hostname1_proxy_get_hostname (Hostname1 *object) |
1487 | { |
1488 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
1489 | GVariant *variant; |
1490 | const gchar *value = NULL; |
1491 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Hostname"); |
1492 | if (variant != NULL) |
1493 | { |
1494 | value = g_variant_get_string (variant, NULL); |
1495 | g_variant_unref (variant); |
1496 | } |
1497 | return value; |
1498 | } |
1499 | |
1500 | static const gchar * |
1501 | hostname1_proxy_get_static_hostname (Hostname1 *object) |
1502 | { |
1503 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
1504 | GVariant *variant; |
1505 | const gchar *value = NULL; |
1506 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "StaticHostname"); |
1507 | if (variant != NULL) |
1508 | { |
1509 | value = g_variant_get_string (variant, NULL); |
1510 | g_variant_unref (variant); |
1511 | } |
1512 | return value; |
1513 | } |
1514 | |
1515 | static const gchar * |
1516 | hostname1_proxy_get_pretty_hostname (Hostname1 *object) |
1517 | { |
1518 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
1519 | GVariant *variant; |
1520 | const gchar *value = NULL; |
1521 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PrettyHostname"); |
1522 | if (variant != NULL) |
1523 | { |
1524 | value = g_variant_get_string (variant, NULL); |
1525 | g_variant_unref (variant); |
1526 | } |
1527 | return value; |
1528 | } |
1529 | |
1530 | static const gchar * |
1531 | hostname1_proxy_get_icon_name (Hostname1 *object) |
1532 | { |
1533 | Hostname1Proxy *proxy = HOSTNAME1_PROXY (object); |
1534 | GVariant *variant; |
1535 | const gchar *value = NULL; |
1536 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IconName"); |
1537 | if (variant != NULL) |
1538 | { |
1539 | value = g_variant_get_string (variant, NULL); |
1540 | g_variant_unref (variant); |
1541 | } |
1542 | return value; |
1543 | } |
1544 | |
1545 | static void |
1546 | hostname1_proxy_init (Hostname1Proxy *proxy) |
1547 | { |
1548 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1549 | proxy->priv = hostname1_proxy_get_instance_private (proxy); |
1550 | #else |
1551 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOSTNAME1_PROXY, Hostname1ProxyPrivate); |
1552 | #endif |
1553 | |
1554 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hostname1_interface_info ()); |
1555 | } |
1556 | |
1557 | static void |
1558 | hostname1_proxy_class_init (Hostname1ProxyClass *klass) |
1559 | { |
1560 | GObjectClass *gobject_class; |
1561 | GDBusProxyClass *proxy_class; |
1562 | |
1563 | gobject_class = G_OBJECT_CLASS (klass); |
1564 | gobject_class->finalize = hostname1_proxy_finalize; |
1565 | gobject_class->get_property = hostname1_proxy_get_property; |
1566 | gobject_class->set_property = hostname1_proxy_set_property; |
1567 | |
1568 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
1569 | proxy_class->g_signal = hostname1_proxy_g_signal; |
1570 | proxy_class->g_properties_changed = hostname1_proxy_g_properties_changed; |
1571 | |
1572 | hostname1_override_properties (gobject_class, 1); |
1573 | |
1574 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
1575 | g_type_class_add_private (klass, sizeof (Hostname1ProxyPrivate)); |
1576 | #endif |
1577 | } |
1578 | |
1579 | static void |
1580 | hostname1_proxy_iface_init (Hostname1Iface *iface) |
1581 | { |
1582 | iface->get_hostname = hostname1_proxy_get_hostname; |
1583 | iface->get_static_hostname = hostname1_proxy_get_static_hostname; |
1584 | iface->get_pretty_hostname = hostname1_proxy_get_pretty_hostname; |
1585 | iface->get_icon_name = hostname1_proxy_get_icon_name; |
1586 | } |
1587 | |
1588 | /** |
1589 | * hostname1_proxy_new: |
1590 | * @connection: A #GDBusConnection. |
1591 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1592 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1593 | * @object_path: An object path. |
1594 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1595 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1596 | * @user_data: User data to pass to @callback. |
1597 | * |
1598 | * 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. |
1599 | * |
1600 | * 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. |
1601 | * You can then call hostname1_proxy_new_finish() to get the result of the operation. |
1602 | * |
1603 | * See hostname1_proxy_new_sync() for the synchronous, blocking version of this constructor. |
1604 | */ |
1605 | void |
1606 | hostname1_proxy_new ( |
1607 | GDBusConnection *connection, |
1608 | GDBusProxyFlags flags, |
1609 | const gchar *name, |
1610 | const gchar *object_path, |
1611 | GCancellable *cancellable, |
1612 | GAsyncReadyCallback callback, |
1613 | gpointer user_data) |
1614 | { |
1615 | 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); |
1616 | } |
1617 | |
1618 | /** |
1619 | * hostname1_proxy_new_finish: |
1620 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new(). |
1621 | * @error: Return location for error or %NULL |
1622 | * |
1623 | * Finishes an operation started with hostname1_proxy_new(). |
1624 | * |
1625 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
1626 | */ |
1627 | Hostname1 * |
1628 | hostname1_proxy_new_finish ( |
1629 | GAsyncResult *res, |
1630 | GError **error) |
1631 | { |
1632 | GObject *ret; |
1633 | GObject *source_object; |
1634 | source_object = g_async_result_get_source_object (res); |
1635 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1636 | g_object_unref (source_object); |
1637 | if (ret != NULL) |
1638 | return HOSTNAME1 (ret); |
1639 | else |
1640 | return NULL; |
1641 | } |
1642 | |
1643 | /** |
1644 | * hostname1_proxy_new_sync: |
1645 | * @connection: A #GDBusConnection. |
1646 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1647 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1648 | * @object_path: An object path. |
1649 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1650 | * @error: Return location for error or %NULL |
1651 | * |
1652 | * 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. |
1653 | * |
1654 | * The calling thread is blocked until a reply is received. |
1655 | * |
1656 | * See hostname1_proxy_new() for the asynchronous version of this constructor. |
1657 | * |
1658 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
1659 | */ |
1660 | Hostname1 * |
1661 | hostname1_proxy_new_sync ( |
1662 | GDBusConnection *connection, |
1663 | GDBusProxyFlags flags, |
1664 | const gchar *name, |
1665 | const gchar *object_path, |
1666 | GCancellable *cancellable, |
1667 | GError **error) |
1668 | { |
1669 | GInitable *ret; |
1670 | 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); |
1671 | if (ret != NULL) |
1672 | return HOSTNAME1 (ret); |
1673 | else |
1674 | return NULL; |
1675 | } |
1676 | |
1677 | |
1678 | /** |
1679 | * hostname1_proxy_new_for_bus: |
1680 | * @bus_type: A #GBusType. |
1681 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1682 | * @name: A bus name (well-known or unique). |
1683 | * @object_path: An object path. |
1684 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1685 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1686 | * @user_data: User data to pass to @callback. |
1687 | * |
1688 | * Like hostname1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
1689 | * |
1690 | * 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. |
1691 | * You can then call hostname1_proxy_new_for_bus_finish() to get the result of the operation. |
1692 | * |
1693 | * See hostname1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
1694 | */ |
1695 | void |
1696 | hostname1_proxy_new_for_bus ( |
1697 | GBusType bus_type, |
1698 | GDBusProxyFlags flags, |
1699 | const gchar *name, |
1700 | const gchar *object_path, |
1701 | GCancellable *cancellable, |
1702 | GAsyncReadyCallback callback, |
1703 | gpointer user_data) |
1704 | { |
1705 | 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); |
1706 | } |
1707 | |
1708 | /** |
1709 | * hostname1_proxy_new_for_bus_finish: |
1710 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hostname1_proxy_new_for_bus(). |
1711 | * @error: Return location for error or %NULL |
1712 | * |
1713 | * Finishes an operation started with hostname1_proxy_new_for_bus(). |
1714 | * |
1715 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
1716 | */ |
1717 | Hostname1 * |
1718 | hostname1_proxy_new_for_bus_finish ( |
1719 | GAsyncResult *res, |
1720 | GError **error) |
1721 | { |
1722 | GObject *ret; |
1723 | GObject *source_object; |
1724 | source_object = g_async_result_get_source_object (res); |
1725 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1726 | g_object_unref (source_object); |
1727 | if (ret != NULL) |
1728 | return HOSTNAME1 (ret); |
1729 | else |
1730 | return NULL; |
1731 | } |
1732 | |
1733 | /** |
1734 | * hostname1_proxy_new_for_bus_sync: |
1735 | * @bus_type: A #GBusType. |
1736 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1737 | * @name: A bus name (well-known or unique). |
1738 | * @object_path: An object path. |
1739 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1740 | * @error: Return location for error or %NULL |
1741 | * |
1742 | * Like hostname1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
1743 | * |
1744 | * The calling thread is blocked until a reply is received. |
1745 | * |
1746 | * See hostname1_proxy_new_for_bus() for the asynchronous version of this constructor. |
1747 | * |
1748 | * Returns: (transfer full) (type Hostname1Proxy): The constructed proxy object or %NULL if @error is set. |
1749 | */ |
1750 | Hostname1 * |
1751 | hostname1_proxy_new_for_bus_sync ( |
1752 | GBusType bus_type, |
1753 | GDBusProxyFlags flags, |
1754 | const gchar *name, |
1755 | const gchar *object_path, |
1756 | GCancellable *cancellable, |
1757 | GError **error) |
1758 | { |
1759 | GInitable *ret; |
1760 | 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); |
1761 | if (ret != NULL) |
1762 | return HOSTNAME1 (ret); |
1763 | else |
1764 | return NULL; |
1765 | } |
1766 | |
1767 | |
1768 | /* ------------------------------------------------------------------------ */ |
1769 | |
1770 | /** |
1771 | * Hostname1Skeleton: |
1772 | * |
1773 | * The #Hostname1Skeleton structure contains only private data and should only be accessed using the provided API. |
1774 | */ |
1775 | |
1776 | /** |
1777 | * Hostname1SkeletonClass: |
1778 | * @parent_class: The parent class. |
1779 | * |
1780 | * Class structure for #Hostname1Skeleton. |
1781 | */ |
1782 | |
1783 | struct _Hostname1SkeletonPrivate |
1784 | { |
1785 | GValue *properties; |
1786 | GList *changed_properties; |
1787 | GSource *changed_properties_idle_source; |
1788 | GMainContext *context; |
1789 | GMutex lock; |
1790 | }; |
1791 | |
1792 | static void |
1793 | _hostname1_skeleton_handle_method_call ( |
1794 | GDBusConnection *connection G_GNUC_UNUSED, |
1795 | const gchar *sender G_GNUC_UNUSED, |
1796 | const gchar *object_path G_GNUC_UNUSED, |
1797 | const gchar *interface_name, |
1798 | const gchar *method_name, |
1799 | GVariant *parameters, |
1800 | GDBusMethodInvocation *invocation, |
1801 | gpointer user_data) |
1802 | { |
1803 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
1804 | _ExtendedGDBusMethodInfo *info; |
1805 | GVariantIter iter; |
1806 | GVariant *child; |
1807 | GValue *paramv; |
1808 | guint num_params; |
1809 | guint num_extra; |
1810 | guint n; |
1811 | guint signal_id; |
1812 | GValue return_value = G_VALUE_INIT; |
1813 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
1814 | g_assert (info != NULL); |
1815 | num_params = g_variant_n_children (parameters); |
1816 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
1817 | n = 0; |
1818 | g_value_init (¶mv[n], TYPE_HOSTNAME1); |
1819 | g_value_set_object (¶mv[n++], skeleton); |
1820 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
1821 | g_value_set_object (¶mv[n++], invocation); |
1822 | if (info->pass_fdlist) |
1823 | { |
1824 | #ifdef G_OS_UNIX |
1825 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
1826 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
1827 | #else |
1828 | g_assert_not_reached (); |
1829 | #endif |
1830 | } |
1831 | g_variant_iter_init (&iter, parameters); |
1832 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1833 | { |
1834 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
1835 | if (arg_info->use_gvariant) |
1836 | { |
1837 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
1838 | g_value_set_variant (¶mv[n], child); |
1839 | n++; |
1840 | } |
1841 | else |
1842 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1843 | g_variant_unref (child); |
1844 | } |
1845 | signal_id = g_signal_lookup (info->signal_name, TYPE_HOSTNAME1); |
1846 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
1847 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
1848 | if (!g_value_get_boolean (&return_value)) |
1849 | 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); |
1850 | g_value_unset (&return_value); |
1851 | for (n = 0; n < num_params + num_extra; n++) |
1852 | g_value_unset (¶mv[n]); |
1853 | g_free (paramv); |
1854 | } |
1855 | |
1856 | static GVariant * |
1857 | _hostname1_skeleton_handle_get_property ( |
1858 | GDBusConnection *connection G_GNUC_UNUSED, |
1859 | const gchar *sender G_GNUC_UNUSED, |
1860 | const gchar *object_path G_GNUC_UNUSED, |
1861 | const gchar *interface_name G_GNUC_UNUSED, |
1862 | const gchar *property_name, |
1863 | GError **error, |
1864 | gpointer user_data) |
1865 | { |
1866 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
1867 | GValue value = G_VALUE_INIT; |
1868 | GParamSpec *pspec; |
1869 | _ExtendedGDBusPropertyInfo *info; |
1870 | GVariant *ret; |
1871 | ret = NULL; |
1872 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, property_name); |
1873 | g_assert (info != NULL); |
1874 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1875 | if (pspec == NULL) |
1876 | { |
1877 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1878 | } |
1879 | else |
1880 | { |
1881 | g_value_init (&value, pspec->value_type); |
1882 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1883 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1884 | g_value_unset (&value); |
1885 | } |
1886 | return ret; |
1887 | } |
1888 | |
1889 | static gboolean |
1890 | _hostname1_skeleton_handle_set_property ( |
1891 | GDBusConnection *connection G_GNUC_UNUSED, |
1892 | const gchar *sender G_GNUC_UNUSED, |
1893 | const gchar *object_path G_GNUC_UNUSED, |
1894 | const gchar *interface_name G_GNUC_UNUSED, |
1895 | const gchar *property_name, |
1896 | GVariant *variant, |
1897 | GError **error, |
1898 | gpointer user_data) |
1899 | { |
1900 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
1901 | GValue value = G_VALUE_INIT; |
1902 | GParamSpec *pspec; |
1903 | _ExtendedGDBusPropertyInfo *info; |
1904 | gboolean ret; |
1905 | ret = FALSE; |
1906 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hostname1_interface_info.parent_struct, property_name); |
1907 | g_assert (info != NULL); |
1908 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
1909 | if (pspec == NULL) |
1910 | { |
1911 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
1912 | } |
1913 | else |
1914 | { |
1915 | if (info->use_gvariant) |
1916 | g_value_set_variant (&value, variant); |
1917 | else |
1918 | g_dbus_gvariant_to_gvalue (variant, &value); |
1919 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
1920 | g_value_unset (&value); |
1921 | ret = TRUE; |
1922 | } |
1923 | return ret; |
1924 | } |
1925 | |
1926 | static const GDBusInterfaceVTable _hostname1_skeleton_vtable = |
1927 | { |
1928 | _hostname1_skeleton_handle_method_call, |
1929 | _hostname1_skeleton_handle_get_property, |
1930 | _hostname1_skeleton_handle_set_property, |
1931 | {NULL} |
1932 | }; |
1933 | |
1934 | static GDBusInterfaceInfo * |
1935 | hostname1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1936 | { |
1937 | return hostname1_interface_info (); |
1938 | } |
1939 | |
1940 | static GDBusInterfaceVTable * |
1941 | hostname1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
1942 | { |
1943 | return (GDBusInterfaceVTable *) &_hostname1_skeleton_vtable; |
1944 | } |
1945 | |
1946 | static GVariant * |
1947 | hostname1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
1948 | { |
1949 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (_skeleton); |
1950 | |
1951 | GVariantBuilder builder; |
1952 | guint n; |
1953 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
1954 | if (_hostname1_interface_info.parent_struct.properties == NULL) |
1955 | goto out; |
1956 | for (n = 0; _hostname1_interface_info.parent_struct.properties[n] != NULL; n++) |
1957 | { |
1958 | GDBusPropertyInfo *info = _hostname1_interface_info.parent_struct.properties[n]; |
1959 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
1960 | { |
1961 | GVariant *value; |
1962 | 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); |
1963 | if (value != NULL) |
1964 | { |
1965 | g_variant_take_ref (value); |
1966 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
1967 | g_variant_unref (value); |
1968 | } |
1969 | } |
1970 | } |
1971 | out: |
1972 | return g_variant_builder_end (&builder); |
1973 | } |
1974 | |
1975 | static gboolean _hostname1_emit_changed (gpointer user_data); |
1976 | |
1977 | static void |
1978 | hostname1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
1979 | { |
1980 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (_skeleton); |
1981 | gboolean emit_changed = FALSE; |
1982 | |
1983 | g_mutex_lock (&skeleton->priv->lock); |
1984 | if (skeleton->priv->changed_properties_idle_source != NULL) |
1985 | { |
1986 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
1987 | skeleton->priv->changed_properties_idle_source = NULL; |
1988 | emit_changed = TRUE; |
1989 | } |
1990 | g_mutex_unlock (&skeleton->priv->lock); |
1991 | |
1992 | if (emit_changed) |
1993 | _hostname1_emit_changed (skeleton); |
1994 | } |
1995 | |
1996 | static void hostname1_skeleton_iface_init (Hostname1Iface *iface); |
1997 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1998 | G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton, hostname1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
1999 | G_ADD_PRIVATE (Hostname1Skeleton) |
2000 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_skeleton_iface_init)); |
2001 | |
2002 | #else |
2003 | G_DEFINE_TYPE_WITH_CODE (Hostname1Skeleton, hostname1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
2004 | G_IMPLEMENT_INTERFACE (TYPE_HOSTNAME1, hostname1_skeleton_iface_init)); |
2005 | |
2006 | #endif |
2007 | static void |
2008 | hostname1_skeleton_finalize (GObject *object) |
2009 | { |
2010 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2011 | guint n; |
2012 | for (n = 0; n < 4; n++) |
2013 | g_value_unset (&skeleton->priv->properties[n]); |
2014 | g_free (skeleton->priv->properties); |
2015 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2016 | if (skeleton->priv->changed_properties_idle_source != NULL) |
2017 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
2018 | g_main_context_unref (skeleton->priv->context); |
2019 | g_mutex_clear (&skeleton->priv->lock); |
2020 | G_OBJECT_CLASS (hostname1_skeleton_parent_class)->finalize (object); |
2021 | } |
2022 | |
2023 | static void |
2024 | hostname1_skeleton_get_property (GObject *object, |
2025 | guint prop_id, |
2026 | GValue *value, |
2027 | GParamSpec *pspec G_GNUC_UNUSED) |
2028 | { |
2029 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2030 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
2031 | g_mutex_lock (&skeleton->priv->lock); |
2032 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
2033 | g_mutex_unlock (&skeleton->priv->lock); |
2034 | } |
2035 | |
2036 | static gboolean |
2037 | _hostname1_emit_changed (gpointer user_data) |
2038 | { |
2039 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (user_data); |
2040 | GList *l; |
2041 | GVariantBuilder builder; |
2042 | GVariantBuilder invalidated_builder; |
2043 | guint num_changes; |
2044 | |
2045 | g_mutex_lock (&skeleton->priv->lock); |
2046 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
2047 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
2048 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
2049 | { |
2050 | ChangedProperty *cp = l->data; |
2051 | GVariant *variant; |
2052 | const GValue *cur_value; |
2053 | |
2054 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
2055 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
2056 | { |
2057 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
2058 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
2059 | g_variant_unref (variant); |
2060 | num_changes++; |
2061 | } |
2062 | } |
2063 | if (num_changes > 0) |
2064 | { |
2065 | GList *connections, *ll; |
2066 | GVariant *signal_variant; |
2067 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.hostname1", |
2068 | &builder, &invalidated_builder)); |
2069 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
2070 | for (ll = connections; ll != NULL; ll = ll->next) |
2071 | { |
2072 | GDBusConnection *connection = ll->data; |
2073 | |
2074 | g_dbus_connection_emit_signal (connection, |
2075 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
2076 | "org.freedesktop.DBus.Properties", |
2077 | "PropertiesChanged", |
2078 | signal_variant, |
2079 | NULL); |
2080 | } |
2081 | g_variant_unref (signal_variant); |
2082 | g_list_free_full (connections, g_object_unref); |
2083 | } |
2084 | else |
2085 | { |
2086 | g_variant_builder_clear (&builder); |
2087 | g_variant_builder_clear (&invalidated_builder); |
2088 | } |
2089 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2090 | skeleton->priv->changed_properties = NULL; |
2091 | skeleton->priv->changed_properties_idle_source = NULL; |
2092 | g_mutex_unlock (&skeleton->priv->lock); |
2093 | return FALSE; |
2094 | } |
2095 | |
2096 | static void |
2097 | _hostname1_schedule_emit_changed (Hostname1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
2098 | { |
2099 | ChangedProperty *cp; |
2100 | GList *l; |
2101 | cp = NULL; |
2102 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
2103 | { |
2104 | ChangedProperty *i_cp = l->data; |
2105 | if (i_cp->info == info) |
2106 | { |
2107 | cp = i_cp; |
2108 | break; |
2109 | } |
2110 | } |
2111 | if (cp == NULL) |
2112 | { |
2113 | cp = g_new0 (ChangedProperty, 1); |
2114 | cp->prop_id = prop_id; |
2115 | cp->info = info; |
2116 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
2117 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
2118 | g_value_copy (orig_value, &cp->orig_value); |
2119 | } |
2120 | } |
2121 | |
2122 | static void |
2123 | hostname1_skeleton_notify (GObject *object, |
2124 | GParamSpec *pspec G_GNUC_UNUSED) |
2125 | { |
2126 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2127 | g_mutex_lock (&skeleton->priv->lock); |
2128 | if (skeleton->priv->changed_properties != NULL && |
2129 | skeleton->priv->changed_properties_idle_source == NULL) |
2130 | { |
2131 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
2132 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
2133 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hostname1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
2134 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
2135 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
2136 | } |
2137 | g_mutex_unlock (&skeleton->priv->lock); |
2138 | } |
2139 | |
2140 | static void |
2141 | hostname1_skeleton_set_property (GObject *object, |
2142 | guint prop_id, |
2143 | const GValue *value, |
2144 | GParamSpec *pspec) |
2145 | { |
2146 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2147 | g_assert (prop_id != 0 && prop_id - 1 < 4); |
2148 | g_mutex_lock (&skeleton->priv->lock); |
2149 | g_object_freeze_notify (object); |
2150 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
2151 | { |
2152 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
2153 | _hostname1_schedule_emit_changed (skeleton, _hostname1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
2154 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
2155 | g_object_notify_by_pspec (object, pspec); |
2156 | } |
2157 | g_mutex_unlock (&skeleton->priv->lock); |
2158 | g_object_thaw_notify (object); |
2159 | } |
2160 | |
2161 | static void |
2162 | hostname1_skeleton_init (Hostname1Skeleton *skeleton) |
2163 | { |
2164 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2165 | skeleton->priv = hostname1_skeleton_get_instance_private (skeleton); |
2166 | #else |
2167 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOSTNAME1_SKELETON, Hostname1SkeletonPrivate); |
2168 | #endif |
2169 | |
2170 | g_mutex_init (&skeleton->priv->lock); |
2171 | skeleton->priv->context = g_main_context_ref_thread_default (); |
2172 | skeleton->priv->properties = g_new0 (GValue, 4); |
2173 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); |
2174 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
2175 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
2176 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
2177 | } |
2178 | |
2179 | static const gchar * |
2180 | hostname1_skeleton_get_hostname (Hostname1 *object) |
2181 | { |
2182 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2183 | const gchar *value; |
2184 | g_mutex_lock (&skeleton->priv->lock); |
2185 | value = g_value_get_string (&(skeleton->priv->properties[0])); |
2186 | g_mutex_unlock (&skeleton->priv->lock); |
2187 | return value; |
2188 | } |
2189 | |
2190 | static const gchar * |
2191 | hostname1_skeleton_get_static_hostname (Hostname1 *object) |
2192 | { |
2193 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2194 | const gchar *value; |
2195 | g_mutex_lock (&skeleton->priv->lock); |
2196 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
2197 | g_mutex_unlock (&skeleton->priv->lock); |
2198 | return value; |
2199 | } |
2200 | |
2201 | static const gchar * |
2202 | hostname1_skeleton_get_pretty_hostname (Hostname1 *object) |
2203 | { |
2204 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2205 | const gchar *value; |
2206 | g_mutex_lock (&skeleton->priv->lock); |
2207 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
2208 | g_mutex_unlock (&skeleton->priv->lock); |
2209 | return value; |
2210 | } |
2211 | |
2212 | static const gchar * |
2213 | hostname1_skeleton_get_icon_name (Hostname1 *object) |
2214 | { |
2215 | Hostname1Skeleton *skeleton = HOSTNAME1_SKELETON (object); |
2216 | const gchar *value; |
2217 | g_mutex_lock (&skeleton->priv->lock); |
2218 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
2219 | g_mutex_unlock (&skeleton->priv->lock); |
2220 | return value; |
2221 | } |
2222 | |
2223 | static void |
2224 | hostname1_skeleton_class_init (Hostname1SkeletonClass *klass) |
2225 | { |
2226 | GObjectClass *gobject_class; |
2227 | GDBusInterfaceSkeletonClass *skeleton_class; |
2228 | |
2229 | gobject_class = G_OBJECT_CLASS (klass); |
2230 | gobject_class->finalize = hostname1_skeleton_finalize; |
2231 | gobject_class->get_property = hostname1_skeleton_get_property; |
2232 | gobject_class->set_property = hostname1_skeleton_set_property; |
2233 | gobject_class->notify = hostname1_skeleton_notify; |
2234 | |
2235 | |
2236 | hostname1_override_properties (gobject_class, 1); |
2237 | |
2238 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
2239 | skeleton_class->get_info = hostname1_skeleton_dbus_interface_get_info; |
2240 | skeleton_class->get_properties = hostname1_skeleton_dbus_interface_get_properties; |
2241 | skeleton_class->flush = hostname1_skeleton_dbus_interface_flush; |
2242 | skeleton_class->get_vtable = hostname1_skeleton_dbus_interface_get_vtable; |
2243 | |
2244 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2245 | g_type_class_add_private (klass, sizeof (Hostname1SkeletonPrivate)); |
2246 | #endif |
2247 | } |
2248 | |
2249 | static void |
2250 | hostname1_skeleton_iface_init (Hostname1Iface *iface) |
2251 | { |
2252 | iface->get_hostname = hostname1_skeleton_get_hostname; |
2253 | iface->get_static_hostname = hostname1_skeleton_get_static_hostname; |
2254 | iface->get_pretty_hostname = hostname1_skeleton_get_pretty_hostname; |
2255 | iface->get_icon_name = hostname1_skeleton_get_icon_name; |
2256 | } |
2257 | |
2258 | /** |
2259 | * hostname1_skeleton_new: |
2260 | * |
2261 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-hostname1.top_of_page">org.freedesktop.hostname1</link>. |
2262 | * |
2263 | * Returns: (transfer full) (type Hostname1Skeleton): The skeleton object. |
2264 | */ |
2265 | Hostname1 * |
2266 | hostname1_skeleton_new (void) |
2267 | { |
2268 | return HOSTNAME1 (g_object_new (TYPE_HOSTNAME1_SKELETON, NULL)); |
2269 | } |
2270 | |