GCC Code Coverage Report


Directory: ./
File: _build/panels/system/datetime/timedated.c
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 676 0.0%
Functions: 0 89 0.0%
Branches: 0 256 0.0%

Line Branch Exec Source
1 /*
2 * This file is generated by gdbus-codegen, do not modify it.
3 *
4 * The license of this code is the same as for the D-Bus interface description
5 * it was derived from. Note that it links to GLib, so must comply with the
6 * LGPL linking clauses.
7 */
8
9 #ifdef HAVE_CONFIG_H
10 # include "config.h"
11 #endif
12
13 #include "timedated.h"
14
15 #include <string.h>
16 #ifdef G_OS_UNIX
17 # include <gio/gunixfdlist.h>
18 #endif
19
20 #ifdef G_ENABLE_DEBUG
21 #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
22 #define g_marshal_value_peek_char(v) g_value_get_schar (v)
23 #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
24 #define g_marshal_value_peek_int(v) g_value_get_int (v)
25 #define g_marshal_value_peek_uint(v) g_value_get_uint (v)
26 #define g_marshal_value_peek_long(v) g_value_get_long (v)
27 #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
28 #define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
29 #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
30 #define g_marshal_value_peek_enum(v) g_value_get_enum (v)
31 #define g_marshal_value_peek_flags(v) g_value_get_flags (v)
32 #define g_marshal_value_peek_float(v) g_value_get_float (v)
33 #define g_marshal_value_peek_double(v) g_value_get_double (v)
34 #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
35 #define g_marshal_value_peek_param(v) g_value_get_param (v)
36 #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
37 #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
38 #define g_marshal_value_peek_object(v) g_value_get_object (v)
39 #define g_marshal_value_peek_variant(v) g_value_get_variant (v)
40 #else /* !G_ENABLE_DEBUG */
41 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
42 * Do not access GValues directly in your code. Instead, use the
43 * g_value_get_*() functions
44 */
45 #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
46 #define g_marshal_value_peek_char(v) (v)->data[0].v_int
47 #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
48 #define g_marshal_value_peek_int(v) (v)->data[0].v_int
49 #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
50 #define g_marshal_value_peek_long(v) (v)->data[0].v_long
51 #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
52 #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
53 #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
54 #define g_marshal_value_peek_enum(v) (v)->data[0].v_long
55 #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
56 #define g_marshal_value_peek_float(v) (v)->data[0].v_float
57 #define g_marshal_value_peek_double(v) (v)->data[0].v_double
58 #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
59 #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
60 #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
61 #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
62 #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
63 #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
64 #endif /* !G_ENABLE_DEBUG */
65
66 typedef struct
67 {
68 GDBusArgInfo parent_struct;
69 gboolean use_gvariant;
70 } _ExtendedGDBusArgInfo;
71
72 typedef struct
73 {
74 GDBusMethodInfo parent_struct;
75 const gchar *signal_name;
76 gboolean pass_fdlist;
77 } _ExtendedGDBusMethodInfo;
78
79 typedef struct
80 {
81 GDBusSignalInfo parent_struct;
82 const gchar *signal_name;
83 } _ExtendedGDBusSignalInfo;
84
85 typedef struct
86 {
87 GDBusPropertyInfo parent_struct;
88 const gchar *hyphen_name;
89 guint use_gvariant : 1;
90 guint emits_changed_signal : 1;
91 } _ExtendedGDBusPropertyInfo;
92
93 typedef struct
94 {
95 GDBusInterfaceInfo parent_struct;
96 const gchar *hyphen_name;
97 } _ExtendedGDBusInterfaceInfo;
98
99 typedef struct
100 {
101 const _ExtendedGDBusPropertyInfo *info;
102 guint prop_id;
103 GValue orig_value; /* the value before the change */
104 } ChangedProperty;
105
106 static void
107 _changed_property_free (ChangedProperty *data)
108 {
109 g_value_unset (&data->orig_value);
110 g_free (data);
111 }
112
113 static gboolean
114 _g_strv_equal0 (gchar **a, gchar **b)
115 {
116 gboolean ret = FALSE;
117 guint n;
118 if (a == NULL && b == NULL)
119 {
120 ret = TRUE;
121 goto out;
122 }
123 if (a == NULL || b == NULL)
124 goto out;
125 if (g_strv_length (a) != g_strv_length (b))
126 goto out;
127 for (n = 0; a[n] != NULL; n++)
128 if (g_strcmp0 (a[n], b[n]) != 0)
129 goto out;
130 ret = TRUE;
131 out:
132 return ret;
133 }
134
135 static gboolean
136 _g_variant_equal0 (GVariant *a, GVariant *b)
137 {
138 gboolean ret = FALSE;
139 if (a == NULL && b == NULL)
140 {
141 ret = TRUE;
142 goto out;
143 }
144 if (a == NULL || b == NULL)
145 goto out;
146 ret = g_variant_equal (a, b);
147 out:
148 return ret;
149 }
150
151 G_GNUC_UNUSED static gboolean
152 _g_value_equal (const GValue *a, const GValue *b)
153 {
154 gboolean ret = FALSE;
155 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
156 switch (G_VALUE_TYPE (a))
157 {
158 case G_TYPE_BOOLEAN:
159 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
160 break;
161 case G_TYPE_UCHAR:
162 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
163 break;
164 case G_TYPE_INT:
165 ret = (g_value_get_int (a) == g_value_get_int (b));
166 break;
167 case G_TYPE_UINT:
168 ret = (g_value_get_uint (a) == g_value_get_uint (b));
169 break;
170 case G_TYPE_INT64:
171 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
172 break;
173 case G_TYPE_UINT64:
174 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
175 break;
176 case G_TYPE_DOUBLE:
177 {
178 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
179 gdouble da = g_value_get_double (a);
180 gdouble db = g_value_get_double (b);
181 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
182 }
183 break;
184 case G_TYPE_STRING:
185 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
186 break;
187 case G_TYPE_VARIANT:
188 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
189 break;
190 default:
191 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
192 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
193 else
194 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
195 break;
196 }
197 return ret;
198 }
199
200 static void
201 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT64_BOOLEAN_BOOLEAN (
202 GClosure *closure,
203 GValue *return_value,
204 unsigned int n_param_values,
205 const GValue *param_values,
206 void *invocation_hint G_GNUC_UNUSED,
207 void *marshal_data)
208 {
209 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectInt64BooleanBooleanFunc)
210 (void *data1,
211 GDBusMethodInvocation *arg_method_invocation,
212 gint64 arg_usec_utc,
213 gboolean arg_relative,
214 gboolean arg_user_interaction,
215 void *data2);
216 _GDbusCodegenMarshalBoolean_ObjectInt64BooleanBooleanFunc callback;
217 GCClosure *cc = (GCClosure*) closure;
218 void *data1, *data2;
219 gboolean v_return;
220
221 g_return_if_fail (return_value != NULL);
222 g_return_if_fail (n_param_values == 5);
223
224 if (G_CCLOSURE_SWAP_DATA (closure))
225 {
226 data1 = closure->data;
227 data2 = g_value_peek_pointer (param_values + 0);
228 }
229 else
230 {
231 data1 = g_value_peek_pointer (param_values + 0);
232 data2 = closure->data;
233 }
234
235 callback = (_GDbusCodegenMarshalBoolean_ObjectInt64BooleanBooleanFunc)
236 (marshal_data ? marshal_data : cc->callback);
237
238 v_return =
239 callback (data1,
240 g_marshal_value_peek_object (param_values + 1),
241 g_marshal_value_peek_int64 (param_values + 2),
242 g_marshal_value_peek_boolean (param_values + 3),
243 g_marshal_value_peek_boolean (param_values + 4),
244 data2);
245
246 g_value_set_boolean (return_value, v_return);
247 }
248
249 static void
250 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_BOOLEAN (
251 GClosure *closure,
252 GValue *return_value,
253 unsigned int n_param_values,
254 const GValue *param_values,
255 void *invocation_hint G_GNUC_UNUSED,
256 void *marshal_data)
257 {
258 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringBooleanFunc)
259 (void *data1,
260 GDBusMethodInvocation *arg_method_invocation,
261 const gchar *arg_timezone,
262 gboolean arg_user_interaction,
263 void *data2);
264 _GDbusCodegenMarshalBoolean_ObjectStringBooleanFunc callback;
265 GCClosure *cc = (GCClosure*) closure;
266 void *data1, *data2;
267 gboolean v_return;
268
269 g_return_if_fail (return_value != NULL);
270 g_return_if_fail (n_param_values == 4);
271
272 if (G_CCLOSURE_SWAP_DATA (closure))
273 {
274 data1 = closure->data;
275 data2 = g_value_peek_pointer (param_values + 0);
276 }
277 else
278 {
279 data1 = g_value_peek_pointer (param_values + 0);
280 data2 = closure->data;
281 }
282
283 callback = (_GDbusCodegenMarshalBoolean_ObjectStringBooleanFunc)
284 (marshal_data ? marshal_data : cc->callback);
285
286 v_return =
287 callback (data1,
288 g_marshal_value_peek_object (param_values + 1),
289 g_marshal_value_peek_string (param_values + 2),
290 g_marshal_value_peek_boolean (param_values + 3),
291 data2);
292
293 g_value_set_boolean (return_value, v_return);
294 }
295
296 static void
297 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_BOOLEAN_BOOLEAN_BOOLEAN (
298 GClosure *closure,
299 GValue *return_value,
300 unsigned int n_param_values,
301 const GValue *param_values,
302 void *invocation_hint G_GNUC_UNUSED,
303 void *marshal_data)
304 {
305 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectBooleanBooleanBooleanFunc)
306 (void *data1,
307 GDBusMethodInvocation *arg_method_invocation,
308 gboolean arg_local_rtc,
309 gboolean arg_fix_system,
310 gboolean arg_user_interaction,
311 void *data2);
312 _GDbusCodegenMarshalBoolean_ObjectBooleanBooleanBooleanFunc callback;
313 GCClosure *cc = (GCClosure*) closure;
314 void *data1, *data2;
315 gboolean v_return;
316
317 g_return_if_fail (return_value != NULL);
318 g_return_if_fail (n_param_values == 5);
319
320 if (G_CCLOSURE_SWAP_DATA (closure))
321 {
322 data1 = closure->data;
323 data2 = g_value_peek_pointer (param_values + 0);
324 }
325 else
326 {
327 data1 = g_value_peek_pointer (param_values + 0);
328 data2 = closure->data;
329 }
330
331 callback = (_GDbusCodegenMarshalBoolean_ObjectBooleanBooleanBooleanFunc)
332 (marshal_data ? marshal_data : cc->callback);
333
334 v_return =
335 callback (data1,
336 g_marshal_value_peek_object (param_values + 1),
337 g_marshal_value_peek_boolean (param_values + 2),
338 g_marshal_value_peek_boolean (param_values + 3),
339 g_marshal_value_peek_boolean (param_values + 4),
340 data2);
341
342 g_value_set_boolean (return_value, v_return);
343 }
344
345 static void
346 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_BOOLEAN_BOOLEAN (
347 GClosure *closure,
348 GValue *return_value,
349 unsigned int n_param_values,
350 const GValue *param_values,
351 void *invocation_hint G_GNUC_UNUSED,
352 void *marshal_data)
353 {
354 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectBooleanBooleanFunc)
355 (void *data1,
356 GDBusMethodInvocation *arg_method_invocation,
357 gboolean arg_use_ntp,
358 gboolean arg_user_interaction,
359 void *data2);
360 _GDbusCodegenMarshalBoolean_ObjectBooleanBooleanFunc callback;
361 GCClosure *cc = (GCClosure*) closure;
362 void *data1, *data2;
363 gboolean v_return;
364
365 g_return_if_fail (return_value != NULL);
366 g_return_if_fail (n_param_values == 4);
367
368 if (G_CCLOSURE_SWAP_DATA (closure))
369 {
370 data1 = closure->data;
371 data2 = g_value_peek_pointer (param_values + 0);
372 }
373 else
374 {
375 data1 = g_value_peek_pointer (param_values + 0);
376 data2 = closure->data;
377 }
378
379 callback = (_GDbusCodegenMarshalBoolean_ObjectBooleanBooleanFunc)
380 (marshal_data ? marshal_data : cc->callback);
381
382 v_return =
383 callback (data1,
384 g_marshal_value_peek_object (param_values + 1),
385 g_marshal_value_peek_boolean (param_values + 2),
386 g_marshal_value_peek_boolean (param_values + 3),
387 data2);
388
389 g_value_set_boolean (return_value, v_return);
390 }
391
392 /* ------------------------------------------------------------------------
393 * Code for interface org.freedesktop.timedate1
394 * ------------------------------------------------------------------------
395 */
396
397 /**
398 * SECTION:Timedate1
399 * @title: Timedate1
400 * @short_description: Generated C code for the org.freedesktop.timedate1 D-Bus interface
401 *
402 * 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.
403 */
404
405 /* ---- Introspection data for org.freedesktop.timedate1 ---- */
406
407 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_time_IN_ARG_usec_utc =
408 {
409 {
410 -1,
411 (gchar *) "usec_utc",
412 (gchar *) "x",
413 NULL
414 },
415 FALSE
416 };
417
418 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_time_IN_ARG_relative =
419 {
420 {
421 -1,
422 (gchar *) "relative",
423 (gchar *) "b",
424 NULL
425 },
426 FALSE
427 };
428
429 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_time_IN_ARG_user_interaction =
430 {
431 {
432 -1,
433 (gchar *) "user_interaction",
434 (gchar *) "b",
435 NULL
436 },
437 FALSE
438 };
439
440 static const GDBusArgInfo * const _timedate1_method_info_set_time_IN_ARG_pointers[] =
441 {
442 &_timedate1_method_info_set_time_IN_ARG_usec_utc.parent_struct,
443 &_timedate1_method_info_set_time_IN_ARG_relative.parent_struct,
444 &_timedate1_method_info_set_time_IN_ARG_user_interaction.parent_struct,
445 NULL
446 };
447
448 static const _ExtendedGDBusMethodInfo _timedate1_method_info_set_time =
449 {
450 {
451 -1,
452 (gchar *) "SetTime",
453 (GDBusArgInfo **) &_timedate1_method_info_set_time_IN_ARG_pointers,
454 NULL,
455 NULL
456 },
457 "handle-set-time",
458 FALSE
459 };
460
461 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_timezone_IN_ARG_timezone =
462 {
463 {
464 -1,
465 (gchar *) "timezone",
466 (gchar *) "s",
467 NULL
468 },
469 FALSE
470 };
471
472 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_timezone_IN_ARG_user_interaction =
473 {
474 {
475 -1,
476 (gchar *) "user_interaction",
477 (gchar *) "b",
478 NULL
479 },
480 FALSE
481 };
482
483 static const GDBusArgInfo * const _timedate1_method_info_set_timezone_IN_ARG_pointers[] =
484 {
485 &_timedate1_method_info_set_timezone_IN_ARG_timezone.parent_struct,
486 &_timedate1_method_info_set_timezone_IN_ARG_user_interaction.parent_struct,
487 NULL
488 };
489
490 static const _ExtendedGDBusMethodInfo _timedate1_method_info_set_timezone =
491 {
492 {
493 -1,
494 (gchar *) "SetTimezone",
495 (GDBusArgInfo **) &_timedate1_method_info_set_timezone_IN_ARG_pointers,
496 NULL,
497 NULL
498 },
499 "handle-set-timezone",
500 FALSE
501 };
502
503 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_local_rtc_IN_ARG_local_rtc =
504 {
505 {
506 -1,
507 (gchar *) "local_rtc",
508 (gchar *) "b",
509 NULL
510 },
511 FALSE
512 };
513
514 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_local_rtc_IN_ARG_fix_system =
515 {
516 {
517 -1,
518 (gchar *) "fix_system",
519 (gchar *) "b",
520 NULL
521 },
522 FALSE
523 };
524
525 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_local_rtc_IN_ARG_user_interaction =
526 {
527 {
528 -1,
529 (gchar *) "user_interaction",
530 (gchar *) "b",
531 NULL
532 },
533 FALSE
534 };
535
536 static const GDBusArgInfo * const _timedate1_method_info_set_local_rtc_IN_ARG_pointers[] =
537 {
538 &_timedate1_method_info_set_local_rtc_IN_ARG_local_rtc.parent_struct,
539 &_timedate1_method_info_set_local_rtc_IN_ARG_fix_system.parent_struct,
540 &_timedate1_method_info_set_local_rtc_IN_ARG_user_interaction.parent_struct,
541 NULL
542 };
543
544 static const _ExtendedGDBusMethodInfo _timedate1_method_info_set_local_rtc =
545 {
546 {
547 -1,
548 (gchar *) "SetLocalRTC",
549 (GDBusArgInfo **) &_timedate1_method_info_set_local_rtc_IN_ARG_pointers,
550 NULL,
551 NULL
552 },
553 "handle-set-local-rtc",
554 FALSE
555 };
556
557 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_ntp_IN_ARG_use_ntp =
558 {
559 {
560 -1,
561 (gchar *) "use_ntp",
562 (gchar *) "b",
563 NULL
564 },
565 FALSE
566 };
567
568 static const _ExtendedGDBusArgInfo _timedate1_method_info_set_ntp_IN_ARG_user_interaction =
569 {
570 {
571 -1,
572 (gchar *) "user_interaction",
573 (gchar *) "b",
574 NULL
575 },
576 FALSE
577 };
578
579 static const GDBusArgInfo * const _timedate1_method_info_set_ntp_IN_ARG_pointers[] =
580 {
581 &_timedate1_method_info_set_ntp_IN_ARG_use_ntp.parent_struct,
582 &_timedate1_method_info_set_ntp_IN_ARG_user_interaction.parent_struct,
583 NULL
584 };
585
586 static const _ExtendedGDBusMethodInfo _timedate1_method_info_set_ntp =
587 {
588 {
589 -1,
590 (gchar *) "SetNTP",
591 (GDBusArgInfo **) &_timedate1_method_info_set_ntp_IN_ARG_pointers,
592 NULL,
593 NULL
594 },
595 "handle-set-ntp",
596 FALSE
597 };
598
599 static const GDBusMethodInfo * const _timedate1_method_info_pointers[] =
600 {
601 &_timedate1_method_info_set_time.parent_struct,
602 &_timedate1_method_info_set_timezone.parent_struct,
603 &_timedate1_method_info_set_local_rtc.parent_struct,
604 &_timedate1_method_info_set_ntp.parent_struct,
605 NULL
606 };
607
608 static const _ExtendedGDBusPropertyInfo _timedate1_property_info_timezone =
609 {
610 {
611 -1,
612 (gchar *) "Timezone",
613 (gchar *) "s",
614 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
615 NULL
616 },
617 "timezone",
618 FALSE,
619 TRUE
620 };
621
622 static const _ExtendedGDBusPropertyInfo _timedate1_property_info_local_rtc =
623 {
624 {
625 -1,
626 (gchar *) "LocalRTC",
627 (gchar *) "b",
628 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
629 NULL
630 },
631 "local-rtc",
632 FALSE,
633 TRUE
634 };
635
636 static const _ExtendedGDBusPropertyInfo _timedate1_property_info_can_ntp =
637 {
638 {
639 -1,
640 (gchar *) "CanNTP",
641 (gchar *) "b",
642 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
643 NULL
644 },
645 "can-ntp",
646 FALSE,
647 TRUE
648 };
649
650 static const _ExtendedGDBusPropertyInfo _timedate1_property_info_ntp =
651 {
652 {
653 -1,
654 (gchar *) "NTP",
655 (gchar *) "b",
656 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
657 NULL
658 },
659 "ntp",
660 FALSE,
661 TRUE
662 };
663
664 static const GDBusPropertyInfo * const _timedate1_property_info_pointers[] =
665 {
666 &_timedate1_property_info_timezone.parent_struct,
667 &_timedate1_property_info_local_rtc.parent_struct,
668 &_timedate1_property_info_can_ntp.parent_struct,
669 &_timedate1_property_info_ntp.parent_struct,
670 NULL
671 };
672
673 static const _ExtendedGDBusInterfaceInfo _timedate1_interface_info =
674 {
675 {
676 -1,
677 (gchar *) "org.freedesktop.timedate1",
678 (GDBusMethodInfo **) &_timedate1_method_info_pointers,
679 NULL,
680 (GDBusPropertyInfo **) &_timedate1_property_info_pointers,
681 NULL
682 },
683 "timedate1",
684 };
685
686
687 /**
688 * timedate1_interface_info:
689 *
690 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-timedate1.top_of_page">org.freedesktop.timedate1</link> D-Bus interface.
691 *
692 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
693 */
694 GDBusInterfaceInfo *
695 timedate1_interface_info (void)
696 {
697 return (GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct;
698 }
699
700 /**
701 * timedate1_override_properties:
702 * @klass: The class structure for a #GObject derived class.
703 * @property_id_begin: The property id to assign to the first overridden property.
704 *
705 * Overrides all #GObject properties in the #Timedate1 interface for a concrete class.
706 * The properties are overridden in the order they are defined.
707 *
708 * Returns: The last property id.
709 */
710 guint
711 timedate1_override_properties (GObjectClass *klass, guint property_id_begin)
712 {
713 g_object_class_override_property (klass, property_id_begin++, "timezone");
714 g_object_class_override_property (klass, property_id_begin++, "local-rtc");
715 g_object_class_override_property (klass, property_id_begin++, "can-ntp");
716 g_object_class_override_property (klass, property_id_begin++, "ntp");
717 return property_id_begin - 1;
718 }
719
720
721 inline static void
722 timedate1_method_marshal_set_time (
723 GClosure *closure,
724 GValue *return_value,
725 unsigned int n_param_values,
726 const GValue *param_values,
727 void *invocation_hint,
728 void *marshal_data)
729 {
730 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_INT64_BOOLEAN_BOOLEAN (closure,
731 return_value, n_param_values, param_values, invocation_hint, marshal_data);
732 }
733
734 inline static void
735 timedate1_method_marshal_set_timezone (
736 GClosure *closure,
737 GValue *return_value,
738 unsigned int n_param_values,
739 const GValue *param_values,
740 void *invocation_hint,
741 void *marshal_data)
742 {
743 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_BOOLEAN (closure,
744 return_value, n_param_values, param_values, invocation_hint, marshal_data);
745 }
746
747 inline static void
748 timedate1_method_marshal_set_local_rtc (
749 GClosure *closure,
750 GValue *return_value,
751 unsigned int n_param_values,
752 const GValue *param_values,
753 void *invocation_hint,
754 void *marshal_data)
755 {
756 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_BOOLEAN_BOOLEAN_BOOLEAN (closure,
757 return_value, n_param_values, param_values, invocation_hint, marshal_data);
758 }
759
760 inline static void
761 timedate1_method_marshal_set_ntp (
762 GClosure *closure,
763 GValue *return_value,
764 unsigned int n_param_values,
765 const GValue *param_values,
766 void *invocation_hint,
767 void *marshal_data)
768 {
769 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_BOOLEAN_BOOLEAN (closure,
770 return_value, n_param_values, param_values, invocation_hint, marshal_data);
771 }
772
773
774 /**
775 * Timedate1:
776 *
777 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-timedate1.top_of_page">org.freedesktop.timedate1</link>.
778 */
779
780 /**
781 * Timedate1Iface:
782 * @parent_iface: The parent interface.
783 * @handle_set_local_rtc: Handler for the #Timedate1::handle-set-local-rtc signal.
784 * @handle_set_ntp: Handler for the #Timedate1::handle-set-ntp signal.
785 * @handle_set_time: Handler for the #Timedate1::handle-set-time signal.
786 * @handle_set_timezone: Handler for the #Timedate1::handle-set-timezone signal.
787 * @get_can_ntp: Getter for the #Timedate1:can-ntp property.
788 * @get_local_rtc: Getter for the #Timedate1:local-rtc property.
789 * @get_ntp: Getter for the #Timedate1:ntp property.
790 * @get_timezone: Getter for the #Timedate1:timezone property.
791 *
792 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-timedate1.top_of_page">org.freedesktop.timedate1</link>.
793 */
794
795 typedef Timedate1Iface Timedate1Interface;
796 G_DEFINE_INTERFACE (Timedate1, timedate1, G_TYPE_OBJECT)
797
798 static void
799 timedate1_default_init (Timedate1Iface *iface)
800 {
801 /* GObject signals for incoming D-Bus method calls: */
802 /**
803 * Timedate1::handle-set-time:
804 * @object: A #Timedate1.
805 * @invocation: A #GDBusMethodInvocation.
806 * @arg_usec_utc: Argument passed by remote caller.
807 * @arg_relative: Argument passed by remote caller.
808 * @arg_user_interaction: Argument passed by remote caller.
809 *
810 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-timedate1.SetTime">SetTime()</link> D-Bus method.
811 *
812 * 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 timedate1_complete_set_time() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
813 *
814 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
815 */
816 g_signal_new ("handle-set-time",
817 G_TYPE_FROM_INTERFACE (iface),
818 G_SIGNAL_RUN_LAST,
819 G_STRUCT_OFFSET (Timedate1Iface, handle_set_time),
820 g_signal_accumulator_true_handled,
821 NULL,
822 timedate1_method_marshal_set_time,
823 G_TYPE_BOOLEAN,
824 4,
825 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT64, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
826
827 /**
828 * Timedate1::handle-set-timezone:
829 * @object: A #Timedate1.
830 * @invocation: A #GDBusMethodInvocation.
831 * @arg_timezone: Argument passed by remote caller.
832 * @arg_user_interaction: Argument passed by remote caller.
833 *
834 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-timedate1.SetTimezone">SetTimezone()</link> D-Bus method.
835 *
836 * 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 timedate1_complete_set_timezone() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
837 *
838 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
839 */
840 g_signal_new ("handle-set-timezone",
841 G_TYPE_FROM_INTERFACE (iface),
842 G_SIGNAL_RUN_LAST,
843 G_STRUCT_OFFSET (Timedate1Iface, handle_set_timezone),
844 g_signal_accumulator_true_handled,
845 NULL,
846 timedate1_method_marshal_set_timezone,
847 G_TYPE_BOOLEAN,
848 3,
849 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_BOOLEAN);
850
851 /**
852 * Timedate1::handle-set-local-rtc:
853 * @object: A #Timedate1.
854 * @invocation: A #GDBusMethodInvocation.
855 * @arg_local_rtc: Argument passed by remote caller.
856 * @arg_fix_system: Argument passed by remote caller.
857 * @arg_user_interaction: Argument passed by remote caller.
858 *
859 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-timedate1.SetLocalRTC">SetLocalRTC()</link> D-Bus method.
860 *
861 * 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 timedate1_complete_set_local_rtc() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
862 *
863 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
864 */
865 g_signal_new ("handle-set-local-rtc",
866 G_TYPE_FROM_INTERFACE (iface),
867 G_SIGNAL_RUN_LAST,
868 G_STRUCT_OFFSET (Timedate1Iface, handle_set_local_rtc),
869 g_signal_accumulator_true_handled,
870 NULL,
871 timedate1_method_marshal_set_local_rtc,
872 G_TYPE_BOOLEAN,
873 4,
874 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
875
876 /**
877 * Timedate1::handle-set-ntp:
878 * @object: A #Timedate1.
879 * @invocation: A #GDBusMethodInvocation.
880 * @arg_use_ntp: Argument passed by remote caller.
881 * @arg_user_interaction: Argument passed by remote caller.
882 *
883 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-timedate1.SetNTP">SetNTP()</link> D-Bus method.
884 *
885 * 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 timedate1_complete_set_ntp() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
886 *
887 * Returns: %G_DBUS_METHOD_INVOCATION_HANDLED or %TRUE if the invocation was handled, %G_DBUS_METHOD_INVOCATION_UNHANDLED or %FALSE to let other signal handlers run.
888 */
889 g_signal_new ("handle-set-ntp",
890 G_TYPE_FROM_INTERFACE (iface),
891 G_SIGNAL_RUN_LAST,
892 G_STRUCT_OFFSET (Timedate1Iface, handle_set_ntp),
893 g_signal_accumulator_true_handled,
894 NULL,
895 timedate1_method_marshal_set_ntp,
896 G_TYPE_BOOLEAN,
897 3,
898 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
899
900 /* GObject properties for D-Bus properties: */
901 /**
902 * Timedate1:timezone:
903 *
904 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-timedate1.Timezone">"Timezone"</link>.
905 *
906 * 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.
907 */
908 g_object_interface_install_property (iface,
909 g_param_spec_string ("timezone", "Timezone", "Timezone", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
910 /**
911 * Timedate1:local-rtc:
912 *
913 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-timedate1.LocalRTC">"LocalRTC"</link>.
914 *
915 * 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.
916 */
917 g_object_interface_install_property (iface,
918 g_param_spec_boolean ("local-rtc", "LocalRTC", "LocalRTC", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
919 /**
920 * Timedate1:can-ntp:
921 *
922 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-timedate1.CanNTP">"CanNTP"</link>.
923 *
924 * 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.
925 */
926 g_object_interface_install_property (iface,
927 g_param_spec_boolean ("can-ntp", "CanNTP", "CanNTP", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
928 /**
929 * Timedate1:ntp:
930 *
931 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-timedate1.NTP">"NTP"</link>.
932 *
933 * 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.
934 */
935 g_object_interface_install_property (iface,
936 g_param_spec_boolean ("ntp", "NTP", "NTP", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
937 }
938
939 /**
940 * timedate1_get_timezone: (skip)
941 * @object: A #Timedate1.
942 *
943 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-timedate1.Timezone">"Timezone"</link> D-Bus property.
944 *
945 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
946 *
947 * 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 timedate1_dup_timezone() if on another thread.
948 *
949 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
950 */
951 const gchar *
952 timedate1_get_timezone (Timedate1 *object)
953 {
954 g_return_val_if_fail (IS_TIMEDATE1 (object), NULL);
955
956 return TIMEDATE1_GET_IFACE (object)->get_timezone (object);
957 }
958
959 /**
960 * timedate1_dup_timezone: (skip)
961 * @object: A #Timedate1.
962 *
963 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-timedate1.Timezone">"Timezone"</link> D-Bus property.
964 *
965 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
966 *
967 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
968 */
969 gchar *
970 timedate1_dup_timezone (Timedate1 *object)
971 {
972 gchar *value;
973 g_object_get (G_OBJECT (object), "timezone", &value, NULL);
974 return value;
975 }
976
977 /**
978 * timedate1_set_timezone: (skip)
979 * @object: A #Timedate1.
980 * @value: The value to set.
981 *
982 * Sets the <link linkend="gdbus-property-org-freedesktop-timedate1.Timezone">"Timezone"</link> D-Bus property to @value.
983 *
984 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
985 */
986 void
987 timedate1_set_timezone (Timedate1 *object, const gchar *value)
988 {
989 g_object_set (G_OBJECT (object), "timezone", value, NULL);
990 }
991
992 /**
993 * timedate1_get_local_rtc: (skip)
994 * @object: A #Timedate1.
995 *
996 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-timedate1.LocalRTC">"LocalRTC"</link> D-Bus property.
997 *
998 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
999 *
1000 * Returns: The property value.
1001 */
1002 gboolean
1003 timedate1_get_local_rtc (Timedate1 *object)
1004 {
1005 g_return_val_if_fail (IS_TIMEDATE1 (object), FALSE);
1006
1007 return TIMEDATE1_GET_IFACE (object)->get_local_rtc (object);
1008 }
1009
1010 /**
1011 * timedate1_set_local_rtc: (skip)
1012 * @object: A #Timedate1.
1013 * @value: The value to set.
1014 *
1015 * Sets the <link linkend="gdbus-property-org-freedesktop-timedate1.LocalRTC">"LocalRTC"</link> D-Bus property to @value.
1016 *
1017 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1018 */
1019 void
1020 timedate1_set_local_rtc (Timedate1 *object, gboolean value)
1021 {
1022 g_object_set (G_OBJECT (object), "local-rtc", value, NULL);
1023 }
1024
1025 /**
1026 * timedate1_get_can_ntp: (skip)
1027 * @object: A #Timedate1.
1028 *
1029 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-timedate1.CanNTP">"CanNTP"</link> D-Bus property.
1030 *
1031 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1032 *
1033 * Returns: The property value.
1034 */
1035 gboolean
1036 timedate1_get_can_ntp (Timedate1 *object)
1037 {
1038 g_return_val_if_fail (IS_TIMEDATE1 (object), FALSE);
1039
1040 return TIMEDATE1_GET_IFACE (object)->get_can_ntp (object);
1041 }
1042
1043 /**
1044 * timedate1_set_can_ntp: (skip)
1045 * @object: A #Timedate1.
1046 * @value: The value to set.
1047 *
1048 * Sets the <link linkend="gdbus-property-org-freedesktop-timedate1.CanNTP">"CanNTP"</link> D-Bus property to @value.
1049 *
1050 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1051 */
1052 void
1053 timedate1_set_can_ntp (Timedate1 *object, gboolean value)
1054 {
1055 g_object_set (G_OBJECT (object), "can-ntp", value, NULL);
1056 }
1057
1058 /**
1059 * timedate1_get_ntp: (skip)
1060 * @object: A #Timedate1.
1061 *
1062 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-timedate1.NTP">"NTP"</link> D-Bus property.
1063 *
1064 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1065 *
1066 * Returns: The property value.
1067 */
1068 gboolean
1069 timedate1_get_ntp (Timedate1 *object)
1070 {
1071 g_return_val_if_fail (IS_TIMEDATE1 (object), FALSE);
1072
1073 return TIMEDATE1_GET_IFACE (object)->get_ntp (object);
1074 }
1075
1076 /**
1077 * timedate1_set_ntp: (skip)
1078 * @object: A #Timedate1.
1079 * @value: The value to set.
1080 *
1081 * Sets the <link linkend="gdbus-property-org-freedesktop-timedate1.NTP">"NTP"</link> D-Bus property to @value.
1082 *
1083 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1084 */
1085 void
1086 timedate1_set_ntp (Timedate1 *object, gboolean value)
1087 {
1088 g_object_set (G_OBJECT (object), "ntp", value, NULL);
1089 }
1090
1091 /**
1092 * timedate1_call_set_time:
1093 * @proxy: A #Timedate1Proxy.
1094 * @arg_usec_utc: Argument to pass with the method invocation.
1095 * @arg_relative: Argument to pass with the method invocation.
1096 * @arg_user_interaction: Argument to pass with the method invocation.
1097 * @cancellable: (nullable): A #GCancellable or %NULL.
1098 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1099 * @user_data: User data to pass to @callback.
1100 *
1101 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-timedate1.SetTime">SetTime()</link> D-Bus method on @proxy.
1102 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1103 * You can then call timedate1_call_set_time_finish() to get the result of the operation.
1104 *
1105 * See timedate1_call_set_time_sync() for the synchronous, blocking version of this method.
1106 */
1107 void
1108 timedate1_call_set_time (
1109 Timedate1 *proxy,
1110 gint64 arg_usec_utc,
1111 gboolean arg_relative,
1112 gboolean arg_user_interaction,
1113 GCancellable *cancellable,
1114 GAsyncReadyCallback callback,
1115 gpointer user_data)
1116 {
1117 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1118 "SetTime",
1119 g_variant_new ("(xbb)",
1120 arg_usec_utc,
1121 arg_relative,
1122 arg_user_interaction),
1123 G_DBUS_CALL_FLAGS_NONE,
1124 -1,
1125 cancellable,
1126 callback,
1127 user_data);
1128 }
1129
1130 /**
1131 * timedate1_call_set_time_finish:
1132 * @proxy: A #Timedate1Proxy.
1133 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_call_set_time().
1134 * @error: Return location for error or %NULL.
1135 *
1136 * Finishes an operation started with timedate1_call_set_time().
1137 *
1138 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1139 */
1140 gboolean
1141 timedate1_call_set_time_finish (
1142 Timedate1 *proxy,
1143 GAsyncResult *res,
1144 GError **error)
1145 {
1146 GVariant *_ret;
1147 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1148 if (_ret == NULL)
1149 goto _out;
1150 g_variant_get (_ret,
1151 "()");
1152 g_variant_unref (_ret);
1153 _out:
1154 return _ret != NULL;
1155 }
1156
1157 /**
1158 * timedate1_call_set_time_sync:
1159 * @proxy: A #Timedate1Proxy.
1160 * @arg_usec_utc: Argument to pass with the method invocation.
1161 * @arg_relative: Argument to pass with the method invocation.
1162 * @arg_user_interaction: Argument to pass with the method invocation.
1163 * @cancellable: (nullable): A #GCancellable or %NULL.
1164 * @error: Return location for error or %NULL.
1165 *
1166 * 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.
1167 *
1168 * See timedate1_call_set_time() for the asynchronous version of this method.
1169 *
1170 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1171 */
1172 gboolean
1173 timedate1_call_set_time_sync (
1174 Timedate1 *proxy,
1175 gint64 arg_usec_utc,
1176 gboolean arg_relative,
1177 gboolean arg_user_interaction,
1178 GCancellable *cancellable,
1179 GError **error)
1180 {
1181 GVariant *_ret;
1182 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1183 "SetTime",
1184 g_variant_new ("(xbb)",
1185 arg_usec_utc,
1186 arg_relative,
1187 arg_user_interaction),
1188 G_DBUS_CALL_FLAGS_NONE,
1189 -1,
1190 cancellable,
1191 error);
1192 if (_ret == NULL)
1193 goto _out;
1194 g_variant_get (_ret,
1195 "()");
1196 g_variant_unref (_ret);
1197 _out:
1198 return _ret != NULL;
1199 }
1200
1201 /**
1202 * timedate1_call_set_timezone:
1203 * @proxy: A #Timedate1Proxy.
1204 * @arg_timezone: Argument to pass with the method invocation.
1205 * @arg_user_interaction: Argument to pass with the method invocation.
1206 * @cancellable: (nullable): A #GCancellable or %NULL.
1207 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1208 * @user_data: User data to pass to @callback.
1209 *
1210 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-timedate1.SetTimezone">SetTimezone()</link> D-Bus method on @proxy.
1211 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1212 * You can then call timedate1_call_set_timezone_finish() to get the result of the operation.
1213 *
1214 * See timedate1_call_set_timezone_sync() for the synchronous, blocking version of this method.
1215 */
1216 void
1217 timedate1_call_set_timezone (
1218 Timedate1 *proxy,
1219 const gchar *arg_timezone,
1220 gboolean arg_user_interaction,
1221 GCancellable *cancellable,
1222 GAsyncReadyCallback callback,
1223 gpointer user_data)
1224 {
1225 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1226 "SetTimezone",
1227 g_variant_new ("(sb)",
1228 arg_timezone,
1229 arg_user_interaction),
1230 G_DBUS_CALL_FLAGS_NONE,
1231 -1,
1232 cancellable,
1233 callback,
1234 user_data);
1235 }
1236
1237 /**
1238 * timedate1_call_set_timezone_finish:
1239 * @proxy: A #Timedate1Proxy.
1240 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_call_set_timezone().
1241 * @error: Return location for error or %NULL.
1242 *
1243 * Finishes an operation started with timedate1_call_set_timezone().
1244 *
1245 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1246 */
1247 gboolean
1248 timedate1_call_set_timezone_finish (
1249 Timedate1 *proxy,
1250 GAsyncResult *res,
1251 GError **error)
1252 {
1253 GVariant *_ret;
1254 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1255 if (_ret == NULL)
1256 goto _out;
1257 g_variant_get (_ret,
1258 "()");
1259 g_variant_unref (_ret);
1260 _out:
1261 return _ret != NULL;
1262 }
1263
1264 /**
1265 * timedate1_call_set_timezone_sync:
1266 * @proxy: A #Timedate1Proxy.
1267 * @arg_timezone: Argument to pass with the method invocation.
1268 * @arg_user_interaction: Argument to pass with the method invocation.
1269 * @cancellable: (nullable): A #GCancellable or %NULL.
1270 * @error: Return location for error or %NULL.
1271 *
1272 * 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.
1273 *
1274 * See timedate1_call_set_timezone() for the asynchronous version of this method.
1275 *
1276 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1277 */
1278 gboolean
1279 timedate1_call_set_timezone_sync (
1280 Timedate1 *proxy,
1281 const gchar *arg_timezone,
1282 gboolean arg_user_interaction,
1283 GCancellable *cancellable,
1284 GError **error)
1285 {
1286 GVariant *_ret;
1287 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1288 "SetTimezone",
1289 g_variant_new ("(sb)",
1290 arg_timezone,
1291 arg_user_interaction),
1292 G_DBUS_CALL_FLAGS_NONE,
1293 -1,
1294 cancellable,
1295 error);
1296 if (_ret == NULL)
1297 goto _out;
1298 g_variant_get (_ret,
1299 "()");
1300 g_variant_unref (_ret);
1301 _out:
1302 return _ret != NULL;
1303 }
1304
1305 /**
1306 * timedate1_call_set_local_rtc:
1307 * @proxy: A #Timedate1Proxy.
1308 * @arg_local_rtc: Argument to pass with the method invocation.
1309 * @arg_fix_system: Argument to pass with the method invocation.
1310 * @arg_user_interaction: Argument to pass with the method invocation.
1311 * @cancellable: (nullable): A #GCancellable or %NULL.
1312 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1313 * @user_data: User data to pass to @callback.
1314 *
1315 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-timedate1.SetLocalRTC">SetLocalRTC()</link> D-Bus method on @proxy.
1316 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1317 * You can then call timedate1_call_set_local_rtc_finish() to get the result of the operation.
1318 *
1319 * See timedate1_call_set_local_rtc_sync() for the synchronous, blocking version of this method.
1320 */
1321 void
1322 timedate1_call_set_local_rtc (
1323 Timedate1 *proxy,
1324 gboolean arg_local_rtc,
1325 gboolean arg_fix_system,
1326 gboolean arg_user_interaction,
1327 GCancellable *cancellable,
1328 GAsyncReadyCallback callback,
1329 gpointer user_data)
1330 {
1331 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1332 "SetLocalRTC",
1333 g_variant_new ("(bbb)",
1334 arg_local_rtc,
1335 arg_fix_system,
1336 arg_user_interaction),
1337 G_DBUS_CALL_FLAGS_NONE,
1338 -1,
1339 cancellable,
1340 callback,
1341 user_data);
1342 }
1343
1344 /**
1345 * timedate1_call_set_local_rtc_finish:
1346 * @proxy: A #Timedate1Proxy.
1347 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_call_set_local_rtc().
1348 * @error: Return location for error or %NULL.
1349 *
1350 * Finishes an operation started with timedate1_call_set_local_rtc().
1351 *
1352 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1353 */
1354 gboolean
1355 timedate1_call_set_local_rtc_finish (
1356 Timedate1 *proxy,
1357 GAsyncResult *res,
1358 GError **error)
1359 {
1360 GVariant *_ret;
1361 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1362 if (_ret == NULL)
1363 goto _out;
1364 g_variant_get (_ret,
1365 "()");
1366 g_variant_unref (_ret);
1367 _out:
1368 return _ret != NULL;
1369 }
1370
1371 /**
1372 * timedate1_call_set_local_rtc_sync:
1373 * @proxy: A #Timedate1Proxy.
1374 * @arg_local_rtc: Argument to pass with the method invocation.
1375 * @arg_fix_system: Argument to pass with the method invocation.
1376 * @arg_user_interaction: Argument to pass with the method invocation.
1377 * @cancellable: (nullable): A #GCancellable or %NULL.
1378 * @error: Return location for error or %NULL.
1379 *
1380 * 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.
1381 *
1382 * See timedate1_call_set_local_rtc() for the asynchronous version of this method.
1383 *
1384 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1385 */
1386 gboolean
1387 timedate1_call_set_local_rtc_sync (
1388 Timedate1 *proxy,
1389 gboolean arg_local_rtc,
1390 gboolean arg_fix_system,
1391 gboolean arg_user_interaction,
1392 GCancellable *cancellable,
1393 GError **error)
1394 {
1395 GVariant *_ret;
1396 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1397 "SetLocalRTC",
1398 g_variant_new ("(bbb)",
1399 arg_local_rtc,
1400 arg_fix_system,
1401 arg_user_interaction),
1402 G_DBUS_CALL_FLAGS_NONE,
1403 -1,
1404 cancellable,
1405 error);
1406 if (_ret == NULL)
1407 goto _out;
1408 g_variant_get (_ret,
1409 "()");
1410 g_variant_unref (_ret);
1411 _out:
1412 return _ret != NULL;
1413 }
1414
1415 /**
1416 * timedate1_call_set_ntp:
1417 * @proxy: A #Timedate1Proxy.
1418 * @arg_use_ntp: Argument to pass with the method invocation.
1419 * @arg_user_interaction: Argument to pass with the method invocation.
1420 * @cancellable: (nullable): A #GCancellable or %NULL.
1421 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1422 * @user_data: User data to pass to @callback.
1423 *
1424 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-timedate1.SetNTP">SetNTP()</link> D-Bus method on @proxy.
1425 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1426 * You can then call timedate1_call_set_ntp_finish() to get the result of the operation.
1427 *
1428 * See timedate1_call_set_ntp_sync() for the synchronous, blocking version of this method.
1429 */
1430 void
1431 timedate1_call_set_ntp (
1432 Timedate1 *proxy,
1433 gboolean arg_use_ntp,
1434 gboolean arg_user_interaction,
1435 GCancellable *cancellable,
1436 GAsyncReadyCallback callback,
1437 gpointer user_data)
1438 {
1439 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1440 "SetNTP",
1441 g_variant_new ("(bb)",
1442 arg_use_ntp,
1443 arg_user_interaction),
1444 G_DBUS_CALL_FLAGS_NONE,
1445 -1,
1446 cancellable,
1447 callback,
1448 user_data);
1449 }
1450
1451 /**
1452 * timedate1_call_set_ntp_finish:
1453 * @proxy: A #Timedate1Proxy.
1454 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_call_set_ntp().
1455 * @error: Return location for error or %NULL.
1456 *
1457 * Finishes an operation started with timedate1_call_set_ntp().
1458 *
1459 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1460 */
1461 gboolean
1462 timedate1_call_set_ntp_finish (
1463 Timedate1 *proxy,
1464 GAsyncResult *res,
1465 GError **error)
1466 {
1467 GVariant *_ret;
1468 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1469 if (_ret == NULL)
1470 goto _out;
1471 g_variant_get (_ret,
1472 "()");
1473 g_variant_unref (_ret);
1474 _out:
1475 return _ret != NULL;
1476 }
1477
1478 /**
1479 * timedate1_call_set_ntp_sync:
1480 * @proxy: A #Timedate1Proxy.
1481 * @arg_use_ntp: Argument to pass with the method invocation.
1482 * @arg_user_interaction: Argument to pass with the method invocation.
1483 * @cancellable: (nullable): A #GCancellable or %NULL.
1484 * @error: Return location for error or %NULL.
1485 *
1486 * 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.
1487 *
1488 * See timedate1_call_set_ntp() for the asynchronous version of this method.
1489 *
1490 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1491 */
1492 gboolean
1493 timedate1_call_set_ntp_sync (
1494 Timedate1 *proxy,
1495 gboolean arg_use_ntp,
1496 gboolean arg_user_interaction,
1497 GCancellable *cancellable,
1498 GError **error)
1499 {
1500 GVariant *_ret;
1501 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1502 "SetNTP",
1503 g_variant_new ("(bb)",
1504 arg_use_ntp,
1505 arg_user_interaction),
1506 G_DBUS_CALL_FLAGS_NONE,
1507 -1,
1508 cancellable,
1509 error);
1510 if (_ret == NULL)
1511 goto _out;
1512 g_variant_get (_ret,
1513 "()");
1514 g_variant_unref (_ret);
1515 _out:
1516 return _ret != NULL;
1517 }
1518
1519 /**
1520 * timedate1_complete_set_time:
1521 * @object: A #Timedate1.
1522 * @invocation: (transfer full): A #GDBusMethodInvocation.
1523 *
1524 * 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.
1525 *
1526 * This method will free @invocation, you cannot use it afterwards.
1527 */
1528 void
1529 timedate1_complete_set_time (
1530 Timedate1 *object G_GNUC_UNUSED,
1531 GDBusMethodInvocation *invocation)
1532 {
1533 g_dbus_method_invocation_return_value (invocation,
1534 g_variant_new ("()"));
1535 }
1536
1537 /**
1538 * timedate1_complete_set_timezone:
1539 * @object: A #Timedate1.
1540 * @invocation: (transfer full): A #GDBusMethodInvocation.
1541 *
1542 * 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.
1543 *
1544 * This method will free @invocation, you cannot use it afterwards.
1545 */
1546 void
1547 timedate1_complete_set_timezone (
1548 Timedate1 *object G_GNUC_UNUSED,
1549 GDBusMethodInvocation *invocation)
1550 {
1551 g_dbus_method_invocation_return_value (invocation,
1552 g_variant_new ("()"));
1553 }
1554
1555 /**
1556 * timedate1_complete_set_local_rtc:
1557 * @object: A #Timedate1.
1558 * @invocation: (transfer full): A #GDBusMethodInvocation.
1559 *
1560 * 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.
1561 *
1562 * This method will free @invocation, you cannot use it afterwards.
1563 */
1564 void
1565 timedate1_complete_set_local_rtc (
1566 Timedate1 *object G_GNUC_UNUSED,
1567 GDBusMethodInvocation *invocation)
1568 {
1569 g_dbus_method_invocation_return_value (invocation,
1570 g_variant_new ("()"));
1571 }
1572
1573 /**
1574 * timedate1_complete_set_ntp:
1575 * @object: A #Timedate1.
1576 * @invocation: (transfer full): A #GDBusMethodInvocation.
1577 *
1578 * 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.
1579 *
1580 * This method will free @invocation, you cannot use it afterwards.
1581 */
1582 void
1583 timedate1_complete_set_ntp (
1584 Timedate1 *object G_GNUC_UNUSED,
1585 GDBusMethodInvocation *invocation)
1586 {
1587 g_dbus_method_invocation_return_value (invocation,
1588 g_variant_new ("()"));
1589 }
1590
1591 /* ------------------------------------------------------------------------ */
1592
1593 /**
1594 * Timedate1Proxy:
1595 *
1596 * The #Timedate1Proxy structure contains only private data and should only be accessed using the provided API.
1597 */
1598
1599 /**
1600 * Timedate1ProxyClass:
1601 * @parent_class: The parent class.
1602 *
1603 * Class structure for #Timedate1Proxy.
1604 */
1605
1606 struct _Timedate1ProxyPrivate
1607 {
1608 GData *qdata;
1609 };
1610
1611 static void timedate1_proxy_iface_init (Timedate1Iface *iface);
1612
1613 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1614 G_DEFINE_TYPE_WITH_CODE (Timedate1Proxy, timedate1_proxy, G_TYPE_DBUS_PROXY,
1615 G_ADD_PRIVATE (Timedate1Proxy)
1616 G_IMPLEMENT_INTERFACE (TYPE_TIMEDATE1, timedate1_proxy_iface_init))
1617
1618 #else
1619 G_DEFINE_TYPE_WITH_CODE (Timedate1Proxy, timedate1_proxy, G_TYPE_DBUS_PROXY,
1620 G_IMPLEMENT_INTERFACE (TYPE_TIMEDATE1, timedate1_proxy_iface_init))
1621
1622 #endif
1623 static void
1624 timedate1_proxy_finalize (GObject *object)
1625 {
1626 Timedate1Proxy *proxy = TIMEDATE1_PROXY (object);
1627 g_datalist_clear (&proxy->priv->qdata);
1628 G_OBJECT_CLASS (timedate1_proxy_parent_class)->finalize (object);
1629 }
1630
1631 static void
1632 timedate1_proxy_get_property (GObject *object,
1633 guint prop_id,
1634 GValue *value,
1635 GParamSpec *pspec G_GNUC_UNUSED)
1636 {
1637 const _ExtendedGDBusPropertyInfo *info;
1638 GVariant *variant;
1639 g_assert (prop_id != 0 && prop_id - 1 < 4);
1640 info = (const _ExtendedGDBusPropertyInfo *) _timedate1_property_info_pointers[prop_id - 1];
1641 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1642 if (info->use_gvariant)
1643 {
1644 g_value_set_variant (value, variant);
1645 }
1646 else
1647 {
1648 if (variant != NULL)
1649 g_dbus_gvariant_to_gvalue (variant, value);
1650 }
1651 if (variant != NULL)
1652 g_variant_unref (variant);
1653 }
1654
1655 static void
1656 timedate1_proxy_set_property_cb (GDBusProxy *proxy,
1657 GAsyncResult *res,
1658 gpointer user_data)
1659 {
1660 const _ExtendedGDBusPropertyInfo *info = user_data;
1661 GError *error;
1662 GVariant *_ret;
1663 error = NULL;
1664 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1665 if (!_ret)
1666 {
1667 g_warning ("Error setting property '%s' on interface org.freedesktop.timedate1: %s (%s, %d)",
1668 info->parent_struct.name,
1669 error->message, g_quark_to_string (error->domain), error->code);
1670 g_error_free (error);
1671 }
1672 else
1673 {
1674 g_variant_unref (_ret);
1675 }
1676 }
1677
1678 static void
1679 timedate1_proxy_set_property (GObject *object,
1680 guint prop_id,
1681 const GValue *value,
1682 GParamSpec *pspec G_GNUC_UNUSED)
1683 {
1684 const _ExtendedGDBusPropertyInfo *info;
1685 GVariant *variant;
1686 g_assert (prop_id != 0 && prop_id - 1 < 4);
1687 info = (const _ExtendedGDBusPropertyInfo *) _timedate1_property_info_pointers[prop_id - 1];
1688 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1689 g_dbus_proxy_call (G_DBUS_PROXY (object),
1690 "org.freedesktop.DBus.Properties.Set",
1691 g_variant_new ("(ssv)", "org.freedesktop.timedate1", info->parent_struct.name, variant),
1692 G_DBUS_CALL_FLAGS_NONE,
1693 -1,
1694 NULL, (GAsyncReadyCallback) timedate1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1695 g_variant_unref (variant);
1696 }
1697
1698 static void
1699 timedate1_proxy_g_signal (GDBusProxy *proxy,
1700 const gchar *sender_name G_GNUC_UNUSED,
1701 const gchar *signal_name,
1702 GVariant *parameters)
1703 {
1704 _ExtendedGDBusSignalInfo *info;
1705 GVariantIter iter;
1706 GVariant *child;
1707 GValue *paramv;
1708 gsize num_params;
1709 gsize n;
1710 guint signal_id;
1711 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct, signal_name);
1712 if (info == NULL)
1713 return;
1714 num_params = g_variant_n_children (parameters);
1715 paramv = g_new0 (GValue, num_params + 1);
1716 g_value_init (&paramv[0], TYPE_TIMEDATE1);
1717 g_value_set_object (&paramv[0], proxy);
1718 g_variant_iter_init (&iter, parameters);
1719 n = 1;
1720 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1721 {
1722 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1723 if (arg_info->use_gvariant)
1724 {
1725 g_value_init (&paramv[n], G_TYPE_VARIANT);
1726 g_value_set_variant (&paramv[n], child);
1727 n++;
1728 }
1729 else
1730 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1731 g_variant_unref (child);
1732 }
1733 signal_id = g_signal_lookup (info->signal_name, TYPE_TIMEDATE1);
1734 g_signal_emitv (paramv, signal_id, 0, NULL);
1735 for (n = 0; n < num_params + 1; n++)
1736 g_value_unset (&paramv[n]);
1737 g_free (paramv);
1738 }
1739
1740 static void
1741 timedate1_proxy_g_properties_changed (GDBusProxy *_proxy,
1742 GVariant *changed_properties,
1743 const gchar *const *invalidated_properties)
1744 {
1745 Timedate1Proxy *proxy = TIMEDATE1_PROXY (_proxy);
1746 guint n;
1747 const gchar *key;
1748 GVariantIter *iter;
1749 _ExtendedGDBusPropertyInfo *info;
1750 g_variant_get (changed_properties, "a{sv}", &iter);
1751 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1752 {
1753 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct, key);
1754 g_datalist_remove_data (&proxy->priv->qdata, key);
1755 if (info != NULL)
1756 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1757 }
1758 g_variant_iter_free (iter);
1759 for (n = 0; invalidated_properties[n] != NULL; n++)
1760 {
1761 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct, invalidated_properties[n]);
1762 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1763 if (info != NULL)
1764 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1765 }
1766 }
1767
1768 static const gchar *
1769 timedate1_proxy_get_timezone (Timedate1 *object)
1770 {
1771 Timedate1Proxy *proxy = TIMEDATE1_PROXY (object);
1772 GVariant *variant;
1773 const gchar *value = NULL;
1774 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Timezone");
1775 if (variant != NULL)
1776 {
1777 value = g_variant_get_string (variant, NULL);
1778 g_variant_unref (variant);
1779 }
1780 return value;
1781 }
1782
1783 static gboolean
1784 timedate1_proxy_get_local_rtc (Timedate1 *object)
1785 {
1786 Timedate1Proxy *proxy = TIMEDATE1_PROXY (object);
1787 GVariant *variant;
1788 gboolean value = FALSE;
1789 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LocalRTC");
1790 if (variant != NULL)
1791 {
1792 value = g_variant_get_boolean (variant);
1793 g_variant_unref (variant);
1794 }
1795 return value;
1796 }
1797
1798 static gboolean
1799 timedate1_proxy_get_can_ntp (Timedate1 *object)
1800 {
1801 Timedate1Proxy *proxy = TIMEDATE1_PROXY (object);
1802 GVariant *variant;
1803 gboolean value = FALSE;
1804 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "CanNTP");
1805 if (variant != NULL)
1806 {
1807 value = g_variant_get_boolean (variant);
1808 g_variant_unref (variant);
1809 }
1810 return value;
1811 }
1812
1813 static gboolean
1814 timedate1_proxy_get_ntp (Timedate1 *object)
1815 {
1816 Timedate1Proxy *proxy = TIMEDATE1_PROXY (object);
1817 GVariant *variant;
1818 gboolean value = FALSE;
1819 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "NTP");
1820 if (variant != NULL)
1821 {
1822 value = g_variant_get_boolean (variant);
1823 g_variant_unref (variant);
1824 }
1825 return value;
1826 }
1827
1828 static void
1829 timedate1_proxy_init (Timedate1Proxy *proxy)
1830 {
1831 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1832 proxy->priv = timedate1_proxy_get_instance_private (proxy);
1833 #else
1834 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_TIMEDATE1_PROXY, Timedate1ProxyPrivate);
1835 #endif
1836
1837 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), timedate1_interface_info ());
1838 }
1839
1840 static void
1841 timedate1_proxy_class_init (Timedate1ProxyClass *klass)
1842 {
1843 GObjectClass *gobject_class;
1844 GDBusProxyClass *proxy_class;
1845
1846 gobject_class = G_OBJECT_CLASS (klass);
1847 gobject_class->finalize = timedate1_proxy_finalize;
1848 gobject_class->get_property = timedate1_proxy_get_property;
1849 gobject_class->set_property = timedate1_proxy_set_property;
1850
1851 proxy_class = G_DBUS_PROXY_CLASS (klass);
1852 proxy_class->g_signal = timedate1_proxy_g_signal;
1853 proxy_class->g_properties_changed = timedate1_proxy_g_properties_changed;
1854
1855 timedate1_override_properties (gobject_class, 1);
1856
1857 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1858 g_type_class_add_private (klass, sizeof (Timedate1ProxyPrivate));
1859 #endif
1860 }
1861
1862 static void
1863 timedate1_proxy_iface_init (Timedate1Iface *iface)
1864 {
1865 iface->get_timezone = timedate1_proxy_get_timezone;
1866 iface->get_local_rtc = timedate1_proxy_get_local_rtc;
1867 iface->get_can_ntp = timedate1_proxy_get_can_ntp;
1868 iface->get_ntp = timedate1_proxy_get_ntp;
1869 }
1870
1871 /**
1872 * timedate1_proxy_new:
1873 * @connection: A #GDBusConnection.
1874 * @flags: Flags from the #GDBusProxyFlags enumeration.
1875 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1876 * @object_path: An object path.
1877 * @cancellable: (nullable): A #GCancellable or %NULL.
1878 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1879 * @user_data: User data to pass to @callback.
1880 *
1881 * 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.
1882 *
1883 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1884 * You can then call timedate1_proxy_new_finish() to get the result of the operation.
1885 *
1886 * See timedate1_proxy_new_sync() for the synchronous, blocking version of this constructor.
1887 */
1888 void
1889 timedate1_proxy_new (
1890 GDBusConnection *connection,
1891 GDBusProxyFlags flags,
1892 const gchar *name,
1893 const gchar *object_path,
1894 GCancellable *cancellable,
1895 GAsyncReadyCallback callback,
1896 gpointer user_data)
1897 {
1898 g_async_initable_new_async (TYPE_TIMEDATE1_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);
1899 }
1900
1901 /**
1902 * timedate1_proxy_new_finish:
1903 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_proxy_new().
1904 * @error: Return location for error or %NULL
1905 *
1906 * Finishes an operation started with timedate1_proxy_new().
1907 *
1908 * Returns: (transfer full) (type Timedate1Proxy): The constructed proxy object or %NULL if @error is set.
1909 */
1910 Timedate1 *
1911 timedate1_proxy_new_finish (
1912 GAsyncResult *res,
1913 GError **error)
1914 {
1915 GObject *ret;
1916 GObject *source_object;
1917 source_object = g_async_result_get_source_object (res);
1918 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1919 g_object_unref (source_object);
1920 if (ret != NULL)
1921 return TIMEDATE1 (ret);
1922 else
1923 return NULL;
1924 }
1925
1926 /**
1927 * timedate1_proxy_new_sync:
1928 * @connection: A #GDBusConnection.
1929 * @flags: Flags from the #GDBusProxyFlags enumeration.
1930 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1931 * @object_path: An object path.
1932 * @cancellable: (nullable): A #GCancellable or %NULL.
1933 * @error: Return location for error or %NULL
1934 *
1935 * 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.
1936 *
1937 * The calling thread is blocked until a reply is received.
1938 *
1939 * See timedate1_proxy_new() for the asynchronous version of this constructor.
1940 *
1941 * Returns: (transfer full) (type Timedate1Proxy): The constructed proxy object or %NULL if @error is set.
1942 */
1943 Timedate1 *
1944 timedate1_proxy_new_sync (
1945 GDBusConnection *connection,
1946 GDBusProxyFlags flags,
1947 const gchar *name,
1948 const gchar *object_path,
1949 GCancellable *cancellable,
1950 GError **error)
1951 {
1952 GInitable *ret;
1953 ret = g_initable_new (TYPE_TIMEDATE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.timedate1", NULL);
1954 if (ret != NULL)
1955 return TIMEDATE1 (ret);
1956 else
1957 return NULL;
1958 }
1959
1960
1961 /**
1962 * timedate1_proxy_new_for_bus:
1963 * @bus_type: A #GBusType.
1964 * @flags: Flags from the #GDBusProxyFlags enumeration.
1965 * @name: A bus name (well-known or unique).
1966 * @object_path: An object path.
1967 * @cancellable: (nullable): A #GCancellable or %NULL.
1968 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1969 * @user_data: User data to pass to @callback.
1970 *
1971 * Like timedate1_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1972 *
1973 * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from (see g_main_context_push_thread_default()).
1974 * You can then call timedate1_proxy_new_for_bus_finish() to get the result of the operation.
1975 *
1976 * See timedate1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1977 */
1978 void
1979 timedate1_proxy_new_for_bus (
1980 GBusType bus_type,
1981 GDBusProxyFlags flags,
1982 const gchar *name,
1983 const gchar *object_path,
1984 GCancellable *cancellable,
1985 GAsyncReadyCallback callback,
1986 gpointer user_data)
1987 {
1988 g_async_initable_new_async (TYPE_TIMEDATE1_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);
1989 }
1990
1991 /**
1992 * timedate1_proxy_new_for_bus_finish:
1993 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to timedate1_proxy_new_for_bus().
1994 * @error: Return location for error or %NULL
1995 *
1996 * Finishes an operation started with timedate1_proxy_new_for_bus().
1997 *
1998 * Returns: (transfer full) (type Timedate1Proxy): The constructed proxy object or %NULL if @error is set.
1999 */
2000 Timedate1 *
2001 timedate1_proxy_new_for_bus_finish (
2002 GAsyncResult *res,
2003 GError **error)
2004 {
2005 GObject *ret;
2006 GObject *source_object;
2007 source_object = g_async_result_get_source_object (res);
2008 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2009 g_object_unref (source_object);
2010 if (ret != NULL)
2011 return TIMEDATE1 (ret);
2012 else
2013 return NULL;
2014 }
2015
2016 /**
2017 * timedate1_proxy_new_for_bus_sync:
2018 * @bus_type: A #GBusType.
2019 * @flags: Flags from the #GDBusProxyFlags enumeration.
2020 * @name: A bus name (well-known or unique).
2021 * @object_path: An object path.
2022 * @cancellable: (nullable): A #GCancellable or %NULL.
2023 * @error: Return location for error or %NULL
2024 *
2025 * Like timedate1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2026 *
2027 * The calling thread is blocked until a reply is received.
2028 *
2029 * See timedate1_proxy_new_for_bus() for the asynchronous version of this constructor.
2030 *
2031 * Returns: (transfer full) (type Timedate1Proxy): The constructed proxy object or %NULL if @error is set.
2032 */
2033 Timedate1 *
2034 timedate1_proxy_new_for_bus_sync (
2035 GBusType bus_type,
2036 GDBusProxyFlags flags,
2037 const gchar *name,
2038 const gchar *object_path,
2039 GCancellable *cancellable,
2040 GError **error)
2041 {
2042 GInitable *ret;
2043 ret = g_initable_new (TYPE_TIMEDATE1_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);
2044 if (ret != NULL)
2045 return TIMEDATE1 (ret);
2046 else
2047 return NULL;
2048 }
2049
2050
2051 /* ------------------------------------------------------------------------ */
2052
2053 /**
2054 * Timedate1Skeleton:
2055 *
2056 * The #Timedate1Skeleton structure contains only private data and should only be accessed using the provided API.
2057 */
2058
2059 /**
2060 * Timedate1SkeletonClass:
2061 * @parent_class: The parent class.
2062 *
2063 * Class structure for #Timedate1Skeleton.
2064 */
2065
2066 struct _Timedate1SkeletonPrivate
2067 {
2068 GValue *properties;
2069 GList *changed_properties;
2070 GSource *changed_properties_idle_source;
2071 GMainContext *context;
2072 GMutex lock;
2073 };
2074
2075 static void
2076 _timedate1_skeleton_handle_method_call (
2077 GDBusConnection *connection G_GNUC_UNUSED,
2078 const gchar *sender G_GNUC_UNUSED,
2079 const gchar *object_path G_GNUC_UNUSED,
2080 const gchar *interface_name,
2081 const gchar *method_name,
2082 GVariant *parameters,
2083 GDBusMethodInvocation *invocation,
2084 gpointer user_data)
2085 {
2086 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (user_data);
2087 _ExtendedGDBusMethodInfo *info;
2088 GVariantIter iter;
2089 GVariant *child;
2090 GValue *paramv;
2091 gsize num_params;
2092 guint num_extra;
2093 gsize n;
2094 guint signal_id;
2095 GValue return_value = G_VALUE_INIT;
2096 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2097 g_assert (info != NULL);
2098 num_params = g_variant_n_children (parameters);
2099 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2100 n = 0;
2101 g_value_init (&paramv[n], TYPE_TIMEDATE1);
2102 g_value_set_object (&paramv[n++], skeleton);
2103 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2104 g_value_set_object (&paramv[n++], invocation);
2105 if (info->pass_fdlist)
2106 {
2107 #ifdef G_OS_UNIX
2108 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2109 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2110 #else
2111 g_assert_not_reached ();
2112 #endif
2113 }
2114 g_variant_iter_init (&iter, parameters);
2115 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2116 {
2117 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2118 if (arg_info->use_gvariant)
2119 {
2120 g_value_init (&paramv[n], G_TYPE_VARIANT);
2121 g_value_set_variant (&paramv[n], child);
2122 n++;
2123 }
2124 else
2125 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2126 g_variant_unref (child);
2127 }
2128 signal_id = g_signal_lookup (info->signal_name, TYPE_TIMEDATE1);
2129 g_value_init (&return_value, G_TYPE_BOOLEAN);
2130 g_signal_emitv (paramv, signal_id, 0, &return_value);
2131 if (!g_value_get_boolean (&return_value))
2132 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);
2133 g_value_unset (&return_value);
2134 for (n = 0; n < num_params + num_extra; n++)
2135 g_value_unset (&paramv[n]);
2136 g_free (paramv);
2137 }
2138
2139 static GVariant *
2140 _timedate1_skeleton_handle_get_property (
2141 GDBusConnection *connection G_GNUC_UNUSED,
2142 const gchar *sender G_GNUC_UNUSED,
2143 const gchar *object_path G_GNUC_UNUSED,
2144 const gchar *interface_name G_GNUC_UNUSED,
2145 const gchar *property_name,
2146 GError **error,
2147 gpointer user_data)
2148 {
2149 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (user_data);
2150 GValue value = G_VALUE_INIT;
2151 GParamSpec *pspec;
2152 _ExtendedGDBusPropertyInfo *info;
2153 GVariant *ret;
2154 ret = NULL;
2155 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct, property_name);
2156 g_assert (info != NULL);
2157 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2158 if (pspec == NULL)
2159 {
2160 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2161 }
2162 else
2163 {
2164 g_value_init (&value, pspec->value_type);
2165 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2166 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2167 g_value_unset (&value);
2168 }
2169 return ret;
2170 }
2171
2172 static gboolean
2173 _timedate1_skeleton_handle_set_property (
2174 GDBusConnection *connection G_GNUC_UNUSED,
2175 const gchar *sender G_GNUC_UNUSED,
2176 const gchar *object_path G_GNUC_UNUSED,
2177 const gchar *interface_name G_GNUC_UNUSED,
2178 const gchar *property_name,
2179 GVariant *variant,
2180 GError **error,
2181 gpointer user_data)
2182 {
2183 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (user_data);
2184 GValue value = G_VALUE_INIT;
2185 GParamSpec *pspec;
2186 _ExtendedGDBusPropertyInfo *info;
2187 gboolean ret;
2188 ret = FALSE;
2189 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_timedate1_interface_info.parent_struct, property_name);
2190 g_assert (info != NULL);
2191 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2192 if (pspec == NULL)
2193 {
2194 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2195 }
2196 else
2197 {
2198 if (info->use_gvariant)
2199 g_value_set_variant (&value, variant);
2200 else
2201 g_dbus_gvariant_to_gvalue (variant, &value);
2202 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2203 g_value_unset (&value);
2204 ret = TRUE;
2205 }
2206 return ret;
2207 }
2208
2209 static const GDBusInterfaceVTable _timedate1_skeleton_vtable =
2210 {
2211 _timedate1_skeleton_handle_method_call,
2212 _timedate1_skeleton_handle_get_property,
2213 _timedate1_skeleton_handle_set_property,
2214 {NULL}
2215 };
2216
2217 static GDBusInterfaceInfo *
2218 timedate1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2219 {
2220 return timedate1_interface_info ();
2221 }
2222
2223 static GDBusInterfaceVTable *
2224 timedate1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2225 {
2226 return (GDBusInterfaceVTable *) &_timedate1_skeleton_vtable;
2227 }
2228
2229 static GVariant *
2230 timedate1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2231 {
2232 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (_skeleton);
2233
2234 GVariantBuilder builder;
2235 guint n;
2236 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2237 if (_timedate1_interface_info.parent_struct.properties == NULL)
2238 goto out;
2239 for (n = 0; _timedate1_interface_info.parent_struct.properties[n] != NULL; n++)
2240 {
2241 GDBusPropertyInfo *info = _timedate1_interface_info.parent_struct.properties[n];
2242 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2243 {
2244 GVariant *value;
2245 value = _timedate1_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);
2246 if (value != NULL)
2247 {
2248 g_variant_take_ref (value);
2249 g_variant_builder_add (&builder, "{sv}", info->name, value);
2250 g_variant_unref (value);
2251 }
2252 }
2253 }
2254 out:
2255 return g_variant_builder_end (&builder);
2256 }
2257
2258 static gboolean _timedate1_emit_changed (gpointer user_data);
2259
2260 static void
2261 timedate1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2262 {
2263 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (_skeleton);
2264 gboolean emit_changed = FALSE;
2265
2266 g_mutex_lock (&skeleton->priv->lock);
2267 if (skeleton->priv->changed_properties_idle_source != NULL)
2268 {
2269 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2270 skeleton->priv->changed_properties_idle_source = NULL;
2271 emit_changed = TRUE;
2272 }
2273 g_mutex_unlock (&skeleton->priv->lock);
2274
2275 if (emit_changed)
2276 _timedate1_emit_changed (skeleton);
2277 }
2278
2279 static void timedate1_skeleton_iface_init (Timedate1Iface *iface);
2280 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2281 G_DEFINE_TYPE_WITH_CODE (Timedate1Skeleton, timedate1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2282 G_ADD_PRIVATE (Timedate1Skeleton)
2283 G_IMPLEMENT_INTERFACE (TYPE_TIMEDATE1, timedate1_skeleton_iface_init))
2284
2285 #else
2286 G_DEFINE_TYPE_WITH_CODE (Timedate1Skeleton, timedate1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2287 G_IMPLEMENT_INTERFACE (TYPE_TIMEDATE1, timedate1_skeleton_iface_init))
2288
2289 #endif
2290 static void
2291 timedate1_skeleton_finalize (GObject *object)
2292 {
2293 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2294 guint n;
2295 for (n = 0; n < 4; n++)
2296 g_value_unset (&skeleton->priv->properties[n]);
2297 g_free (skeleton->priv->properties);
2298 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2299 if (skeleton->priv->changed_properties_idle_source != NULL)
2300 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2301 g_main_context_unref (skeleton->priv->context);
2302 g_mutex_clear (&skeleton->priv->lock);
2303 G_OBJECT_CLASS (timedate1_skeleton_parent_class)->finalize (object);
2304 }
2305
2306 static void
2307 timedate1_skeleton_get_property (GObject *object,
2308 guint prop_id,
2309 GValue *value,
2310 GParamSpec *pspec G_GNUC_UNUSED)
2311 {
2312 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2313 g_assert (prop_id != 0 && prop_id - 1 < 4);
2314 g_mutex_lock (&skeleton->priv->lock);
2315 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
2316 g_mutex_unlock (&skeleton->priv->lock);
2317 }
2318
2319 static gboolean
2320 _timedate1_emit_changed (gpointer user_data)
2321 {
2322 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (user_data);
2323 GList *l;
2324 GVariantBuilder builder;
2325 GVariantBuilder invalidated_builder;
2326 guint num_changes;
2327
2328 g_mutex_lock (&skeleton->priv->lock);
2329 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2330 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
2331 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
2332 {
2333 ChangedProperty *cp = l->data;
2334 GVariant *variant;
2335 const GValue *cur_value;
2336
2337 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
2338 if (!_g_value_equal (cur_value, &cp->orig_value))
2339 {
2340 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2341 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2342 g_variant_unref (variant);
2343 num_changes++;
2344 }
2345 }
2346 if (num_changes > 0)
2347 {
2348 GList *connections, *ll;
2349 GVariant *signal_variant;
2350 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.timedate1",
2351 &builder, &invalidated_builder));
2352 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2353 for (ll = connections; ll != NULL; ll = ll->next)
2354 {
2355 GDBusConnection *connection = ll->data;
2356
2357 g_dbus_connection_emit_signal (connection,
2358 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2359 "org.freedesktop.DBus.Properties",
2360 "PropertiesChanged",
2361 signal_variant,
2362 NULL);
2363 }
2364 g_variant_unref (signal_variant);
2365 g_list_free_full (connections, g_object_unref);
2366 }
2367 else
2368 {
2369 g_variant_builder_clear (&builder);
2370 g_variant_builder_clear (&invalidated_builder);
2371 }
2372 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2373 skeleton->priv->changed_properties = NULL;
2374 skeleton->priv->changed_properties_idle_source = NULL;
2375 g_mutex_unlock (&skeleton->priv->lock);
2376 return FALSE;
2377 }
2378
2379 static void
2380 _timedate1_schedule_emit_changed (Timedate1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2381 {
2382 ChangedProperty *cp;
2383 GList *l;
2384 cp = NULL;
2385 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2386 {
2387 ChangedProperty *i_cp = l->data;
2388 if (i_cp->info == info)
2389 {
2390 cp = i_cp;
2391 break;
2392 }
2393 }
2394 if (cp == NULL)
2395 {
2396 cp = g_new0 (ChangedProperty, 1);
2397 cp->prop_id = prop_id;
2398 cp->info = info;
2399 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2400 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2401 g_value_copy (orig_value, &cp->orig_value);
2402 }
2403 }
2404
2405 static void
2406 timedate1_skeleton_notify (GObject *object,
2407 GParamSpec *pspec G_GNUC_UNUSED)
2408 {
2409 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2410 g_mutex_lock (&skeleton->priv->lock);
2411 if (skeleton->priv->changed_properties != NULL &&
2412 skeleton->priv->changed_properties_idle_source == NULL)
2413 {
2414 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2415 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2416 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _timedate1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2417 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _timedate1_emit_changed");
2418 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2419 g_source_unref (skeleton->priv->changed_properties_idle_source);
2420 }
2421 g_mutex_unlock (&skeleton->priv->lock);
2422 }
2423
2424 static void
2425 timedate1_skeleton_set_property (GObject *object,
2426 guint prop_id,
2427 const GValue *value,
2428 GParamSpec *pspec)
2429 {
2430 const _ExtendedGDBusPropertyInfo *info;
2431 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2432 g_assert (prop_id != 0 && prop_id - 1 < 4);
2433 info = (const _ExtendedGDBusPropertyInfo *) _timedate1_property_info_pointers[prop_id - 1];
2434 g_mutex_lock (&skeleton->priv->lock);
2435 g_object_freeze_notify (object);
2436 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2437 {
2438 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
2439 info->emits_changed_signal)
2440 _timedate1_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
2441 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2442 g_object_notify_by_pspec (object, pspec);
2443 }
2444 g_mutex_unlock (&skeleton->priv->lock);
2445 g_object_thaw_notify (object);
2446 }
2447
2448 static void
2449 timedate1_skeleton_init (Timedate1Skeleton *skeleton)
2450 {
2451 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2452 skeleton->priv = timedate1_skeleton_get_instance_private (skeleton);
2453 #else
2454 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_TIMEDATE1_SKELETON, Timedate1SkeletonPrivate);
2455 #endif
2456
2457 g_mutex_init (&skeleton->priv->lock);
2458 skeleton->priv->context = g_main_context_ref_thread_default ();
2459 skeleton->priv->properties = g_new0 (GValue, 4);
2460 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
2461 g_value_init (&skeleton->priv->properties[1], G_TYPE_BOOLEAN);
2462 g_value_init (&skeleton->priv->properties[2], G_TYPE_BOOLEAN);
2463 g_value_init (&skeleton->priv->properties[3], G_TYPE_BOOLEAN);
2464 }
2465
2466 static const gchar *
2467 timedate1_skeleton_get_timezone (Timedate1 *object)
2468 {
2469 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2470 const gchar *value;
2471 g_mutex_lock (&skeleton->priv->lock);
2472 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
2473 g_mutex_unlock (&skeleton->priv->lock);
2474 return value;
2475 }
2476
2477 static gboolean
2478 timedate1_skeleton_get_local_rtc (Timedate1 *object)
2479 {
2480 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2481 gboolean value;
2482 g_mutex_lock (&skeleton->priv->lock);
2483 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[1]));
2484 g_mutex_unlock (&skeleton->priv->lock);
2485 return value;
2486 }
2487
2488 static gboolean
2489 timedate1_skeleton_get_can_ntp (Timedate1 *object)
2490 {
2491 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2492 gboolean value;
2493 g_mutex_lock (&skeleton->priv->lock);
2494 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[2]));
2495 g_mutex_unlock (&skeleton->priv->lock);
2496 return value;
2497 }
2498
2499 static gboolean
2500 timedate1_skeleton_get_ntp (Timedate1 *object)
2501 {
2502 Timedate1Skeleton *skeleton = TIMEDATE1_SKELETON (object);
2503 gboolean value;
2504 g_mutex_lock (&skeleton->priv->lock);
2505 value = g_marshal_value_peek_boolean (&(skeleton->priv->properties[3]));
2506 g_mutex_unlock (&skeleton->priv->lock);
2507 return value;
2508 }
2509
2510 static void
2511 timedate1_skeleton_class_init (Timedate1SkeletonClass *klass)
2512 {
2513 GObjectClass *gobject_class;
2514 GDBusInterfaceSkeletonClass *skeleton_class;
2515
2516 gobject_class = G_OBJECT_CLASS (klass);
2517 gobject_class->finalize = timedate1_skeleton_finalize;
2518 gobject_class->get_property = timedate1_skeleton_get_property;
2519 gobject_class->set_property = timedate1_skeleton_set_property;
2520 gobject_class->notify = timedate1_skeleton_notify;
2521
2522
2523 timedate1_override_properties (gobject_class, 1);
2524
2525 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2526 skeleton_class->get_info = timedate1_skeleton_dbus_interface_get_info;
2527 skeleton_class->get_properties = timedate1_skeleton_dbus_interface_get_properties;
2528 skeleton_class->flush = timedate1_skeleton_dbus_interface_flush;
2529 skeleton_class->get_vtable = timedate1_skeleton_dbus_interface_get_vtable;
2530
2531 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2532 g_type_class_add_private (klass, sizeof (Timedate1SkeletonPrivate));
2533 #endif
2534 }
2535
2536 static void
2537 timedate1_skeleton_iface_init (Timedate1Iface *iface)
2538 {
2539 iface->get_timezone = timedate1_skeleton_get_timezone;
2540 iface->get_local_rtc = timedate1_skeleton_get_local_rtc;
2541 iface->get_can_ntp = timedate1_skeleton_get_can_ntp;
2542 iface->get_ntp = timedate1_skeleton_get_ntp;
2543 }
2544
2545 /**
2546 * timedate1_skeleton_new:
2547 *
2548 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-timedate1.top_of_page">org.freedesktop.timedate1</link>.
2549 *
2550 * Returns: (transfer full) (type Timedate1Skeleton): The skeleton object.
2551 */
2552 Timedate1 *
2553 timedate1_skeleton_new (void)
2554 {
2555 return TIMEDATE1 (g_object_new (TYPE_TIMEDATE1_SKELETON, NULL));
2556 }
2557
2558