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