GCC Code Coverage Report


Directory: ./
File: _build/panels/system/users/cc-realm-generated.c
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 2669 0.0%
Functions: 0 393 0.0%
Branches: 0 1035 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 "cc-realm-generated.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_STRING_VARIANT (
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_ObjectStringVariantFunc)
210 (void *data1,
211 GDBusMethodInvocation *arg_method_invocation,
212 const gchar *arg_string,
213 GVariant *arg_options,
214 void *data2);
215 _GDbusCodegenMarshalBoolean_ObjectStringVariantFunc callback;
216 GCClosure *cc = (GCClosure*) closure;
217 void *data1, *data2;
218 gboolean v_return;
219
220 g_return_if_fail (return_value != NULL);
221 g_return_if_fail (n_param_values == 4);
222
223 if (G_CCLOSURE_SWAP_DATA (closure))
224 {
225 data1 = closure->data;
226 data2 = g_value_peek_pointer (param_values + 0);
227 }
228 else
229 {
230 data1 = g_value_peek_pointer (param_values + 0);
231 data2 = closure->data;
232 }
233
234 callback = (_GDbusCodegenMarshalBoolean_ObjectStringVariantFunc)
235 (marshal_data ? marshal_data : cc->callback);
236
237 v_return =
238 callback (data1,
239 g_marshal_value_peek_object (param_values + 1),
240 g_marshal_value_peek_string (param_values + 2),
241 g_marshal_value_peek_variant (param_values + 3),
242 data2);
243
244 g_value_set_boolean (return_value, v_return);
245 }
246
247 static void
248 _g_dbus_codegen_marshal_VOID__STRING_STRING (
249 GClosure *closure,
250 GValue *return_value G_GNUC_UNUSED,
251 unsigned int n_param_values,
252 const GValue *param_values,
253 void *invocation_hint G_GNUC_UNUSED,
254 void *marshal_data)
255 {
256 typedef void (*_GDbusCodegenMarshalVoid_StringStringFunc)
257 (void *data1,
258 const gchar *arg_data,
259 const gchar *arg_operation,
260 void *data2);
261 _GDbusCodegenMarshalVoid_StringStringFunc callback;
262 GCClosure *cc = (GCClosure*) closure;
263 void *data1, *data2;
264
265 g_return_if_fail (n_param_values == 3);
266
267 if (G_CCLOSURE_SWAP_DATA (closure))
268 {
269 data1 = closure->data;
270 data2 = g_value_peek_pointer (param_values + 0);
271 }
272 else
273 {
274 data1 = g_value_peek_pointer (param_values + 0);
275 data2 = closure->data;
276 }
277
278 callback = (_GDbusCodegenMarshalVoid_StringStringFunc)
279 (marshal_data ? marshal_data : cc->callback);
280
281 callback (data1,
282 g_marshal_value_peek_string (param_values + 1),
283 g_marshal_value_peek_string (param_values + 2),
284 data2);
285 }
286
287 static void
288 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (
289 GClosure *closure,
290 GValue *return_value,
291 unsigned int n_param_values,
292 const GValue *param_values,
293 void *invocation_hint G_GNUC_UNUSED,
294 void *marshal_data)
295 {
296 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringFunc)
297 (void *data1,
298 GDBusMethodInvocation *arg_method_invocation,
299 const gchar *arg_operation,
300 void *data2);
301 _GDbusCodegenMarshalBoolean_ObjectStringFunc callback;
302 GCClosure *cc = (GCClosure*) closure;
303 void *data1, *data2;
304 gboolean v_return;
305
306 g_return_if_fail (return_value != NULL);
307 g_return_if_fail (n_param_values == 3);
308
309 if (G_CCLOSURE_SWAP_DATA (closure))
310 {
311 data1 = closure->data;
312 data2 = g_value_peek_pointer (param_values + 0);
313 }
314 else
315 {
316 data1 = g_value_peek_pointer (param_values + 0);
317 data2 = closure->data;
318 }
319
320 callback = (_GDbusCodegenMarshalBoolean_ObjectStringFunc)
321 (marshal_data ? marshal_data : cc->callback);
322
323 v_return =
324 callback (data1,
325 g_marshal_value_peek_object (param_values + 1),
326 g_marshal_value_peek_string (param_values + 2),
327 data2);
328
329 g_value_set_boolean (return_value, v_return);
330 }
331
332 static void
333 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (
334 GClosure *closure,
335 GValue *return_value,
336 unsigned int n_param_values,
337 const GValue *param_values,
338 void *invocation_hint G_GNUC_UNUSED,
339 void *marshal_data)
340 {
341 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectFunc)
342 (void *data1,
343 GDBusMethodInvocation *arg_method_invocation,
344 void *data2);
345 _GDbusCodegenMarshalBoolean_ObjectFunc callback;
346 GCClosure *cc = (GCClosure*) closure;
347 void *data1, *data2;
348 gboolean v_return;
349
350 g_return_if_fail (return_value != NULL);
351 g_return_if_fail (n_param_values == 2);
352
353 if (G_CCLOSURE_SWAP_DATA (closure))
354 {
355 data1 = closure->data;
356 data2 = g_value_peek_pointer (param_values + 0);
357 }
358 else
359 {
360 data1 = g_value_peek_pointer (param_values + 0);
361 data2 = closure->data;
362 }
363
364 callback = (_GDbusCodegenMarshalBoolean_ObjectFunc)
365 (marshal_data ? marshal_data : cc->callback);
366
367 v_return =
368 callback (data1,
369 g_marshal_value_peek_object (param_values + 1),
370 data2);
371
372 g_value_set_boolean (return_value, v_return);
373 }
374
375 static void
376 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (
377 GClosure *closure,
378 GValue *return_value,
379 unsigned int n_param_values,
380 const GValue *param_values,
381 void *invocation_hint G_GNUC_UNUSED,
382 void *marshal_data)
383 {
384 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectVariantFunc)
385 (void *data1,
386 GDBusMethodInvocation *arg_method_invocation,
387 GVariant *arg_options,
388 void *data2);
389 _GDbusCodegenMarshalBoolean_ObjectVariantFunc callback;
390 GCClosure *cc = (GCClosure*) closure;
391 void *data1, *data2;
392 gboolean v_return;
393
394 g_return_if_fail (return_value != NULL);
395 g_return_if_fail (n_param_values == 3);
396
397 if (G_CCLOSURE_SWAP_DATA (closure))
398 {
399 data1 = closure->data;
400 data2 = g_value_peek_pointer (param_values + 0);
401 }
402 else
403 {
404 data1 = g_value_peek_pointer (param_values + 0);
405 data2 = closure->data;
406 }
407
408 callback = (_GDbusCodegenMarshalBoolean_ObjectVariantFunc)
409 (marshal_data ? marshal_data : cc->callback);
410
411 v_return =
412 callback (data1,
413 g_marshal_value_peek_object (param_values + 1),
414 g_marshal_value_peek_variant (param_values + 2),
415 data2);
416
417 g_value_set_boolean (return_value, v_return);
418 }
419
420 static void
421 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_BOXED_BOXED_VARIANT (
422 GClosure *closure,
423 GValue *return_value,
424 unsigned int n_param_values,
425 const GValue *param_values,
426 void *invocation_hint G_GNUC_UNUSED,
427 void *marshal_data)
428 {
429 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectStringBoxedBoxedVariantFunc)
430 (void *data1,
431 GDBusMethodInvocation *arg_method_invocation,
432 const gchar *arg_login_policy,
433 const gchar *const *arg_permitted_add,
434 const gchar *const *arg_permitted_remove,
435 GVariant *arg_options,
436 void *data2);
437 _GDbusCodegenMarshalBoolean_ObjectStringBoxedBoxedVariantFunc callback;
438 GCClosure *cc = (GCClosure*) closure;
439 void *data1, *data2;
440 gboolean v_return;
441
442 g_return_if_fail (return_value != NULL);
443 g_return_if_fail (n_param_values == 6);
444
445 if (G_CCLOSURE_SWAP_DATA (closure))
446 {
447 data1 = closure->data;
448 data2 = g_value_peek_pointer (param_values + 0);
449 }
450 else
451 {
452 data1 = g_value_peek_pointer (param_values + 0);
453 data2 = closure->data;
454 }
455
456 callback = (_GDbusCodegenMarshalBoolean_ObjectStringBoxedBoxedVariantFunc)
457 (marshal_data ? marshal_data : cc->callback);
458
459 v_return =
460 callback (data1,
461 g_marshal_value_peek_object (param_values + 1),
462 g_marshal_value_peek_string (param_values + 2),
463 g_marshal_value_peek_boxed (param_values + 3),
464 g_marshal_value_peek_boxed (param_values + 4),
465 g_marshal_value_peek_variant (param_values + 5),
466 data2);
467
468 g_value_set_boolean (return_value, v_return);
469 }
470
471 static void
472 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT_VARIANT (
473 GClosure *closure,
474 GValue *return_value,
475 unsigned int n_param_values,
476 const GValue *param_values,
477 void *invocation_hint G_GNUC_UNUSED,
478 void *marshal_data)
479 {
480 typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc)
481 (void *data1,
482 GDBusMethodInvocation *arg_method_invocation,
483 GVariant *arg_credentials,
484 GVariant *arg_options,
485 void *data2);
486 _GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc callback;
487 GCClosure *cc = (GCClosure*) closure;
488 void *data1, *data2;
489 gboolean v_return;
490
491 g_return_if_fail (return_value != NULL);
492 g_return_if_fail (n_param_values == 4);
493
494 if (G_CCLOSURE_SWAP_DATA (closure))
495 {
496 data1 = closure->data;
497 data2 = g_value_peek_pointer (param_values + 0);
498 }
499 else
500 {
501 data1 = g_value_peek_pointer (param_values + 0);
502 data2 = closure->data;
503 }
504
505 callback = (_GDbusCodegenMarshalBoolean_ObjectVariantVariantFunc)
506 (marshal_data ? marshal_data : cc->callback);
507
508 v_return =
509 callback (data1,
510 g_marshal_value_peek_object (param_values + 1),
511 g_marshal_value_peek_variant (param_values + 2),
512 g_marshal_value_peek_variant (param_values + 3),
513 data2);
514
515 g_value_set_boolean (return_value, v_return);
516 }
517
518 /* ------------------------------------------------------------------------
519 * Code for interface org.freedesktop.realmd.Provider
520 * ------------------------------------------------------------------------
521 */
522
523 /**
524 * SECTION:CcRealmProvider
525 * @title: CcRealmProvider
526 * @short_description: Generated C code for the org.freedesktop.realmd.Provider D-Bus interface
527 *
528 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link> D-Bus interface in C.
529 */
530
531 /* ---- Introspection data for org.freedesktop.realmd.Provider ---- */
532
533 static const _ExtendedGDBusArgInfo _cc_realm_provider_method_info_discover_IN_ARG_string =
534 {
535 {
536 -1,
537 (gchar *) "string",
538 (gchar *) "s",
539 NULL
540 },
541 FALSE
542 };
543
544 static const _ExtendedGDBusArgInfo _cc_realm_provider_method_info_discover_IN_ARG_options =
545 {
546 {
547 -1,
548 (gchar *) "options",
549 (gchar *) "a{sv}",
550 NULL
551 },
552 FALSE
553 };
554
555 static const GDBusArgInfo * const _cc_realm_provider_method_info_discover_IN_ARG_pointers[] =
556 {
557 &_cc_realm_provider_method_info_discover_IN_ARG_string.parent_struct,
558 &_cc_realm_provider_method_info_discover_IN_ARG_options.parent_struct,
559 NULL
560 };
561
562 static const _ExtendedGDBusArgInfo _cc_realm_provider_method_info_discover_OUT_ARG_relevance =
563 {
564 {
565 -1,
566 (gchar *) "relevance",
567 (gchar *) "i",
568 NULL
569 },
570 FALSE
571 };
572
573 static const _ExtendedGDBusArgInfo _cc_realm_provider_method_info_discover_OUT_ARG_realm =
574 {
575 {
576 -1,
577 (gchar *) "realm",
578 (gchar *) "ao",
579 NULL
580 },
581 FALSE
582 };
583
584 static const GDBusArgInfo * const _cc_realm_provider_method_info_discover_OUT_ARG_pointers[] =
585 {
586 &_cc_realm_provider_method_info_discover_OUT_ARG_relevance.parent_struct,
587 &_cc_realm_provider_method_info_discover_OUT_ARG_realm.parent_struct,
588 NULL
589 };
590
591 static const _ExtendedGDBusMethodInfo _cc_realm_provider_method_info_discover =
592 {
593 {
594 -1,
595 (gchar *) "Discover",
596 (GDBusArgInfo **) &_cc_realm_provider_method_info_discover_IN_ARG_pointers,
597 (GDBusArgInfo **) &_cc_realm_provider_method_info_discover_OUT_ARG_pointers,
598 NULL
599 },
600 "handle-discover",
601 FALSE
602 };
603
604 static const GDBusMethodInfo * const _cc_realm_provider_method_info_pointers[] =
605 {
606 &_cc_realm_provider_method_info_discover.parent_struct,
607 NULL
608 };
609
610 static const _ExtendedGDBusPropertyInfo _cc_realm_provider_property_info_name =
611 {
612 {
613 -1,
614 (gchar *) "Name",
615 (gchar *) "s",
616 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
617 NULL
618 },
619 "name",
620 FALSE,
621 TRUE
622 };
623
624 static const _ExtendedGDBusPropertyInfo _cc_realm_provider_property_info_version =
625 {
626 {
627 -1,
628 (gchar *) "Version",
629 (gchar *) "s",
630 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
631 NULL
632 },
633 "version",
634 FALSE,
635 TRUE
636 };
637
638 static const _ExtendedGDBusPropertyInfo _cc_realm_provider_property_info_realms =
639 {
640 {
641 -1,
642 (gchar *) "Realms",
643 (gchar *) "ao",
644 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
645 NULL
646 },
647 "realms",
648 FALSE,
649 TRUE
650 };
651
652 static const GDBusPropertyInfo * const _cc_realm_provider_property_info_pointers[] =
653 {
654 &_cc_realm_provider_property_info_name.parent_struct,
655 &_cc_realm_provider_property_info_version.parent_struct,
656 &_cc_realm_provider_property_info_realms.parent_struct,
657 NULL
658 };
659
660 static const _ExtendedGDBusInterfaceInfo _cc_realm_provider_interface_info =
661 {
662 {
663 -1,
664 (gchar *) "org.freedesktop.realmd.Provider",
665 (GDBusMethodInfo **) &_cc_realm_provider_method_info_pointers,
666 NULL,
667 (GDBusPropertyInfo **) &_cc_realm_provider_property_info_pointers,
668 NULL
669 },
670 "provider",
671 };
672
673
674 /**
675 * cc_realm_provider_interface_info:
676 *
677 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link> D-Bus interface.
678 *
679 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
680 */
681 GDBusInterfaceInfo *
682 cc_realm_provider_interface_info (void)
683 {
684 return (GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct;
685 }
686
687 /**
688 * cc_realm_provider_override_properties:
689 * @klass: The class structure for a #GObject derived class.
690 * @property_id_begin: The property id to assign to the first overridden property.
691 *
692 * Overrides all #GObject properties in the #CcRealmProvider interface for a concrete class.
693 * The properties are overridden in the order they are defined.
694 *
695 * Returns: The last property id.
696 */
697 guint
698 cc_realm_provider_override_properties (GObjectClass *klass, guint property_id_begin)
699 {
700 g_object_class_override_property (klass, property_id_begin++, "name");
701 g_object_class_override_property (klass, property_id_begin++, "version");
702 g_object_class_override_property (klass, property_id_begin++, "realms");
703 return property_id_begin - 1;
704 }
705
706
707 inline static void
708 cc_realm_provider_method_marshal_discover (
709 GClosure *closure,
710 GValue *return_value,
711 unsigned int n_param_values,
712 const GValue *param_values,
713 void *invocation_hint,
714 void *marshal_data)
715 {
716 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_VARIANT (closure,
717 return_value, n_param_values, param_values, invocation_hint, marshal_data);
718 }
719
720
721 /**
722 * CcRealmProvider:
723 *
724 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>.
725 */
726
727 /**
728 * CcRealmProviderIface:
729 * @parent_iface: The parent interface.
730 * @handle_discover: Handler for the #CcRealmProvider::handle-discover signal.
731 * @get_name: Getter for the #CcRealmProvider:name property.
732 * @get_realms: Getter for the #CcRealmProvider:realms property.
733 * @get_version: Getter for the #CcRealmProvider:version property.
734 *
735 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>.
736 */
737
738 typedef CcRealmProviderIface CcRealmProviderInterface;
739 G_DEFINE_INTERFACE (CcRealmProvider, cc_realm_provider, G_TYPE_OBJECT)
740
741 static void
742 cc_realm_provider_default_init (CcRealmProviderIface *iface)
743 {
744 /* GObject signals for incoming D-Bus method calls: */
745 /**
746 * CcRealmProvider::handle-discover:
747 * @object: A #CcRealmProvider.
748 * @invocation: A #GDBusMethodInvocation.
749 * @arg_string: Argument passed by remote caller.
750 * @arg_options: Argument passed by remote caller.
751 *
752 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Provider.Discover">Discover()</link> D-Bus method.
753 *
754 * 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 cc_realm_provider_complete_discover() 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.
755 *
756 * 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.
757 */
758 g_signal_new ("handle-discover",
759 G_TYPE_FROM_INTERFACE (iface),
760 G_SIGNAL_RUN_LAST,
761 G_STRUCT_OFFSET (CcRealmProviderIface, handle_discover),
762 g_signal_accumulator_true_handled,
763 NULL,
764 cc_realm_provider_method_marshal_discover,
765 G_TYPE_BOOLEAN,
766 3,
767 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT);
768
769 /* GObject properties for D-Bus properties: */
770 /**
771 * CcRealmProvider:name:
772 *
773 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Name">"Name"</link>.
774 *
775 * 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.
776 */
777 g_object_interface_install_property (iface,
778 g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
779 /**
780 * CcRealmProvider:version:
781 *
782 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Version">"Version"</link>.
783 *
784 * 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.
785 */
786 g_object_interface_install_property (iface,
787 g_param_spec_string ("version", "Version", "Version", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
788 /**
789 * CcRealmProvider:realms:
790 *
791 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Realms">"Realms"</link>.
792 *
793 * 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.
794 */
795 g_object_interface_install_property (iface,
796 g_param_spec_boxed ("realms", "Realms", "Realms", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
797 }
798
799 /**
800 * cc_realm_provider_get_name: (skip)
801 * @object: A #CcRealmProvider.
802 *
803 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Name">"Name"</link> D-Bus property.
804 *
805 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
806 *
807 * 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 cc_realm_provider_dup_name() if on another thread.
808 *
809 * 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.
810 */
811 const gchar *
812 cc_realm_provider_get_name (CcRealmProvider *object)
813 {
814 g_return_val_if_fail (CC_REALM_IS_PROVIDER (object), NULL);
815
816 return CC_REALM_PROVIDER_GET_IFACE (object)->get_name (object);
817 }
818
819 /**
820 * cc_realm_provider_dup_name: (skip)
821 * @object: A #CcRealmProvider.
822 *
823 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Name">"Name"</link> D-Bus property.
824 *
825 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
826 *
827 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
828 */
829 gchar *
830 cc_realm_provider_dup_name (CcRealmProvider *object)
831 {
832 gchar *value;
833 g_object_get (G_OBJECT (object), "name", &value, NULL);
834 return value;
835 }
836
837 /**
838 * cc_realm_provider_set_name: (skip)
839 * @object: A #CcRealmProvider.
840 * @value: The value to set.
841 *
842 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Name">"Name"</link> D-Bus property to @value.
843 *
844 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
845 */
846 void
847 cc_realm_provider_set_name (CcRealmProvider *object, const gchar *value)
848 {
849 g_object_set (G_OBJECT (object), "name", value, NULL);
850 }
851
852 /**
853 * cc_realm_provider_get_version: (skip)
854 * @object: A #CcRealmProvider.
855 *
856 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Version">"Version"</link> D-Bus property.
857 *
858 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
859 *
860 * 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 cc_realm_provider_dup_version() if on another thread.
861 *
862 * 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.
863 */
864 const gchar *
865 cc_realm_provider_get_version (CcRealmProvider *object)
866 {
867 g_return_val_if_fail (CC_REALM_IS_PROVIDER (object), NULL);
868
869 return CC_REALM_PROVIDER_GET_IFACE (object)->get_version (object);
870 }
871
872 /**
873 * cc_realm_provider_dup_version: (skip)
874 * @object: A #CcRealmProvider.
875 *
876 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Version">"Version"</link> D-Bus property.
877 *
878 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
879 *
880 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
881 */
882 gchar *
883 cc_realm_provider_dup_version (CcRealmProvider *object)
884 {
885 gchar *value;
886 g_object_get (G_OBJECT (object), "version", &value, NULL);
887 return value;
888 }
889
890 /**
891 * cc_realm_provider_set_version: (skip)
892 * @object: A #CcRealmProvider.
893 * @value: The value to set.
894 *
895 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Version">"Version"</link> D-Bus property to @value.
896 *
897 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
898 */
899 void
900 cc_realm_provider_set_version (CcRealmProvider *object, const gchar *value)
901 {
902 g_object_set (G_OBJECT (object), "version", value, NULL);
903 }
904
905 /**
906 * cc_realm_provider_get_realms: (skip)
907 * @object: A #CcRealmProvider.
908 *
909 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Realms">"Realms"</link> D-Bus property.
910 *
911 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
912 *
913 * 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 cc_realm_provider_dup_realms() if on another thread.
914 *
915 * 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.
916 */
917 const gchar *const *
918 cc_realm_provider_get_realms (CcRealmProvider *object)
919 {
920 g_return_val_if_fail (CC_REALM_IS_PROVIDER (object), NULL);
921
922 return CC_REALM_PROVIDER_GET_IFACE (object)->get_realms (object);
923 }
924
925 /**
926 * cc_realm_provider_dup_realms: (skip)
927 * @object: A #CcRealmProvider.
928 *
929 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Realms">"Realms"</link> D-Bus property.
930 *
931 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
932 *
933 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
934 */
935 gchar **
936 cc_realm_provider_dup_realms (CcRealmProvider *object)
937 {
938 gchar **value;
939 g_object_get (G_OBJECT (object), "realms", &value, NULL);
940 return value;
941 }
942
943 /**
944 * cc_realm_provider_set_realms: (skip)
945 * @object: A #CcRealmProvider.
946 * @value: The value to set.
947 *
948 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Provider.Realms">"Realms"</link> D-Bus property to @value.
949 *
950 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
951 */
952 void
953 cc_realm_provider_set_realms (CcRealmProvider *object, const gchar *const *value)
954 {
955 g_object_set (G_OBJECT (object), "realms", value, NULL);
956 }
957
958 /**
959 * cc_realm_provider_call_discover:
960 * @proxy: A #CcRealmProviderProxy.
961 * @arg_string: Argument to pass with the method invocation.
962 * @arg_options: Argument to pass with the method invocation.
963 * @cancellable: (nullable): A #GCancellable or %NULL.
964 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
965 * @user_data: User data to pass to @callback.
966 *
967 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Provider.Discover">Discover()</link> D-Bus method on @proxy.
968 * 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()).
969 * You can then call cc_realm_provider_call_discover_finish() to get the result of the operation.
970 *
971 * See cc_realm_provider_call_discover_sync() for the synchronous, blocking version of this method.
972 */
973 void
974 cc_realm_provider_call_discover (
975 CcRealmProvider *proxy,
976 const gchar *arg_string,
977 GVariant *arg_options,
978 GCancellable *cancellable,
979 GAsyncReadyCallback callback,
980 gpointer user_data)
981 {
982 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
983 "Discover",
984 g_variant_new ("(s@a{sv})",
985 arg_string,
986 arg_options),
987 G_DBUS_CALL_FLAGS_NONE,
988 -1,
989 cancellable,
990 callback,
991 user_data);
992 }
993
994 /**
995 * cc_realm_provider_call_discover_finish:
996 * @proxy: A #CcRealmProviderProxy.
997 * @out_relevance: (out) (optional): Return location for return parameter or %NULL to ignore.
998 * @out_realm: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
999 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_provider_call_discover().
1000 * @error: Return location for error or %NULL.
1001 *
1002 * Finishes an operation started with cc_realm_provider_call_discover().
1003 *
1004 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1005 */
1006 gboolean
1007 cc_realm_provider_call_discover_finish (
1008 CcRealmProvider *proxy,
1009 gint *out_relevance,
1010 gchar ***out_realm,
1011 GAsyncResult *res,
1012 GError **error)
1013 {
1014 GVariant *_ret;
1015 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1016 if (_ret == NULL)
1017 goto _out;
1018 g_variant_get (_ret,
1019 "(i^ao)",
1020 out_relevance,
1021 out_realm);
1022 g_variant_unref (_ret);
1023 _out:
1024 return _ret != NULL;
1025 }
1026
1027 /**
1028 * cc_realm_provider_call_discover_sync:
1029 * @proxy: A #CcRealmProviderProxy.
1030 * @arg_string: Argument to pass with the method invocation.
1031 * @arg_options: Argument to pass with the method invocation.
1032 * @out_relevance: (out) (optional): Return location for return parameter or %NULL to ignore.
1033 * @out_realm: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
1034 * @cancellable: (nullable): A #GCancellable or %NULL.
1035 * @error: Return location for error or %NULL.
1036 *
1037 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Provider.Discover">Discover()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1038 *
1039 * See cc_realm_provider_call_discover() for the asynchronous version of this method.
1040 *
1041 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1042 */
1043 gboolean
1044 cc_realm_provider_call_discover_sync (
1045 CcRealmProvider *proxy,
1046 const gchar *arg_string,
1047 GVariant *arg_options,
1048 gint *out_relevance,
1049 gchar ***out_realm,
1050 GCancellable *cancellable,
1051 GError **error)
1052 {
1053 GVariant *_ret;
1054 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1055 "Discover",
1056 g_variant_new ("(s@a{sv})",
1057 arg_string,
1058 arg_options),
1059 G_DBUS_CALL_FLAGS_NONE,
1060 -1,
1061 cancellable,
1062 error);
1063 if (_ret == NULL)
1064 goto _out;
1065 g_variant_get (_ret,
1066 "(i^ao)",
1067 out_relevance,
1068 out_realm);
1069 g_variant_unref (_ret);
1070 _out:
1071 return _ret != NULL;
1072 }
1073
1074 /**
1075 * cc_realm_provider_complete_discover:
1076 * @object: A #CcRealmProvider.
1077 * @invocation: (transfer full): A #GDBusMethodInvocation.
1078 * @relevance: Parameter to return.
1079 * @realm: Parameter to return.
1080 *
1081 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Provider.Discover">Discover()</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.
1082 *
1083 * This method will free @invocation, you cannot use it afterwards.
1084 */
1085 void
1086 cc_realm_provider_complete_discover (
1087 CcRealmProvider *object G_GNUC_UNUSED,
1088 GDBusMethodInvocation *invocation,
1089 gint relevance,
1090 const gchar *const *realm)
1091 {
1092 g_dbus_method_invocation_return_value (invocation,
1093 g_variant_new ("(i^ao)",
1094 relevance,
1095 realm));
1096 }
1097
1098 /* ------------------------------------------------------------------------ */
1099
1100 /**
1101 * CcRealmProviderProxy:
1102 *
1103 * The #CcRealmProviderProxy structure contains only private data and should only be accessed using the provided API.
1104 */
1105
1106 /**
1107 * CcRealmProviderProxyClass:
1108 * @parent_class: The parent class.
1109 *
1110 * Class structure for #CcRealmProviderProxy.
1111 */
1112
1113 struct _CcRealmProviderProxyPrivate
1114 {
1115 GData *qdata;
1116 };
1117
1118 static void cc_realm_provider_proxy_iface_init (CcRealmProviderIface *iface);
1119
1120 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1121 G_DEFINE_TYPE_WITH_CODE (CcRealmProviderProxy, cc_realm_provider_proxy, G_TYPE_DBUS_PROXY,
1122 G_ADD_PRIVATE (CcRealmProviderProxy)
1123 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_PROVIDER, cc_realm_provider_proxy_iface_init))
1124
1125 #else
1126 G_DEFINE_TYPE_WITH_CODE (CcRealmProviderProxy, cc_realm_provider_proxy, G_TYPE_DBUS_PROXY,
1127 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_PROVIDER, cc_realm_provider_proxy_iface_init))
1128
1129 #endif
1130 static void
1131 cc_realm_provider_proxy_finalize (GObject *object)
1132 {
1133 CcRealmProviderProxy *proxy = CC_REALM_PROVIDER_PROXY (object);
1134 g_datalist_clear (&proxy->priv->qdata);
1135 G_OBJECT_CLASS (cc_realm_provider_proxy_parent_class)->finalize (object);
1136 }
1137
1138 static void
1139 cc_realm_provider_proxy_get_property (GObject *object,
1140 guint prop_id,
1141 GValue *value,
1142 GParamSpec *pspec G_GNUC_UNUSED)
1143 {
1144 const _ExtendedGDBusPropertyInfo *info;
1145 GVariant *variant;
1146 g_assert (prop_id != 0 && prop_id - 1 < 3);
1147 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_provider_property_info_pointers[prop_id - 1];
1148 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1149 if (info->use_gvariant)
1150 {
1151 g_value_set_variant (value, variant);
1152 }
1153 else
1154 {
1155 if (variant != NULL)
1156 g_dbus_gvariant_to_gvalue (variant, value);
1157 }
1158 if (variant != NULL)
1159 g_variant_unref (variant);
1160 }
1161
1162 static void
1163 cc_realm_provider_proxy_set_property_cb (GDBusProxy *proxy,
1164 GAsyncResult *res,
1165 gpointer user_data)
1166 {
1167 const _ExtendedGDBusPropertyInfo *info = user_data;
1168 GError *error;
1169 GVariant *_ret;
1170 error = NULL;
1171 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1172 if (!_ret)
1173 {
1174 g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Provider: %s (%s, %d)",
1175 info->parent_struct.name,
1176 error->message, g_quark_to_string (error->domain), error->code);
1177 g_error_free (error);
1178 }
1179 else
1180 {
1181 g_variant_unref (_ret);
1182 }
1183 }
1184
1185 static void
1186 cc_realm_provider_proxy_set_property (GObject *object,
1187 guint prop_id,
1188 const GValue *value,
1189 GParamSpec *pspec G_GNUC_UNUSED)
1190 {
1191 const _ExtendedGDBusPropertyInfo *info;
1192 GVariant *variant;
1193 g_assert (prop_id != 0 && prop_id - 1 < 3);
1194 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_provider_property_info_pointers[prop_id - 1];
1195 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1196 g_dbus_proxy_call (G_DBUS_PROXY (object),
1197 "org.freedesktop.DBus.Properties.Set",
1198 g_variant_new ("(ssv)", "org.freedesktop.realmd.Provider", info->parent_struct.name, variant),
1199 G_DBUS_CALL_FLAGS_NONE,
1200 -1,
1201 NULL, (GAsyncReadyCallback) cc_realm_provider_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1202 g_variant_unref (variant);
1203 }
1204
1205 static void
1206 cc_realm_provider_proxy_g_signal (GDBusProxy *proxy,
1207 const gchar *sender_name G_GNUC_UNUSED,
1208 const gchar *signal_name,
1209 GVariant *parameters)
1210 {
1211 _ExtendedGDBusSignalInfo *info;
1212 GVariantIter iter;
1213 GVariant *child;
1214 GValue *paramv;
1215 gsize num_params;
1216 gsize n;
1217 guint signal_id;
1218 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct, signal_name);
1219 if (info == NULL)
1220 return;
1221 num_params = g_variant_n_children (parameters);
1222 paramv = g_new0 (GValue, num_params + 1);
1223 g_value_init (&paramv[0], CC_REALM_TYPE_PROVIDER);
1224 g_value_set_object (&paramv[0], proxy);
1225 g_variant_iter_init (&iter, parameters);
1226 n = 1;
1227 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1228 {
1229 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1230 if (arg_info->use_gvariant)
1231 {
1232 g_value_init (&paramv[n], G_TYPE_VARIANT);
1233 g_value_set_variant (&paramv[n], child);
1234 n++;
1235 }
1236 else
1237 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1238 g_variant_unref (child);
1239 }
1240 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_PROVIDER);
1241 g_signal_emitv (paramv, signal_id, 0, NULL);
1242 for (n = 0; n < num_params + 1; n++)
1243 g_value_unset (&paramv[n]);
1244 g_free (paramv);
1245 }
1246
1247 static void
1248 cc_realm_provider_proxy_g_properties_changed (GDBusProxy *_proxy,
1249 GVariant *changed_properties,
1250 const gchar *const *invalidated_properties)
1251 {
1252 CcRealmProviderProxy *proxy = CC_REALM_PROVIDER_PROXY (_proxy);
1253 guint n;
1254 const gchar *key;
1255 GVariantIter *iter;
1256 _ExtendedGDBusPropertyInfo *info;
1257 g_variant_get (changed_properties, "a{sv}", &iter);
1258 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1259 {
1260 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct, key);
1261 g_datalist_remove_data (&proxy->priv->qdata, key);
1262 if (info != NULL)
1263 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1264 }
1265 g_variant_iter_free (iter);
1266 for (n = 0; invalidated_properties[n] != NULL; n++)
1267 {
1268 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct, invalidated_properties[n]);
1269 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1270 if (info != NULL)
1271 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1272 }
1273 }
1274
1275 static const gchar *
1276 cc_realm_provider_proxy_get_name (CcRealmProvider *object)
1277 {
1278 CcRealmProviderProxy *proxy = CC_REALM_PROVIDER_PROXY (object);
1279 GVariant *variant;
1280 const gchar *value = NULL;
1281 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name");
1282 if (variant != NULL)
1283 {
1284 value = g_variant_get_string (variant, NULL);
1285 g_variant_unref (variant);
1286 }
1287 return value;
1288 }
1289
1290 static const gchar *
1291 cc_realm_provider_proxy_get_version (CcRealmProvider *object)
1292 {
1293 CcRealmProviderProxy *proxy = CC_REALM_PROVIDER_PROXY (object);
1294 GVariant *variant;
1295 const gchar *value = NULL;
1296 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Version");
1297 if (variant != NULL)
1298 {
1299 value = g_variant_get_string (variant, NULL);
1300 g_variant_unref (variant);
1301 }
1302 return value;
1303 }
1304
1305 static const gchar *const *
1306 cc_realm_provider_proxy_get_realms (CcRealmProvider *object)
1307 {
1308 CcRealmProviderProxy *proxy = CC_REALM_PROVIDER_PROXY (object);
1309 GVariant *variant;
1310 const gchar *const *value = NULL;
1311 value = g_datalist_get_data (&proxy->priv->qdata, "Realms");
1312 if (value != NULL)
1313 return value;
1314 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Realms");
1315 if (variant != NULL)
1316 {
1317 value = g_variant_get_objv (variant, NULL);
1318 g_datalist_set_data_full (&proxy->priv->qdata, "Realms", (gpointer) value, g_free);
1319 g_variant_unref (variant);
1320 }
1321 return value;
1322 }
1323
1324 static void
1325 cc_realm_provider_proxy_init (CcRealmProviderProxy *proxy)
1326 {
1327 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1328 proxy->priv = cc_realm_provider_proxy_get_instance_private (proxy);
1329 #else
1330 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, CC_REALM_TYPE_PROVIDER_PROXY, CcRealmProviderProxyPrivate);
1331 #endif
1332
1333 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), cc_realm_provider_interface_info ());
1334 }
1335
1336 static void
1337 cc_realm_provider_proxy_class_init (CcRealmProviderProxyClass *klass)
1338 {
1339 GObjectClass *gobject_class;
1340 GDBusProxyClass *proxy_class;
1341
1342 gobject_class = G_OBJECT_CLASS (klass);
1343 gobject_class->finalize = cc_realm_provider_proxy_finalize;
1344 gobject_class->get_property = cc_realm_provider_proxy_get_property;
1345 gobject_class->set_property = cc_realm_provider_proxy_set_property;
1346
1347 proxy_class = G_DBUS_PROXY_CLASS (klass);
1348 proxy_class->g_signal = cc_realm_provider_proxy_g_signal;
1349 proxy_class->g_properties_changed = cc_realm_provider_proxy_g_properties_changed;
1350
1351 cc_realm_provider_override_properties (gobject_class, 1);
1352
1353 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1354 g_type_class_add_private (klass, sizeof (CcRealmProviderProxyPrivate));
1355 #endif
1356 }
1357
1358 static void
1359 cc_realm_provider_proxy_iface_init (CcRealmProviderIface *iface)
1360 {
1361 iface->get_name = cc_realm_provider_proxy_get_name;
1362 iface->get_version = cc_realm_provider_proxy_get_version;
1363 iface->get_realms = cc_realm_provider_proxy_get_realms;
1364 }
1365
1366 /**
1367 * cc_realm_provider_proxy_new:
1368 * @connection: A #GDBusConnection.
1369 * @flags: Flags from the #GDBusProxyFlags enumeration.
1370 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1371 * @object_path: An object path.
1372 * @cancellable: (nullable): A #GCancellable or %NULL.
1373 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1374 * @user_data: User data to pass to @callback.
1375 *
1376 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>. See g_dbus_proxy_new() for more details.
1377 *
1378 * 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()).
1379 * You can then call cc_realm_provider_proxy_new_finish() to get the result of the operation.
1380 *
1381 * See cc_realm_provider_proxy_new_sync() for the synchronous, blocking version of this constructor.
1382 */
1383 void
1384 cc_realm_provider_proxy_new (
1385 GDBusConnection *connection,
1386 GDBusProxyFlags flags,
1387 const gchar *name,
1388 const gchar *object_path,
1389 GCancellable *cancellable,
1390 GAsyncReadyCallback callback,
1391 gpointer user_data)
1392 {
1393 g_async_initable_new_async (CC_REALM_TYPE_PROVIDER_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.realmd.Provider", NULL);
1394 }
1395
1396 /**
1397 * cc_realm_provider_proxy_new_finish:
1398 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_provider_proxy_new().
1399 * @error: Return location for error or %NULL
1400 *
1401 * Finishes an operation started with cc_realm_provider_proxy_new().
1402 *
1403 * Returns: (transfer full) (type CcRealmProviderProxy): The constructed proxy object or %NULL if @error is set.
1404 */
1405 CcRealmProvider *
1406 cc_realm_provider_proxy_new_finish (
1407 GAsyncResult *res,
1408 GError **error)
1409 {
1410 GObject *ret;
1411 GObject *source_object;
1412 source_object = g_async_result_get_source_object (res);
1413 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1414 g_object_unref (source_object);
1415 if (ret != NULL)
1416 return CC_REALM_PROVIDER (ret);
1417 else
1418 return NULL;
1419 }
1420
1421 /**
1422 * cc_realm_provider_proxy_new_sync:
1423 * @connection: A #GDBusConnection.
1424 * @flags: Flags from the #GDBusProxyFlags enumeration.
1425 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1426 * @object_path: An object path.
1427 * @cancellable: (nullable): A #GCancellable or %NULL.
1428 * @error: Return location for error or %NULL
1429 *
1430 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>. See g_dbus_proxy_new_sync() for more details.
1431 *
1432 * The calling thread is blocked until a reply is received.
1433 *
1434 * See cc_realm_provider_proxy_new() for the asynchronous version of this constructor.
1435 *
1436 * Returns: (transfer full) (type CcRealmProviderProxy): The constructed proxy object or %NULL if @error is set.
1437 */
1438 CcRealmProvider *
1439 cc_realm_provider_proxy_new_sync (
1440 GDBusConnection *connection,
1441 GDBusProxyFlags flags,
1442 const gchar *name,
1443 const gchar *object_path,
1444 GCancellable *cancellable,
1445 GError **error)
1446 {
1447 GInitable *ret;
1448 ret = g_initable_new (CC_REALM_TYPE_PROVIDER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Provider", NULL);
1449 if (ret != NULL)
1450 return CC_REALM_PROVIDER (ret);
1451 else
1452 return NULL;
1453 }
1454
1455
1456 /**
1457 * cc_realm_provider_proxy_new_for_bus:
1458 * @bus_type: A #GBusType.
1459 * @flags: Flags from the #GDBusProxyFlags enumeration.
1460 * @name: A bus name (well-known or unique).
1461 * @object_path: An object path.
1462 * @cancellable: (nullable): A #GCancellable or %NULL.
1463 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1464 * @user_data: User data to pass to @callback.
1465 *
1466 * Like cc_realm_provider_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1467 *
1468 * 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()).
1469 * You can then call cc_realm_provider_proxy_new_for_bus_finish() to get the result of the operation.
1470 *
1471 * See cc_realm_provider_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1472 */
1473 void
1474 cc_realm_provider_proxy_new_for_bus (
1475 GBusType bus_type,
1476 GDBusProxyFlags flags,
1477 const gchar *name,
1478 const gchar *object_path,
1479 GCancellable *cancellable,
1480 GAsyncReadyCallback callback,
1481 gpointer user_data)
1482 {
1483 g_async_initable_new_async (CC_REALM_TYPE_PROVIDER_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.realmd.Provider", NULL);
1484 }
1485
1486 /**
1487 * cc_realm_provider_proxy_new_for_bus_finish:
1488 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_provider_proxy_new_for_bus().
1489 * @error: Return location for error or %NULL
1490 *
1491 * Finishes an operation started with cc_realm_provider_proxy_new_for_bus().
1492 *
1493 * Returns: (transfer full) (type CcRealmProviderProxy): The constructed proxy object or %NULL if @error is set.
1494 */
1495 CcRealmProvider *
1496 cc_realm_provider_proxy_new_for_bus_finish (
1497 GAsyncResult *res,
1498 GError **error)
1499 {
1500 GObject *ret;
1501 GObject *source_object;
1502 source_object = g_async_result_get_source_object (res);
1503 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1504 g_object_unref (source_object);
1505 if (ret != NULL)
1506 return CC_REALM_PROVIDER (ret);
1507 else
1508 return NULL;
1509 }
1510
1511 /**
1512 * cc_realm_provider_proxy_new_for_bus_sync:
1513 * @bus_type: A #GBusType.
1514 * @flags: Flags from the #GDBusProxyFlags enumeration.
1515 * @name: A bus name (well-known or unique).
1516 * @object_path: An object path.
1517 * @cancellable: (nullable): A #GCancellable or %NULL.
1518 * @error: Return location for error or %NULL
1519 *
1520 * Like cc_realm_provider_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1521 *
1522 * The calling thread is blocked until a reply is received.
1523 *
1524 * See cc_realm_provider_proxy_new_for_bus() for the asynchronous version of this constructor.
1525 *
1526 * Returns: (transfer full) (type CcRealmProviderProxy): The constructed proxy object or %NULL if @error is set.
1527 */
1528 CcRealmProvider *
1529 cc_realm_provider_proxy_new_for_bus_sync (
1530 GBusType bus_type,
1531 GDBusProxyFlags flags,
1532 const gchar *name,
1533 const gchar *object_path,
1534 GCancellable *cancellable,
1535 GError **error)
1536 {
1537 GInitable *ret;
1538 ret = g_initable_new (CC_REALM_TYPE_PROVIDER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Provider", NULL);
1539 if (ret != NULL)
1540 return CC_REALM_PROVIDER (ret);
1541 else
1542 return NULL;
1543 }
1544
1545
1546 /* ------------------------------------------------------------------------ */
1547
1548 /**
1549 * CcRealmProviderSkeleton:
1550 *
1551 * The #CcRealmProviderSkeleton structure contains only private data and should only be accessed using the provided API.
1552 */
1553
1554 /**
1555 * CcRealmProviderSkeletonClass:
1556 * @parent_class: The parent class.
1557 *
1558 * Class structure for #CcRealmProviderSkeleton.
1559 */
1560
1561 struct _CcRealmProviderSkeletonPrivate
1562 {
1563 GValue *properties;
1564 GList *changed_properties;
1565 GSource *changed_properties_idle_source;
1566 GMainContext *context;
1567 GMutex lock;
1568 };
1569
1570 static void
1571 _cc_realm_provider_skeleton_handle_method_call (
1572 GDBusConnection *connection G_GNUC_UNUSED,
1573 const gchar *sender G_GNUC_UNUSED,
1574 const gchar *object_path G_GNUC_UNUSED,
1575 const gchar *interface_name,
1576 const gchar *method_name,
1577 GVariant *parameters,
1578 GDBusMethodInvocation *invocation,
1579 gpointer user_data)
1580 {
1581 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (user_data);
1582 _ExtendedGDBusMethodInfo *info;
1583 GVariantIter iter;
1584 GVariant *child;
1585 GValue *paramv;
1586 gsize num_params;
1587 guint num_extra;
1588 gsize n;
1589 guint signal_id;
1590 GValue return_value = G_VALUE_INIT;
1591 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1592 g_assert (info != NULL);
1593 num_params = g_variant_n_children (parameters);
1594 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1595 n = 0;
1596 g_value_init (&paramv[n], CC_REALM_TYPE_PROVIDER);
1597 g_value_set_object (&paramv[n++], skeleton);
1598 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1599 g_value_set_object (&paramv[n++], invocation);
1600 if (info->pass_fdlist)
1601 {
1602 #ifdef G_OS_UNIX
1603 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1604 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1605 #else
1606 g_assert_not_reached ();
1607 #endif
1608 }
1609 g_variant_iter_init (&iter, parameters);
1610 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1611 {
1612 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1613 if (arg_info->use_gvariant)
1614 {
1615 g_value_init (&paramv[n], G_TYPE_VARIANT);
1616 g_value_set_variant (&paramv[n], child);
1617 n++;
1618 }
1619 else
1620 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1621 g_variant_unref (child);
1622 }
1623 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_PROVIDER);
1624 g_value_init (&return_value, G_TYPE_BOOLEAN);
1625 g_signal_emitv (paramv, signal_id, 0, &return_value);
1626 if (!g_value_get_boolean (&return_value))
1627 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);
1628 g_value_unset (&return_value);
1629 for (n = 0; n < num_params + num_extra; n++)
1630 g_value_unset (&paramv[n]);
1631 g_free (paramv);
1632 }
1633
1634 static GVariant *
1635 _cc_realm_provider_skeleton_handle_get_property (
1636 GDBusConnection *connection G_GNUC_UNUSED,
1637 const gchar *sender G_GNUC_UNUSED,
1638 const gchar *object_path G_GNUC_UNUSED,
1639 const gchar *interface_name G_GNUC_UNUSED,
1640 const gchar *property_name,
1641 GError **error,
1642 gpointer user_data)
1643 {
1644 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (user_data);
1645 GValue value = G_VALUE_INIT;
1646 GParamSpec *pspec;
1647 _ExtendedGDBusPropertyInfo *info;
1648 GVariant *ret;
1649 ret = NULL;
1650 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct, property_name);
1651 g_assert (info != NULL);
1652 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1653 if (pspec == NULL)
1654 {
1655 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1656 }
1657 else
1658 {
1659 g_value_init (&value, pspec->value_type);
1660 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1661 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1662 g_value_unset (&value);
1663 }
1664 return ret;
1665 }
1666
1667 static gboolean
1668 _cc_realm_provider_skeleton_handle_set_property (
1669 GDBusConnection *connection G_GNUC_UNUSED,
1670 const gchar *sender G_GNUC_UNUSED,
1671 const gchar *object_path G_GNUC_UNUSED,
1672 const gchar *interface_name G_GNUC_UNUSED,
1673 const gchar *property_name,
1674 GVariant *variant,
1675 GError **error,
1676 gpointer user_data)
1677 {
1678 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (user_data);
1679 GValue value = G_VALUE_INIT;
1680 GParamSpec *pspec;
1681 _ExtendedGDBusPropertyInfo *info;
1682 gboolean ret;
1683 ret = FALSE;
1684 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_provider_interface_info.parent_struct, property_name);
1685 g_assert (info != NULL);
1686 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1687 if (pspec == NULL)
1688 {
1689 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1690 }
1691 else
1692 {
1693 if (info->use_gvariant)
1694 g_value_set_variant (&value, variant);
1695 else
1696 g_dbus_gvariant_to_gvalue (variant, &value);
1697 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1698 g_value_unset (&value);
1699 ret = TRUE;
1700 }
1701 return ret;
1702 }
1703
1704 static const GDBusInterfaceVTable _cc_realm_provider_skeleton_vtable =
1705 {
1706 _cc_realm_provider_skeleton_handle_method_call,
1707 _cc_realm_provider_skeleton_handle_get_property,
1708 _cc_realm_provider_skeleton_handle_set_property,
1709 {NULL}
1710 };
1711
1712 static GDBusInterfaceInfo *
1713 cc_realm_provider_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1714 {
1715 return cc_realm_provider_interface_info ();
1716 }
1717
1718 static GDBusInterfaceVTable *
1719 cc_realm_provider_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1720 {
1721 return (GDBusInterfaceVTable *) &_cc_realm_provider_skeleton_vtable;
1722 }
1723
1724 static GVariant *
1725 cc_realm_provider_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1726 {
1727 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (_skeleton);
1728
1729 GVariantBuilder builder;
1730 guint n;
1731 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1732 if (_cc_realm_provider_interface_info.parent_struct.properties == NULL)
1733 goto out;
1734 for (n = 0; _cc_realm_provider_interface_info.parent_struct.properties[n] != NULL; n++)
1735 {
1736 GDBusPropertyInfo *info = _cc_realm_provider_interface_info.parent_struct.properties[n];
1737 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1738 {
1739 GVariant *value;
1740 value = _cc_realm_provider_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.realmd.Provider", info->name, NULL, skeleton);
1741 if (value != NULL)
1742 {
1743 g_variant_take_ref (value);
1744 g_variant_builder_add (&builder, "{sv}", info->name, value);
1745 g_variant_unref (value);
1746 }
1747 }
1748 }
1749 out:
1750 return g_variant_builder_end (&builder);
1751 }
1752
1753 static gboolean _cc_realm_provider_emit_changed (gpointer user_data);
1754
1755 static void
1756 cc_realm_provider_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1757 {
1758 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (_skeleton);
1759 gboolean emit_changed = FALSE;
1760
1761 g_mutex_lock (&skeleton->priv->lock);
1762 if (skeleton->priv->changed_properties_idle_source != NULL)
1763 {
1764 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1765 skeleton->priv->changed_properties_idle_source = NULL;
1766 emit_changed = TRUE;
1767 }
1768 g_mutex_unlock (&skeleton->priv->lock);
1769
1770 if (emit_changed)
1771 _cc_realm_provider_emit_changed (skeleton);
1772 }
1773
1774 static void cc_realm_provider_skeleton_iface_init (CcRealmProviderIface *iface);
1775 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1776 G_DEFINE_TYPE_WITH_CODE (CcRealmProviderSkeleton, cc_realm_provider_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1777 G_ADD_PRIVATE (CcRealmProviderSkeleton)
1778 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_PROVIDER, cc_realm_provider_skeleton_iface_init))
1779
1780 #else
1781 G_DEFINE_TYPE_WITH_CODE (CcRealmProviderSkeleton, cc_realm_provider_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1782 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_PROVIDER, cc_realm_provider_skeleton_iface_init))
1783
1784 #endif
1785 static void
1786 cc_realm_provider_skeleton_finalize (GObject *object)
1787 {
1788 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1789 guint n;
1790 for (n = 0; n < 3; n++)
1791 g_value_unset (&skeleton->priv->properties[n]);
1792 g_free (skeleton->priv->properties);
1793 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1794 if (skeleton->priv->changed_properties_idle_source != NULL)
1795 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1796 g_main_context_unref (skeleton->priv->context);
1797 g_mutex_clear (&skeleton->priv->lock);
1798 G_OBJECT_CLASS (cc_realm_provider_skeleton_parent_class)->finalize (object);
1799 }
1800
1801 static void
1802 cc_realm_provider_skeleton_get_property (GObject *object,
1803 guint prop_id,
1804 GValue *value,
1805 GParamSpec *pspec G_GNUC_UNUSED)
1806 {
1807 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1808 g_assert (prop_id != 0 && prop_id - 1 < 3);
1809 g_mutex_lock (&skeleton->priv->lock);
1810 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1811 g_mutex_unlock (&skeleton->priv->lock);
1812 }
1813
1814 static gboolean
1815 _cc_realm_provider_emit_changed (gpointer user_data)
1816 {
1817 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (user_data);
1818 GList *l;
1819 GVariantBuilder builder;
1820 GVariantBuilder invalidated_builder;
1821 guint num_changes;
1822
1823 g_mutex_lock (&skeleton->priv->lock);
1824 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1825 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1826 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1827 {
1828 ChangedProperty *cp = l->data;
1829 GVariant *variant;
1830 const GValue *cur_value;
1831
1832 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1833 if (!_g_value_equal (cur_value, &cp->orig_value))
1834 {
1835 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1836 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1837 g_variant_unref (variant);
1838 num_changes++;
1839 }
1840 }
1841 if (num_changes > 0)
1842 {
1843 GList *connections, *ll;
1844 GVariant *signal_variant;
1845 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Provider",
1846 &builder, &invalidated_builder));
1847 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1848 for (ll = connections; ll != NULL; ll = ll->next)
1849 {
1850 GDBusConnection *connection = ll->data;
1851
1852 g_dbus_connection_emit_signal (connection,
1853 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1854 "org.freedesktop.DBus.Properties",
1855 "PropertiesChanged",
1856 signal_variant,
1857 NULL);
1858 }
1859 g_variant_unref (signal_variant);
1860 g_list_free_full (connections, g_object_unref);
1861 }
1862 else
1863 {
1864 g_variant_builder_clear (&builder);
1865 g_variant_builder_clear (&invalidated_builder);
1866 }
1867 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1868 skeleton->priv->changed_properties = NULL;
1869 skeleton->priv->changed_properties_idle_source = NULL;
1870 g_mutex_unlock (&skeleton->priv->lock);
1871 return FALSE;
1872 }
1873
1874 static void
1875 _cc_realm_provider_schedule_emit_changed (CcRealmProviderSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1876 {
1877 ChangedProperty *cp;
1878 GList *l;
1879 cp = NULL;
1880 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1881 {
1882 ChangedProperty *i_cp = l->data;
1883 if (i_cp->info == info)
1884 {
1885 cp = i_cp;
1886 break;
1887 }
1888 }
1889 if (cp == NULL)
1890 {
1891 cp = g_new0 (ChangedProperty, 1);
1892 cp->prop_id = prop_id;
1893 cp->info = info;
1894 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1895 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1896 g_value_copy (orig_value, &cp->orig_value);
1897 }
1898 }
1899
1900 static void
1901 cc_realm_provider_skeleton_notify (GObject *object,
1902 GParamSpec *pspec G_GNUC_UNUSED)
1903 {
1904 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1905 g_mutex_lock (&skeleton->priv->lock);
1906 if (skeleton->priv->changed_properties != NULL &&
1907 skeleton->priv->changed_properties_idle_source == NULL)
1908 {
1909 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1910 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1911 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _cc_realm_provider_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1912 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _cc_realm_provider_emit_changed");
1913 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1914 g_source_unref (skeleton->priv->changed_properties_idle_source);
1915 }
1916 g_mutex_unlock (&skeleton->priv->lock);
1917 }
1918
1919 static void
1920 cc_realm_provider_skeleton_set_property (GObject *object,
1921 guint prop_id,
1922 const GValue *value,
1923 GParamSpec *pspec)
1924 {
1925 const _ExtendedGDBusPropertyInfo *info;
1926 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1927 g_assert (prop_id != 0 && prop_id - 1 < 3);
1928 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_provider_property_info_pointers[prop_id - 1];
1929 g_mutex_lock (&skeleton->priv->lock);
1930 g_object_freeze_notify (object);
1931 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1932 {
1933 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
1934 info->emits_changed_signal)
1935 _cc_realm_provider_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
1936 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1937 g_object_notify_by_pspec (object, pspec);
1938 }
1939 g_mutex_unlock (&skeleton->priv->lock);
1940 g_object_thaw_notify (object);
1941 }
1942
1943 static void
1944 cc_realm_provider_skeleton_init (CcRealmProviderSkeleton *skeleton)
1945 {
1946 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1947 skeleton->priv = cc_realm_provider_skeleton_get_instance_private (skeleton);
1948 #else
1949 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, CC_REALM_TYPE_PROVIDER_SKELETON, CcRealmProviderSkeletonPrivate);
1950 #endif
1951
1952 g_mutex_init (&skeleton->priv->lock);
1953 skeleton->priv->context = g_main_context_ref_thread_default ();
1954 skeleton->priv->properties = g_new0 (GValue, 3);
1955 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
1956 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1957 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV);
1958 }
1959
1960 static const gchar *
1961 cc_realm_provider_skeleton_get_name (CcRealmProvider *object)
1962 {
1963 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1964 const gchar *value;
1965 g_mutex_lock (&skeleton->priv->lock);
1966 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
1967 g_mutex_unlock (&skeleton->priv->lock);
1968 return value;
1969 }
1970
1971 static const gchar *
1972 cc_realm_provider_skeleton_get_version (CcRealmProvider *object)
1973 {
1974 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1975 const gchar *value;
1976 g_mutex_lock (&skeleton->priv->lock);
1977 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
1978 g_mutex_unlock (&skeleton->priv->lock);
1979 return value;
1980 }
1981
1982 static const gchar *const *
1983 cc_realm_provider_skeleton_get_realms (CcRealmProvider *object)
1984 {
1985 CcRealmProviderSkeleton *skeleton = CC_REALM_PROVIDER_SKELETON (object);
1986 const gchar *const *value;
1987 g_mutex_lock (&skeleton->priv->lock);
1988 value = g_marshal_value_peek_boxed (&(skeleton->priv->properties[2]));
1989 g_mutex_unlock (&skeleton->priv->lock);
1990 return value;
1991 }
1992
1993 static void
1994 cc_realm_provider_skeleton_class_init (CcRealmProviderSkeletonClass *klass)
1995 {
1996 GObjectClass *gobject_class;
1997 GDBusInterfaceSkeletonClass *skeleton_class;
1998
1999 gobject_class = G_OBJECT_CLASS (klass);
2000 gobject_class->finalize = cc_realm_provider_skeleton_finalize;
2001 gobject_class->get_property = cc_realm_provider_skeleton_get_property;
2002 gobject_class->set_property = cc_realm_provider_skeleton_set_property;
2003 gobject_class->notify = cc_realm_provider_skeleton_notify;
2004
2005
2006 cc_realm_provider_override_properties (gobject_class, 1);
2007
2008 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2009 skeleton_class->get_info = cc_realm_provider_skeleton_dbus_interface_get_info;
2010 skeleton_class->get_properties = cc_realm_provider_skeleton_dbus_interface_get_properties;
2011 skeleton_class->flush = cc_realm_provider_skeleton_dbus_interface_flush;
2012 skeleton_class->get_vtable = cc_realm_provider_skeleton_dbus_interface_get_vtable;
2013
2014 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2015 g_type_class_add_private (klass, sizeof (CcRealmProviderSkeletonPrivate));
2016 #endif
2017 }
2018
2019 static void
2020 cc_realm_provider_skeleton_iface_init (CcRealmProviderIface *iface)
2021 {
2022 iface->get_name = cc_realm_provider_skeleton_get_name;
2023 iface->get_version = cc_realm_provider_skeleton_get_version;
2024 iface->get_realms = cc_realm_provider_skeleton_get_realms;
2025 }
2026
2027 /**
2028 * cc_realm_provider_skeleton_new:
2029 *
2030 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>.
2031 *
2032 * Returns: (transfer full) (type CcRealmProviderSkeleton): The skeleton object.
2033 */
2034 CcRealmProvider *
2035 cc_realm_provider_skeleton_new (void)
2036 {
2037 return CC_REALM_PROVIDER (g_object_new (CC_REALM_TYPE_PROVIDER_SKELETON, NULL));
2038 }
2039
2040 /* ------------------------------------------------------------------------
2041 * Code for interface org.freedesktop.realmd.Service
2042 * ------------------------------------------------------------------------
2043 */
2044
2045 /**
2046 * SECTION:CcRealmService
2047 * @title: CcRealmService
2048 * @short_description: Generated C code for the org.freedesktop.realmd.Service D-Bus interface
2049 *
2050 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link> D-Bus interface in C.
2051 */
2052
2053 enum
2054 {
2055 CC_REALM__SERVICE_DIAGNOSTICS,
2056 };
2057
2058 static unsigned CC_REALM__SERVICE_SIGNALS[1] = { 0 };
2059
2060 /* ---- Introspection data for org.freedesktop.realmd.Service ---- */
2061
2062 static const _ExtendedGDBusArgInfo _cc_realm_service_method_info_cancel_IN_ARG_operation =
2063 {
2064 {
2065 -1,
2066 (gchar *) "operation",
2067 (gchar *) "s",
2068 NULL
2069 },
2070 FALSE
2071 };
2072
2073 static const GDBusArgInfo * const _cc_realm_service_method_info_cancel_IN_ARG_pointers[] =
2074 {
2075 &_cc_realm_service_method_info_cancel_IN_ARG_operation.parent_struct,
2076 NULL
2077 };
2078
2079 static const _ExtendedGDBusMethodInfo _cc_realm_service_method_info_cancel =
2080 {
2081 {
2082 -1,
2083 (gchar *) "Cancel",
2084 (GDBusArgInfo **) &_cc_realm_service_method_info_cancel_IN_ARG_pointers,
2085 NULL,
2086 NULL
2087 },
2088 "handle-cancel",
2089 FALSE
2090 };
2091
2092 static const _ExtendedGDBusArgInfo _cc_realm_service_method_info_set_locale_IN_ARG_locale =
2093 {
2094 {
2095 -1,
2096 (gchar *) "locale",
2097 (gchar *) "s",
2098 NULL
2099 },
2100 FALSE
2101 };
2102
2103 static const GDBusArgInfo * const _cc_realm_service_method_info_set_locale_IN_ARG_pointers[] =
2104 {
2105 &_cc_realm_service_method_info_set_locale_IN_ARG_locale.parent_struct,
2106 NULL
2107 };
2108
2109 static const _ExtendedGDBusMethodInfo _cc_realm_service_method_info_set_locale =
2110 {
2111 {
2112 -1,
2113 (gchar *) "SetLocale",
2114 (GDBusArgInfo **) &_cc_realm_service_method_info_set_locale_IN_ARG_pointers,
2115 NULL,
2116 NULL
2117 },
2118 "handle-set-locale",
2119 FALSE
2120 };
2121
2122 static const _ExtendedGDBusMethodInfo _cc_realm_service_method_info_release =
2123 {
2124 {
2125 -1,
2126 (gchar *) "Release",
2127 NULL,
2128 NULL,
2129 NULL
2130 },
2131 "handle-release",
2132 FALSE
2133 };
2134
2135 static const GDBusMethodInfo * const _cc_realm_service_method_info_pointers[] =
2136 {
2137 &_cc_realm_service_method_info_cancel.parent_struct,
2138 &_cc_realm_service_method_info_set_locale.parent_struct,
2139 &_cc_realm_service_method_info_release.parent_struct,
2140 NULL
2141 };
2142
2143 static const _ExtendedGDBusArgInfo _cc_realm_service_signal_info_diagnostics_ARG_data =
2144 {
2145 {
2146 -1,
2147 (gchar *) "data",
2148 (gchar *) "s",
2149 NULL
2150 },
2151 FALSE
2152 };
2153
2154 static const _ExtendedGDBusArgInfo _cc_realm_service_signal_info_diagnostics_ARG_operation =
2155 {
2156 {
2157 -1,
2158 (gchar *) "operation",
2159 (gchar *) "s",
2160 NULL
2161 },
2162 FALSE
2163 };
2164
2165 static const GDBusArgInfo * const _cc_realm_service_signal_info_diagnostics_ARG_pointers[] =
2166 {
2167 &_cc_realm_service_signal_info_diagnostics_ARG_data.parent_struct,
2168 &_cc_realm_service_signal_info_diagnostics_ARG_operation.parent_struct,
2169 NULL
2170 };
2171
2172 static const _ExtendedGDBusSignalInfo _cc_realm_service_signal_info_diagnostics =
2173 {
2174 {
2175 -1,
2176 (gchar *) "Diagnostics",
2177 (GDBusArgInfo **) &_cc_realm_service_signal_info_diagnostics_ARG_pointers,
2178 NULL
2179 },
2180 "diagnostics"
2181 };
2182
2183 static const GDBusSignalInfo * const _cc_realm_service_signal_info_pointers[] =
2184 {
2185 &_cc_realm_service_signal_info_diagnostics.parent_struct,
2186 NULL
2187 };
2188
2189 static const _ExtendedGDBusInterfaceInfo _cc_realm_service_interface_info =
2190 {
2191 {
2192 -1,
2193 (gchar *) "org.freedesktop.realmd.Service",
2194 (GDBusMethodInfo **) &_cc_realm_service_method_info_pointers,
2195 (GDBusSignalInfo **) &_cc_realm_service_signal_info_pointers,
2196 NULL,
2197 NULL
2198 },
2199 "service",
2200 };
2201
2202
2203 /**
2204 * cc_realm_service_interface_info:
2205 *
2206 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link> D-Bus interface.
2207 *
2208 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2209 */
2210 GDBusInterfaceInfo *
2211 cc_realm_service_interface_info (void)
2212 {
2213 return (GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct;
2214 }
2215
2216 /**
2217 * cc_realm_service_override_properties:
2218 * @klass: The class structure for a #GObject derived class.
2219 * @property_id_begin: The property id to assign to the first overridden property.
2220 *
2221 * Overrides all #GObject properties in the #CcRealmService interface for a concrete class.
2222 * The properties are overridden in the order they are defined.
2223 *
2224 * Returns: The last property id.
2225 */
2226 guint
2227 cc_realm_service_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
2228 {
2229 return property_id_begin - 1;
2230 }
2231
2232
2233 inline static void
2234 cc_realm_service_signal_marshal_diagnostics (
2235 GClosure *closure,
2236 GValue *return_value,
2237 unsigned int n_param_values,
2238 const GValue *param_values,
2239 void *invocation_hint,
2240 void *marshal_data)
2241 {
2242 _g_dbus_codegen_marshal_VOID__STRING_STRING (closure,
2243 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2244 }
2245
2246 inline static void
2247 cc_realm_service_method_marshal_cancel (
2248 GClosure *closure,
2249 GValue *return_value,
2250 unsigned int n_param_values,
2251 const GValue *param_values,
2252 void *invocation_hint,
2253 void *marshal_data)
2254 {
2255 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure,
2256 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2257 }
2258
2259 inline static void
2260 cc_realm_service_method_marshal_set_locale (
2261 GClosure *closure,
2262 GValue *return_value,
2263 unsigned int n_param_values,
2264 const GValue *param_values,
2265 void *invocation_hint,
2266 void *marshal_data)
2267 {
2268 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING (closure,
2269 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2270 }
2271
2272 inline static void
2273 cc_realm_service_method_marshal_release (
2274 GClosure *closure,
2275 GValue *return_value,
2276 unsigned int n_param_values,
2277 const GValue *param_values,
2278 void *invocation_hint,
2279 void *marshal_data)
2280 {
2281 _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
2282 return_value, n_param_values, param_values, invocation_hint, marshal_data);
2283 }
2284
2285
2286 /**
2287 * CcRealmService:
2288 *
2289 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>.
2290 */
2291
2292 /**
2293 * CcRealmServiceIface:
2294 * @parent_iface: The parent interface.
2295 * @handle_cancel: Handler for the #CcRealmService::handle-cancel signal.
2296 * @handle_release: Handler for the #CcRealmService::handle-release signal.
2297 * @handle_set_locale: Handler for the #CcRealmService::handle-set-locale signal.
2298 * @diagnostics: Handler for the #CcRealmService::diagnostics signal.
2299 *
2300 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>.
2301 */
2302
2303 typedef CcRealmServiceIface CcRealmServiceInterface;
2304 G_DEFINE_INTERFACE (CcRealmService, cc_realm_service, G_TYPE_OBJECT)
2305
2306 static void
2307 cc_realm_service_default_init (CcRealmServiceIface *iface)
2308 {
2309 /* GObject signals for incoming D-Bus method calls: */
2310 /**
2311 * CcRealmService::handle-cancel:
2312 * @object: A #CcRealmService.
2313 * @invocation: A #GDBusMethodInvocation.
2314 * @arg_operation: Argument passed by remote caller.
2315 *
2316 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Cancel">Cancel()</link> D-Bus method.
2317 *
2318 * 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 cc_realm_service_complete_cancel() 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.
2319 *
2320 * 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.
2321 */
2322 g_signal_new ("handle-cancel",
2323 G_TYPE_FROM_INTERFACE (iface),
2324 G_SIGNAL_RUN_LAST,
2325 G_STRUCT_OFFSET (CcRealmServiceIface, handle_cancel),
2326 g_signal_accumulator_true_handled,
2327 NULL,
2328 cc_realm_service_method_marshal_cancel,
2329 G_TYPE_BOOLEAN,
2330 2,
2331 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
2332
2333 /**
2334 * CcRealmService::handle-set-locale:
2335 * @object: A #CcRealmService.
2336 * @invocation: A #GDBusMethodInvocation.
2337 * @arg_locale: Argument passed by remote caller.
2338 *
2339 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Service.SetLocale">SetLocale()</link> D-Bus method.
2340 *
2341 * 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 cc_realm_service_complete_set_locale() 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.
2342 *
2343 * 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.
2344 */
2345 g_signal_new ("handle-set-locale",
2346 G_TYPE_FROM_INTERFACE (iface),
2347 G_SIGNAL_RUN_LAST,
2348 G_STRUCT_OFFSET (CcRealmServiceIface, handle_set_locale),
2349 g_signal_accumulator_true_handled,
2350 NULL,
2351 cc_realm_service_method_marshal_set_locale,
2352 G_TYPE_BOOLEAN,
2353 2,
2354 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
2355
2356 /**
2357 * CcRealmService::handle-release:
2358 * @object: A #CcRealmService.
2359 * @invocation: A #GDBusMethodInvocation.
2360 *
2361 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Release">Release()</link> D-Bus method.
2362 *
2363 * 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 cc_realm_service_complete_release() 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.
2364 *
2365 * 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.
2366 */
2367 g_signal_new ("handle-release",
2368 G_TYPE_FROM_INTERFACE (iface),
2369 G_SIGNAL_RUN_LAST,
2370 G_STRUCT_OFFSET (CcRealmServiceIface, handle_release),
2371 g_signal_accumulator_true_handled,
2372 NULL,
2373 cc_realm_service_method_marshal_release,
2374 G_TYPE_BOOLEAN,
2375 1,
2376 G_TYPE_DBUS_METHOD_INVOCATION);
2377
2378 /* GObject signals for received D-Bus signals: */
2379 /**
2380 * CcRealmService::diagnostics:
2381 * @object: A #CcRealmService.
2382 * @arg_data: Argument.
2383 * @arg_operation: Argument.
2384 *
2385 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-realmd-Service.Diagnostics">"Diagnostics"</link> is received.
2386 *
2387 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
2388 */
2389 CC_REALM__SERVICE_SIGNALS[CC_REALM__SERVICE_DIAGNOSTICS] =
2390 g_signal_new ("diagnostics",
2391 G_TYPE_FROM_INTERFACE (iface),
2392 G_SIGNAL_RUN_LAST,
2393 G_STRUCT_OFFSET (CcRealmServiceIface, diagnostics),
2394 NULL,
2395 NULL,
2396 cc_realm_service_signal_marshal_diagnostics,
2397 G_TYPE_NONE,
2398 2, G_TYPE_STRING, G_TYPE_STRING);
2399
2400 }
2401
2402 /**
2403 * cc_realm_service_emit_diagnostics:
2404 * @object: A #CcRealmService.
2405 * @arg_data: Argument to pass with the signal.
2406 * @arg_operation: Argument to pass with the signal.
2407 *
2408 * Emits the <link linkend="gdbus-signal-org-freedesktop-realmd-Service.Diagnostics">"Diagnostics"</link> D-Bus signal.
2409 */
2410 void
2411 cc_realm_service_emit_diagnostics (
2412 CcRealmService *object,
2413 const gchar *arg_data,
2414 const gchar *arg_operation)
2415 {
2416 g_signal_emit (object, CC_REALM__SERVICE_SIGNALS[CC_REALM__SERVICE_DIAGNOSTICS], 0, arg_data, arg_operation);
2417 }
2418
2419 /**
2420 * cc_realm_service_call_cancel:
2421 * @proxy: A #CcRealmServiceProxy.
2422 * @arg_operation: Argument to pass with the method invocation.
2423 * @cancellable: (nullable): A #GCancellable or %NULL.
2424 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2425 * @user_data: User data to pass to @callback.
2426 *
2427 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Cancel">Cancel()</link> D-Bus method on @proxy.
2428 * 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()).
2429 * You can then call cc_realm_service_call_cancel_finish() to get the result of the operation.
2430 *
2431 * See cc_realm_service_call_cancel_sync() for the synchronous, blocking version of this method.
2432 */
2433 void
2434 cc_realm_service_call_cancel (
2435 CcRealmService *proxy,
2436 const gchar *arg_operation,
2437 GCancellable *cancellable,
2438 GAsyncReadyCallback callback,
2439 gpointer user_data)
2440 {
2441 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2442 "Cancel",
2443 g_variant_new ("(s)",
2444 arg_operation),
2445 G_DBUS_CALL_FLAGS_NONE,
2446 -1,
2447 cancellable,
2448 callback,
2449 user_data);
2450 }
2451
2452 /**
2453 * cc_realm_service_call_cancel_finish:
2454 * @proxy: A #CcRealmServiceProxy.
2455 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_service_call_cancel().
2456 * @error: Return location for error or %NULL.
2457 *
2458 * Finishes an operation started with cc_realm_service_call_cancel().
2459 *
2460 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2461 */
2462 gboolean
2463 cc_realm_service_call_cancel_finish (
2464 CcRealmService *proxy,
2465 GAsyncResult *res,
2466 GError **error)
2467 {
2468 GVariant *_ret;
2469 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2470 if (_ret == NULL)
2471 goto _out;
2472 g_variant_get (_ret,
2473 "()");
2474 g_variant_unref (_ret);
2475 _out:
2476 return _ret != NULL;
2477 }
2478
2479 /**
2480 * cc_realm_service_call_cancel_sync:
2481 * @proxy: A #CcRealmServiceProxy.
2482 * @arg_operation: Argument to pass with the method invocation.
2483 * @cancellable: (nullable): A #GCancellable or %NULL.
2484 * @error: Return location for error or %NULL.
2485 *
2486 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Cancel">Cancel()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2487 *
2488 * See cc_realm_service_call_cancel() for the asynchronous version of this method.
2489 *
2490 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2491 */
2492 gboolean
2493 cc_realm_service_call_cancel_sync (
2494 CcRealmService *proxy,
2495 const gchar *arg_operation,
2496 GCancellable *cancellable,
2497 GError **error)
2498 {
2499 GVariant *_ret;
2500 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2501 "Cancel",
2502 g_variant_new ("(s)",
2503 arg_operation),
2504 G_DBUS_CALL_FLAGS_NONE,
2505 -1,
2506 cancellable,
2507 error);
2508 if (_ret == NULL)
2509 goto _out;
2510 g_variant_get (_ret,
2511 "()");
2512 g_variant_unref (_ret);
2513 _out:
2514 return _ret != NULL;
2515 }
2516
2517 /**
2518 * cc_realm_service_call_set_locale:
2519 * @proxy: A #CcRealmServiceProxy.
2520 * @arg_locale: Argument to pass with the method invocation.
2521 * @cancellable: (nullable): A #GCancellable or %NULL.
2522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2523 * @user_data: User data to pass to @callback.
2524 *
2525 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.SetLocale">SetLocale()</link> D-Bus method on @proxy.
2526 * 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()).
2527 * You can then call cc_realm_service_call_set_locale_finish() to get the result of the operation.
2528 *
2529 * See cc_realm_service_call_set_locale_sync() for the synchronous, blocking version of this method.
2530 */
2531 void
2532 cc_realm_service_call_set_locale (
2533 CcRealmService *proxy,
2534 const gchar *arg_locale,
2535 GCancellable *cancellable,
2536 GAsyncReadyCallback callback,
2537 gpointer user_data)
2538 {
2539 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2540 "SetLocale",
2541 g_variant_new ("(s)",
2542 arg_locale),
2543 G_DBUS_CALL_FLAGS_NONE,
2544 -1,
2545 cancellable,
2546 callback,
2547 user_data);
2548 }
2549
2550 /**
2551 * cc_realm_service_call_set_locale_finish:
2552 * @proxy: A #CcRealmServiceProxy.
2553 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_service_call_set_locale().
2554 * @error: Return location for error or %NULL.
2555 *
2556 * Finishes an operation started with cc_realm_service_call_set_locale().
2557 *
2558 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2559 */
2560 gboolean
2561 cc_realm_service_call_set_locale_finish (
2562 CcRealmService *proxy,
2563 GAsyncResult *res,
2564 GError **error)
2565 {
2566 GVariant *_ret;
2567 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2568 if (_ret == NULL)
2569 goto _out;
2570 g_variant_get (_ret,
2571 "()");
2572 g_variant_unref (_ret);
2573 _out:
2574 return _ret != NULL;
2575 }
2576
2577 /**
2578 * cc_realm_service_call_set_locale_sync:
2579 * @proxy: A #CcRealmServiceProxy.
2580 * @arg_locale: Argument to pass with the method invocation.
2581 * @cancellable: (nullable): A #GCancellable or %NULL.
2582 * @error: Return location for error or %NULL.
2583 *
2584 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.SetLocale">SetLocale()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2585 *
2586 * See cc_realm_service_call_set_locale() for the asynchronous version of this method.
2587 *
2588 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2589 */
2590 gboolean
2591 cc_realm_service_call_set_locale_sync (
2592 CcRealmService *proxy,
2593 const gchar *arg_locale,
2594 GCancellable *cancellable,
2595 GError **error)
2596 {
2597 GVariant *_ret;
2598 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2599 "SetLocale",
2600 g_variant_new ("(s)",
2601 arg_locale),
2602 G_DBUS_CALL_FLAGS_NONE,
2603 -1,
2604 cancellable,
2605 error);
2606 if (_ret == NULL)
2607 goto _out;
2608 g_variant_get (_ret,
2609 "()");
2610 g_variant_unref (_ret);
2611 _out:
2612 return _ret != NULL;
2613 }
2614
2615 /**
2616 * cc_realm_service_call_release:
2617 * @proxy: A #CcRealmServiceProxy.
2618 * @cancellable: (nullable): A #GCancellable or %NULL.
2619 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2620 * @user_data: User data to pass to @callback.
2621 *
2622 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Release">Release()</link> D-Bus method on @proxy.
2623 * 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()).
2624 * You can then call cc_realm_service_call_release_finish() to get the result of the operation.
2625 *
2626 * See cc_realm_service_call_release_sync() for the synchronous, blocking version of this method.
2627 */
2628 void
2629 cc_realm_service_call_release (
2630 CcRealmService *proxy,
2631 GCancellable *cancellable,
2632 GAsyncReadyCallback callback,
2633 gpointer user_data)
2634 {
2635 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2636 "Release",
2637 g_variant_new ("()"),
2638 G_DBUS_CALL_FLAGS_NONE,
2639 -1,
2640 cancellable,
2641 callback,
2642 user_data);
2643 }
2644
2645 /**
2646 * cc_realm_service_call_release_finish:
2647 * @proxy: A #CcRealmServiceProxy.
2648 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_service_call_release().
2649 * @error: Return location for error or %NULL.
2650 *
2651 * Finishes an operation started with cc_realm_service_call_release().
2652 *
2653 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2654 */
2655 gboolean
2656 cc_realm_service_call_release_finish (
2657 CcRealmService *proxy,
2658 GAsyncResult *res,
2659 GError **error)
2660 {
2661 GVariant *_ret;
2662 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2663 if (_ret == NULL)
2664 goto _out;
2665 g_variant_get (_ret,
2666 "()");
2667 g_variant_unref (_ret);
2668 _out:
2669 return _ret != NULL;
2670 }
2671
2672 /**
2673 * cc_realm_service_call_release_sync:
2674 * @proxy: A #CcRealmServiceProxy.
2675 * @cancellable: (nullable): A #GCancellable or %NULL.
2676 * @error: Return location for error or %NULL.
2677 *
2678 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Release">Release()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2679 *
2680 * See cc_realm_service_call_release() for the asynchronous version of this method.
2681 *
2682 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2683 */
2684 gboolean
2685 cc_realm_service_call_release_sync (
2686 CcRealmService *proxy,
2687 GCancellable *cancellable,
2688 GError **error)
2689 {
2690 GVariant *_ret;
2691 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2692 "Release",
2693 g_variant_new ("()"),
2694 G_DBUS_CALL_FLAGS_NONE,
2695 -1,
2696 cancellable,
2697 error);
2698 if (_ret == NULL)
2699 goto _out;
2700 g_variant_get (_ret,
2701 "()");
2702 g_variant_unref (_ret);
2703 _out:
2704 return _ret != NULL;
2705 }
2706
2707 /**
2708 * cc_realm_service_complete_cancel:
2709 * @object: A #CcRealmService.
2710 * @invocation: (transfer full): A #GDBusMethodInvocation.
2711 *
2712 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Cancel">Cancel()</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.
2713 *
2714 * This method will free @invocation, you cannot use it afterwards.
2715 */
2716 void
2717 cc_realm_service_complete_cancel (
2718 CcRealmService *object G_GNUC_UNUSED,
2719 GDBusMethodInvocation *invocation)
2720 {
2721 g_dbus_method_invocation_return_value (invocation,
2722 g_variant_new ("()"));
2723 }
2724
2725 /**
2726 * cc_realm_service_complete_set_locale:
2727 * @object: A #CcRealmService.
2728 * @invocation: (transfer full): A #GDBusMethodInvocation.
2729 *
2730 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Service.SetLocale">SetLocale()</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.
2731 *
2732 * This method will free @invocation, you cannot use it afterwards.
2733 */
2734 void
2735 cc_realm_service_complete_set_locale (
2736 CcRealmService *object G_GNUC_UNUSED,
2737 GDBusMethodInvocation *invocation)
2738 {
2739 g_dbus_method_invocation_return_value (invocation,
2740 g_variant_new ("()"));
2741 }
2742
2743 /**
2744 * cc_realm_service_complete_release:
2745 * @object: A #CcRealmService.
2746 * @invocation: (transfer full): A #GDBusMethodInvocation.
2747 *
2748 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Service.Release">Release()</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.
2749 *
2750 * This method will free @invocation, you cannot use it afterwards.
2751 */
2752 void
2753 cc_realm_service_complete_release (
2754 CcRealmService *object G_GNUC_UNUSED,
2755 GDBusMethodInvocation *invocation)
2756 {
2757 g_dbus_method_invocation_return_value (invocation,
2758 g_variant_new ("()"));
2759 }
2760
2761 /* ------------------------------------------------------------------------ */
2762
2763 /**
2764 * CcRealmServiceProxy:
2765 *
2766 * The #CcRealmServiceProxy structure contains only private data and should only be accessed using the provided API.
2767 */
2768
2769 /**
2770 * CcRealmServiceProxyClass:
2771 * @parent_class: The parent class.
2772 *
2773 * Class structure for #CcRealmServiceProxy.
2774 */
2775
2776 struct _CcRealmServiceProxyPrivate
2777 {
2778 GData *qdata;
2779 };
2780
2781 static void cc_realm_service_proxy_iface_init (CcRealmServiceIface *iface);
2782
2783 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2784 G_DEFINE_TYPE_WITH_CODE (CcRealmServiceProxy, cc_realm_service_proxy, G_TYPE_DBUS_PROXY,
2785 G_ADD_PRIVATE (CcRealmServiceProxy)
2786 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_SERVICE, cc_realm_service_proxy_iface_init))
2787
2788 #else
2789 G_DEFINE_TYPE_WITH_CODE (CcRealmServiceProxy, cc_realm_service_proxy, G_TYPE_DBUS_PROXY,
2790 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_SERVICE, cc_realm_service_proxy_iface_init))
2791
2792 #endif
2793 static void
2794 cc_realm_service_proxy_finalize (GObject *object)
2795 {
2796 CcRealmServiceProxy *proxy = CC_REALM_SERVICE_PROXY (object);
2797 g_datalist_clear (&proxy->priv->qdata);
2798 G_OBJECT_CLASS (cc_realm_service_proxy_parent_class)->finalize (object);
2799 }
2800
2801 static void
2802 cc_realm_service_proxy_get_property (GObject *object G_GNUC_UNUSED,
2803 guint prop_id G_GNUC_UNUSED,
2804 GValue *value G_GNUC_UNUSED,
2805 GParamSpec *pspec G_GNUC_UNUSED)
2806 {
2807 }
2808
2809 static void
2810 cc_realm_service_proxy_set_property (GObject *object G_GNUC_UNUSED,
2811 guint prop_id G_GNUC_UNUSED,
2812 const GValue *value G_GNUC_UNUSED,
2813 GParamSpec *pspec G_GNUC_UNUSED)
2814 {
2815 }
2816
2817 static void
2818 cc_realm_service_proxy_g_signal (GDBusProxy *proxy,
2819 const gchar *sender_name G_GNUC_UNUSED,
2820 const gchar *signal_name,
2821 GVariant *parameters)
2822 {
2823 _ExtendedGDBusSignalInfo *info;
2824 GVariantIter iter;
2825 GVariant *child;
2826 GValue *paramv;
2827 gsize num_params;
2828 gsize n;
2829 guint signal_id;
2830 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct, signal_name);
2831 if (info == NULL)
2832 return;
2833 num_params = g_variant_n_children (parameters);
2834 paramv = g_new0 (GValue, num_params + 1);
2835 g_value_init (&paramv[0], CC_REALM_TYPE_SERVICE);
2836 g_value_set_object (&paramv[0], proxy);
2837 g_variant_iter_init (&iter, parameters);
2838 n = 1;
2839 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2840 {
2841 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2842 if (arg_info->use_gvariant)
2843 {
2844 g_value_init (&paramv[n], G_TYPE_VARIANT);
2845 g_value_set_variant (&paramv[n], child);
2846 n++;
2847 }
2848 else
2849 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2850 g_variant_unref (child);
2851 }
2852 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_SERVICE);
2853 g_signal_emitv (paramv, signal_id, 0, NULL);
2854 for (n = 0; n < num_params + 1; n++)
2855 g_value_unset (&paramv[n]);
2856 g_free (paramv);
2857 }
2858
2859 static void
2860 cc_realm_service_proxy_g_properties_changed (GDBusProxy *_proxy,
2861 GVariant *changed_properties,
2862 const gchar *const *invalidated_properties)
2863 {
2864 CcRealmServiceProxy *proxy = CC_REALM_SERVICE_PROXY (_proxy);
2865 guint n;
2866 const gchar *key;
2867 GVariantIter *iter;
2868 _ExtendedGDBusPropertyInfo *info;
2869 g_variant_get (changed_properties, "a{sv}", &iter);
2870 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2871 {
2872 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct, key);
2873 g_datalist_remove_data (&proxy->priv->qdata, key);
2874 if (info != NULL)
2875 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2876 }
2877 g_variant_iter_free (iter);
2878 for (n = 0; invalidated_properties[n] != NULL; n++)
2879 {
2880 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct, invalidated_properties[n]);
2881 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2882 if (info != NULL)
2883 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2884 }
2885 }
2886
2887 static void
2888 cc_realm_service_proxy_init (CcRealmServiceProxy *proxy)
2889 {
2890 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2891 proxy->priv = cc_realm_service_proxy_get_instance_private (proxy);
2892 #else
2893 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, CC_REALM_TYPE_SERVICE_PROXY, CcRealmServiceProxyPrivate);
2894 #endif
2895
2896 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), cc_realm_service_interface_info ());
2897 }
2898
2899 static void
2900 cc_realm_service_proxy_class_init (CcRealmServiceProxyClass *klass)
2901 {
2902 GObjectClass *gobject_class;
2903 GDBusProxyClass *proxy_class;
2904
2905 gobject_class = G_OBJECT_CLASS (klass);
2906 gobject_class->finalize = cc_realm_service_proxy_finalize;
2907 gobject_class->get_property = cc_realm_service_proxy_get_property;
2908 gobject_class->set_property = cc_realm_service_proxy_set_property;
2909
2910 proxy_class = G_DBUS_PROXY_CLASS (klass);
2911 proxy_class->g_signal = cc_realm_service_proxy_g_signal;
2912 proxy_class->g_properties_changed = cc_realm_service_proxy_g_properties_changed;
2913
2914 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2915 g_type_class_add_private (klass, sizeof (CcRealmServiceProxyPrivate));
2916 #endif
2917 }
2918
2919 static void
2920 cc_realm_service_proxy_iface_init (CcRealmServiceIface *iface G_GNUC_UNUSED)
2921 {
2922 }
2923
2924 /**
2925 * cc_realm_service_proxy_new:
2926 * @connection: A #GDBusConnection.
2927 * @flags: Flags from the #GDBusProxyFlags enumeration.
2928 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2929 * @object_path: An object path.
2930 * @cancellable: (nullable): A #GCancellable or %NULL.
2931 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2932 * @user_data: User data to pass to @callback.
2933 *
2934 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>. See g_dbus_proxy_new() for more details.
2935 *
2936 * 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()).
2937 * You can then call cc_realm_service_proxy_new_finish() to get the result of the operation.
2938 *
2939 * See cc_realm_service_proxy_new_sync() for the synchronous, blocking version of this constructor.
2940 */
2941 void
2942 cc_realm_service_proxy_new (
2943 GDBusConnection *connection,
2944 GDBusProxyFlags flags,
2945 const gchar *name,
2946 const gchar *object_path,
2947 GCancellable *cancellable,
2948 GAsyncReadyCallback callback,
2949 gpointer user_data)
2950 {
2951 g_async_initable_new_async (CC_REALM_TYPE_SERVICE_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.realmd.Service", NULL);
2952 }
2953
2954 /**
2955 * cc_realm_service_proxy_new_finish:
2956 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_service_proxy_new().
2957 * @error: Return location for error or %NULL
2958 *
2959 * Finishes an operation started with cc_realm_service_proxy_new().
2960 *
2961 * Returns: (transfer full) (type CcRealmServiceProxy): The constructed proxy object or %NULL if @error is set.
2962 */
2963 CcRealmService *
2964 cc_realm_service_proxy_new_finish (
2965 GAsyncResult *res,
2966 GError **error)
2967 {
2968 GObject *ret;
2969 GObject *source_object;
2970 source_object = g_async_result_get_source_object (res);
2971 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2972 g_object_unref (source_object);
2973 if (ret != NULL)
2974 return CC_REALM_SERVICE (ret);
2975 else
2976 return NULL;
2977 }
2978
2979 /**
2980 * cc_realm_service_proxy_new_sync:
2981 * @connection: A #GDBusConnection.
2982 * @flags: Flags from the #GDBusProxyFlags enumeration.
2983 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2984 * @object_path: An object path.
2985 * @cancellable: (nullable): A #GCancellable or %NULL.
2986 * @error: Return location for error or %NULL
2987 *
2988 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>. See g_dbus_proxy_new_sync() for more details.
2989 *
2990 * The calling thread is blocked until a reply is received.
2991 *
2992 * See cc_realm_service_proxy_new() for the asynchronous version of this constructor.
2993 *
2994 * Returns: (transfer full) (type CcRealmServiceProxy): The constructed proxy object or %NULL if @error is set.
2995 */
2996 CcRealmService *
2997 cc_realm_service_proxy_new_sync (
2998 GDBusConnection *connection,
2999 GDBusProxyFlags flags,
3000 const gchar *name,
3001 const gchar *object_path,
3002 GCancellable *cancellable,
3003 GError **error)
3004 {
3005 GInitable *ret;
3006 ret = g_initable_new (CC_REALM_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Service", NULL);
3007 if (ret != NULL)
3008 return CC_REALM_SERVICE (ret);
3009 else
3010 return NULL;
3011 }
3012
3013
3014 /**
3015 * cc_realm_service_proxy_new_for_bus:
3016 * @bus_type: A #GBusType.
3017 * @flags: Flags from the #GDBusProxyFlags enumeration.
3018 * @name: A bus name (well-known or unique).
3019 * @object_path: An object path.
3020 * @cancellable: (nullable): A #GCancellable or %NULL.
3021 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3022 * @user_data: User data to pass to @callback.
3023 *
3024 * Like cc_realm_service_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3025 *
3026 * 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()).
3027 * You can then call cc_realm_service_proxy_new_for_bus_finish() to get the result of the operation.
3028 *
3029 * See cc_realm_service_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3030 */
3031 void
3032 cc_realm_service_proxy_new_for_bus (
3033 GBusType bus_type,
3034 GDBusProxyFlags flags,
3035 const gchar *name,
3036 const gchar *object_path,
3037 GCancellable *cancellable,
3038 GAsyncReadyCallback callback,
3039 gpointer user_data)
3040 {
3041 g_async_initable_new_async (CC_REALM_TYPE_SERVICE_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.realmd.Service", NULL);
3042 }
3043
3044 /**
3045 * cc_realm_service_proxy_new_for_bus_finish:
3046 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_service_proxy_new_for_bus().
3047 * @error: Return location for error or %NULL
3048 *
3049 * Finishes an operation started with cc_realm_service_proxy_new_for_bus().
3050 *
3051 * Returns: (transfer full) (type CcRealmServiceProxy): The constructed proxy object or %NULL if @error is set.
3052 */
3053 CcRealmService *
3054 cc_realm_service_proxy_new_for_bus_finish (
3055 GAsyncResult *res,
3056 GError **error)
3057 {
3058 GObject *ret;
3059 GObject *source_object;
3060 source_object = g_async_result_get_source_object (res);
3061 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3062 g_object_unref (source_object);
3063 if (ret != NULL)
3064 return CC_REALM_SERVICE (ret);
3065 else
3066 return NULL;
3067 }
3068
3069 /**
3070 * cc_realm_service_proxy_new_for_bus_sync:
3071 * @bus_type: A #GBusType.
3072 * @flags: Flags from the #GDBusProxyFlags enumeration.
3073 * @name: A bus name (well-known or unique).
3074 * @object_path: An object path.
3075 * @cancellable: (nullable): A #GCancellable or %NULL.
3076 * @error: Return location for error or %NULL
3077 *
3078 * Like cc_realm_service_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3079 *
3080 * The calling thread is blocked until a reply is received.
3081 *
3082 * See cc_realm_service_proxy_new_for_bus() for the asynchronous version of this constructor.
3083 *
3084 * Returns: (transfer full) (type CcRealmServiceProxy): The constructed proxy object or %NULL if @error is set.
3085 */
3086 CcRealmService *
3087 cc_realm_service_proxy_new_for_bus_sync (
3088 GBusType bus_type,
3089 GDBusProxyFlags flags,
3090 const gchar *name,
3091 const gchar *object_path,
3092 GCancellable *cancellable,
3093 GError **error)
3094 {
3095 GInitable *ret;
3096 ret = g_initable_new (CC_REALM_TYPE_SERVICE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Service", NULL);
3097 if (ret != NULL)
3098 return CC_REALM_SERVICE (ret);
3099 else
3100 return NULL;
3101 }
3102
3103
3104 /* ------------------------------------------------------------------------ */
3105
3106 /**
3107 * CcRealmServiceSkeleton:
3108 *
3109 * The #CcRealmServiceSkeleton structure contains only private data and should only be accessed using the provided API.
3110 */
3111
3112 /**
3113 * CcRealmServiceSkeletonClass:
3114 * @parent_class: The parent class.
3115 *
3116 * Class structure for #CcRealmServiceSkeleton.
3117 */
3118
3119 struct _CcRealmServiceSkeletonPrivate
3120 {
3121 GValue *properties;
3122 GList *changed_properties;
3123 GSource *changed_properties_idle_source;
3124 GMainContext *context;
3125 GMutex lock;
3126 };
3127
3128 static void
3129 _cc_realm_service_skeleton_handle_method_call (
3130 GDBusConnection *connection G_GNUC_UNUSED,
3131 const gchar *sender G_GNUC_UNUSED,
3132 const gchar *object_path G_GNUC_UNUSED,
3133 const gchar *interface_name,
3134 const gchar *method_name,
3135 GVariant *parameters,
3136 GDBusMethodInvocation *invocation,
3137 gpointer user_data)
3138 {
3139 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (user_data);
3140 _ExtendedGDBusMethodInfo *info;
3141 GVariantIter iter;
3142 GVariant *child;
3143 GValue *paramv;
3144 gsize num_params;
3145 guint num_extra;
3146 gsize n;
3147 guint signal_id;
3148 GValue return_value = G_VALUE_INIT;
3149 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3150 g_assert (info != NULL);
3151 num_params = g_variant_n_children (parameters);
3152 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3153 n = 0;
3154 g_value_init (&paramv[n], CC_REALM_TYPE_SERVICE);
3155 g_value_set_object (&paramv[n++], skeleton);
3156 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3157 g_value_set_object (&paramv[n++], invocation);
3158 if (info->pass_fdlist)
3159 {
3160 #ifdef G_OS_UNIX
3161 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3162 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3163 #else
3164 g_assert_not_reached ();
3165 #endif
3166 }
3167 g_variant_iter_init (&iter, parameters);
3168 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3169 {
3170 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3171 if (arg_info->use_gvariant)
3172 {
3173 g_value_init (&paramv[n], G_TYPE_VARIANT);
3174 g_value_set_variant (&paramv[n], child);
3175 n++;
3176 }
3177 else
3178 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3179 g_variant_unref (child);
3180 }
3181 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_SERVICE);
3182 g_value_init (&return_value, G_TYPE_BOOLEAN);
3183 g_signal_emitv (paramv, signal_id, 0, &return_value);
3184 if (!g_value_get_boolean (&return_value))
3185 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);
3186 g_value_unset (&return_value);
3187 for (n = 0; n < num_params + num_extra; n++)
3188 g_value_unset (&paramv[n]);
3189 g_free (paramv);
3190 }
3191
3192 static GVariant *
3193 _cc_realm_service_skeleton_handle_get_property (
3194 GDBusConnection *connection G_GNUC_UNUSED,
3195 const gchar *sender G_GNUC_UNUSED,
3196 const gchar *object_path G_GNUC_UNUSED,
3197 const gchar *interface_name G_GNUC_UNUSED,
3198 const gchar *property_name,
3199 GError **error,
3200 gpointer user_data)
3201 {
3202 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (user_data);
3203 GValue value = G_VALUE_INIT;
3204 GParamSpec *pspec;
3205 _ExtendedGDBusPropertyInfo *info;
3206 GVariant *ret;
3207 ret = NULL;
3208 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct, property_name);
3209 g_assert (info != NULL);
3210 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3211 if (pspec == NULL)
3212 {
3213 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3214 }
3215 else
3216 {
3217 g_value_init (&value, pspec->value_type);
3218 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3219 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3220 g_value_unset (&value);
3221 }
3222 return ret;
3223 }
3224
3225 static gboolean
3226 _cc_realm_service_skeleton_handle_set_property (
3227 GDBusConnection *connection G_GNUC_UNUSED,
3228 const gchar *sender G_GNUC_UNUSED,
3229 const gchar *object_path G_GNUC_UNUSED,
3230 const gchar *interface_name G_GNUC_UNUSED,
3231 const gchar *property_name,
3232 GVariant *variant,
3233 GError **error,
3234 gpointer user_data)
3235 {
3236 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (user_data);
3237 GValue value = G_VALUE_INIT;
3238 GParamSpec *pspec;
3239 _ExtendedGDBusPropertyInfo *info;
3240 gboolean ret;
3241 ret = FALSE;
3242 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_service_interface_info.parent_struct, property_name);
3243 g_assert (info != NULL);
3244 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3245 if (pspec == NULL)
3246 {
3247 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3248 }
3249 else
3250 {
3251 if (info->use_gvariant)
3252 g_value_set_variant (&value, variant);
3253 else
3254 g_dbus_gvariant_to_gvalue (variant, &value);
3255 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3256 g_value_unset (&value);
3257 ret = TRUE;
3258 }
3259 return ret;
3260 }
3261
3262 static const GDBusInterfaceVTable _cc_realm_service_skeleton_vtable =
3263 {
3264 _cc_realm_service_skeleton_handle_method_call,
3265 _cc_realm_service_skeleton_handle_get_property,
3266 _cc_realm_service_skeleton_handle_set_property,
3267 {NULL}
3268 };
3269
3270 static GDBusInterfaceInfo *
3271 cc_realm_service_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3272 {
3273 return cc_realm_service_interface_info ();
3274 }
3275
3276 static GDBusInterfaceVTable *
3277 cc_realm_service_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3278 {
3279 return (GDBusInterfaceVTable *) &_cc_realm_service_skeleton_vtable;
3280 }
3281
3282 static GVariant *
3283 cc_realm_service_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3284 {
3285 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (_skeleton);
3286
3287 GVariantBuilder builder;
3288 guint n;
3289 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3290 if (_cc_realm_service_interface_info.parent_struct.properties == NULL)
3291 goto out;
3292 for (n = 0; _cc_realm_service_interface_info.parent_struct.properties[n] != NULL; n++)
3293 {
3294 GDBusPropertyInfo *info = _cc_realm_service_interface_info.parent_struct.properties[n];
3295 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3296 {
3297 GVariant *value;
3298 value = _cc_realm_service_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.realmd.Service", info->name, NULL, skeleton);
3299 if (value != NULL)
3300 {
3301 g_variant_take_ref (value);
3302 g_variant_builder_add (&builder, "{sv}", info->name, value);
3303 g_variant_unref (value);
3304 }
3305 }
3306 }
3307 out:
3308 return g_variant_builder_end (&builder);
3309 }
3310
3311 static void
3312 cc_realm_service_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
3313 {
3314 }
3315
3316 static void
3317 _cc_realm_service_on_signal_diagnostics (
3318 CcRealmService *object,
3319 const gchar *arg_data,
3320 const gchar *arg_operation)
3321 {
3322 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (object);
3323
3324 GList *connections, *l;
3325 GVariant *signal_variant;
3326 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3327
3328 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
3329 arg_data,
3330 arg_operation));
3331 for (l = connections; l != NULL; l = l->next)
3332 {
3333 GDBusConnection *connection = l->data;
3334 g_dbus_connection_emit_signal (connection,
3335 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.realmd.Service", "Diagnostics",
3336 signal_variant, NULL);
3337 }
3338 g_variant_unref (signal_variant);
3339 g_list_free_full (connections, g_object_unref);
3340 }
3341
3342 static void cc_realm_service_skeleton_iface_init (CcRealmServiceIface *iface);
3343 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3344 G_DEFINE_TYPE_WITH_CODE (CcRealmServiceSkeleton, cc_realm_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3345 G_ADD_PRIVATE (CcRealmServiceSkeleton)
3346 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_SERVICE, cc_realm_service_skeleton_iface_init))
3347
3348 #else
3349 G_DEFINE_TYPE_WITH_CODE (CcRealmServiceSkeleton, cc_realm_service_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3350 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_SERVICE, cc_realm_service_skeleton_iface_init))
3351
3352 #endif
3353 static void
3354 cc_realm_service_skeleton_finalize (GObject *object)
3355 {
3356 CcRealmServiceSkeleton *skeleton = CC_REALM_SERVICE_SKELETON (object);
3357 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3358 if (skeleton->priv->changed_properties_idle_source != NULL)
3359 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3360 g_main_context_unref (skeleton->priv->context);
3361 g_mutex_clear (&skeleton->priv->lock);
3362 G_OBJECT_CLASS (cc_realm_service_skeleton_parent_class)->finalize (object);
3363 }
3364
3365 static void
3366 cc_realm_service_skeleton_init (CcRealmServiceSkeleton *skeleton)
3367 {
3368 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3369 skeleton->priv = cc_realm_service_skeleton_get_instance_private (skeleton);
3370 #else
3371 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, CC_REALM_TYPE_SERVICE_SKELETON, CcRealmServiceSkeletonPrivate);
3372 #endif
3373
3374 g_mutex_init (&skeleton->priv->lock);
3375 skeleton->priv->context = g_main_context_ref_thread_default ();
3376 }
3377
3378 static void
3379 cc_realm_service_skeleton_class_init (CcRealmServiceSkeletonClass *klass)
3380 {
3381 GObjectClass *gobject_class;
3382 GDBusInterfaceSkeletonClass *skeleton_class;
3383
3384 gobject_class = G_OBJECT_CLASS (klass);
3385 gobject_class->finalize = cc_realm_service_skeleton_finalize;
3386
3387 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3388 skeleton_class->get_info = cc_realm_service_skeleton_dbus_interface_get_info;
3389 skeleton_class->get_properties = cc_realm_service_skeleton_dbus_interface_get_properties;
3390 skeleton_class->flush = cc_realm_service_skeleton_dbus_interface_flush;
3391 skeleton_class->get_vtable = cc_realm_service_skeleton_dbus_interface_get_vtable;
3392
3393 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3394 g_type_class_add_private (klass, sizeof (CcRealmServiceSkeletonPrivate));
3395 #endif
3396 }
3397
3398 static void
3399 cc_realm_service_skeleton_iface_init (CcRealmServiceIface *iface)
3400 {
3401 iface->diagnostics = _cc_realm_service_on_signal_diagnostics;
3402 }
3403
3404 /**
3405 * cc_realm_service_skeleton_new:
3406 *
3407 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>.
3408 *
3409 * Returns: (transfer full) (type CcRealmServiceSkeleton): The skeleton object.
3410 */
3411 CcRealmService *
3412 cc_realm_service_skeleton_new (void)
3413 {
3414 return CC_REALM_SERVICE (g_object_new (CC_REALM_TYPE_SERVICE_SKELETON, NULL));
3415 }
3416
3417 /* ------------------------------------------------------------------------
3418 * Code for interface org.freedesktop.realmd.Realm
3419 * ------------------------------------------------------------------------
3420 */
3421
3422 /**
3423 * SECTION:CcRealmCommon
3424 * @title: CcRealmCommon
3425 * @short_description: Generated C code for the org.freedesktop.realmd.Realm D-Bus interface
3426 *
3427 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link> D-Bus interface in C.
3428 */
3429
3430 /* ---- Introspection data for org.freedesktop.realmd.Realm ---- */
3431
3432 static const _ExtendedGDBusArgInfo _cc_realm_common_method_info_deconfigure_IN_ARG_options =
3433 {
3434 {
3435 -1,
3436 (gchar *) "options",
3437 (gchar *) "a{sv}",
3438 NULL
3439 },
3440 FALSE
3441 };
3442
3443 static const GDBusArgInfo * const _cc_realm_common_method_info_deconfigure_IN_ARG_pointers[] =
3444 {
3445 &_cc_realm_common_method_info_deconfigure_IN_ARG_options.parent_struct,
3446 NULL
3447 };
3448
3449 static const _ExtendedGDBusMethodInfo _cc_realm_common_method_info_deconfigure =
3450 {
3451 {
3452 -1,
3453 (gchar *) "Deconfigure",
3454 (GDBusArgInfo **) &_cc_realm_common_method_info_deconfigure_IN_ARG_pointers,
3455 NULL,
3456 NULL
3457 },
3458 "handle-deconfigure",
3459 FALSE
3460 };
3461
3462 static const _ExtendedGDBusArgInfo _cc_realm_common_method_info_change_login_policy_IN_ARG_login_policy =
3463 {
3464 {
3465 -1,
3466 (gchar *) "login_policy",
3467 (gchar *) "s",
3468 NULL
3469 },
3470 FALSE
3471 };
3472
3473 static const _ExtendedGDBusArgInfo _cc_realm_common_method_info_change_login_policy_IN_ARG_permitted_add =
3474 {
3475 {
3476 -1,
3477 (gchar *) "permitted_add",
3478 (gchar *) "as",
3479 NULL
3480 },
3481 FALSE
3482 };
3483
3484 static const _ExtendedGDBusArgInfo _cc_realm_common_method_info_change_login_policy_IN_ARG_permitted_remove =
3485 {
3486 {
3487 -1,
3488 (gchar *) "permitted_remove",
3489 (gchar *) "as",
3490 NULL
3491 },
3492 FALSE
3493 };
3494
3495 static const _ExtendedGDBusArgInfo _cc_realm_common_method_info_change_login_policy_IN_ARG_options =
3496 {
3497 {
3498 -1,
3499 (gchar *) "options",
3500 (gchar *) "a{sv}",
3501 NULL
3502 },
3503 FALSE
3504 };
3505
3506 static const GDBusArgInfo * const _cc_realm_common_method_info_change_login_policy_IN_ARG_pointers[] =
3507 {
3508 &_cc_realm_common_method_info_change_login_policy_IN_ARG_login_policy.parent_struct,
3509 &_cc_realm_common_method_info_change_login_policy_IN_ARG_permitted_add.parent_struct,
3510 &_cc_realm_common_method_info_change_login_policy_IN_ARG_permitted_remove.parent_struct,
3511 &_cc_realm_common_method_info_change_login_policy_IN_ARG_options.parent_struct,
3512 NULL
3513 };
3514
3515 static const _ExtendedGDBusMethodInfo _cc_realm_common_method_info_change_login_policy =
3516 {
3517 {
3518 -1,
3519 (gchar *) "ChangeLoginPolicy",
3520 (GDBusArgInfo **) &_cc_realm_common_method_info_change_login_policy_IN_ARG_pointers,
3521 NULL,
3522 NULL
3523 },
3524 "handle-change-login-policy",
3525 FALSE
3526 };
3527
3528 static const GDBusMethodInfo * const _cc_realm_common_method_info_pointers[] =
3529 {
3530 &_cc_realm_common_method_info_deconfigure.parent_struct,
3531 &_cc_realm_common_method_info_change_login_policy.parent_struct,
3532 NULL
3533 };
3534
3535 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_name =
3536 {
3537 {
3538 -1,
3539 (gchar *) "Name",
3540 (gchar *) "s",
3541 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3542 NULL
3543 },
3544 "name",
3545 FALSE,
3546 TRUE
3547 };
3548
3549 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_configured =
3550 {
3551 {
3552 -1,
3553 (gchar *) "Configured",
3554 (gchar *) "s",
3555 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3556 NULL
3557 },
3558 "configured",
3559 FALSE,
3560 TRUE
3561 };
3562
3563 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_supported_interfaces =
3564 {
3565 {
3566 -1,
3567 (gchar *) "SupportedInterfaces",
3568 (gchar *) "as",
3569 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3570 NULL
3571 },
3572 "supported-interfaces",
3573 FALSE,
3574 TRUE
3575 };
3576
3577 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_details =
3578 {
3579 {
3580 -1,
3581 (gchar *) "Details",
3582 (gchar *) "a(ss)",
3583 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3584 NULL
3585 },
3586 "details",
3587 FALSE,
3588 TRUE
3589 };
3590
3591 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_login_formats =
3592 {
3593 {
3594 -1,
3595 (gchar *) "LoginFormats",
3596 (gchar *) "as",
3597 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3598 NULL
3599 },
3600 "login-formats",
3601 FALSE,
3602 TRUE
3603 };
3604
3605 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_login_policy =
3606 {
3607 {
3608 -1,
3609 (gchar *) "LoginPolicy",
3610 (gchar *) "s",
3611 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3612 NULL
3613 },
3614 "login-policy",
3615 FALSE,
3616 TRUE
3617 };
3618
3619 static const _ExtendedGDBusPropertyInfo _cc_realm_common_property_info_permitted_logins =
3620 {
3621 {
3622 -1,
3623 (gchar *) "PermittedLogins",
3624 (gchar *) "as",
3625 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3626 NULL
3627 },
3628 "permitted-logins",
3629 FALSE,
3630 TRUE
3631 };
3632
3633 static const GDBusPropertyInfo * const _cc_realm_common_property_info_pointers[] =
3634 {
3635 &_cc_realm_common_property_info_name.parent_struct,
3636 &_cc_realm_common_property_info_configured.parent_struct,
3637 &_cc_realm_common_property_info_supported_interfaces.parent_struct,
3638 &_cc_realm_common_property_info_details.parent_struct,
3639 &_cc_realm_common_property_info_login_formats.parent_struct,
3640 &_cc_realm_common_property_info_login_policy.parent_struct,
3641 &_cc_realm_common_property_info_permitted_logins.parent_struct,
3642 NULL
3643 };
3644
3645 static const _ExtendedGDBusInterfaceInfo _cc_realm_common_interface_info =
3646 {
3647 {
3648 -1,
3649 (gchar *) "org.freedesktop.realmd.Realm",
3650 (GDBusMethodInfo **) &_cc_realm_common_method_info_pointers,
3651 NULL,
3652 (GDBusPropertyInfo **) &_cc_realm_common_property_info_pointers,
3653 NULL
3654 },
3655 "common",
3656 };
3657
3658
3659 /**
3660 * cc_realm_common_interface_info:
3661 *
3662 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link> D-Bus interface.
3663 *
3664 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3665 */
3666 GDBusInterfaceInfo *
3667 cc_realm_common_interface_info (void)
3668 {
3669 return (GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct;
3670 }
3671
3672 /**
3673 * cc_realm_common_override_properties:
3674 * @klass: The class structure for a #GObject derived class.
3675 * @property_id_begin: The property id to assign to the first overridden property.
3676 *
3677 * Overrides all #GObject properties in the #CcRealmCommon interface for a concrete class.
3678 * The properties are overridden in the order they are defined.
3679 *
3680 * Returns: The last property id.
3681 */
3682 guint
3683 cc_realm_common_override_properties (GObjectClass *klass, guint property_id_begin)
3684 {
3685 g_object_class_override_property (klass, property_id_begin++, "name");
3686 g_object_class_override_property (klass, property_id_begin++, "configured");
3687 g_object_class_override_property (klass, property_id_begin++, "supported-interfaces");
3688 g_object_class_override_property (klass, property_id_begin++, "details");
3689 g_object_class_override_property (klass, property_id_begin++, "login-formats");
3690 g_object_class_override_property (klass, property_id_begin++, "login-policy");
3691 g_object_class_override_property (klass, property_id_begin++, "permitted-logins");
3692 return property_id_begin - 1;
3693 }
3694
3695
3696 inline static void
3697 cc_realm_common_method_marshal_deconfigure (
3698 GClosure *closure,
3699 GValue *return_value,
3700 unsigned int n_param_values,
3701 const GValue *param_values,
3702 void *invocation_hint,
3703 void *marshal_data)
3704 {
3705 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT (closure,
3706 return_value, n_param_values, param_values, invocation_hint, marshal_data);
3707 }
3708
3709 inline static void
3710 cc_realm_common_method_marshal_change_login_policy (
3711 GClosure *closure,
3712 GValue *return_value,
3713 unsigned int n_param_values,
3714 const GValue *param_values,
3715 void *invocation_hint,
3716 void *marshal_data)
3717 {
3718 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_STRING_BOXED_BOXED_VARIANT (closure,
3719 return_value, n_param_values, param_values, invocation_hint, marshal_data);
3720 }
3721
3722
3723 /**
3724 * CcRealmCommon:
3725 *
3726 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>.
3727 */
3728
3729 /**
3730 * CcRealmCommonIface:
3731 * @parent_iface: The parent interface.
3732 * @handle_change_login_policy: Handler for the #CcRealmCommon::handle-change-login-policy signal.
3733 * @handle_deconfigure: Handler for the #CcRealmCommon::handle-deconfigure signal.
3734 * @get_configured: Getter for the #CcRealmCommon:configured property.
3735 * @get_details: Getter for the #CcRealmCommon:details property.
3736 * @get_login_formats: Getter for the #CcRealmCommon:login-formats property.
3737 * @get_login_policy: Getter for the #CcRealmCommon:login-policy property.
3738 * @get_name: Getter for the #CcRealmCommon:name property.
3739 * @get_permitted_logins: Getter for the #CcRealmCommon:permitted-logins property.
3740 * @get_supported_interfaces: Getter for the #CcRealmCommon:supported-interfaces property.
3741 *
3742 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>.
3743 */
3744
3745 typedef CcRealmCommonIface CcRealmCommonInterface;
3746 G_DEFINE_INTERFACE (CcRealmCommon, cc_realm_common, G_TYPE_OBJECT)
3747
3748 static void
3749 cc_realm_common_default_init (CcRealmCommonIface *iface)
3750 {
3751 /* GObject signals for incoming D-Bus method calls: */
3752 /**
3753 * CcRealmCommon::handle-deconfigure:
3754 * @object: A #CcRealmCommon.
3755 * @invocation: A #GDBusMethodInvocation.
3756 * @arg_options: Argument passed by remote caller.
3757 *
3758 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.Deconfigure">Deconfigure()</link> D-Bus method.
3759 *
3760 * 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 cc_realm_common_complete_deconfigure() 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.
3761 *
3762 * 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.
3763 */
3764 g_signal_new ("handle-deconfigure",
3765 G_TYPE_FROM_INTERFACE (iface),
3766 G_SIGNAL_RUN_LAST,
3767 G_STRUCT_OFFSET (CcRealmCommonIface, handle_deconfigure),
3768 g_signal_accumulator_true_handled,
3769 NULL,
3770 cc_realm_common_method_marshal_deconfigure,
3771 G_TYPE_BOOLEAN,
3772 2,
3773 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3774
3775 /**
3776 * CcRealmCommon::handle-change-login-policy:
3777 * @object: A #CcRealmCommon.
3778 * @invocation: A #GDBusMethodInvocation.
3779 * @arg_login_policy: Argument passed by remote caller.
3780 * @arg_permitted_add: Argument passed by remote caller.
3781 * @arg_permitted_remove: Argument passed by remote caller.
3782 * @arg_options: Argument passed by remote caller.
3783 *
3784 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.ChangeLoginPolicy">ChangeLoginPolicy()</link> D-Bus method.
3785 *
3786 * 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 cc_realm_common_complete_change_login_policy() 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.
3787 *
3788 * 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.
3789 */
3790 g_signal_new ("handle-change-login-policy",
3791 G_TYPE_FROM_INTERFACE (iface),
3792 G_SIGNAL_RUN_LAST,
3793 G_STRUCT_OFFSET (CcRealmCommonIface, handle_change_login_policy),
3794 g_signal_accumulator_true_handled,
3795 NULL,
3796 cc_realm_common_method_marshal_change_login_policy,
3797 G_TYPE_BOOLEAN,
3798 5,
3799 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_VARIANT);
3800
3801 /* GObject properties for D-Bus properties: */
3802 /**
3803 * CcRealmCommon:name:
3804 *
3805 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Name">"Name"</link>.
3806 *
3807 * 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.
3808 */
3809 g_object_interface_install_property (iface,
3810 g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3811 /**
3812 * CcRealmCommon:configured:
3813 *
3814 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Configured">"Configured"</link>.
3815 *
3816 * 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.
3817 */
3818 g_object_interface_install_property (iface,
3819 g_param_spec_string ("configured", "Configured", "Configured", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3820 /**
3821 * CcRealmCommon:supported-interfaces:
3822 *
3823 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.SupportedInterfaces">"SupportedInterfaces"</link>.
3824 *
3825 * 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.
3826 */
3827 g_object_interface_install_property (iface,
3828 g_param_spec_boxed ("supported-interfaces", "SupportedInterfaces", "SupportedInterfaces", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3829 /**
3830 * CcRealmCommon:details:
3831 *
3832 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Details">"Details"</link>.
3833 *
3834 * 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.
3835 */
3836 g_object_interface_install_property (iface,
3837 g_param_spec_variant ("details", "Details", "Details", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3838 /**
3839 * CcRealmCommon:login-formats:
3840 *
3841 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginFormats">"LoginFormats"</link>.
3842 *
3843 * 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.
3844 */
3845 g_object_interface_install_property (iface,
3846 g_param_spec_boxed ("login-formats", "LoginFormats", "LoginFormats", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3847 /**
3848 * CcRealmCommon:login-policy:
3849 *
3850 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginPolicy">"LoginPolicy"</link>.
3851 *
3852 * 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.
3853 */
3854 g_object_interface_install_property (iface,
3855 g_param_spec_string ("login-policy", "LoginPolicy", "LoginPolicy", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3856 /**
3857 * CcRealmCommon:permitted-logins:
3858 *
3859 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Realm.PermittedLogins">"PermittedLogins"</link>.
3860 *
3861 * 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.
3862 */
3863 g_object_interface_install_property (iface,
3864 g_param_spec_boxed ("permitted-logins", "PermittedLogins", "PermittedLogins", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3865 }
3866
3867 /**
3868 * cc_realm_common_get_name: (skip)
3869 * @object: A #CcRealmCommon.
3870 *
3871 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Name">"Name"</link> D-Bus property.
3872 *
3873 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3874 *
3875 * 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 cc_realm_common_dup_name() if on another thread.
3876 *
3877 * 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.
3878 */
3879 const gchar *
3880 cc_realm_common_get_name (CcRealmCommon *object)
3881 {
3882 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
3883
3884 return CC_REALM_COMMON_GET_IFACE (object)->get_name (object);
3885 }
3886
3887 /**
3888 * cc_realm_common_dup_name: (skip)
3889 * @object: A #CcRealmCommon.
3890 *
3891 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Name">"Name"</link> D-Bus property.
3892 *
3893 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3894 *
3895 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3896 */
3897 gchar *
3898 cc_realm_common_dup_name (CcRealmCommon *object)
3899 {
3900 gchar *value;
3901 g_object_get (G_OBJECT (object), "name", &value, NULL);
3902 return value;
3903 }
3904
3905 /**
3906 * cc_realm_common_set_name: (skip)
3907 * @object: A #CcRealmCommon.
3908 * @value: The value to set.
3909 *
3910 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Name">"Name"</link> D-Bus property to @value.
3911 *
3912 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3913 */
3914 void
3915 cc_realm_common_set_name (CcRealmCommon *object, const gchar *value)
3916 {
3917 g_object_set (G_OBJECT (object), "name", value, NULL);
3918 }
3919
3920 /**
3921 * cc_realm_common_get_configured: (skip)
3922 * @object: A #CcRealmCommon.
3923 *
3924 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Configured">"Configured"</link> D-Bus property.
3925 *
3926 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3927 *
3928 * 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 cc_realm_common_dup_configured() if on another thread.
3929 *
3930 * 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.
3931 */
3932 const gchar *
3933 cc_realm_common_get_configured (CcRealmCommon *object)
3934 {
3935 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
3936
3937 return CC_REALM_COMMON_GET_IFACE (object)->get_configured (object);
3938 }
3939
3940 /**
3941 * cc_realm_common_dup_configured: (skip)
3942 * @object: A #CcRealmCommon.
3943 *
3944 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Configured">"Configured"</link> D-Bus property.
3945 *
3946 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3947 *
3948 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3949 */
3950 gchar *
3951 cc_realm_common_dup_configured (CcRealmCommon *object)
3952 {
3953 gchar *value;
3954 g_object_get (G_OBJECT (object), "configured", &value, NULL);
3955 return value;
3956 }
3957
3958 /**
3959 * cc_realm_common_set_configured: (skip)
3960 * @object: A #CcRealmCommon.
3961 * @value: The value to set.
3962 *
3963 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Configured">"Configured"</link> D-Bus property to @value.
3964 *
3965 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3966 */
3967 void
3968 cc_realm_common_set_configured (CcRealmCommon *object, const gchar *value)
3969 {
3970 g_object_set (G_OBJECT (object), "configured", value, NULL);
3971 }
3972
3973 /**
3974 * cc_realm_common_get_supported_interfaces: (skip)
3975 * @object: A #CcRealmCommon.
3976 *
3977 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.SupportedInterfaces">"SupportedInterfaces"</link> D-Bus property.
3978 *
3979 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3980 *
3981 * 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 cc_realm_common_dup_supported_interfaces() if on another thread.
3982 *
3983 * 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.
3984 */
3985 const gchar *const *
3986 cc_realm_common_get_supported_interfaces (CcRealmCommon *object)
3987 {
3988 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
3989
3990 return CC_REALM_COMMON_GET_IFACE (object)->get_supported_interfaces (object);
3991 }
3992
3993 /**
3994 * cc_realm_common_dup_supported_interfaces: (skip)
3995 * @object: A #CcRealmCommon.
3996 *
3997 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.SupportedInterfaces">"SupportedInterfaces"</link> D-Bus property.
3998 *
3999 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4000 *
4001 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
4002 */
4003 gchar **
4004 cc_realm_common_dup_supported_interfaces (CcRealmCommon *object)
4005 {
4006 gchar **value;
4007 g_object_get (G_OBJECT (object), "supported-interfaces", &value, NULL);
4008 return value;
4009 }
4010
4011 /**
4012 * cc_realm_common_set_supported_interfaces: (skip)
4013 * @object: A #CcRealmCommon.
4014 * @value: The value to set.
4015 *
4016 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.SupportedInterfaces">"SupportedInterfaces"</link> D-Bus property to @value.
4017 *
4018 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4019 */
4020 void
4021 cc_realm_common_set_supported_interfaces (CcRealmCommon *object, const gchar *const *value)
4022 {
4023 g_object_set (G_OBJECT (object), "supported-interfaces", value, NULL);
4024 }
4025
4026 /**
4027 * cc_realm_common_get_details: (skip)
4028 * @object: A #CcRealmCommon.
4029 *
4030 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Details">"Details"</link> D-Bus property.
4031 *
4032 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4033 *
4034 * 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 cc_realm_common_dup_details() if on another thread.
4035 *
4036 * 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.
4037 */
4038 GVariant *
4039 cc_realm_common_get_details (CcRealmCommon *object)
4040 {
4041 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
4042
4043 return CC_REALM_COMMON_GET_IFACE (object)->get_details (object);
4044 }
4045
4046 /**
4047 * cc_realm_common_dup_details: (skip)
4048 * @object: A #CcRealmCommon.
4049 *
4050 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Details">"Details"</link> D-Bus property.
4051 *
4052 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4053 *
4054 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4055 */
4056 GVariant *
4057 cc_realm_common_dup_details (CcRealmCommon *object)
4058 {
4059 GVariant *value;
4060 g_object_get (G_OBJECT (object), "details", &value, NULL);
4061 return value;
4062 }
4063
4064 /**
4065 * cc_realm_common_set_details: (skip)
4066 * @object: A #CcRealmCommon.
4067 * @value: The value to set.
4068 *
4069 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.Details">"Details"</link> D-Bus property to @value.
4070 *
4071 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4072 */
4073 void
4074 cc_realm_common_set_details (CcRealmCommon *object, GVariant *value)
4075 {
4076 g_object_set (G_OBJECT (object), "details", value, NULL);
4077 }
4078
4079 /**
4080 * cc_realm_common_get_login_formats: (skip)
4081 * @object: A #CcRealmCommon.
4082 *
4083 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginFormats">"LoginFormats"</link> D-Bus property.
4084 *
4085 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4086 *
4087 * 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 cc_realm_common_dup_login_formats() if on another thread.
4088 *
4089 * 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.
4090 */
4091 const gchar *const *
4092 cc_realm_common_get_login_formats (CcRealmCommon *object)
4093 {
4094 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
4095
4096 return CC_REALM_COMMON_GET_IFACE (object)->get_login_formats (object);
4097 }
4098
4099 /**
4100 * cc_realm_common_dup_login_formats: (skip)
4101 * @object: A #CcRealmCommon.
4102 *
4103 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginFormats">"LoginFormats"</link> D-Bus property.
4104 *
4105 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4106 *
4107 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
4108 */
4109 gchar **
4110 cc_realm_common_dup_login_formats (CcRealmCommon *object)
4111 {
4112 gchar **value;
4113 g_object_get (G_OBJECT (object), "login-formats", &value, NULL);
4114 return value;
4115 }
4116
4117 /**
4118 * cc_realm_common_set_login_formats: (skip)
4119 * @object: A #CcRealmCommon.
4120 * @value: The value to set.
4121 *
4122 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginFormats">"LoginFormats"</link> D-Bus property to @value.
4123 *
4124 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4125 */
4126 void
4127 cc_realm_common_set_login_formats (CcRealmCommon *object, const gchar *const *value)
4128 {
4129 g_object_set (G_OBJECT (object), "login-formats", value, NULL);
4130 }
4131
4132 /**
4133 * cc_realm_common_get_login_policy: (skip)
4134 * @object: A #CcRealmCommon.
4135 *
4136 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginPolicy">"LoginPolicy"</link> D-Bus property.
4137 *
4138 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4139 *
4140 * 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 cc_realm_common_dup_login_policy() if on another thread.
4141 *
4142 * 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.
4143 */
4144 const gchar *
4145 cc_realm_common_get_login_policy (CcRealmCommon *object)
4146 {
4147 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
4148
4149 return CC_REALM_COMMON_GET_IFACE (object)->get_login_policy (object);
4150 }
4151
4152 /**
4153 * cc_realm_common_dup_login_policy: (skip)
4154 * @object: A #CcRealmCommon.
4155 *
4156 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginPolicy">"LoginPolicy"</link> D-Bus property.
4157 *
4158 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4159 *
4160 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4161 */
4162 gchar *
4163 cc_realm_common_dup_login_policy (CcRealmCommon *object)
4164 {
4165 gchar *value;
4166 g_object_get (G_OBJECT (object), "login-policy", &value, NULL);
4167 return value;
4168 }
4169
4170 /**
4171 * cc_realm_common_set_login_policy: (skip)
4172 * @object: A #CcRealmCommon.
4173 * @value: The value to set.
4174 *
4175 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.LoginPolicy">"LoginPolicy"</link> D-Bus property to @value.
4176 *
4177 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4178 */
4179 void
4180 cc_realm_common_set_login_policy (CcRealmCommon *object, const gchar *value)
4181 {
4182 g_object_set (G_OBJECT (object), "login-policy", value, NULL);
4183 }
4184
4185 /**
4186 * cc_realm_common_get_permitted_logins: (skip)
4187 * @object: A #CcRealmCommon.
4188 *
4189 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.PermittedLogins">"PermittedLogins"</link> D-Bus property.
4190 *
4191 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4192 *
4193 * 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 cc_realm_common_dup_permitted_logins() if on another thread.
4194 *
4195 * 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.
4196 */
4197 const gchar *const *
4198 cc_realm_common_get_permitted_logins (CcRealmCommon *object)
4199 {
4200 g_return_val_if_fail (CC_REALM_IS_COMMON (object), NULL);
4201
4202 return CC_REALM_COMMON_GET_IFACE (object)->get_permitted_logins (object);
4203 }
4204
4205 /**
4206 * cc_realm_common_dup_permitted_logins: (skip)
4207 * @object: A #CcRealmCommon.
4208 *
4209 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.PermittedLogins">"PermittedLogins"</link> D-Bus property.
4210 *
4211 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4212 *
4213 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
4214 */
4215 gchar **
4216 cc_realm_common_dup_permitted_logins (CcRealmCommon *object)
4217 {
4218 gchar **value;
4219 g_object_get (G_OBJECT (object), "permitted-logins", &value, NULL);
4220 return value;
4221 }
4222
4223 /**
4224 * cc_realm_common_set_permitted_logins: (skip)
4225 * @object: A #CcRealmCommon.
4226 * @value: The value to set.
4227 *
4228 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Realm.PermittedLogins">"PermittedLogins"</link> D-Bus property to @value.
4229 *
4230 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4231 */
4232 void
4233 cc_realm_common_set_permitted_logins (CcRealmCommon *object, const gchar *const *value)
4234 {
4235 g_object_set (G_OBJECT (object), "permitted-logins", value, NULL);
4236 }
4237
4238 /**
4239 * cc_realm_common_call_deconfigure:
4240 * @proxy: A #CcRealmCommonProxy.
4241 * @arg_options: Argument to pass with the method invocation.
4242 * @cancellable: (nullable): A #GCancellable or %NULL.
4243 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4244 * @user_data: User data to pass to @callback.
4245 *
4246 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.Deconfigure">Deconfigure()</link> D-Bus method on @proxy.
4247 * 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()).
4248 * You can then call cc_realm_common_call_deconfigure_finish() to get the result of the operation.
4249 *
4250 * See cc_realm_common_call_deconfigure_sync() for the synchronous, blocking version of this method.
4251 */
4252 void
4253 cc_realm_common_call_deconfigure (
4254 CcRealmCommon *proxy,
4255 GVariant *arg_options,
4256 GCancellable *cancellable,
4257 GAsyncReadyCallback callback,
4258 gpointer user_data)
4259 {
4260 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4261 "Deconfigure",
4262 g_variant_new ("(@a{sv})",
4263 arg_options),
4264 G_DBUS_CALL_FLAGS_NONE,
4265 -1,
4266 cancellable,
4267 callback,
4268 user_data);
4269 }
4270
4271 /**
4272 * cc_realm_common_call_deconfigure_finish:
4273 * @proxy: A #CcRealmCommonProxy.
4274 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_common_call_deconfigure().
4275 * @error: Return location for error or %NULL.
4276 *
4277 * Finishes an operation started with cc_realm_common_call_deconfigure().
4278 *
4279 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4280 */
4281 gboolean
4282 cc_realm_common_call_deconfigure_finish (
4283 CcRealmCommon *proxy,
4284 GAsyncResult *res,
4285 GError **error)
4286 {
4287 GVariant *_ret;
4288 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4289 if (_ret == NULL)
4290 goto _out;
4291 g_variant_get (_ret,
4292 "()");
4293 g_variant_unref (_ret);
4294 _out:
4295 return _ret != NULL;
4296 }
4297
4298 /**
4299 * cc_realm_common_call_deconfigure_sync:
4300 * @proxy: A #CcRealmCommonProxy.
4301 * @arg_options: Argument to pass with the method invocation.
4302 * @cancellable: (nullable): A #GCancellable or %NULL.
4303 * @error: Return location for error or %NULL.
4304 *
4305 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.Deconfigure">Deconfigure()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4306 *
4307 * See cc_realm_common_call_deconfigure() for the asynchronous version of this method.
4308 *
4309 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4310 */
4311 gboolean
4312 cc_realm_common_call_deconfigure_sync (
4313 CcRealmCommon *proxy,
4314 GVariant *arg_options,
4315 GCancellable *cancellable,
4316 GError **error)
4317 {
4318 GVariant *_ret;
4319 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4320 "Deconfigure",
4321 g_variant_new ("(@a{sv})",
4322 arg_options),
4323 G_DBUS_CALL_FLAGS_NONE,
4324 -1,
4325 cancellable,
4326 error);
4327 if (_ret == NULL)
4328 goto _out;
4329 g_variant_get (_ret,
4330 "()");
4331 g_variant_unref (_ret);
4332 _out:
4333 return _ret != NULL;
4334 }
4335
4336 /**
4337 * cc_realm_common_call_change_login_policy:
4338 * @proxy: A #CcRealmCommonProxy.
4339 * @arg_login_policy: Argument to pass with the method invocation.
4340 * @arg_permitted_add: Argument to pass with the method invocation.
4341 * @arg_permitted_remove: Argument to pass with the method invocation.
4342 * @arg_options: Argument to pass with the method invocation.
4343 * @cancellable: (nullable): A #GCancellable or %NULL.
4344 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4345 * @user_data: User data to pass to @callback.
4346 *
4347 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.ChangeLoginPolicy">ChangeLoginPolicy()</link> D-Bus method on @proxy.
4348 * 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()).
4349 * You can then call cc_realm_common_call_change_login_policy_finish() to get the result of the operation.
4350 *
4351 * See cc_realm_common_call_change_login_policy_sync() for the synchronous, blocking version of this method.
4352 */
4353 void
4354 cc_realm_common_call_change_login_policy (
4355 CcRealmCommon *proxy,
4356 const gchar *arg_login_policy,
4357 const gchar *const *arg_permitted_add,
4358 const gchar *const *arg_permitted_remove,
4359 GVariant *arg_options,
4360 GCancellable *cancellable,
4361 GAsyncReadyCallback callback,
4362 gpointer user_data)
4363 {
4364 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4365 "ChangeLoginPolicy",
4366 g_variant_new ("(s^as^as@a{sv})",
4367 arg_login_policy,
4368 arg_permitted_add,
4369 arg_permitted_remove,
4370 arg_options),
4371 G_DBUS_CALL_FLAGS_NONE,
4372 -1,
4373 cancellable,
4374 callback,
4375 user_data);
4376 }
4377
4378 /**
4379 * cc_realm_common_call_change_login_policy_finish:
4380 * @proxy: A #CcRealmCommonProxy.
4381 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_common_call_change_login_policy().
4382 * @error: Return location for error or %NULL.
4383 *
4384 * Finishes an operation started with cc_realm_common_call_change_login_policy().
4385 *
4386 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4387 */
4388 gboolean
4389 cc_realm_common_call_change_login_policy_finish (
4390 CcRealmCommon *proxy,
4391 GAsyncResult *res,
4392 GError **error)
4393 {
4394 GVariant *_ret;
4395 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4396 if (_ret == NULL)
4397 goto _out;
4398 g_variant_get (_ret,
4399 "()");
4400 g_variant_unref (_ret);
4401 _out:
4402 return _ret != NULL;
4403 }
4404
4405 /**
4406 * cc_realm_common_call_change_login_policy_sync:
4407 * @proxy: A #CcRealmCommonProxy.
4408 * @arg_login_policy: Argument to pass with the method invocation.
4409 * @arg_permitted_add: Argument to pass with the method invocation.
4410 * @arg_permitted_remove: Argument to pass with the method invocation.
4411 * @arg_options: Argument to pass with the method invocation.
4412 * @cancellable: (nullable): A #GCancellable or %NULL.
4413 * @error: Return location for error or %NULL.
4414 *
4415 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.ChangeLoginPolicy">ChangeLoginPolicy()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4416 *
4417 * See cc_realm_common_call_change_login_policy() for the asynchronous version of this method.
4418 *
4419 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4420 */
4421 gboolean
4422 cc_realm_common_call_change_login_policy_sync (
4423 CcRealmCommon *proxy,
4424 const gchar *arg_login_policy,
4425 const gchar *const *arg_permitted_add,
4426 const gchar *const *arg_permitted_remove,
4427 GVariant *arg_options,
4428 GCancellable *cancellable,
4429 GError **error)
4430 {
4431 GVariant *_ret;
4432 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4433 "ChangeLoginPolicy",
4434 g_variant_new ("(s^as^as@a{sv})",
4435 arg_login_policy,
4436 arg_permitted_add,
4437 arg_permitted_remove,
4438 arg_options),
4439 G_DBUS_CALL_FLAGS_NONE,
4440 -1,
4441 cancellable,
4442 error);
4443 if (_ret == NULL)
4444 goto _out;
4445 g_variant_get (_ret,
4446 "()");
4447 g_variant_unref (_ret);
4448 _out:
4449 return _ret != NULL;
4450 }
4451
4452 /**
4453 * cc_realm_common_complete_deconfigure:
4454 * @object: A #CcRealmCommon.
4455 * @invocation: (transfer full): A #GDBusMethodInvocation.
4456 *
4457 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.Deconfigure">Deconfigure()</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.
4458 *
4459 * This method will free @invocation, you cannot use it afterwards.
4460 */
4461 void
4462 cc_realm_common_complete_deconfigure (
4463 CcRealmCommon *object G_GNUC_UNUSED,
4464 GDBusMethodInvocation *invocation)
4465 {
4466 g_dbus_method_invocation_return_value (invocation,
4467 g_variant_new ("()"));
4468 }
4469
4470 /**
4471 * cc_realm_common_complete_change_login_policy:
4472 * @object: A #CcRealmCommon.
4473 * @invocation: (transfer full): A #GDBusMethodInvocation.
4474 *
4475 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-Realm.ChangeLoginPolicy">ChangeLoginPolicy()</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.
4476 *
4477 * This method will free @invocation, you cannot use it afterwards.
4478 */
4479 void
4480 cc_realm_common_complete_change_login_policy (
4481 CcRealmCommon *object G_GNUC_UNUSED,
4482 GDBusMethodInvocation *invocation)
4483 {
4484 g_dbus_method_invocation_return_value (invocation,
4485 g_variant_new ("()"));
4486 }
4487
4488 /* ------------------------------------------------------------------------ */
4489
4490 /**
4491 * CcRealmCommonProxy:
4492 *
4493 * The #CcRealmCommonProxy structure contains only private data and should only be accessed using the provided API.
4494 */
4495
4496 /**
4497 * CcRealmCommonProxyClass:
4498 * @parent_class: The parent class.
4499 *
4500 * Class structure for #CcRealmCommonProxy.
4501 */
4502
4503 struct _CcRealmCommonProxyPrivate
4504 {
4505 GData *qdata;
4506 };
4507
4508 static void cc_realm_common_proxy_iface_init (CcRealmCommonIface *iface);
4509
4510 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4511 G_DEFINE_TYPE_WITH_CODE (CcRealmCommonProxy, cc_realm_common_proxy, G_TYPE_DBUS_PROXY,
4512 G_ADD_PRIVATE (CcRealmCommonProxy)
4513 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_COMMON, cc_realm_common_proxy_iface_init))
4514
4515 #else
4516 G_DEFINE_TYPE_WITH_CODE (CcRealmCommonProxy, cc_realm_common_proxy, G_TYPE_DBUS_PROXY,
4517 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_COMMON, cc_realm_common_proxy_iface_init))
4518
4519 #endif
4520 static void
4521 cc_realm_common_proxy_finalize (GObject *object)
4522 {
4523 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4524 g_datalist_clear (&proxy->priv->qdata);
4525 G_OBJECT_CLASS (cc_realm_common_proxy_parent_class)->finalize (object);
4526 }
4527
4528 static void
4529 cc_realm_common_proxy_get_property (GObject *object,
4530 guint prop_id,
4531 GValue *value,
4532 GParamSpec *pspec G_GNUC_UNUSED)
4533 {
4534 const _ExtendedGDBusPropertyInfo *info;
4535 GVariant *variant;
4536 g_assert (prop_id != 0 && prop_id - 1 < 7);
4537 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_common_property_info_pointers[prop_id - 1];
4538 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4539 if (info->use_gvariant)
4540 {
4541 g_value_set_variant (value, variant);
4542 }
4543 else
4544 {
4545 if (variant != NULL)
4546 g_dbus_gvariant_to_gvalue (variant, value);
4547 }
4548 if (variant != NULL)
4549 g_variant_unref (variant);
4550 }
4551
4552 static void
4553 cc_realm_common_proxy_set_property_cb (GDBusProxy *proxy,
4554 GAsyncResult *res,
4555 gpointer user_data)
4556 {
4557 const _ExtendedGDBusPropertyInfo *info = user_data;
4558 GError *error;
4559 GVariant *_ret;
4560 error = NULL;
4561 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4562 if (!_ret)
4563 {
4564 g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Realm: %s (%s, %d)",
4565 info->parent_struct.name,
4566 error->message, g_quark_to_string (error->domain), error->code);
4567 g_error_free (error);
4568 }
4569 else
4570 {
4571 g_variant_unref (_ret);
4572 }
4573 }
4574
4575 static void
4576 cc_realm_common_proxy_set_property (GObject *object,
4577 guint prop_id,
4578 const GValue *value,
4579 GParamSpec *pspec G_GNUC_UNUSED)
4580 {
4581 const _ExtendedGDBusPropertyInfo *info;
4582 GVariant *variant;
4583 g_assert (prop_id != 0 && prop_id - 1 < 7);
4584 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_common_property_info_pointers[prop_id - 1];
4585 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4586 g_dbus_proxy_call (G_DBUS_PROXY (object),
4587 "org.freedesktop.DBus.Properties.Set",
4588 g_variant_new ("(ssv)", "org.freedesktop.realmd.Realm", info->parent_struct.name, variant),
4589 G_DBUS_CALL_FLAGS_NONE,
4590 -1,
4591 NULL, (GAsyncReadyCallback) cc_realm_common_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4592 g_variant_unref (variant);
4593 }
4594
4595 static void
4596 cc_realm_common_proxy_g_signal (GDBusProxy *proxy,
4597 const gchar *sender_name G_GNUC_UNUSED,
4598 const gchar *signal_name,
4599 GVariant *parameters)
4600 {
4601 _ExtendedGDBusSignalInfo *info;
4602 GVariantIter iter;
4603 GVariant *child;
4604 GValue *paramv;
4605 gsize num_params;
4606 gsize n;
4607 guint signal_id;
4608 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct, signal_name);
4609 if (info == NULL)
4610 return;
4611 num_params = g_variant_n_children (parameters);
4612 paramv = g_new0 (GValue, num_params + 1);
4613 g_value_init (&paramv[0], CC_REALM_TYPE_COMMON);
4614 g_value_set_object (&paramv[0], proxy);
4615 g_variant_iter_init (&iter, parameters);
4616 n = 1;
4617 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4618 {
4619 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4620 if (arg_info->use_gvariant)
4621 {
4622 g_value_init (&paramv[n], G_TYPE_VARIANT);
4623 g_value_set_variant (&paramv[n], child);
4624 n++;
4625 }
4626 else
4627 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4628 g_variant_unref (child);
4629 }
4630 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_COMMON);
4631 g_signal_emitv (paramv, signal_id, 0, NULL);
4632 for (n = 0; n < num_params + 1; n++)
4633 g_value_unset (&paramv[n]);
4634 g_free (paramv);
4635 }
4636
4637 static void
4638 cc_realm_common_proxy_g_properties_changed (GDBusProxy *_proxy,
4639 GVariant *changed_properties,
4640 const gchar *const *invalidated_properties)
4641 {
4642 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (_proxy);
4643 guint n;
4644 const gchar *key;
4645 GVariantIter *iter;
4646 _ExtendedGDBusPropertyInfo *info;
4647 g_variant_get (changed_properties, "a{sv}", &iter);
4648 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4649 {
4650 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct, key);
4651 g_datalist_remove_data (&proxy->priv->qdata, key);
4652 if (info != NULL)
4653 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4654 }
4655 g_variant_iter_free (iter);
4656 for (n = 0; invalidated_properties[n] != NULL; n++)
4657 {
4658 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct, invalidated_properties[n]);
4659 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4660 if (info != NULL)
4661 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4662 }
4663 }
4664
4665 static const gchar *
4666 cc_realm_common_proxy_get_name (CcRealmCommon *object)
4667 {
4668 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4669 GVariant *variant;
4670 const gchar *value = NULL;
4671 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name");
4672 if (variant != NULL)
4673 {
4674 value = g_variant_get_string (variant, NULL);
4675 g_variant_unref (variant);
4676 }
4677 return value;
4678 }
4679
4680 static const gchar *
4681 cc_realm_common_proxy_get_configured (CcRealmCommon *object)
4682 {
4683 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4684 GVariant *variant;
4685 const gchar *value = NULL;
4686 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Configured");
4687 if (variant != NULL)
4688 {
4689 value = g_variant_get_string (variant, NULL);
4690 g_variant_unref (variant);
4691 }
4692 return value;
4693 }
4694
4695 static const gchar *const *
4696 cc_realm_common_proxy_get_supported_interfaces (CcRealmCommon *object)
4697 {
4698 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4699 GVariant *variant;
4700 const gchar *const *value = NULL;
4701 value = g_datalist_get_data (&proxy->priv->qdata, "SupportedInterfaces");
4702 if (value != NULL)
4703 return value;
4704 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedInterfaces");
4705 if (variant != NULL)
4706 {
4707 value = g_variant_get_strv (variant, NULL);
4708 g_datalist_set_data_full (&proxy->priv->qdata, "SupportedInterfaces", (gpointer) value, g_free);
4709 g_variant_unref (variant);
4710 }
4711 return value;
4712 }
4713
4714 static GVariant *
4715 cc_realm_common_proxy_get_details (CcRealmCommon *object)
4716 {
4717 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4718 GVariant *variant;
4719 GVariant *value = NULL;
4720 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Details");
4721 value = variant;
4722 if (variant != NULL)
4723 g_variant_unref (variant);
4724 return value;
4725 }
4726
4727 static const gchar *const *
4728 cc_realm_common_proxy_get_login_formats (CcRealmCommon *object)
4729 {
4730 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4731 GVariant *variant;
4732 const gchar *const *value = NULL;
4733 value = g_datalist_get_data (&proxy->priv->qdata, "LoginFormats");
4734 if (value != NULL)
4735 return value;
4736 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LoginFormats");
4737 if (variant != NULL)
4738 {
4739 value = g_variant_get_strv (variant, NULL);
4740 g_datalist_set_data_full (&proxy->priv->qdata, "LoginFormats", (gpointer) value, g_free);
4741 g_variant_unref (variant);
4742 }
4743 return value;
4744 }
4745
4746 static const gchar *
4747 cc_realm_common_proxy_get_login_policy (CcRealmCommon *object)
4748 {
4749 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4750 GVariant *variant;
4751 const gchar *value = NULL;
4752 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LoginPolicy");
4753 if (variant != NULL)
4754 {
4755 value = g_variant_get_string (variant, NULL);
4756 g_variant_unref (variant);
4757 }
4758 return value;
4759 }
4760
4761 static const gchar *const *
4762 cc_realm_common_proxy_get_permitted_logins (CcRealmCommon *object)
4763 {
4764 CcRealmCommonProxy *proxy = CC_REALM_COMMON_PROXY (object);
4765 GVariant *variant;
4766 const gchar *const *value = NULL;
4767 value = g_datalist_get_data (&proxy->priv->qdata, "PermittedLogins");
4768 if (value != NULL)
4769 return value;
4770 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PermittedLogins");
4771 if (variant != NULL)
4772 {
4773 value = g_variant_get_strv (variant, NULL);
4774 g_datalist_set_data_full (&proxy->priv->qdata, "PermittedLogins", (gpointer) value, g_free);
4775 g_variant_unref (variant);
4776 }
4777 return value;
4778 }
4779
4780 static void
4781 cc_realm_common_proxy_init (CcRealmCommonProxy *proxy)
4782 {
4783 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4784 proxy->priv = cc_realm_common_proxy_get_instance_private (proxy);
4785 #else
4786 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, CC_REALM_TYPE_COMMON_PROXY, CcRealmCommonProxyPrivate);
4787 #endif
4788
4789 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), cc_realm_common_interface_info ());
4790 }
4791
4792 static void
4793 cc_realm_common_proxy_class_init (CcRealmCommonProxyClass *klass)
4794 {
4795 GObjectClass *gobject_class;
4796 GDBusProxyClass *proxy_class;
4797
4798 gobject_class = G_OBJECT_CLASS (klass);
4799 gobject_class->finalize = cc_realm_common_proxy_finalize;
4800 gobject_class->get_property = cc_realm_common_proxy_get_property;
4801 gobject_class->set_property = cc_realm_common_proxy_set_property;
4802
4803 proxy_class = G_DBUS_PROXY_CLASS (klass);
4804 proxy_class->g_signal = cc_realm_common_proxy_g_signal;
4805 proxy_class->g_properties_changed = cc_realm_common_proxy_g_properties_changed;
4806
4807 cc_realm_common_override_properties (gobject_class, 1);
4808
4809 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4810 g_type_class_add_private (klass, sizeof (CcRealmCommonProxyPrivate));
4811 #endif
4812 }
4813
4814 static void
4815 cc_realm_common_proxy_iface_init (CcRealmCommonIface *iface)
4816 {
4817 iface->get_name = cc_realm_common_proxy_get_name;
4818 iface->get_configured = cc_realm_common_proxy_get_configured;
4819 iface->get_supported_interfaces = cc_realm_common_proxy_get_supported_interfaces;
4820 iface->get_details = cc_realm_common_proxy_get_details;
4821 iface->get_login_formats = cc_realm_common_proxy_get_login_formats;
4822 iface->get_login_policy = cc_realm_common_proxy_get_login_policy;
4823 iface->get_permitted_logins = cc_realm_common_proxy_get_permitted_logins;
4824 }
4825
4826 /**
4827 * cc_realm_common_proxy_new:
4828 * @connection: A #GDBusConnection.
4829 * @flags: Flags from the #GDBusProxyFlags enumeration.
4830 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4831 * @object_path: An object path.
4832 * @cancellable: (nullable): A #GCancellable or %NULL.
4833 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4834 * @user_data: User data to pass to @callback.
4835 *
4836 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>. See g_dbus_proxy_new() for more details.
4837 *
4838 * 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()).
4839 * You can then call cc_realm_common_proxy_new_finish() to get the result of the operation.
4840 *
4841 * See cc_realm_common_proxy_new_sync() for the synchronous, blocking version of this constructor.
4842 */
4843 void
4844 cc_realm_common_proxy_new (
4845 GDBusConnection *connection,
4846 GDBusProxyFlags flags,
4847 const gchar *name,
4848 const gchar *object_path,
4849 GCancellable *cancellable,
4850 GAsyncReadyCallback callback,
4851 gpointer user_data)
4852 {
4853 g_async_initable_new_async (CC_REALM_TYPE_COMMON_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.realmd.Realm", NULL);
4854 }
4855
4856 /**
4857 * cc_realm_common_proxy_new_finish:
4858 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_common_proxy_new().
4859 * @error: Return location for error or %NULL
4860 *
4861 * Finishes an operation started with cc_realm_common_proxy_new().
4862 *
4863 * Returns: (transfer full) (type CcRealmCommonProxy): The constructed proxy object or %NULL if @error is set.
4864 */
4865 CcRealmCommon *
4866 cc_realm_common_proxy_new_finish (
4867 GAsyncResult *res,
4868 GError **error)
4869 {
4870 GObject *ret;
4871 GObject *source_object;
4872 source_object = g_async_result_get_source_object (res);
4873 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4874 g_object_unref (source_object);
4875 if (ret != NULL)
4876 return CC_REALM_COMMON (ret);
4877 else
4878 return NULL;
4879 }
4880
4881 /**
4882 * cc_realm_common_proxy_new_sync:
4883 * @connection: A #GDBusConnection.
4884 * @flags: Flags from the #GDBusProxyFlags enumeration.
4885 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4886 * @object_path: An object path.
4887 * @cancellable: (nullable): A #GCancellable or %NULL.
4888 * @error: Return location for error or %NULL
4889 *
4890 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>. See g_dbus_proxy_new_sync() for more details.
4891 *
4892 * The calling thread is blocked until a reply is received.
4893 *
4894 * See cc_realm_common_proxy_new() for the asynchronous version of this constructor.
4895 *
4896 * Returns: (transfer full) (type CcRealmCommonProxy): The constructed proxy object or %NULL if @error is set.
4897 */
4898 CcRealmCommon *
4899 cc_realm_common_proxy_new_sync (
4900 GDBusConnection *connection,
4901 GDBusProxyFlags flags,
4902 const gchar *name,
4903 const gchar *object_path,
4904 GCancellable *cancellable,
4905 GError **error)
4906 {
4907 GInitable *ret;
4908 ret = g_initable_new (CC_REALM_TYPE_COMMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Realm", NULL);
4909 if (ret != NULL)
4910 return CC_REALM_COMMON (ret);
4911 else
4912 return NULL;
4913 }
4914
4915
4916 /**
4917 * cc_realm_common_proxy_new_for_bus:
4918 * @bus_type: A #GBusType.
4919 * @flags: Flags from the #GDBusProxyFlags enumeration.
4920 * @name: A bus name (well-known or unique).
4921 * @object_path: An object path.
4922 * @cancellable: (nullable): A #GCancellable or %NULL.
4923 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4924 * @user_data: User data to pass to @callback.
4925 *
4926 * Like cc_realm_common_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4927 *
4928 * 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()).
4929 * You can then call cc_realm_common_proxy_new_for_bus_finish() to get the result of the operation.
4930 *
4931 * See cc_realm_common_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4932 */
4933 void
4934 cc_realm_common_proxy_new_for_bus (
4935 GBusType bus_type,
4936 GDBusProxyFlags flags,
4937 const gchar *name,
4938 const gchar *object_path,
4939 GCancellable *cancellable,
4940 GAsyncReadyCallback callback,
4941 gpointer user_data)
4942 {
4943 g_async_initable_new_async (CC_REALM_TYPE_COMMON_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.realmd.Realm", NULL);
4944 }
4945
4946 /**
4947 * cc_realm_common_proxy_new_for_bus_finish:
4948 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_common_proxy_new_for_bus().
4949 * @error: Return location for error or %NULL
4950 *
4951 * Finishes an operation started with cc_realm_common_proxy_new_for_bus().
4952 *
4953 * Returns: (transfer full) (type CcRealmCommonProxy): The constructed proxy object or %NULL if @error is set.
4954 */
4955 CcRealmCommon *
4956 cc_realm_common_proxy_new_for_bus_finish (
4957 GAsyncResult *res,
4958 GError **error)
4959 {
4960 GObject *ret;
4961 GObject *source_object;
4962 source_object = g_async_result_get_source_object (res);
4963 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4964 g_object_unref (source_object);
4965 if (ret != NULL)
4966 return CC_REALM_COMMON (ret);
4967 else
4968 return NULL;
4969 }
4970
4971 /**
4972 * cc_realm_common_proxy_new_for_bus_sync:
4973 * @bus_type: A #GBusType.
4974 * @flags: Flags from the #GDBusProxyFlags enumeration.
4975 * @name: A bus name (well-known or unique).
4976 * @object_path: An object path.
4977 * @cancellable: (nullable): A #GCancellable or %NULL.
4978 * @error: Return location for error or %NULL
4979 *
4980 * Like cc_realm_common_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4981 *
4982 * The calling thread is blocked until a reply is received.
4983 *
4984 * See cc_realm_common_proxy_new_for_bus() for the asynchronous version of this constructor.
4985 *
4986 * Returns: (transfer full) (type CcRealmCommonProxy): The constructed proxy object or %NULL if @error is set.
4987 */
4988 CcRealmCommon *
4989 cc_realm_common_proxy_new_for_bus_sync (
4990 GBusType bus_type,
4991 GDBusProxyFlags flags,
4992 const gchar *name,
4993 const gchar *object_path,
4994 GCancellable *cancellable,
4995 GError **error)
4996 {
4997 GInitable *ret;
4998 ret = g_initable_new (CC_REALM_TYPE_COMMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Realm", NULL);
4999 if (ret != NULL)
5000 return CC_REALM_COMMON (ret);
5001 else
5002 return NULL;
5003 }
5004
5005
5006 /* ------------------------------------------------------------------------ */
5007
5008 /**
5009 * CcRealmCommonSkeleton:
5010 *
5011 * The #CcRealmCommonSkeleton structure contains only private data and should only be accessed using the provided API.
5012 */
5013
5014 /**
5015 * CcRealmCommonSkeletonClass:
5016 * @parent_class: The parent class.
5017 *
5018 * Class structure for #CcRealmCommonSkeleton.
5019 */
5020
5021 struct _CcRealmCommonSkeletonPrivate
5022 {
5023 GValue *properties;
5024 GList *changed_properties;
5025 GSource *changed_properties_idle_source;
5026 GMainContext *context;
5027 GMutex lock;
5028 };
5029
5030 static void
5031 _cc_realm_common_skeleton_handle_method_call (
5032 GDBusConnection *connection G_GNUC_UNUSED,
5033 const gchar *sender G_GNUC_UNUSED,
5034 const gchar *object_path G_GNUC_UNUSED,
5035 const gchar *interface_name,
5036 const gchar *method_name,
5037 GVariant *parameters,
5038 GDBusMethodInvocation *invocation,
5039 gpointer user_data)
5040 {
5041 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (user_data);
5042 _ExtendedGDBusMethodInfo *info;
5043 GVariantIter iter;
5044 GVariant *child;
5045 GValue *paramv;
5046 gsize num_params;
5047 guint num_extra;
5048 gsize n;
5049 guint signal_id;
5050 GValue return_value = G_VALUE_INIT;
5051 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5052 g_assert (info != NULL);
5053 num_params = g_variant_n_children (parameters);
5054 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5055 n = 0;
5056 g_value_init (&paramv[n], CC_REALM_TYPE_COMMON);
5057 g_value_set_object (&paramv[n++], skeleton);
5058 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5059 g_value_set_object (&paramv[n++], invocation);
5060 if (info->pass_fdlist)
5061 {
5062 #ifdef G_OS_UNIX
5063 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5064 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5065 #else
5066 g_assert_not_reached ();
5067 #endif
5068 }
5069 g_variant_iter_init (&iter, parameters);
5070 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5071 {
5072 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5073 if (arg_info->use_gvariant)
5074 {
5075 g_value_init (&paramv[n], G_TYPE_VARIANT);
5076 g_value_set_variant (&paramv[n], child);
5077 n++;
5078 }
5079 else
5080 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5081 g_variant_unref (child);
5082 }
5083 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_COMMON);
5084 g_value_init (&return_value, G_TYPE_BOOLEAN);
5085 g_signal_emitv (paramv, signal_id, 0, &return_value);
5086 if (!g_value_get_boolean (&return_value))
5087 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);
5088 g_value_unset (&return_value);
5089 for (n = 0; n < num_params + num_extra; n++)
5090 g_value_unset (&paramv[n]);
5091 g_free (paramv);
5092 }
5093
5094 static GVariant *
5095 _cc_realm_common_skeleton_handle_get_property (
5096 GDBusConnection *connection G_GNUC_UNUSED,
5097 const gchar *sender G_GNUC_UNUSED,
5098 const gchar *object_path G_GNUC_UNUSED,
5099 const gchar *interface_name G_GNUC_UNUSED,
5100 const gchar *property_name,
5101 GError **error,
5102 gpointer user_data)
5103 {
5104 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (user_data);
5105 GValue value = G_VALUE_INIT;
5106 GParamSpec *pspec;
5107 _ExtendedGDBusPropertyInfo *info;
5108 GVariant *ret;
5109 ret = NULL;
5110 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct, property_name);
5111 g_assert (info != NULL);
5112 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5113 if (pspec == NULL)
5114 {
5115 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5116 }
5117 else
5118 {
5119 g_value_init (&value, pspec->value_type);
5120 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5121 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5122 g_value_unset (&value);
5123 }
5124 return ret;
5125 }
5126
5127 static gboolean
5128 _cc_realm_common_skeleton_handle_set_property (
5129 GDBusConnection *connection G_GNUC_UNUSED,
5130 const gchar *sender G_GNUC_UNUSED,
5131 const gchar *object_path G_GNUC_UNUSED,
5132 const gchar *interface_name G_GNUC_UNUSED,
5133 const gchar *property_name,
5134 GVariant *variant,
5135 GError **error,
5136 gpointer user_data)
5137 {
5138 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (user_data);
5139 GValue value = G_VALUE_INIT;
5140 GParamSpec *pspec;
5141 _ExtendedGDBusPropertyInfo *info;
5142 gboolean ret;
5143 ret = FALSE;
5144 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_common_interface_info.parent_struct, property_name);
5145 g_assert (info != NULL);
5146 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5147 if (pspec == NULL)
5148 {
5149 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5150 }
5151 else
5152 {
5153 if (info->use_gvariant)
5154 g_value_set_variant (&value, variant);
5155 else
5156 g_dbus_gvariant_to_gvalue (variant, &value);
5157 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5158 g_value_unset (&value);
5159 ret = TRUE;
5160 }
5161 return ret;
5162 }
5163
5164 static const GDBusInterfaceVTable _cc_realm_common_skeleton_vtable =
5165 {
5166 _cc_realm_common_skeleton_handle_method_call,
5167 _cc_realm_common_skeleton_handle_get_property,
5168 _cc_realm_common_skeleton_handle_set_property,
5169 {NULL}
5170 };
5171
5172 static GDBusInterfaceInfo *
5173 cc_realm_common_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5174 {
5175 return cc_realm_common_interface_info ();
5176 }
5177
5178 static GDBusInterfaceVTable *
5179 cc_realm_common_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5180 {
5181 return (GDBusInterfaceVTable *) &_cc_realm_common_skeleton_vtable;
5182 }
5183
5184 static GVariant *
5185 cc_realm_common_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5186 {
5187 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (_skeleton);
5188
5189 GVariantBuilder builder;
5190 guint n;
5191 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5192 if (_cc_realm_common_interface_info.parent_struct.properties == NULL)
5193 goto out;
5194 for (n = 0; _cc_realm_common_interface_info.parent_struct.properties[n] != NULL; n++)
5195 {
5196 GDBusPropertyInfo *info = _cc_realm_common_interface_info.parent_struct.properties[n];
5197 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5198 {
5199 GVariant *value;
5200 value = _cc_realm_common_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.realmd.Realm", info->name, NULL, skeleton);
5201 if (value != NULL)
5202 {
5203 g_variant_take_ref (value);
5204 g_variant_builder_add (&builder, "{sv}", info->name, value);
5205 g_variant_unref (value);
5206 }
5207 }
5208 }
5209 out:
5210 return g_variant_builder_end (&builder);
5211 }
5212
5213 static gboolean _cc_realm_common_emit_changed (gpointer user_data);
5214
5215 static void
5216 cc_realm_common_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5217 {
5218 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (_skeleton);
5219 gboolean emit_changed = FALSE;
5220
5221 g_mutex_lock (&skeleton->priv->lock);
5222 if (skeleton->priv->changed_properties_idle_source != NULL)
5223 {
5224 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5225 skeleton->priv->changed_properties_idle_source = NULL;
5226 emit_changed = TRUE;
5227 }
5228 g_mutex_unlock (&skeleton->priv->lock);
5229
5230 if (emit_changed)
5231 _cc_realm_common_emit_changed (skeleton);
5232 }
5233
5234 static void cc_realm_common_skeleton_iface_init (CcRealmCommonIface *iface);
5235 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5236 G_DEFINE_TYPE_WITH_CODE (CcRealmCommonSkeleton, cc_realm_common_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5237 G_ADD_PRIVATE (CcRealmCommonSkeleton)
5238 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_COMMON, cc_realm_common_skeleton_iface_init))
5239
5240 #else
5241 G_DEFINE_TYPE_WITH_CODE (CcRealmCommonSkeleton, cc_realm_common_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5242 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_COMMON, cc_realm_common_skeleton_iface_init))
5243
5244 #endif
5245 static void
5246 cc_realm_common_skeleton_finalize (GObject *object)
5247 {
5248 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5249 guint n;
5250 for (n = 0; n < 7; n++)
5251 g_value_unset (&skeleton->priv->properties[n]);
5252 g_free (skeleton->priv->properties);
5253 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5254 if (skeleton->priv->changed_properties_idle_source != NULL)
5255 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5256 g_main_context_unref (skeleton->priv->context);
5257 g_mutex_clear (&skeleton->priv->lock);
5258 G_OBJECT_CLASS (cc_realm_common_skeleton_parent_class)->finalize (object);
5259 }
5260
5261 static void
5262 cc_realm_common_skeleton_get_property (GObject *object,
5263 guint prop_id,
5264 GValue *value,
5265 GParamSpec *pspec G_GNUC_UNUSED)
5266 {
5267 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5268 g_assert (prop_id != 0 && prop_id - 1 < 7);
5269 g_mutex_lock (&skeleton->priv->lock);
5270 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5271 g_mutex_unlock (&skeleton->priv->lock);
5272 }
5273
5274 static gboolean
5275 _cc_realm_common_emit_changed (gpointer user_data)
5276 {
5277 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (user_data);
5278 GList *l;
5279 GVariantBuilder builder;
5280 GVariantBuilder invalidated_builder;
5281 guint num_changes;
5282
5283 g_mutex_lock (&skeleton->priv->lock);
5284 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5285 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5286 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5287 {
5288 ChangedProperty *cp = l->data;
5289 GVariant *variant;
5290 const GValue *cur_value;
5291
5292 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5293 if (!_g_value_equal (cur_value, &cp->orig_value))
5294 {
5295 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5296 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5297 g_variant_unref (variant);
5298 num_changes++;
5299 }
5300 }
5301 if (num_changes > 0)
5302 {
5303 GList *connections, *ll;
5304 GVariant *signal_variant;
5305 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Realm",
5306 &builder, &invalidated_builder));
5307 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5308 for (ll = connections; ll != NULL; ll = ll->next)
5309 {
5310 GDBusConnection *connection = ll->data;
5311
5312 g_dbus_connection_emit_signal (connection,
5313 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5314 "org.freedesktop.DBus.Properties",
5315 "PropertiesChanged",
5316 signal_variant,
5317 NULL);
5318 }
5319 g_variant_unref (signal_variant);
5320 g_list_free_full (connections, g_object_unref);
5321 }
5322 else
5323 {
5324 g_variant_builder_clear (&builder);
5325 g_variant_builder_clear (&invalidated_builder);
5326 }
5327 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5328 skeleton->priv->changed_properties = NULL;
5329 skeleton->priv->changed_properties_idle_source = NULL;
5330 g_mutex_unlock (&skeleton->priv->lock);
5331 return FALSE;
5332 }
5333
5334 static void
5335 _cc_realm_common_schedule_emit_changed (CcRealmCommonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5336 {
5337 ChangedProperty *cp;
5338 GList *l;
5339 cp = NULL;
5340 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5341 {
5342 ChangedProperty *i_cp = l->data;
5343 if (i_cp->info == info)
5344 {
5345 cp = i_cp;
5346 break;
5347 }
5348 }
5349 if (cp == NULL)
5350 {
5351 cp = g_new0 (ChangedProperty, 1);
5352 cp->prop_id = prop_id;
5353 cp->info = info;
5354 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5355 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5356 g_value_copy (orig_value, &cp->orig_value);
5357 }
5358 }
5359
5360 static void
5361 cc_realm_common_skeleton_notify (GObject *object,
5362 GParamSpec *pspec G_GNUC_UNUSED)
5363 {
5364 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5365 g_mutex_lock (&skeleton->priv->lock);
5366 if (skeleton->priv->changed_properties != NULL &&
5367 skeleton->priv->changed_properties_idle_source == NULL)
5368 {
5369 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5370 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5371 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _cc_realm_common_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5372 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _cc_realm_common_emit_changed");
5373 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5374 g_source_unref (skeleton->priv->changed_properties_idle_source);
5375 }
5376 g_mutex_unlock (&skeleton->priv->lock);
5377 }
5378
5379 static void
5380 cc_realm_common_skeleton_set_property (GObject *object,
5381 guint prop_id,
5382 const GValue *value,
5383 GParamSpec *pspec)
5384 {
5385 const _ExtendedGDBusPropertyInfo *info;
5386 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5387 g_assert (prop_id != 0 && prop_id - 1 < 7);
5388 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_common_property_info_pointers[prop_id - 1];
5389 g_mutex_lock (&skeleton->priv->lock);
5390 g_object_freeze_notify (object);
5391 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5392 {
5393 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
5394 info->emits_changed_signal)
5395 _cc_realm_common_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
5396 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5397 g_object_notify_by_pspec (object, pspec);
5398 }
5399 g_mutex_unlock (&skeleton->priv->lock);
5400 g_object_thaw_notify (object);
5401 }
5402
5403 static void
5404 cc_realm_common_skeleton_init (CcRealmCommonSkeleton *skeleton)
5405 {
5406 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5407 skeleton->priv = cc_realm_common_skeleton_get_instance_private (skeleton);
5408 #else
5409 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, CC_REALM_TYPE_COMMON_SKELETON, CcRealmCommonSkeletonPrivate);
5410 #endif
5411
5412 g_mutex_init (&skeleton->priv->lock);
5413 skeleton->priv->context = g_main_context_ref_thread_default ();
5414 skeleton->priv->properties = g_new0 (GValue, 7);
5415 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
5416 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5417 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRV);
5418 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
5419 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRV);
5420 g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING);
5421 g_value_init (&skeleton->priv->properties[6], G_TYPE_STRV);
5422 }
5423
5424 static const gchar *
5425 cc_realm_common_skeleton_get_name (CcRealmCommon *object)
5426 {
5427 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5428 const gchar *value;
5429 g_mutex_lock (&skeleton->priv->lock);
5430 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
5431 g_mutex_unlock (&skeleton->priv->lock);
5432 return value;
5433 }
5434
5435 static const gchar *
5436 cc_realm_common_skeleton_get_configured (CcRealmCommon *object)
5437 {
5438 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5439 const gchar *value;
5440 g_mutex_lock (&skeleton->priv->lock);
5441 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
5442 g_mutex_unlock (&skeleton->priv->lock);
5443 return value;
5444 }
5445
5446 static const gchar *const *
5447 cc_realm_common_skeleton_get_supported_interfaces (CcRealmCommon *object)
5448 {
5449 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5450 const gchar *const *value;
5451 g_mutex_lock (&skeleton->priv->lock);
5452 value = g_marshal_value_peek_boxed (&(skeleton->priv->properties[2]));
5453 g_mutex_unlock (&skeleton->priv->lock);
5454 return value;
5455 }
5456
5457 static GVariant *
5458 cc_realm_common_skeleton_get_details (CcRealmCommon *object)
5459 {
5460 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5461 GVariant *value;
5462 g_mutex_lock (&skeleton->priv->lock);
5463 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[3]));
5464 g_mutex_unlock (&skeleton->priv->lock);
5465 return value;
5466 }
5467
5468 static const gchar *const *
5469 cc_realm_common_skeleton_get_login_formats (CcRealmCommon *object)
5470 {
5471 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5472 const gchar *const *value;
5473 g_mutex_lock (&skeleton->priv->lock);
5474 value = g_marshal_value_peek_boxed (&(skeleton->priv->properties[4]));
5475 g_mutex_unlock (&skeleton->priv->lock);
5476 return value;
5477 }
5478
5479 static const gchar *
5480 cc_realm_common_skeleton_get_login_policy (CcRealmCommon *object)
5481 {
5482 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5483 const gchar *value;
5484 g_mutex_lock (&skeleton->priv->lock);
5485 value = g_marshal_value_peek_string (&(skeleton->priv->properties[5]));
5486 g_mutex_unlock (&skeleton->priv->lock);
5487 return value;
5488 }
5489
5490 static const gchar *const *
5491 cc_realm_common_skeleton_get_permitted_logins (CcRealmCommon *object)
5492 {
5493 CcRealmCommonSkeleton *skeleton = CC_REALM_COMMON_SKELETON (object);
5494 const gchar *const *value;
5495 g_mutex_lock (&skeleton->priv->lock);
5496 value = g_marshal_value_peek_boxed (&(skeleton->priv->properties[6]));
5497 g_mutex_unlock (&skeleton->priv->lock);
5498 return value;
5499 }
5500
5501 static void
5502 cc_realm_common_skeleton_class_init (CcRealmCommonSkeletonClass *klass)
5503 {
5504 GObjectClass *gobject_class;
5505 GDBusInterfaceSkeletonClass *skeleton_class;
5506
5507 gobject_class = G_OBJECT_CLASS (klass);
5508 gobject_class->finalize = cc_realm_common_skeleton_finalize;
5509 gobject_class->get_property = cc_realm_common_skeleton_get_property;
5510 gobject_class->set_property = cc_realm_common_skeleton_set_property;
5511 gobject_class->notify = cc_realm_common_skeleton_notify;
5512
5513
5514 cc_realm_common_override_properties (gobject_class, 1);
5515
5516 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5517 skeleton_class->get_info = cc_realm_common_skeleton_dbus_interface_get_info;
5518 skeleton_class->get_properties = cc_realm_common_skeleton_dbus_interface_get_properties;
5519 skeleton_class->flush = cc_realm_common_skeleton_dbus_interface_flush;
5520 skeleton_class->get_vtable = cc_realm_common_skeleton_dbus_interface_get_vtable;
5521
5522 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5523 g_type_class_add_private (klass, sizeof (CcRealmCommonSkeletonPrivate));
5524 #endif
5525 }
5526
5527 static void
5528 cc_realm_common_skeleton_iface_init (CcRealmCommonIface *iface)
5529 {
5530 iface->get_name = cc_realm_common_skeleton_get_name;
5531 iface->get_configured = cc_realm_common_skeleton_get_configured;
5532 iface->get_supported_interfaces = cc_realm_common_skeleton_get_supported_interfaces;
5533 iface->get_details = cc_realm_common_skeleton_get_details;
5534 iface->get_login_formats = cc_realm_common_skeleton_get_login_formats;
5535 iface->get_login_policy = cc_realm_common_skeleton_get_login_policy;
5536 iface->get_permitted_logins = cc_realm_common_skeleton_get_permitted_logins;
5537 }
5538
5539 /**
5540 * cc_realm_common_skeleton_new:
5541 *
5542 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>.
5543 *
5544 * Returns: (transfer full) (type CcRealmCommonSkeleton): The skeleton object.
5545 */
5546 CcRealmCommon *
5547 cc_realm_common_skeleton_new (void)
5548 {
5549 return CC_REALM_COMMON (g_object_new (CC_REALM_TYPE_COMMON_SKELETON, NULL));
5550 }
5551
5552 /* ------------------------------------------------------------------------
5553 * Code for interface org.freedesktop.realmd.Kerberos
5554 * ------------------------------------------------------------------------
5555 */
5556
5557 /**
5558 * SECTION:CcRealmKerberos
5559 * @title: CcRealmKerberos
5560 * @short_description: Generated C code for the org.freedesktop.realmd.Kerberos D-Bus interface
5561 *
5562 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link> D-Bus interface in C.
5563 */
5564
5565 /* ---- Introspection data for org.freedesktop.realmd.Kerberos ---- */
5566
5567 static const _ExtendedGDBusPropertyInfo _cc_realm_kerberos_property_info_realm_name =
5568 {
5569 {
5570 -1,
5571 (gchar *) "RealmName",
5572 (gchar *) "s",
5573 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5574 NULL
5575 },
5576 "realm-name",
5577 FALSE,
5578 TRUE
5579 };
5580
5581 static const _ExtendedGDBusPropertyInfo _cc_realm_kerberos_property_info_domain_name =
5582 {
5583 {
5584 -1,
5585 (gchar *) "DomainName",
5586 (gchar *) "s",
5587 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5588 NULL
5589 },
5590 "domain-name",
5591 FALSE,
5592 TRUE
5593 };
5594
5595 static const GDBusPropertyInfo * const _cc_realm_kerberos_property_info_pointers[] =
5596 {
5597 &_cc_realm_kerberos_property_info_realm_name.parent_struct,
5598 &_cc_realm_kerberos_property_info_domain_name.parent_struct,
5599 NULL
5600 };
5601
5602 static const _ExtendedGDBusInterfaceInfo _cc_realm_kerberos_interface_info =
5603 {
5604 {
5605 -1,
5606 (gchar *) "org.freedesktop.realmd.Kerberos",
5607 NULL,
5608 NULL,
5609 (GDBusPropertyInfo **) &_cc_realm_kerberos_property_info_pointers,
5610 NULL
5611 },
5612 "kerberos",
5613 };
5614
5615
5616 /**
5617 * cc_realm_kerberos_interface_info:
5618 *
5619 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link> D-Bus interface.
5620 *
5621 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5622 */
5623 GDBusInterfaceInfo *
5624 cc_realm_kerberos_interface_info (void)
5625 {
5626 return (GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct;
5627 }
5628
5629 /**
5630 * cc_realm_kerberos_override_properties:
5631 * @klass: The class structure for a #GObject derived class.
5632 * @property_id_begin: The property id to assign to the first overridden property.
5633 *
5634 * Overrides all #GObject properties in the #CcRealmKerberos interface for a concrete class.
5635 * The properties are overridden in the order they are defined.
5636 *
5637 * Returns: The last property id.
5638 */
5639 guint
5640 cc_realm_kerberos_override_properties (GObjectClass *klass, guint property_id_begin)
5641 {
5642 g_object_class_override_property (klass, property_id_begin++, "realm-name");
5643 g_object_class_override_property (klass, property_id_begin++, "domain-name");
5644 return property_id_begin - 1;
5645 }
5646
5647
5648
5649 /**
5650 * CcRealmKerberos:
5651 *
5652 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>.
5653 */
5654
5655 /**
5656 * CcRealmKerberosIface:
5657 * @parent_iface: The parent interface.
5658 * @get_domain_name: Getter for the #CcRealmKerberos:domain-name property.
5659 * @get_realm_name: Getter for the #CcRealmKerberos:realm-name property.
5660 *
5661 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>.
5662 */
5663
5664 typedef CcRealmKerberosIface CcRealmKerberosInterface;
5665 G_DEFINE_INTERFACE (CcRealmKerberos, cc_realm_kerberos, G_TYPE_OBJECT)
5666
5667 static void
5668 cc_realm_kerberos_default_init (CcRealmKerberosIface *iface)
5669 {
5670 /* GObject properties for D-Bus properties: */
5671 /**
5672 * CcRealmKerberos:realm-name:
5673 *
5674 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.RealmName">"RealmName"</link>.
5675 *
5676 * 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.
5677 */
5678 g_object_interface_install_property (iface,
5679 g_param_spec_string ("realm-name", "RealmName", "RealmName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5680 /**
5681 * CcRealmKerberos:domain-name:
5682 *
5683 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.DomainName">"DomainName"</link>.
5684 *
5685 * 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.
5686 */
5687 g_object_interface_install_property (iface,
5688 g_param_spec_string ("domain-name", "DomainName", "DomainName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5689 }
5690
5691 /**
5692 * cc_realm_kerberos_get_realm_name: (skip)
5693 * @object: A #CcRealmKerberos.
5694 *
5695 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.RealmName">"RealmName"</link> D-Bus property.
5696 *
5697 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5698 *
5699 * 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 cc_realm_kerberos_dup_realm_name() if on another thread.
5700 *
5701 * 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.
5702 */
5703 const gchar *
5704 cc_realm_kerberos_get_realm_name (CcRealmKerberos *object)
5705 {
5706 g_return_val_if_fail (CC_REALM_IS_KERBEROS (object), NULL);
5707
5708 return CC_REALM_KERBEROS_GET_IFACE (object)->get_realm_name (object);
5709 }
5710
5711 /**
5712 * cc_realm_kerberos_dup_realm_name: (skip)
5713 * @object: A #CcRealmKerberos.
5714 *
5715 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.RealmName">"RealmName"</link> D-Bus property.
5716 *
5717 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5718 *
5719 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
5720 */
5721 gchar *
5722 cc_realm_kerberos_dup_realm_name (CcRealmKerberos *object)
5723 {
5724 gchar *value;
5725 g_object_get (G_OBJECT (object), "realm-name", &value, NULL);
5726 return value;
5727 }
5728
5729 /**
5730 * cc_realm_kerberos_set_realm_name: (skip)
5731 * @object: A #CcRealmKerberos.
5732 * @value: The value to set.
5733 *
5734 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.RealmName">"RealmName"</link> D-Bus property to @value.
5735 *
5736 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5737 */
5738 void
5739 cc_realm_kerberos_set_realm_name (CcRealmKerberos *object, const gchar *value)
5740 {
5741 g_object_set (G_OBJECT (object), "realm-name", value, NULL);
5742 }
5743
5744 /**
5745 * cc_realm_kerberos_get_domain_name: (skip)
5746 * @object: A #CcRealmKerberos.
5747 *
5748 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.DomainName">"DomainName"</link> D-Bus property.
5749 *
5750 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5751 *
5752 * 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 cc_realm_kerberos_dup_domain_name() if on another thread.
5753 *
5754 * 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.
5755 */
5756 const gchar *
5757 cc_realm_kerberos_get_domain_name (CcRealmKerberos *object)
5758 {
5759 g_return_val_if_fail (CC_REALM_IS_KERBEROS (object), NULL);
5760
5761 return CC_REALM_KERBEROS_GET_IFACE (object)->get_domain_name (object);
5762 }
5763
5764 /**
5765 * cc_realm_kerberos_dup_domain_name: (skip)
5766 * @object: A #CcRealmKerberos.
5767 *
5768 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.DomainName">"DomainName"</link> D-Bus property.
5769 *
5770 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5771 *
5772 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
5773 */
5774 gchar *
5775 cc_realm_kerberos_dup_domain_name (CcRealmKerberos *object)
5776 {
5777 gchar *value;
5778 g_object_get (G_OBJECT (object), "domain-name", &value, NULL);
5779 return value;
5780 }
5781
5782 /**
5783 * cc_realm_kerberos_set_domain_name: (skip)
5784 * @object: A #CcRealmKerberos.
5785 * @value: The value to set.
5786 *
5787 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-Kerberos.DomainName">"DomainName"</link> D-Bus property to @value.
5788 *
5789 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5790 */
5791 void
5792 cc_realm_kerberos_set_domain_name (CcRealmKerberos *object, const gchar *value)
5793 {
5794 g_object_set (G_OBJECT (object), "domain-name", value, NULL);
5795 }
5796
5797 /* ------------------------------------------------------------------------ */
5798
5799 /**
5800 * CcRealmKerberosProxy:
5801 *
5802 * The #CcRealmKerberosProxy structure contains only private data and should only be accessed using the provided API.
5803 */
5804
5805 /**
5806 * CcRealmKerberosProxyClass:
5807 * @parent_class: The parent class.
5808 *
5809 * Class structure for #CcRealmKerberosProxy.
5810 */
5811
5812 struct _CcRealmKerberosProxyPrivate
5813 {
5814 GData *qdata;
5815 };
5816
5817 static void cc_realm_kerberos_proxy_iface_init (CcRealmKerberosIface *iface);
5818
5819 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5820 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosProxy, cc_realm_kerberos_proxy, G_TYPE_DBUS_PROXY,
5821 G_ADD_PRIVATE (CcRealmKerberosProxy)
5822 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS, cc_realm_kerberos_proxy_iface_init))
5823
5824 #else
5825 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosProxy, cc_realm_kerberos_proxy, G_TYPE_DBUS_PROXY,
5826 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS, cc_realm_kerberos_proxy_iface_init))
5827
5828 #endif
5829 static void
5830 cc_realm_kerberos_proxy_finalize (GObject *object)
5831 {
5832 CcRealmKerberosProxy *proxy = CC_REALM_KERBEROS_PROXY (object);
5833 g_datalist_clear (&proxy->priv->qdata);
5834 G_OBJECT_CLASS (cc_realm_kerberos_proxy_parent_class)->finalize (object);
5835 }
5836
5837 static void
5838 cc_realm_kerberos_proxy_get_property (GObject *object,
5839 guint prop_id,
5840 GValue *value,
5841 GParamSpec *pspec G_GNUC_UNUSED)
5842 {
5843 const _ExtendedGDBusPropertyInfo *info;
5844 GVariant *variant;
5845 g_assert (prop_id != 0 && prop_id - 1 < 2);
5846 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_property_info_pointers[prop_id - 1];
5847 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5848 if (info->use_gvariant)
5849 {
5850 g_value_set_variant (value, variant);
5851 }
5852 else
5853 {
5854 if (variant != NULL)
5855 g_dbus_gvariant_to_gvalue (variant, value);
5856 }
5857 if (variant != NULL)
5858 g_variant_unref (variant);
5859 }
5860
5861 static void
5862 cc_realm_kerberos_proxy_set_property_cb (GDBusProxy *proxy,
5863 GAsyncResult *res,
5864 gpointer user_data)
5865 {
5866 const _ExtendedGDBusPropertyInfo *info = user_data;
5867 GError *error;
5868 GVariant *_ret;
5869 error = NULL;
5870 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5871 if (!_ret)
5872 {
5873 g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.Kerberos: %s (%s, %d)",
5874 info->parent_struct.name,
5875 error->message, g_quark_to_string (error->domain), error->code);
5876 g_error_free (error);
5877 }
5878 else
5879 {
5880 g_variant_unref (_ret);
5881 }
5882 }
5883
5884 static void
5885 cc_realm_kerberos_proxy_set_property (GObject *object,
5886 guint prop_id,
5887 const GValue *value,
5888 GParamSpec *pspec G_GNUC_UNUSED)
5889 {
5890 const _ExtendedGDBusPropertyInfo *info;
5891 GVariant *variant;
5892 g_assert (prop_id != 0 && prop_id - 1 < 2);
5893 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_property_info_pointers[prop_id - 1];
5894 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5895 g_dbus_proxy_call (G_DBUS_PROXY (object),
5896 "org.freedesktop.DBus.Properties.Set",
5897 g_variant_new ("(ssv)", "org.freedesktop.realmd.Kerberos", info->parent_struct.name, variant),
5898 G_DBUS_CALL_FLAGS_NONE,
5899 -1,
5900 NULL, (GAsyncReadyCallback) cc_realm_kerberos_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5901 g_variant_unref (variant);
5902 }
5903
5904 static void
5905 cc_realm_kerberos_proxy_g_signal (GDBusProxy *proxy,
5906 const gchar *sender_name G_GNUC_UNUSED,
5907 const gchar *signal_name,
5908 GVariant *parameters)
5909 {
5910 _ExtendedGDBusSignalInfo *info;
5911 GVariantIter iter;
5912 GVariant *child;
5913 GValue *paramv;
5914 gsize num_params;
5915 gsize n;
5916 guint signal_id;
5917 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct, signal_name);
5918 if (info == NULL)
5919 return;
5920 num_params = g_variant_n_children (parameters);
5921 paramv = g_new0 (GValue, num_params + 1);
5922 g_value_init (&paramv[0], CC_REALM_TYPE_KERBEROS);
5923 g_value_set_object (&paramv[0], proxy);
5924 g_variant_iter_init (&iter, parameters);
5925 n = 1;
5926 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5927 {
5928 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5929 if (arg_info->use_gvariant)
5930 {
5931 g_value_init (&paramv[n], G_TYPE_VARIANT);
5932 g_value_set_variant (&paramv[n], child);
5933 n++;
5934 }
5935 else
5936 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5937 g_variant_unref (child);
5938 }
5939 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_KERBEROS);
5940 g_signal_emitv (paramv, signal_id, 0, NULL);
5941 for (n = 0; n < num_params + 1; n++)
5942 g_value_unset (&paramv[n]);
5943 g_free (paramv);
5944 }
5945
5946 static void
5947 cc_realm_kerberos_proxy_g_properties_changed (GDBusProxy *_proxy,
5948 GVariant *changed_properties,
5949 const gchar *const *invalidated_properties)
5950 {
5951 CcRealmKerberosProxy *proxy = CC_REALM_KERBEROS_PROXY (_proxy);
5952 guint n;
5953 const gchar *key;
5954 GVariantIter *iter;
5955 _ExtendedGDBusPropertyInfo *info;
5956 g_variant_get (changed_properties, "a{sv}", &iter);
5957 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5958 {
5959 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct, key);
5960 g_datalist_remove_data (&proxy->priv->qdata, key);
5961 if (info != NULL)
5962 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5963 }
5964 g_variant_iter_free (iter);
5965 for (n = 0; invalidated_properties[n] != NULL; n++)
5966 {
5967 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct, invalidated_properties[n]);
5968 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5969 if (info != NULL)
5970 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5971 }
5972 }
5973
5974 static const gchar *
5975 cc_realm_kerberos_proxy_get_realm_name (CcRealmKerberos *object)
5976 {
5977 CcRealmKerberosProxy *proxy = CC_REALM_KERBEROS_PROXY (object);
5978 GVariant *variant;
5979 const gchar *value = NULL;
5980 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RealmName");
5981 if (variant != NULL)
5982 {
5983 value = g_variant_get_string (variant, NULL);
5984 g_variant_unref (variant);
5985 }
5986 return value;
5987 }
5988
5989 static const gchar *
5990 cc_realm_kerberos_proxy_get_domain_name (CcRealmKerberos *object)
5991 {
5992 CcRealmKerberosProxy *proxy = CC_REALM_KERBEROS_PROXY (object);
5993 GVariant *variant;
5994 const gchar *value = NULL;
5995 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DomainName");
5996 if (variant != NULL)
5997 {
5998 value = g_variant_get_string (variant, NULL);
5999 g_variant_unref (variant);
6000 }
6001 return value;
6002 }
6003
6004 static void
6005 cc_realm_kerberos_proxy_init (CcRealmKerberosProxy *proxy)
6006 {
6007 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6008 proxy->priv = cc_realm_kerberos_proxy_get_instance_private (proxy);
6009 #else
6010 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, CC_REALM_TYPE_KERBEROS_PROXY, CcRealmKerberosProxyPrivate);
6011 #endif
6012
6013 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), cc_realm_kerberos_interface_info ());
6014 }
6015
6016 static void
6017 cc_realm_kerberos_proxy_class_init (CcRealmKerberosProxyClass *klass)
6018 {
6019 GObjectClass *gobject_class;
6020 GDBusProxyClass *proxy_class;
6021
6022 gobject_class = G_OBJECT_CLASS (klass);
6023 gobject_class->finalize = cc_realm_kerberos_proxy_finalize;
6024 gobject_class->get_property = cc_realm_kerberos_proxy_get_property;
6025 gobject_class->set_property = cc_realm_kerberos_proxy_set_property;
6026
6027 proxy_class = G_DBUS_PROXY_CLASS (klass);
6028 proxy_class->g_signal = cc_realm_kerberos_proxy_g_signal;
6029 proxy_class->g_properties_changed = cc_realm_kerberos_proxy_g_properties_changed;
6030
6031 cc_realm_kerberos_override_properties (gobject_class, 1);
6032
6033 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6034 g_type_class_add_private (klass, sizeof (CcRealmKerberosProxyPrivate));
6035 #endif
6036 }
6037
6038 static void
6039 cc_realm_kerberos_proxy_iface_init (CcRealmKerberosIface *iface)
6040 {
6041 iface->get_realm_name = cc_realm_kerberos_proxy_get_realm_name;
6042 iface->get_domain_name = cc_realm_kerberos_proxy_get_domain_name;
6043 }
6044
6045 /**
6046 * cc_realm_kerberos_proxy_new:
6047 * @connection: A #GDBusConnection.
6048 * @flags: Flags from the #GDBusProxyFlags enumeration.
6049 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6050 * @object_path: An object path.
6051 * @cancellable: (nullable): A #GCancellable or %NULL.
6052 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6053 * @user_data: User data to pass to @callback.
6054 *
6055 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>. See g_dbus_proxy_new() for more details.
6056 *
6057 * 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()).
6058 * You can then call cc_realm_kerberos_proxy_new_finish() to get the result of the operation.
6059 *
6060 * See cc_realm_kerberos_proxy_new_sync() for the synchronous, blocking version of this constructor.
6061 */
6062 void
6063 cc_realm_kerberos_proxy_new (
6064 GDBusConnection *connection,
6065 GDBusProxyFlags flags,
6066 const gchar *name,
6067 const gchar *object_path,
6068 GCancellable *cancellable,
6069 GAsyncReadyCallback callback,
6070 gpointer user_data)
6071 {
6072 g_async_initable_new_async (CC_REALM_TYPE_KERBEROS_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.realmd.Kerberos", NULL);
6073 }
6074
6075 /**
6076 * cc_realm_kerberos_proxy_new_finish:
6077 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_proxy_new().
6078 * @error: Return location for error or %NULL
6079 *
6080 * Finishes an operation started with cc_realm_kerberos_proxy_new().
6081 *
6082 * Returns: (transfer full) (type CcRealmKerberosProxy): The constructed proxy object or %NULL if @error is set.
6083 */
6084 CcRealmKerberos *
6085 cc_realm_kerberos_proxy_new_finish (
6086 GAsyncResult *res,
6087 GError **error)
6088 {
6089 GObject *ret;
6090 GObject *source_object;
6091 source_object = g_async_result_get_source_object (res);
6092 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6093 g_object_unref (source_object);
6094 if (ret != NULL)
6095 return CC_REALM_KERBEROS (ret);
6096 else
6097 return NULL;
6098 }
6099
6100 /**
6101 * cc_realm_kerberos_proxy_new_sync:
6102 * @connection: A #GDBusConnection.
6103 * @flags: Flags from the #GDBusProxyFlags enumeration.
6104 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6105 * @object_path: An object path.
6106 * @cancellable: (nullable): A #GCancellable or %NULL.
6107 * @error: Return location for error or %NULL
6108 *
6109 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>. See g_dbus_proxy_new_sync() for more details.
6110 *
6111 * The calling thread is blocked until a reply is received.
6112 *
6113 * See cc_realm_kerberos_proxy_new() for the asynchronous version of this constructor.
6114 *
6115 * Returns: (transfer full) (type CcRealmKerberosProxy): The constructed proxy object or %NULL if @error is set.
6116 */
6117 CcRealmKerberos *
6118 cc_realm_kerberos_proxy_new_sync (
6119 GDBusConnection *connection,
6120 GDBusProxyFlags flags,
6121 const gchar *name,
6122 const gchar *object_path,
6123 GCancellable *cancellable,
6124 GError **error)
6125 {
6126 GInitable *ret;
6127 ret = g_initable_new (CC_REALM_TYPE_KERBEROS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Kerberos", NULL);
6128 if (ret != NULL)
6129 return CC_REALM_KERBEROS (ret);
6130 else
6131 return NULL;
6132 }
6133
6134
6135 /**
6136 * cc_realm_kerberos_proxy_new_for_bus:
6137 * @bus_type: A #GBusType.
6138 * @flags: Flags from the #GDBusProxyFlags enumeration.
6139 * @name: A bus name (well-known or unique).
6140 * @object_path: An object path.
6141 * @cancellable: (nullable): A #GCancellable or %NULL.
6142 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6143 * @user_data: User data to pass to @callback.
6144 *
6145 * Like cc_realm_kerberos_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6146 *
6147 * 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()).
6148 * You can then call cc_realm_kerberos_proxy_new_for_bus_finish() to get the result of the operation.
6149 *
6150 * See cc_realm_kerberos_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6151 */
6152 void
6153 cc_realm_kerberos_proxy_new_for_bus (
6154 GBusType bus_type,
6155 GDBusProxyFlags flags,
6156 const gchar *name,
6157 const gchar *object_path,
6158 GCancellable *cancellable,
6159 GAsyncReadyCallback callback,
6160 gpointer user_data)
6161 {
6162 g_async_initable_new_async (CC_REALM_TYPE_KERBEROS_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.realmd.Kerberos", NULL);
6163 }
6164
6165 /**
6166 * cc_realm_kerberos_proxy_new_for_bus_finish:
6167 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_proxy_new_for_bus().
6168 * @error: Return location for error or %NULL
6169 *
6170 * Finishes an operation started with cc_realm_kerberos_proxy_new_for_bus().
6171 *
6172 * Returns: (transfer full) (type CcRealmKerberosProxy): The constructed proxy object or %NULL if @error is set.
6173 */
6174 CcRealmKerberos *
6175 cc_realm_kerberos_proxy_new_for_bus_finish (
6176 GAsyncResult *res,
6177 GError **error)
6178 {
6179 GObject *ret;
6180 GObject *source_object;
6181 source_object = g_async_result_get_source_object (res);
6182 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6183 g_object_unref (source_object);
6184 if (ret != NULL)
6185 return CC_REALM_KERBEROS (ret);
6186 else
6187 return NULL;
6188 }
6189
6190 /**
6191 * cc_realm_kerberos_proxy_new_for_bus_sync:
6192 * @bus_type: A #GBusType.
6193 * @flags: Flags from the #GDBusProxyFlags enumeration.
6194 * @name: A bus name (well-known or unique).
6195 * @object_path: An object path.
6196 * @cancellable: (nullable): A #GCancellable or %NULL.
6197 * @error: Return location for error or %NULL
6198 *
6199 * Like cc_realm_kerberos_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6200 *
6201 * The calling thread is blocked until a reply is received.
6202 *
6203 * See cc_realm_kerberos_proxy_new_for_bus() for the asynchronous version of this constructor.
6204 *
6205 * Returns: (transfer full) (type CcRealmKerberosProxy): The constructed proxy object or %NULL if @error is set.
6206 */
6207 CcRealmKerberos *
6208 cc_realm_kerberos_proxy_new_for_bus_sync (
6209 GBusType bus_type,
6210 GDBusProxyFlags flags,
6211 const gchar *name,
6212 const gchar *object_path,
6213 GCancellable *cancellable,
6214 GError **error)
6215 {
6216 GInitable *ret;
6217 ret = g_initable_new (CC_REALM_TYPE_KERBEROS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.Kerberos", NULL);
6218 if (ret != NULL)
6219 return CC_REALM_KERBEROS (ret);
6220 else
6221 return NULL;
6222 }
6223
6224
6225 /* ------------------------------------------------------------------------ */
6226
6227 /**
6228 * CcRealmKerberosSkeleton:
6229 *
6230 * The #CcRealmKerberosSkeleton structure contains only private data and should only be accessed using the provided API.
6231 */
6232
6233 /**
6234 * CcRealmKerberosSkeletonClass:
6235 * @parent_class: The parent class.
6236 *
6237 * Class structure for #CcRealmKerberosSkeleton.
6238 */
6239
6240 struct _CcRealmKerberosSkeletonPrivate
6241 {
6242 GValue *properties;
6243 GList *changed_properties;
6244 GSource *changed_properties_idle_source;
6245 GMainContext *context;
6246 GMutex lock;
6247 };
6248
6249 static void
6250 _cc_realm_kerberos_skeleton_handle_method_call (
6251 GDBusConnection *connection G_GNUC_UNUSED,
6252 const gchar *sender G_GNUC_UNUSED,
6253 const gchar *object_path G_GNUC_UNUSED,
6254 const gchar *interface_name,
6255 const gchar *method_name,
6256 GVariant *parameters,
6257 GDBusMethodInvocation *invocation,
6258 gpointer user_data)
6259 {
6260 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (user_data);
6261 _ExtendedGDBusMethodInfo *info;
6262 GVariantIter iter;
6263 GVariant *child;
6264 GValue *paramv;
6265 gsize num_params;
6266 guint num_extra;
6267 gsize n;
6268 guint signal_id;
6269 GValue return_value = G_VALUE_INIT;
6270 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6271 g_assert (info != NULL);
6272 num_params = g_variant_n_children (parameters);
6273 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6274 n = 0;
6275 g_value_init (&paramv[n], CC_REALM_TYPE_KERBEROS);
6276 g_value_set_object (&paramv[n++], skeleton);
6277 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6278 g_value_set_object (&paramv[n++], invocation);
6279 if (info->pass_fdlist)
6280 {
6281 #ifdef G_OS_UNIX
6282 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6283 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6284 #else
6285 g_assert_not_reached ();
6286 #endif
6287 }
6288 g_variant_iter_init (&iter, parameters);
6289 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6290 {
6291 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6292 if (arg_info->use_gvariant)
6293 {
6294 g_value_init (&paramv[n], G_TYPE_VARIANT);
6295 g_value_set_variant (&paramv[n], child);
6296 n++;
6297 }
6298 else
6299 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6300 g_variant_unref (child);
6301 }
6302 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_KERBEROS);
6303 g_value_init (&return_value, G_TYPE_BOOLEAN);
6304 g_signal_emitv (paramv, signal_id, 0, &return_value);
6305 if (!g_value_get_boolean (&return_value))
6306 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);
6307 g_value_unset (&return_value);
6308 for (n = 0; n < num_params + num_extra; n++)
6309 g_value_unset (&paramv[n]);
6310 g_free (paramv);
6311 }
6312
6313 static GVariant *
6314 _cc_realm_kerberos_skeleton_handle_get_property (
6315 GDBusConnection *connection G_GNUC_UNUSED,
6316 const gchar *sender G_GNUC_UNUSED,
6317 const gchar *object_path G_GNUC_UNUSED,
6318 const gchar *interface_name G_GNUC_UNUSED,
6319 const gchar *property_name,
6320 GError **error,
6321 gpointer user_data)
6322 {
6323 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (user_data);
6324 GValue value = G_VALUE_INIT;
6325 GParamSpec *pspec;
6326 _ExtendedGDBusPropertyInfo *info;
6327 GVariant *ret;
6328 ret = NULL;
6329 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct, property_name);
6330 g_assert (info != NULL);
6331 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6332 if (pspec == NULL)
6333 {
6334 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6335 }
6336 else
6337 {
6338 g_value_init (&value, pspec->value_type);
6339 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6340 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6341 g_value_unset (&value);
6342 }
6343 return ret;
6344 }
6345
6346 static gboolean
6347 _cc_realm_kerberos_skeleton_handle_set_property (
6348 GDBusConnection *connection G_GNUC_UNUSED,
6349 const gchar *sender G_GNUC_UNUSED,
6350 const gchar *object_path G_GNUC_UNUSED,
6351 const gchar *interface_name G_GNUC_UNUSED,
6352 const gchar *property_name,
6353 GVariant *variant,
6354 GError **error,
6355 gpointer user_data)
6356 {
6357 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (user_data);
6358 GValue value = G_VALUE_INIT;
6359 GParamSpec *pspec;
6360 _ExtendedGDBusPropertyInfo *info;
6361 gboolean ret;
6362 ret = FALSE;
6363 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_interface_info.parent_struct, property_name);
6364 g_assert (info != NULL);
6365 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6366 if (pspec == NULL)
6367 {
6368 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6369 }
6370 else
6371 {
6372 if (info->use_gvariant)
6373 g_value_set_variant (&value, variant);
6374 else
6375 g_dbus_gvariant_to_gvalue (variant, &value);
6376 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6377 g_value_unset (&value);
6378 ret = TRUE;
6379 }
6380 return ret;
6381 }
6382
6383 static const GDBusInterfaceVTable _cc_realm_kerberos_skeleton_vtable =
6384 {
6385 _cc_realm_kerberos_skeleton_handle_method_call,
6386 _cc_realm_kerberos_skeleton_handle_get_property,
6387 _cc_realm_kerberos_skeleton_handle_set_property,
6388 {NULL}
6389 };
6390
6391 static GDBusInterfaceInfo *
6392 cc_realm_kerberos_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6393 {
6394 return cc_realm_kerberos_interface_info ();
6395 }
6396
6397 static GDBusInterfaceVTable *
6398 cc_realm_kerberos_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6399 {
6400 return (GDBusInterfaceVTable *) &_cc_realm_kerberos_skeleton_vtable;
6401 }
6402
6403 static GVariant *
6404 cc_realm_kerberos_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6405 {
6406 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (_skeleton);
6407
6408 GVariantBuilder builder;
6409 guint n;
6410 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6411 if (_cc_realm_kerberos_interface_info.parent_struct.properties == NULL)
6412 goto out;
6413 for (n = 0; _cc_realm_kerberos_interface_info.parent_struct.properties[n] != NULL; n++)
6414 {
6415 GDBusPropertyInfo *info = _cc_realm_kerberos_interface_info.parent_struct.properties[n];
6416 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6417 {
6418 GVariant *value;
6419 value = _cc_realm_kerberos_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.realmd.Kerberos", info->name, NULL, skeleton);
6420 if (value != NULL)
6421 {
6422 g_variant_take_ref (value);
6423 g_variant_builder_add (&builder, "{sv}", info->name, value);
6424 g_variant_unref (value);
6425 }
6426 }
6427 }
6428 out:
6429 return g_variant_builder_end (&builder);
6430 }
6431
6432 static gboolean _cc_realm_kerberos_emit_changed (gpointer user_data);
6433
6434 static void
6435 cc_realm_kerberos_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6436 {
6437 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (_skeleton);
6438 gboolean emit_changed = FALSE;
6439
6440 g_mutex_lock (&skeleton->priv->lock);
6441 if (skeleton->priv->changed_properties_idle_source != NULL)
6442 {
6443 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6444 skeleton->priv->changed_properties_idle_source = NULL;
6445 emit_changed = TRUE;
6446 }
6447 g_mutex_unlock (&skeleton->priv->lock);
6448
6449 if (emit_changed)
6450 _cc_realm_kerberos_emit_changed (skeleton);
6451 }
6452
6453 static void cc_realm_kerberos_skeleton_iface_init (CcRealmKerberosIface *iface);
6454 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6455 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosSkeleton, cc_realm_kerberos_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6456 G_ADD_PRIVATE (CcRealmKerberosSkeleton)
6457 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS, cc_realm_kerberos_skeleton_iface_init))
6458
6459 #else
6460 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosSkeleton, cc_realm_kerberos_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6461 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS, cc_realm_kerberos_skeleton_iface_init))
6462
6463 #endif
6464 static void
6465 cc_realm_kerberos_skeleton_finalize (GObject *object)
6466 {
6467 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6468 guint n;
6469 for (n = 0; n < 2; n++)
6470 g_value_unset (&skeleton->priv->properties[n]);
6471 g_free (skeleton->priv->properties);
6472 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6473 if (skeleton->priv->changed_properties_idle_source != NULL)
6474 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6475 g_main_context_unref (skeleton->priv->context);
6476 g_mutex_clear (&skeleton->priv->lock);
6477 G_OBJECT_CLASS (cc_realm_kerberos_skeleton_parent_class)->finalize (object);
6478 }
6479
6480 static void
6481 cc_realm_kerberos_skeleton_get_property (GObject *object,
6482 guint prop_id,
6483 GValue *value,
6484 GParamSpec *pspec G_GNUC_UNUSED)
6485 {
6486 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6487 g_assert (prop_id != 0 && prop_id - 1 < 2);
6488 g_mutex_lock (&skeleton->priv->lock);
6489 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6490 g_mutex_unlock (&skeleton->priv->lock);
6491 }
6492
6493 static gboolean
6494 _cc_realm_kerberos_emit_changed (gpointer user_data)
6495 {
6496 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (user_data);
6497 GList *l;
6498 GVariantBuilder builder;
6499 GVariantBuilder invalidated_builder;
6500 guint num_changes;
6501
6502 g_mutex_lock (&skeleton->priv->lock);
6503 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6504 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6505 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6506 {
6507 ChangedProperty *cp = l->data;
6508 GVariant *variant;
6509 const GValue *cur_value;
6510
6511 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6512 if (!_g_value_equal (cur_value, &cp->orig_value))
6513 {
6514 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6515 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6516 g_variant_unref (variant);
6517 num_changes++;
6518 }
6519 }
6520 if (num_changes > 0)
6521 {
6522 GList *connections, *ll;
6523 GVariant *signal_variant;
6524 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.Kerberos",
6525 &builder, &invalidated_builder));
6526 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6527 for (ll = connections; ll != NULL; ll = ll->next)
6528 {
6529 GDBusConnection *connection = ll->data;
6530
6531 g_dbus_connection_emit_signal (connection,
6532 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6533 "org.freedesktop.DBus.Properties",
6534 "PropertiesChanged",
6535 signal_variant,
6536 NULL);
6537 }
6538 g_variant_unref (signal_variant);
6539 g_list_free_full (connections, g_object_unref);
6540 }
6541 else
6542 {
6543 g_variant_builder_clear (&builder);
6544 g_variant_builder_clear (&invalidated_builder);
6545 }
6546 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6547 skeleton->priv->changed_properties = NULL;
6548 skeleton->priv->changed_properties_idle_source = NULL;
6549 g_mutex_unlock (&skeleton->priv->lock);
6550 return FALSE;
6551 }
6552
6553 static void
6554 _cc_realm_kerberos_schedule_emit_changed (CcRealmKerberosSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6555 {
6556 ChangedProperty *cp;
6557 GList *l;
6558 cp = NULL;
6559 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6560 {
6561 ChangedProperty *i_cp = l->data;
6562 if (i_cp->info == info)
6563 {
6564 cp = i_cp;
6565 break;
6566 }
6567 }
6568 if (cp == NULL)
6569 {
6570 cp = g_new0 (ChangedProperty, 1);
6571 cp->prop_id = prop_id;
6572 cp->info = info;
6573 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6574 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6575 g_value_copy (orig_value, &cp->orig_value);
6576 }
6577 }
6578
6579 static void
6580 cc_realm_kerberos_skeleton_notify (GObject *object,
6581 GParamSpec *pspec G_GNUC_UNUSED)
6582 {
6583 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6584 g_mutex_lock (&skeleton->priv->lock);
6585 if (skeleton->priv->changed_properties != NULL &&
6586 skeleton->priv->changed_properties_idle_source == NULL)
6587 {
6588 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6589 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6590 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _cc_realm_kerberos_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6591 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _cc_realm_kerberos_emit_changed");
6592 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6593 g_source_unref (skeleton->priv->changed_properties_idle_source);
6594 }
6595 g_mutex_unlock (&skeleton->priv->lock);
6596 }
6597
6598 static void
6599 cc_realm_kerberos_skeleton_set_property (GObject *object,
6600 guint prop_id,
6601 const GValue *value,
6602 GParamSpec *pspec)
6603 {
6604 const _ExtendedGDBusPropertyInfo *info;
6605 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6606 g_assert (prop_id != 0 && prop_id - 1 < 2);
6607 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_property_info_pointers[prop_id - 1];
6608 g_mutex_lock (&skeleton->priv->lock);
6609 g_object_freeze_notify (object);
6610 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6611 {
6612 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
6613 info->emits_changed_signal)
6614 _cc_realm_kerberos_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
6615 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6616 g_object_notify_by_pspec (object, pspec);
6617 }
6618 g_mutex_unlock (&skeleton->priv->lock);
6619 g_object_thaw_notify (object);
6620 }
6621
6622 static void
6623 cc_realm_kerberos_skeleton_init (CcRealmKerberosSkeleton *skeleton)
6624 {
6625 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6626 skeleton->priv = cc_realm_kerberos_skeleton_get_instance_private (skeleton);
6627 #else
6628 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, CC_REALM_TYPE_KERBEROS_SKELETON, CcRealmKerberosSkeletonPrivate);
6629 #endif
6630
6631 g_mutex_init (&skeleton->priv->lock);
6632 skeleton->priv->context = g_main_context_ref_thread_default ();
6633 skeleton->priv->properties = g_new0 (GValue, 2);
6634 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
6635 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6636 }
6637
6638 static const gchar *
6639 cc_realm_kerberos_skeleton_get_realm_name (CcRealmKerberos *object)
6640 {
6641 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6642 const gchar *value;
6643 g_mutex_lock (&skeleton->priv->lock);
6644 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
6645 g_mutex_unlock (&skeleton->priv->lock);
6646 return value;
6647 }
6648
6649 static const gchar *
6650 cc_realm_kerberos_skeleton_get_domain_name (CcRealmKerberos *object)
6651 {
6652 CcRealmKerberosSkeleton *skeleton = CC_REALM_KERBEROS_SKELETON (object);
6653 const gchar *value;
6654 g_mutex_lock (&skeleton->priv->lock);
6655 value = g_marshal_value_peek_string (&(skeleton->priv->properties[1]));
6656 g_mutex_unlock (&skeleton->priv->lock);
6657 return value;
6658 }
6659
6660 static void
6661 cc_realm_kerberos_skeleton_class_init (CcRealmKerberosSkeletonClass *klass)
6662 {
6663 GObjectClass *gobject_class;
6664 GDBusInterfaceSkeletonClass *skeleton_class;
6665
6666 gobject_class = G_OBJECT_CLASS (klass);
6667 gobject_class->finalize = cc_realm_kerberos_skeleton_finalize;
6668 gobject_class->get_property = cc_realm_kerberos_skeleton_get_property;
6669 gobject_class->set_property = cc_realm_kerberos_skeleton_set_property;
6670 gobject_class->notify = cc_realm_kerberos_skeleton_notify;
6671
6672
6673 cc_realm_kerberos_override_properties (gobject_class, 1);
6674
6675 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6676 skeleton_class->get_info = cc_realm_kerberos_skeleton_dbus_interface_get_info;
6677 skeleton_class->get_properties = cc_realm_kerberos_skeleton_dbus_interface_get_properties;
6678 skeleton_class->flush = cc_realm_kerberos_skeleton_dbus_interface_flush;
6679 skeleton_class->get_vtable = cc_realm_kerberos_skeleton_dbus_interface_get_vtable;
6680
6681 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6682 g_type_class_add_private (klass, sizeof (CcRealmKerberosSkeletonPrivate));
6683 #endif
6684 }
6685
6686 static void
6687 cc_realm_kerberos_skeleton_iface_init (CcRealmKerberosIface *iface)
6688 {
6689 iface->get_realm_name = cc_realm_kerberos_skeleton_get_realm_name;
6690 iface->get_domain_name = cc_realm_kerberos_skeleton_get_domain_name;
6691 }
6692
6693 /**
6694 * cc_realm_kerberos_skeleton_new:
6695 *
6696 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>.
6697 *
6698 * Returns: (transfer full) (type CcRealmKerberosSkeleton): The skeleton object.
6699 */
6700 CcRealmKerberos *
6701 cc_realm_kerberos_skeleton_new (void)
6702 {
6703 return CC_REALM_KERBEROS (g_object_new (CC_REALM_TYPE_KERBEROS_SKELETON, NULL));
6704 }
6705
6706 /* ------------------------------------------------------------------------
6707 * Code for interface org.freedesktop.realmd.KerberosMembership
6708 * ------------------------------------------------------------------------
6709 */
6710
6711 /**
6712 * SECTION:CcRealmKerberosMembership
6713 * @title: CcRealmKerberosMembership
6714 * @short_description: Generated C code for the org.freedesktop.realmd.KerberosMembership D-Bus interface
6715 *
6716 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link> D-Bus interface in C.
6717 */
6718
6719 /* ---- Introspection data for org.freedesktop.realmd.KerberosMembership ---- */
6720
6721 static const _ExtendedGDBusArgInfo _cc_realm_kerberos_membership_method_info_join_IN_ARG_credentials =
6722 {
6723 {
6724 -1,
6725 (gchar *) "credentials",
6726 (gchar *) "(ssv)",
6727 NULL
6728 },
6729 FALSE
6730 };
6731
6732 static const _ExtendedGDBusArgInfo _cc_realm_kerberos_membership_method_info_join_IN_ARG_options =
6733 {
6734 {
6735 -1,
6736 (gchar *) "options",
6737 (gchar *) "a{sv}",
6738 NULL
6739 },
6740 FALSE
6741 };
6742
6743 static const GDBusArgInfo * const _cc_realm_kerberos_membership_method_info_join_IN_ARG_pointers[] =
6744 {
6745 &_cc_realm_kerberos_membership_method_info_join_IN_ARG_credentials.parent_struct,
6746 &_cc_realm_kerberos_membership_method_info_join_IN_ARG_options.parent_struct,
6747 NULL
6748 };
6749
6750 static const _ExtendedGDBusMethodInfo _cc_realm_kerberos_membership_method_info_join =
6751 {
6752 {
6753 -1,
6754 (gchar *) "Join",
6755 (GDBusArgInfo **) &_cc_realm_kerberos_membership_method_info_join_IN_ARG_pointers,
6756 NULL,
6757 NULL
6758 },
6759 "handle-join",
6760 FALSE
6761 };
6762
6763 static const _ExtendedGDBusArgInfo _cc_realm_kerberos_membership_method_info_leave_IN_ARG_credentials =
6764 {
6765 {
6766 -1,
6767 (gchar *) "credentials",
6768 (gchar *) "(ssv)",
6769 NULL
6770 },
6771 FALSE
6772 };
6773
6774 static const _ExtendedGDBusArgInfo _cc_realm_kerberos_membership_method_info_leave_IN_ARG_options =
6775 {
6776 {
6777 -1,
6778 (gchar *) "options",
6779 (gchar *) "a{sv}",
6780 NULL
6781 },
6782 FALSE
6783 };
6784
6785 static const GDBusArgInfo * const _cc_realm_kerberos_membership_method_info_leave_IN_ARG_pointers[] =
6786 {
6787 &_cc_realm_kerberos_membership_method_info_leave_IN_ARG_credentials.parent_struct,
6788 &_cc_realm_kerberos_membership_method_info_leave_IN_ARG_options.parent_struct,
6789 NULL
6790 };
6791
6792 static const _ExtendedGDBusMethodInfo _cc_realm_kerberos_membership_method_info_leave =
6793 {
6794 {
6795 -1,
6796 (gchar *) "Leave",
6797 (GDBusArgInfo **) &_cc_realm_kerberos_membership_method_info_leave_IN_ARG_pointers,
6798 NULL,
6799 NULL
6800 },
6801 "handle-leave",
6802 FALSE
6803 };
6804
6805 static const GDBusMethodInfo * const _cc_realm_kerberos_membership_method_info_pointers[] =
6806 {
6807 &_cc_realm_kerberos_membership_method_info_join.parent_struct,
6808 &_cc_realm_kerberos_membership_method_info_leave.parent_struct,
6809 NULL
6810 };
6811
6812 static const _ExtendedGDBusPropertyInfo _cc_realm_kerberos_membership_property_info_suggested_administrator =
6813 {
6814 {
6815 -1,
6816 (gchar *) "SuggestedAdministrator",
6817 (gchar *) "s",
6818 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6819 NULL
6820 },
6821 "suggested-administrator",
6822 FALSE,
6823 TRUE
6824 };
6825
6826 static const _ExtendedGDBusPropertyInfo _cc_realm_kerberos_membership_property_info_supported_join_credentials =
6827 {
6828 {
6829 -1,
6830 (gchar *) "SupportedJoinCredentials",
6831 (gchar *) "a(ss)",
6832 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6833 NULL
6834 },
6835 "supported-join-credentials",
6836 FALSE,
6837 TRUE
6838 };
6839
6840 static const _ExtendedGDBusPropertyInfo _cc_realm_kerberos_membership_property_info_supported_leave_credentials =
6841 {
6842 {
6843 -1,
6844 (gchar *) "SupportedLeaveCredentials",
6845 (gchar *) "a(ss)",
6846 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6847 NULL
6848 },
6849 "supported-leave-credentials",
6850 FALSE,
6851 TRUE
6852 };
6853
6854 static const GDBusPropertyInfo * const _cc_realm_kerberos_membership_property_info_pointers[] =
6855 {
6856 &_cc_realm_kerberos_membership_property_info_suggested_administrator.parent_struct,
6857 &_cc_realm_kerberos_membership_property_info_supported_join_credentials.parent_struct,
6858 &_cc_realm_kerberos_membership_property_info_supported_leave_credentials.parent_struct,
6859 NULL
6860 };
6861
6862 static const _ExtendedGDBusInterfaceInfo _cc_realm_kerberos_membership_interface_info =
6863 {
6864 {
6865 -1,
6866 (gchar *) "org.freedesktop.realmd.KerberosMembership",
6867 (GDBusMethodInfo **) &_cc_realm_kerberos_membership_method_info_pointers,
6868 NULL,
6869 (GDBusPropertyInfo **) &_cc_realm_kerberos_membership_property_info_pointers,
6870 NULL
6871 },
6872 "kerberos-membership",
6873 };
6874
6875
6876 /**
6877 * cc_realm_kerberos_membership_interface_info:
6878 *
6879 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link> D-Bus interface.
6880 *
6881 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6882 */
6883 GDBusInterfaceInfo *
6884 cc_realm_kerberos_membership_interface_info (void)
6885 {
6886 return (GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct;
6887 }
6888
6889 /**
6890 * cc_realm_kerberos_membership_override_properties:
6891 * @klass: The class structure for a #GObject derived class.
6892 * @property_id_begin: The property id to assign to the first overridden property.
6893 *
6894 * Overrides all #GObject properties in the #CcRealmKerberosMembership interface for a concrete class.
6895 * The properties are overridden in the order they are defined.
6896 *
6897 * Returns: The last property id.
6898 */
6899 guint
6900 cc_realm_kerberos_membership_override_properties (GObjectClass *klass, guint property_id_begin)
6901 {
6902 g_object_class_override_property (klass, property_id_begin++, "suggested-administrator");
6903 g_object_class_override_property (klass, property_id_begin++, "supported-join-credentials");
6904 g_object_class_override_property (klass, property_id_begin++, "supported-leave-credentials");
6905 return property_id_begin - 1;
6906 }
6907
6908
6909 inline static void
6910 cc_realm_kerberos_membership_method_marshal_join (
6911 GClosure *closure,
6912 GValue *return_value,
6913 unsigned int n_param_values,
6914 const GValue *param_values,
6915 void *invocation_hint,
6916 void *marshal_data)
6917 {
6918 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT_VARIANT (closure,
6919 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6920 }
6921
6922 inline static void
6923 cc_realm_kerberos_membership_method_marshal_leave (
6924 GClosure *closure,
6925 GValue *return_value,
6926 unsigned int n_param_values,
6927 const GValue *param_values,
6928 void *invocation_hint,
6929 void *marshal_data)
6930 {
6931 _g_dbus_codegen_marshal_BOOLEAN__OBJECT_VARIANT_VARIANT (closure,
6932 return_value, n_param_values, param_values, invocation_hint, marshal_data);
6933 }
6934
6935
6936 /**
6937 * CcRealmKerberosMembership:
6938 *
6939 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>.
6940 */
6941
6942 /**
6943 * CcRealmKerberosMembershipIface:
6944 * @parent_iface: The parent interface.
6945 * @handle_join: Handler for the #CcRealmKerberosMembership::handle-join signal.
6946 * @handle_leave: Handler for the #CcRealmKerberosMembership::handle-leave signal.
6947 * @get_suggested_administrator: Getter for the #CcRealmKerberosMembership:suggested-administrator property.
6948 * @get_supported_join_credentials: Getter for the #CcRealmKerberosMembership:supported-join-credentials property.
6949 * @get_supported_leave_credentials: Getter for the #CcRealmKerberosMembership:supported-leave-credentials property.
6950 *
6951 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>.
6952 */
6953
6954 typedef CcRealmKerberosMembershipIface CcRealmKerberosMembershipInterface;
6955 G_DEFINE_INTERFACE (CcRealmKerberosMembership, cc_realm_kerberos_membership, G_TYPE_OBJECT)
6956
6957 static void
6958 cc_realm_kerberos_membership_default_init (CcRealmKerberosMembershipIface *iface)
6959 {
6960 /* GObject signals for incoming D-Bus method calls: */
6961 /**
6962 * CcRealmKerberosMembership::handle-join:
6963 * @object: A #CcRealmKerberosMembership.
6964 * @invocation: A #GDBusMethodInvocation.
6965 * @arg_credentials: Argument passed by remote caller.
6966 * @arg_options: Argument passed by remote caller.
6967 *
6968 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Join">Join()</link> D-Bus method.
6969 *
6970 * 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 cc_realm_kerberos_membership_complete_join() 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.
6971 *
6972 * 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.
6973 */
6974 g_signal_new ("handle-join",
6975 G_TYPE_FROM_INTERFACE (iface),
6976 G_SIGNAL_RUN_LAST,
6977 G_STRUCT_OFFSET (CcRealmKerberosMembershipIface, handle_join),
6978 g_signal_accumulator_true_handled,
6979 NULL,
6980 cc_realm_kerberos_membership_method_marshal_join,
6981 G_TYPE_BOOLEAN,
6982 3,
6983 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT);
6984
6985 /**
6986 * CcRealmKerberosMembership::handle-leave:
6987 * @object: A #CcRealmKerberosMembership.
6988 * @invocation: A #GDBusMethodInvocation.
6989 * @arg_credentials: Argument passed by remote caller.
6990 * @arg_options: Argument passed by remote caller.
6991 *
6992 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Leave">Leave()</link> D-Bus method.
6993 *
6994 * 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 cc_realm_kerberos_membership_complete_leave() 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.
6995 *
6996 * 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.
6997 */
6998 g_signal_new ("handle-leave",
6999 G_TYPE_FROM_INTERFACE (iface),
7000 G_SIGNAL_RUN_LAST,
7001 G_STRUCT_OFFSET (CcRealmKerberosMembershipIface, handle_leave),
7002 g_signal_accumulator_true_handled,
7003 NULL,
7004 cc_realm_kerberos_membership_method_marshal_leave,
7005 G_TYPE_BOOLEAN,
7006 3,
7007 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT);
7008
7009 /* GObject properties for D-Bus properties: */
7010 /**
7011 * CcRealmKerberosMembership:suggested-administrator:
7012 *
7013 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SuggestedAdministrator">"SuggestedAdministrator"</link>.
7014 *
7015 * 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.
7016 */
7017 g_object_interface_install_property (iface,
7018 g_param_spec_string ("suggested-administrator", "SuggestedAdministrator", "SuggestedAdministrator", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7019 /**
7020 * CcRealmKerberosMembership:supported-join-credentials:
7021 *
7022 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedJoinCredentials">"SupportedJoinCredentials"</link>.
7023 *
7024 * 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.
7025 */
7026 g_object_interface_install_property (iface,
7027 g_param_spec_variant ("supported-join-credentials", "SupportedJoinCredentials", "SupportedJoinCredentials", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7028 /**
7029 * CcRealmKerberosMembership:supported-leave-credentials:
7030 *
7031 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedLeaveCredentials">"SupportedLeaveCredentials"</link>.
7032 *
7033 * 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.
7034 */
7035 g_object_interface_install_property (iface,
7036 g_param_spec_variant ("supported-leave-credentials", "SupportedLeaveCredentials", "SupportedLeaveCredentials", G_VARIANT_TYPE ("a(ss)"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7037 }
7038
7039 /**
7040 * cc_realm_kerberos_membership_get_suggested_administrator: (skip)
7041 * @object: A #CcRealmKerberosMembership.
7042 *
7043 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SuggestedAdministrator">"SuggestedAdministrator"</link> D-Bus property.
7044 *
7045 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7046 *
7047 * 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 cc_realm_kerberos_membership_dup_suggested_administrator() if on another thread.
7048 *
7049 * 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.
7050 */
7051 const gchar *
7052 cc_realm_kerberos_membership_get_suggested_administrator (CcRealmKerberosMembership *object)
7053 {
7054 g_return_val_if_fail (CC_REALM_IS_KERBEROS_MEMBERSHIP (object), NULL);
7055
7056 return CC_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_suggested_administrator (object);
7057 }
7058
7059 /**
7060 * cc_realm_kerberos_membership_dup_suggested_administrator: (skip)
7061 * @object: A #CcRealmKerberosMembership.
7062 *
7063 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SuggestedAdministrator">"SuggestedAdministrator"</link> D-Bus property.
7064 *
7065 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7066 *
7067 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7068 */
7069 gchar *
7070 cc_realm_kerberos_membership_dup_suggested_administrator (CcRealmKerberosMembership *object)
7071 {
7072 gchar *value;
7073 g_object_get (G_OBJECT (object), "suggested-administrator", &value, NULL);
7074 return value;
7075 }
7076
7077 /**
7078 * cc_realm_kerberos_membership_set_suggested_administrator: (skip)
7079 * @object: A #CcRealmKerberosMembership.
7080 * @value: The value to set.
7081 *
7082 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SuggestedAdministrator">"SuggestedAdministrator"</link> D-Bus property to @value.
7083 *
7084 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7085 */
7086 void
7087 cc_realm_kerberos_membership_set_suggested_administrator (CcRealmKerberosMembership *object, const gchar *value)
7088 {
7089 g_object_set (G_OBJECT (object), "suggested-administrator", value, NULL);
7090 }
7091
7092 /**
7093 * cc_realm_kerberos_membership_get_supported_join_credentials: (skip)
7094 * @object: A #CcRealmKerberosMembership.
7095 *
7096 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedJoinCredentials">"SupportedJoinCredentials"</link> D-Bus property.
7097 *
7098 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7099 *
7100 * 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 cc_realm_kerberos_membership_dup_supported_join_credentials() if on another thread.
7101 *
7102 * 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.
7103 */
7104 GVariant *
7105 cc_realm_kerberos_membership_get_supported_join_credentials (CcRealmKerberosMembership *object)
7106 {
7107 g_return_val_if_fail (CC_REALM_IS_KERBEROS_MEMBERSHIP (object), NULL);
7108
7109 return CC_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_supported_join_credentials (object);
7110 }
7111
7112 /**
7113 * cc_realm_kerberos_membership_dup_supported_join_credentials: (skip)
7114 * @object: A #CcRealmKerberosMembership.
7115 *
7116 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedJoinCredentials">"SupportedJoinCredentials"</link> D-Bus property.
7117 *
7118 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7119 *
7120 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7121 */
7122 GVariant *
7123 cc_realm_kerberos_membership_dup_supported_join_credentials (CcRealmKerberosMembership *object)
7124 {
7125 GVariant *value;
7126 g_object_get (G_OBJECT (object), "supported-join-credentials", &value, NULL);
7127 return value;
7128 }
7129
7130 /**
7131 * cc_realm_kerberos_membership_set_supported_join_credentials: (skip)
7132 * @object: A #CcRealmKerberosMembership.
7133 * @value: The value to set.
7134 *
7135 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedJoinCredentials">"SupportedJoinCredentials"</link> D-Bus property to @value.
7136 *
7137 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7138 */
7139 void
7140 cc_realm_kerberos_membership_set_supported_join_credentials (CcRealmKerberosMembership *object, GVariant *value)
7141 {
7142 g_object_set (G_OBJECT (object), "supported-join-credentials", value, NULL);
7143 }
7144
7145 /**
7146 * cc_realm_kerberos_membership_get_supported_leave_credentials: (skip)
7147 * @object: A #CcRealmKerberosMembership.
7148 *
7149 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedLeaveCredentials">"SupportedLeaveCredentials"</link> D-Bus property.
7150 *
7151 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7152 *
7153 * 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 cc_realm_kerberos_membership_dup_supported_leave_credentials() if on another thread.
7154 *
7155 * 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.
7156 */
7157 GVariant *
7158 cc_realm_kerberos_membership_get_supported_leave_credentials (CcRealmKerberosMembership *object)
7159 {
7160 g_return_val_if_fail (CC_REALM_IS_KERBEROS_MEMBERSHIP (object), NULL);
7161
7162 return CC_REALM_KERBEROS_MEMBERSHIP_GET_IFACE (object)->get_supported_leave_credentials (object);
7163 }
7164
7165 /**
7166 * cc_realm_kerberos_membership_dup_supported_leave_credentials: (skip)
7167 * @object: A #CcRealmKerberosMembership.
7168 *
7169 * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedLeaveCredentials">"SupportedLeaveCredentials"</link> D-Bus property.
7170 *
7171 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7172 *
7173 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7174 */
7175 GVariant *
7176 cc_realm_kerberos_membership_dup_supported_leave_credentials (CcRealmKerberosMembership *object)
7177 {
7178 GVariant *value;
7179 g_object_get (G_OBJECT (object), "supported-leave-credentials", &value, NULL);
7180 return value;
7181 }
7182
7183 /**
7184 * cc_realm_kerberos_membership_set_supported_leave_credentials: (skip)
7185 * @object: A #CcRealmKerberosMembership.
7186 * @value: The value to set.
7187 *
7188 * Sets the <link linkend="gdbus-property-org-freedesktop-realmd-KerberosMembership.SupportedLeaveCredentials">"SupportedLeaveCredentials"</link> D-Bus property to @value.
7189 *
7190 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7191 */
7192 void
7193 cc_realm_kerberos_membership_set_supported_leave_credentials (CcRealmKerberosMembership *object, GVariant *value)
7194 {
7195 g_object_set (G_OBJECT (object), "supported-leave-credentials", value, NULL);
7196 }
7197
7198 /**
7199 * cc_realm_kerberos_membership_call_join:
7200 * @proxy: A #CcRealmKerberosMembershipProxy.
7201 * @arg_credentials: Argument to pass with the method invocation.
7202 * @arg_options: Argument to pass with the method invocation.
7203 * @cancellable: (nullable): A #GCancellable or %NULL.
7204 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
7205 * @user_data: User data to pass to @callback.
7206 *
7207 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Join">Join()</link> D-Bus method on @proxy.
7208 * 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()).
7209 * You can then call cc_realm_kerberos_membership_call_join_finish() to get the result of the operation.
7210 *
7211 * See cc_realm_kerberos_membership_call_join_sync() for the synchronous, blocking version of this method.
7212 */
7213 void
7214 cc_realm_kerberos_membership_call_join (
7215 CcRealmKerberosMembership *proxy,
7216 GVariant *arg_credentials,
7217 GVariant *arg_options,
7218 GCancellable *cancellable,
7219 GAsyncReadyCallback callback,
7220 gpointer user_data)
7221 {
7222 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
7223 "Join",
7224 g_variant_new ("(@(ssv)@a{sv})",
7225 arg_credentials,
7226 arg_options),
7227 G_DBUS_CALL_FLAGS_NONE,
7228 -1,
7229 cancellable,
7230 callback,
7231 user_data);
7232 }
7233
7234 /**
7235 * cc_realm_kerberos_membership_call_join_finish:
7236 * @proxy: A #CcRealmKerberosMembershipProxy.
7237 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_membership_call_join().
7238 * @error: Return location for error or %NULL.
7239 *
7240 * Finishes an operation started with cc_realm_kerberos_membership_call_join().
7241 *
7242 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
7243 */
7244 gboolean
7245 cc_realm_kerberos_membership_call_join_finish (
7246 CcRealmKerberosMembership *proxy,
7247 GAsyncResult *res,
7248 GError **error)
7249 {
7250 GVariant *_ret;
7251 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
7252 if (_ret == NULL)
7253 goto _out;
7254 g_variant_get (_ret,
7255 "()");
7256 g_variant_unref (_ret);
7257 _out:
7258 return _ret != NULL;
7259 }
7260
7261 /**
7262 * cc_realm_kerberos_membership_call_join_sync:
7263 * @proxy: A #CcRealmKerberosMembershipProxy.
7264 * @arg_credentials: Argument to pass with the method invocation.
7265 * @arg_options: Argument to pass with the method invocation.
7266 * @cancellable: (nullable): A #GCancellable or %NULL.
7267 * @error: Return location for error or %NULL.
7268 *
7269 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Join">Join()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
7270 *
7271 * See cc_realm_kerberos_membership_call_join() for the asynchronous version of this method.
7272 *
7273 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
7274 */
7275 gboolean
7276 cc_realm_kerberos_membership_call_join_sync (
7277 CcRealmKerberosMembership *proxy,
7278 GVariant *arg_credentials,
7279 GVariant *arg_options,
7280 GCancellable *cancellable,
7281 GError **error)
7282 {
7283 GVariant *_ret;
7284 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
7285 "Join",
7286 g_variant_new ("(@(ssv)@a{sv})",
7287 arg_credentials,
7288 arg_options),
7289 G_DBUS_CALL_FLAGS_NONE,
7290 -1,
7291 cancellable,
7292 error);
7293 if (_ret == NULL)
7294 goto _out;
7295 g_variant_get (_ret,
7296 "()");
7297 g_variant_unref (_ret);
7298 _out:
7299 return _ret != NULL;
7300 }
7301
7302 /**
7303 * cc_realm_kerberos_membership_call_leave:
7304 * @proxy: A #CcRealmKerberosMembershipProxy.
7305 * @arg_credentials: Argument to pass with the method invocation.
7306 * @arg_options: Argument to pass with the method invocation.
7307 * @cancellable: (nullable): A #GCancellable or %NULL.
7308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
7309 * @user_data: User data to pass to @callback.
7310 *
7311 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Leave">Leave()</link> D-Bus method on @proxy.
7312 * 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()).
7313 * You can then call cc_realm_kerberos_membership_call_leave_finish() to get the result of the operation.
7314 *
7315 * See cc_realm_kerberos_membership_call_leave_sync() for the synchronous, blocking version of this method.
7316 */
7317 void
7318 cc_realm_kerberos_membership_call_leave (
7319 CcRealmKerberosMembership *proxy,
7320 GVariant *arg_credentials,
7321 GVariant *arg_options,
7322 GCancellable *cancellable,
7323 GAsyncReadyCallback callback,
7324 gpointer user_data)
7325 {
7326 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
7327 "Leave",
7328 g_variant_new ("(@(ssv)@a{sv})",
7329 arg_credentials,
7330 arg_options),
7331 G_DBUS_CALL_FLAGS_NONE,
7332 -1,
7333 cancellable,
7334 callback,
7335 user_data);
7336 }
7337
7338 /**
7339 * cc_realm_kerberos_membership_call_leave_finish:
7340 * @proxy: A #CcRealmKerberosMembershipProxy.
7341 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_membership_call_leave().
7342 * @error: Return location for error or %NULL.
7343 *
7344 * Finishes an operation started with cc_realm_kerberos_membership_call_leave().
7345 *
7346 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
7347 */
7348 gboolean
7349 cc_realm_kerberos_membership_call_leave_finish (
7350 CcRealmKerberosMembership *proxy,
7351 GAsyncResult *res,
7352 GError **error)
7353 {
7354 GVariant *_ret;
7355 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
7356 if (_ret == NULL)
7357 goto _out;
7358 g_variant_get (_ret,
7359 "()");
7360 g_variant_unref (_ret);
7361 _out:
7362 return _ret != NULL;
7363 }
7364
7365 /**
7366 * cc_realm_kerberos_membership_call_leave_sync:
7367 * @proxy: A #CcRealmKerberosMembershipProxy.
7368 * @arg_credentials: Argument to pass with the method invocation.
7369 * @arg_options: Argument to pass with the method invocation.
7370 * @cancellable: (nullable): A #GCancellable or %NULL.
7371 * @error: Return location for error or %NULL.
7372 *
7373 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Leave">Leave()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
7374 *
7375 * See cc_realm_kerberos_membership_call_leave() for the asynchronous version of this method.
7376 *
7377 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
7378 */
7379 gboolean
7380 cc_realm_kerberos_membership_call_leave_sync (
7381 CcRealmKerberosMembership *proxy,
7382 GVariant *arg_credentials,
7383 GVariant *arg_options,
7384 GCancellable *cancellable,
7385 GError **error)
7386 {
7387 GVariant *_ret;
7388 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
7389 "Leave",
7390 g_variant_new ("(@(ssv)@a{sv})",
7391 arg_credentials,
7392 arg_options),
7393 G_DBUS_CALL_FLAGS_NONE,
7394 -1,
7395 cancellable,
7396 error);
7397 if (_ret == NULL)
7398 goto _out;
7399 g_variant_get (_ret,
7400 "()");
7401 g_variant_unref (_ret);
7402 _out:
7403 return _ret != NULL;
7404 }
7405
7406 /**
7407 * cc_realm_kerberos_membership_complete_join:
7408 * @object: A #CcRealmKerberosMembership.
7409 * @invocation: (transfer full): A #GDBusMethodInvocation.
7410 *
7411 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Join">Join()</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.
7412 *
7413 * This method will free @invocation, you cannot use it afterwards.
7414 */
7415 void
7416 cc_realm_kerberos_membership_complete_join (
7417 CcRealmKerberosMembership *object G_GNUC_UNUSED,
7418 GDBusMethodInvocation *invocation)
7419 {
7420 g_dbus_method_invocation_return_value (invocation,
7421 g_variant_new ("()"));
7422 }
7423
7424 /**
7425 * cc_realm_kerberos_membership_complete_leave:
7426 * @object: A #CcRealmKerberosMembership.
7427 * @invocation: (transfer full): A #GDBusMethodInvocation.
7428 *
7429 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-realmd-KerberosMembership.Leave">Leave()</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.
7430 *
7431 * This method will free @invocation, you cannot use it afterwards.
7432 */
7433 void
7434 cc_realm_kerberos_membership_complete_leave (
7435 CcRealmKerberosMembership *object G_GNUC_UNUSED,
7436 GDBusMethodInvocation *invocation)
7437 {
7438 g_dbus_method_invocation_return_value (invocation,
7439 g_variant_new ("()"));
7440 }
7441
7442 /* ------------------------------------------------------------------------ */
7443
7444 /**
7445 * CcRealmKerberosMembershipProxy:
7446 *
7447 * The #CcRealmKerberosMembershipProxy structure contains only private data and should only be accessed using the provided API.
7448 */
7449
7450 /**
7451 * CcRealmKerberosMembershipProxyClass:
7452 * @parent_class: The parent class.
7453 *
7454 * Class structure for #CcRealmKerberosMembershipProxy.
7455 */
7456
7457 struct _CcRealmKerberosMembershipProxyPrivate
7458 {
7459 GData *qdata;
7460 };
7461
7462 static void cc_realm_kerberos_membership_proxy_iface_init (CcRealmKerberosMembershipIface *iface);
7463
7464 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7465 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosMembershipProxy, cc_realm_kerberos_membership_proxy, G_TYPE_DBUS_PROXY,
7466 G_ADD_PRIVATE (CcRealmKerberosMembershipProxy)
7467 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS_MEMBERSHIP, cc_realm_kerberos_membership_proxy_iface_init))
7468
7469 #else
7470 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosMembershipProxy, cc_realm_kerberos_membership_proxy, G_TYPE_DBUS_PROXY,
7471 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS_MEMBERSHIP, cc_realm_kerberos_membership_proxy_iface_init))
7472
7473 #endif
7474 static void
7475 cc_realm_kerberos_membership_proxy_finalize (GObject *object)
7476 {
7477 CcRealmKerberosMembershipProxy *proxy = CC_REALM_KERBEROS_MEMBERSHIP_PROXY (object);
7478 g_datalist_clear (&proxy->priv->qdata);
7479 G_OBJECT_CLASS (cc_realm_kerberos_membership_proxy_parent_class)->finalize (object);
7480 }
7481
7482 static void
7483 cc_realm_kerberos_membership_proxy_get_property (GObject *object,
7484 guint prop_id,
7485 GValue *value,
7486 GParamSpec *pspec G_GNUC_UNUSED)
7487 {
7488 const _ExtendedGDBusPropertyInfo *info;
7489 GVariant *variant;
7490 g_assert (prop_id != 0 && prop_id - 1 < 3);
7491 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_membership_property_info_pointers[prop_id - 1];
7492 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7493 if (info->use_gvariant)
7494 {
7495 g_value_set_variant (value, variant);
7496 }
7497 else
7498 {
7499 if (variant != NULL)
7500 g_dbus_gvariant_to_gvalue (variant, value);
7501 }
7502 if (variant != NULL)
7503 g_variant_unref (variant);
7504 }
7505
7506 static void
7507 cc_realm_kerberos_membership_proxy_set_property_cb (GDBusProxy *proxy,
7508 GAsyncResult *res,
7509 gpointer user_data)
7510 {
7511 const _ExtendedGDBusPropertyInfo *info = user_data;
7512 GError *error;
7513 GVariant *_ret;
7514 error = NULL;
7515 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7516 if (!_ret)
7517 {
7518 g_warning ("Error setting property '%s' on interface org.freedesktop.realmd.KerberosMembership: %s (%s, %d)",
7519 info->parent_struct.name,
7520 error->message, g_quark_to_string (error->domain), error->code);
7521 g_error_free (error);
7522 }
7523 else
7524 {
7525 g_variant_unref (_ret);
7526 }
7527 }
7528
7529 static void
7530 cc_realm_kerberos_membership_proxy_set_property (GObject *object,
7531 guint prop_id,
7532 const GValue *value,
7533 GParamSpec *pspec G_GNUC_UNUSED)
7534 {
7535 const _ExtendedGDBusPropertyInfo *info;
7536 GVariant *variant;
7537 g_assert (prop_id != 0 && prop_id - 1 < 3);
7538 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_membership_property_info_pointers[prop_id - 1];
7539 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7540 g_dbus_proxy_call (G_DBUS_PROXY (object),
7541 "org.freedesktop.DBus.Properties.Set",
7542 g_variant_new ("(ssv)", "org.freedesktop.realmd.KerberosMembership", info->parent_struct.name, variant),
7543 G_DBUS_CALL_FLAGS_NONE,
7544 -1,
7545 NULL, (GAsyncReadyCallback) cc_realm_kerberos_membership_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7546 g_variant_unref (variant);
7547 }
7548
7549 static void
7550 cc_realm_kerberos_membership_proxy_g_signal (GDBusProxy *proxy,
7551 const gchar *sender_name G_GNUC_UNUSED,
7552 const gchar *signal_name,
7553 GVariant *parameters)
7554 {
7555 _ExtendedGDBusSignalInfo *info;
7556 GVariantIter iter;
7557 GVariant *child;
7558 GValue *paramv;
7559 gsize num_params;
7560 gsize n;
7561 guint signal_id;
7562 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct, signal_name);
7563 if (info == NULL)
7564 return;
7565 num_params = g_variant_n_children (parameters);
7566 paramv = g_new0 (GValue, num_params + 1);
7567 g_value_init (&paramv[0], CC_REALM_TYPE_KERBEROS_MEMBERSHIP);
7568 g_value_set_object (&paramv[0], proxy);
7569 g_variant_iter_init (&iter, parameters);
7570 n = 1;
7571 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7572 {
7573 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7574 if (arg_info->use_gvariant)
7575 {
7576 g_value_init (&paramv[n], G_TYPE_VARIANT);
7577 g_value_set_variant (&paramv[n], child);
7578 n++;
7579 }
7580 else
7581 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7582 g_variant_unref (child);
7583 }
7584 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_KERBEROS_MEMBERSHIP);
7585 g_signal_emitv (paramv, signal_id, 0, NULL);
7586 for (n = 0; n < num_params + 1; n++)
7587 g_value_unset (&paramv[n]);
7588 g_free (paramv);
7589 }
7590
7591 static void
7592 cc_realm_kerberos_membership_proxy_g_properties_changed (GDBusProxy *_proxy,
7593 GVariant *changed_properties,
7594 const gchar *const *invalidated_properties)
7595 {
7596 CcRealmKerberosMembershipProxy *proxy = CC_REALM_KERBEROS_MEMBERSHIP_PROXY (_proxy);
7597 guint n;
7598 const gchar *key;
7599 GVariantIter *iter;
7600 _ExtendedGDBusPropertyInfo *info;
7601 g_variant_get (changed_properties, "a{sv}", &iter);
7602 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7603 {
7604 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct, key);
7605 g_datalist_remove_data (&proxy->priv->qdata, key);
7606 if (info != NULL)
7607 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7608 }
7609 g_variant_iter_free (iter);
7610 for (n = 0; invalidated_properties[n] != NULL; n++)
7611 {
7612 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct, invalidated_properties[n]);
7613 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7614 if (info != NULL)
7615 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7616 }
7617 }
7618
7619 static const gchar *
7620 cc_realm_kerberos_membership_proxy_get_suggested_administrator (CcRealmKerberosMembership *object)
7621 {
7622 CcRealmKerberosMembershipProxy *proxy = CC_REALM_KERBEROS_MEMBERSHIP_PROXY (object);
7623 GVariant *variant;
7624 const gchar *value = NULL;
7625 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SuggestedAdministrator");
7626 if (variant != NULL)
7627 {
7628 value = g_variant_get_string (variant, NULL);
7629 g_variant_unref (variant);
7630 }
7631 return value;
7632 }
7633
7634 static GVariant *
7635 cc_realm_kerberos_membership_proxy_get_supported_join_credentials (CcRealmKerberosMembership *object)
7636 {
7637 CcRealmKerberosMembershipProxy *proxy = CC_REALM_KERBEROS_MEMBERSHIP_PROXY (object);
7638 GVariant *variant;
7639 GVariant *value = NULL;
7640 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedJoinCredentials");
7641 value = variant;
7642 if (variant != NULL)
7643 g_variant_unref (variant);
7644 return value;
7645 }
7646
7647 static GVariant *
7648 cc_realm_kerberos_membership_proxy_get_supported_leave_credentials (CcRealmKerberosMembership *object)
7649 {
7650 CcRealmKerberosMembershipProxy *proxy = CC_REALM_KERBEROS_MEMBERSHIP_PROXY (object);
7651 GVariant *variant;
7652 GVariant *value = NULL;
7653 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SupportedLeaveCredentials");
7654 value = variant;
7655 if (variant != NULL)
7656 g_variant_unref (variant);
7657 return value;
7658 }
7659
7660 static void
7661 cc_realm_kerberos_membership_proxy_init (CcRealmKerberosMembershipProxy *proxy)
7662 {
7663 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7664 proxy->priv = cc_realm_kerberos_membership_proxy_get_instance_private (proxy);
7665 #else
7666 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, CC_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY, CcRealmKerberosMembershipProxyPrivate);
7667 #endif
7668
7669 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), cc_realm_kerberos_membership_interface_info ());
7670 }
7671
7672 static void
7673 cc_realm_kerberos_membership_proxy_class_init (CcRealmKerberosMembershipProxyClass *klass)
7674 {
7675 GObjectClass *gobject_class;
7676 GDBusProxyClass *proxy_class;
7677
7678 gobject_class = G_OBJECT_CLASS (klass);
7679 gobject_class->finalize = cc_realm_kerberos_membership_proxy_finalize;
7680 gobject_class->get_property = cc_realm_kerberos_membership_proxy_get_property;
7681 gobject_class->set_property = cc_realm_kerberos_membership_proxy_set_property;
7682
7683 proxy_class = G_DBUS_PROXY_CLASS (klass);
7684 proxy_class->g_signal = cc_realm_kerberos_membership_proxy_g_signal;
7685 proxy_class->g_properties_changed = cc_realm_kerberos_membership_proxy_g_properties_changed;
7686
7687 cc_realm_kerberos_membership_override_properties (gobject_class, 1);
7688
7689 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7690 g_type_class_add_private (klass, sizeof (CcRealmKerberosMembershipProxyPrivate));
7691 #endif
7692 }
7693
7694 static void
7695 cc_realm_kerberos_membership_proxy_iface_init (CcRealmKerberosMembershipIface *iface)
7696 {
7697 iface->get_suggested_administrator = cc_realm_kerberos_membership_proxy_get_suggested_administrator;
7698 iface->get_supported_join_credentials = cc_realm_kerberos_membership_proxy_get_supported_join_credentials;
7699 iface->get_supported_leave_credentials = cc_realm_kerberos_membership_proxy_get_supported_leave_credentials;
7700 }
7701
7702 /**
7703 * cc_realm_kerberos_membership_proxy_new:
7704 * @connection: A #GDBusConnection.
7705 * @flags: Flags from the #GDBusProxyFlags enumeration.
7706 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7707 * @object_path: An object path.
7708 * @cancellable: (nullable): A #GCancellable or %NULL.
7709 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7710 * @user_data: User data to pass to @callback.
7711 *
7712 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>. See g_dbus_proxy_new() for more details.
7713 *
7714 * 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()).
7715 * You can then call cc_realm_kerberos_membership_proxy_new_finish() to get the result of the operation.
7716 *
7717 * See cc_realm_kerberos_membership_proxy_new_sync() for the synchronous, blocking version of this constructor.
7718 */
7719 void
7720 cc_realm_kerberos_membership_proxy_new (
7721 GDBusConnection *connection,
7722 GDBusProxyFlags flags,
7723 const gchar *name,
7724 const gchar *object_path,
7725 GCancellable *cancellable,
7726 GAsyncReadyCallback callback,
7727 gpointer user_data)
7728 {
7729 g_async_initable_new_async (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_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.realmd.KerberosMembership", NULL);
7730 }
7731
7732 /**
7733 * cc_realm_kerberos_membership_proxy_new_finish:
7734 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_membership_proxy_new().
7735 * @error: Return location for error or %NULL
7736 *
7737 * Finishes an operation started with cc_realm_kerberos_membership_proxy_new().
7738 *
7739 * Returns: (transfer full) (type CcRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set.
7740 */
7741 CcRealmKerberosMembership *
7742 cc_realm_kerberos_membership_proxy_new_finish (
7743 GAsyncResult *res,
7744 GError **error)
7745 {
7746 GObject *ret;
7747 GObject *source_object;
7748 source_object = g_async_result_get_source_object (res);
7749 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7750 g_object_unref (source_object);
7751 if (ret != NULL)
7752 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
7753 else
7754 return NULL;
7755 }
7756
7757 /**
7758 * cc_realm_kerberos_membership_proxy_new_sync:
7759 * @connection: A #GDBusConnection.
7760 * @flags: Flags from the #GDBusProxyFlags enumeration.
7761 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7762 * @object_path: An object path.
7763 * @cancellable: (nullable): A #GCancellable or %NULL.
7764 * @error: Return location for error or %NULL
7765 *
7766 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>. See g_dbus_proxy_new_sync() for more details.
7767 *
7768 * The calling thread is blocked until a reply is received.
7769 *
7770 * See cc_realm_kerberos_membership_proxy_new() for the asynchronous version of this constructor.
7771 *
7772 * Returns: (transfer full) (type CcRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set.
7773 */
7774 CcRealmKerberosMembership *
7775 cc_realm_kerberos_membership_proxy_new_sync (
7776 GDBusConnection *connection,
7777 GDBusProxyFlags flags,
7778 const gchar *name,
7779 const gchar *object_path,
7780 GCancellable *cancellable,
7781 GError **error)
7782 {
7783 GInitable *ret;
7784 ret = g_initable_new (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.KerberosMembership", NULL);
7785 if (ret != NULL)
7786 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
7787 else
7788 return NULL;
7789 }
7790
7791
7792 /**
7793 * cc_realm_kerberos_membership_proxy_new_for_bus:
7794 * @bus_type: A #GBusType.
7795 * @flags: Flags from the #GDBusProxyFlags enumeration.
7796 * @name: A bus name (well-known or unique).
7797 * @object_path: An object path.
7798 * @cancellable: (nullable): A #GCancellable or %NULL.
7799 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7800 * @user_data: User data to pass to @callback.
7801 *
7802 * Like cc_realm_kerberos_membership_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7803 *
7804 * 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()).
7805 * You can then call cc_realm_kerberos_membership_proxy_new_for_bus_finish() to get the result of the operation.
7806 *
7807 * See cc_realm_kerberos_membership_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7808 */
7809 void
7810 cc_realm_kerberos_membership_proxy_new_for_bus (
7811 GBusType bus_type,
7812 GDBusProxyFlags flags,
7813 const gchar *name,
7814 const gchar *object_path,
7815 GCancellable *cancellable,
7816 GAsyncReadyCallback callback,
7817 gpointer user_data)
7818 {
7819 g_async_initable_new_async (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_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.realmd.KerberosMembership", NULL);
7820 }
7821
7822 /**
7823 * cc_realm_kerberos_membership_proxy_new_for_bus_finish:
7824 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_kerberos_membership_proxy_new_for_bus().
7825 * @error: Return location for error or %NULL
7826 *
7827 * Finishes an operation started with cc_realm_kerberos_membership_proxy_new_for_bus().
7828 *
7829 * Returns: (transfer full) (type CcRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set.
7830 */
7831 CcRealmKerberosMembership *
7832 cc_realm_kerberos_membership_proxy_new_for_bus_finish (
7833 GAsyncResult *res,
7834 GError **error)
7835 {
7836 GObject *ret;
7837 GObject *source_object;
7838 source_object = g_async_result_get_source_object (res);
7839 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7840 g_object_unref (source_object);
7841 if (ret != NULL)
7842 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
7843 else
7844 return NULL;
7845 }
7846
7847 /**
7848 * cc_realm_kerberos_membership_proxy_new_for_bus_sync:
7849 * @bus_type: A #GBusType.
7850 * @flags: Flags from the #GDBusProxyFlags enumeration.
7851 * @name: A bus name (well-known or unique).
7852 * @object_path: An object path.
7853 * @cancellable: (nullable): A #GCancellable or %NULL.
7854 * @error: Return location for error or %NULL
7855 *
7856 * Like cc_realm_kerberos_membership_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7857 *
7858 * The calling thread is blocked until a reply is received.
7859 *
7860 * See cc_realm_kerberos_membership_proxy_new_for_bus() for the asynchronous version of this constructor.
7861 *
7862 * Returns: (transfer full) (type CcRealmKerberosMembershipProxy): The constructed proxy object or %NULL if @error is set.
7863 */
7864 CcRealmKerberosMembership *
7865 cc_realm_kerberos_membership_proxy_new_for_bus_sync (
7866 GBusType bus_type,
7867 GDBusProxyFlags flags,
7868 const gchar *name,
7869 const gchar *object_path,
7870 GCancellable *cancellable,
7871 GError **error)
7872 {
7873 GInitable *ret;
7874 ret = g_initable_new (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.realmd.KerberosMembership", NULL);
7875 if (ret != NULL)
7876 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
7877 else
7878 return NULL;
7879 }
7880
7881
7882 /* ------------------------------------------------------------------------ */
7883
7884 /**
7885 * CcRealmKerberosMembershipSkeleton:
7886 *
7887 * The #CcRealmKerberosMembershipSkeleton structure contains only private data and should only be accessed using the provided API.
7888 */
7889
7890 /**
7891 * CcRealmKerberosMembershipSkeletonClass:
7892 * @parent_class: The parent class.
7893 *
7894 * Class structure for #CcRealmKerberosMembershipSkeleton.
7895 */
7896
7897 struct _CcRealmKerberosMembershipSkeletonPrivate
7898 {
7899 GValue *properties;
7900 GList *changed_properties;
7901 GSource *changed_properties_idle_source;
7902 GMainContext *context;
7903 GMutex lock;
7904 };
7905
7906 static void
7907 _cc_realm_kerberos_membership_skeleton_handle_method_call (
7908 GDBusConnection *connection G_GNUC_UNUSED,
7909 const gchar *sender G_GNUC_UNUSED,
7910 const gchar *object_path G_GNUC_UNUSED,
7911 const gchar *interface_name,
7912 const gchar *method_name,
7913 GVariant *parameters,
7914 GDBusMethodInvocation *invocation,
7915 gpointer user_data)
7916 {
7917 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data);
7918 _ExtendedGDBusMethodInfo *info;
7919 GVariantIter iter;
7920 GVariant *child;
7921 GValue *paramv;
7922 gsize num_params;
7923 guint num_extra;
7924 gsize n;
7925 guint signal_id;
7926 GValue return_value = G_VALUE_INIT;
7927 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7928 g_assert (info != NULL);
7929 num_params = g_variant_n_children (parameters);
7930 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7931 n = 0;
7932 g_value_init (&paramv[n], CC_REALM_TYPE_KERBEROS_MEMBERSHIP);
7933 g_value_set_object (&paramv[n++], skeleton);
7934 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7935 g_value_set_object (&paramv[n++], invocation);
7936 if (info->pass_fdlist)
7937 {
7938 #ifdef G_OS_UNIX
7939 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7940 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7941 #else
7942 g_assert_not_reached ();
7943 #endif
7944 }
7945 g_variant_iter_init (&iter, parameters);
7946 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7947 {
7948 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7949 if (arg_info->use_gvariant)
7950 {
7951 g_value_init (&paramv[n], G_TYPE_VARIANT);
7952 g_value_set_variant (&paramv[n], child);
7953 n++;
7954 }
7955 else
7956 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7957 g_variant_unref (child);
7958 }
7959 signal_id = g_signal_lookup (info->signal_name, CC_REALM_TYPE_KERBEROS_MEMBERSHIP);
7960 g_value_init (&return_value, G_TYPE_BOOLEAN);
7961 g_signal_emitv (paramv, signal_id, 0, &return_value);
7962 if (!g_value_get_boolean (&return_value))
7963 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);
7964 g_value_unset (&return_value);
7965 for (n = 0; n < num_params + num_extra; n++)
7966 g_value_unset (&paramv[n]);
7967 g_free (paramv);
7968 }
7969
7970 static GVariant *
7971 _cc_realm_kerberos_membership_skeleton_handle_get_property (
7972 GDBusConnection *connection G_GNUC_UNUSED,
7973 const gchar *sender G_GNUC_UNUSED,
7974 const gchar *object_path G_GNUC_UNUSED,
7975 const gchar *interface_name G_GNUC_UNUSED,
7976 const gchar *property_name,
7977 GError **error,
7978 gpointer user_data)
7979 {
7980 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data);
7981 GValue value = G_VALUE_INIT;
7982 GParamSpec *pspec;
7983 _ExtendedGDBusPropertyInfo *info;
7984 GVariant *ret;
7985 ret = NULL;
7986 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct, property_name);
7987 g_assert (info != NULL);
7988 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7989 if (pspec == NULL)
7990 {
7991 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7992 }
7993 else
7994 {
7995 g_value_init (&value, pspec->value_type);
7996 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7997 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7998 g_value_unset (&value);
7999 }
8000 return ret;
8001 }
8002
8003 static gboolean
8004 _cc_realm_kerberos_membership_skeleton_handle_set_property (
8005 GDBusConnection *connection G_GNUC_UNUSED,
8006 const gchar *sender G_GNUC_UNUSED,
8007 const gchar *object_path G_GNUC_UNUSED,
8008 const gchar *interface_name G_GNUC_UNUSED,
8009 const gchar *property_name,
8010 GVariant *variant,
8011 GError **error,
8012 gpointer user_data)
8013 {
8014 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data);
8015 GValue value = G_VALUE_INIT;
8016 GParamSpec *pspec;
8017 _ExtendedGDBusPropertyInfo *info;
8018 gboolean ret;
8019 ret = FALSE;
8020 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_cc_realm_kerberos_membership_interface_info.parent_struct, property_name);
8021 g_assert (info != NULL);
8022 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8023 if (pspec == NULL)
8024 {
8025 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8026 }
8027 else
8028 {
8029 if (info->use_gvariant)
8030 g_value_set_variant (&value, variant);
8031 else
8032 g_dbus_gvariant_to_gvalue (variant, &value);
8033 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8034 g_value_unset (&value);
8035 ret = TRUE;
8036 }
8037 return ret;
8038 }
8039
8040 static const GDBusInterfaceVTable _cc_realm_kerberos_membership_skeleton_vtable =
8041 {
8042 _cc_realm_kerberos_membership_skeleton_handle_method_call,
8043 _cc_realm_kerberos_membership_skeleton_handle_get_property,
8044 _cc_realm_kerberos_membership_skeleton_handle_set_property,
8045 {NULL}
8046 };
8047
8048 static GDBusInterfaceInfo *
8049 cc_realm_kerberos_membership_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8050 {
8051 return cc_realm_kerberos_membership_interface_info ();
8052 }
8053
8054 static GDBusInterfaceVTable *
8055 cc_realm_kerberos_membership_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8056 {
8057 return (GDBusInterfaceVTable *) &_cc_realm_kerberos_membership_skeleton_vtable;
8058 }
8059
8060 static GVariant *
8061 cc_realm_kerberos_membership_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8062 {
8063 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (_skeleton);
8064
8065 GVariantBuilder builder;
8066 guint n;
8067 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8068 if (_cc_realm_kerberos_membership_interface_info.parent_struct.properties == NULL)
8069 goto out;
8070 for (n = 0; _cc_realm_kerberos_membership_interface_info.parent_struct.properties[n] != NULL; n++)
8071 {
8072 GDBusPropertyInfo *info = _cc_realm_kerberos_membership_interface_info.parent_struct.properties[n];
8073 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8074 {
8075 GVariant *value;
8076 value = _cc_realm_kerberos_membership_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.realmd.KerberosMembership", info->name, NULL, skeleton);
8077 if (value != NULL)
8078 {
8079 g_variant_take_ref (value);
8080 g_variant_builder_add (&builder, "{sv}", info->name, value);
8081 g_variant_unref (value);
8082 }
8083 }
8084 }
8085 out:
8086 return g_variant_builder_end (&builder);
8087 }
8088
8089 static gboolean _cc_realm_kerberos_membership_emit_changed (gpointer user_data);
8090
8091 static void
8092 cc_realm_kerberos_membership_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8093 {
8094 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (_skeleton);
8095 gboolean emit_changed = FALSE;
8096
8097 g_mutex_lock (&skeleton->priv->lock);
8098 if (skeleton->priv->changed_properties_idle_source != NULL)
8099 {
8100 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8101 skeleton->priv->changed_properties_idle_source = NULL;
8102 emit_changed = TRUE;
8103 }
8104 g_mutex_unlock (&skeleton->priv->lock);
8105
8106 if (emit_changed)
8107 _cc_realm_kerberos_membership_emit_changed (skeleton);
8108 }
8109
8110 static void cc_realm_kerberos_membership_skeleton_iface_init (CcRealmKerberosMembershipIface *iface);
8111 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8112 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosMembershipSkeleton, cc_realm_kerberos_membership_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8113 G_ADD_PRIVATE (CcRealmKerberosMembershipSkeleton)
8114 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS_MEMBERSHIP, cc_realm_kerberos_membership_skeleton_iface_init))
8115
8116 #else
8117 G_DEFINE_TYPE_WITH_CODE (CcRealmKerberosMembershipSkeleton, cc_realm_kerberos_membership_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8118 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_KERBEROS_MEMBERSHIP, cc_realm_kerberos_membership_skeleton_iface_init))
8119
8120 #endif
8121 static void
8122 cc_realm_kerberos_membership_skeleton_finalize (GObject *object)
8123 {
8124 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8125 guint n;
8126 for (n = 0; n < 3; n++)
8127 g_value_unset (&skeleton->priv->properties[n]);
8128 g_free (skeleton->priv->properties);
8129 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8130 if (skeleton->priv->changed_properties_idle_source != NULL)
8131 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8132 g_main_context_unref (skeleton->priv->context);
8133 g_mutex_clear (&skeleton->priv->lock);
8134 G_OBJECT_CLASS (cc_realm_kerberos_membership_skeleton_parent_class)->finalize (object);
8135 }
8136
8137 static void
8138 cc_realm_kerberos_membership_skeleton_get_property (GObject *object,
8139 guint prop_id,
8140 GValue *value,
8141 GParamSpec *pspec G_GNUC_UNUSED)
8142 {
8143 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8144 g_assert (prop_id != 0 && prop_id - 1 < 3);
8145 g_mutex_lock (&skeleton->priv->lock);
8146 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8147 g_mutex_unlock (&skeleton->priv->lock);
8148 }
8149
8150 static gboolean
8151 _cc_realm_kerberos_membership_emit_changed (gpointer user_data)
8152 {
8153 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (user_data);
8154 GList *l;
8155 GVariantBuilder builder;
8156 GVariantBuilder invalidated_builder;
8157 guint num_changes;
8158
8159 g_mutex_lock (&skeleton->priv->lock);
8160 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8161 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8162 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8163 {
8164 ChangedProperty *cp = l->data;
8165 GVariant *variant;
8166 const GValue *cur_value;
8167
8168 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8169 if (!_g_value_equal (cur_value, &cp->orig_value))
8170 {
8171 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8172 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8173 g_variant_unref (variant);
8174 num_changes++;
8175 }
8176 }
8177 if (num_changes > 0)
8178 {
8179 GList *connections, *ll;
8180 GVariant *signal_variant;
8181 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.realmd.KerberosMembership",
8182 &builder, &invalidated_builder));
8183 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8184 for (ll = connections; ll != NULL; ll = ll->next)
8185 {
8186 GDBusConnection *connection = ll->data;
8187
8188 g_dbus_connection_emit_signal (connection,
8189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8190 "org.freedesktop.DBus.Properties",
8191 "PropertiesChanged",
8192 signal_variant,
8193 NULL);
8194 }
8195 g_variant_unref (signal_variant);
8196 g_list_free_full (connections, g_object_unref);
8197 }
8198 else
8199 {
8200 g_variant_builder_clear (&builder);
8201 g_variant_builder_clear (&invalidated_builder);
8202 }
8203 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8204 skeleton->priv->changed_properties = NULL;
8205 skeleton->priv->changed_properties_idle_source = NULL;
8206 g_mutex_unlock (&skeleton->priv->lock);
8207 return FALSE;
8208 }
8209
8210 static void
8211 _cc_realm_kerberos_membership_schedule_emit_changed (CcRealmKerberosMembershipSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8212 {
8213 ChangedProperty *cp;
8214 GList *l;
8215 cp = NULL;
8216 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8217 {
8218 ChangedProperty *i_cp = l->data;
8219 if (i_cp->info == info)
8220 {
8221 cp = i_cp;
8222 break;
8223 }
8224 }
8225 if (cp == NULL)
8226 {
8227 cp = g_new0 (ChangedProperty, 1);
8228 cp->prop_id = prop_id;
8229 cp->info = info;
8230 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8231 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8232 g_value_copy (orig_value, &cp->orig_value);
8233 }
8234 }
8235
8236 static void
8237 cc_realm_kerberos_membership_skeleton_notify (GObject *object,
8238 GParamSpec *pspec G_GNUC_UNUSED)
8239 {
8240 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8241 g_mutex_lock (&skeleton->priv->lock);
8242 if (skeleton->priv->changed_properties != NULL &&
8243 skeleton->priv->changed_properties_idle_source == NULL)
8244 {
8245 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8246 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8247 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _cc_realm_kerberos_membership_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8248 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _cc_realm_kerberos_membership_emit_changed");
8249 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8250 g_source_unref (skeleton->priv->changed_properties_idle_source);
8251 }
8252 g_mutex_unlock (&skeleton->priv->lock);
8253 }
8254
8255 static void
8256 cc_realm_kerberos_membership_skeleton_set_property (GObject *object,
8257 guint prop_id,
8258 const GValue *value,
8259 GParamSpec *pspec)
8260 {
8261 const _ExtendedGDBusPropertyInfo *info;
8262 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8263 g_assert (prop_id != 0 && prop_id - 1 < 3);
8264 info = (const _ExtendedGDBusPropertyInfo *) _cc_realm_kerberos_membership_property_info_pointers[prop_id - 1];
8265 g_mutex_lock (&skeleton->priv->lock);
8266 g_object_freeze_notify (object);
8267 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8268 {
8269 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
8270 info->emits_changed_signal)
8271 _cc_realm_kerberos_membership_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
8272 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8273 g_object_notify_by_pspec (object, pspec);
8274 }
8275 g_mutex_unlock (&skeleton->priv->lock);
8276 g_object_thaw_notify (object);
8277 }
8278
8279 static void
8280 cc_realm_kerberos_membership_skeleton_init (CcRealmKerberosMembershipSkeleton *skeleton)
8281 {
8282 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8283 skeleton->priv = cc_realm_kerberos_membership_skeleton_get_instance_private (skeleton);
8284 #else
8285 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, CC_REALM_TYPE_KERBEROS_MEMBERSHIP_SKELETON, CcRealmKerberosMembershipSkeletonPrivate);
8286 #endif
8287
8288 g_mutex_init (&skeleton->priv->lock);
8289 skeleton->priv->context = g_main_context_ref_thread_default ();
8290 skeleton->priv->properties = g_new0 (GValue, 3);
8291 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8292 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
8293 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
8294 }
8295
8296 static const gchar *
8297 cc_realm_kerberos_membership_skeleton_get_suggested_administrator (CcRealmKerberosMembership *object)
8298 {
8299 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8300 const gchar *value;
8301 g_mutex_lock (&skeleton->priv->lock);
8302 value = g_marshal_value_peek_string (&(skeleton->priv->properties[0]));
8303 g_mutex_unlock (&skeleton->priv->lock);
8304 return value;
8305 }
8306
8307 static GVariant *
8308 cc_realm_kerberos_membership_skeleton_get_supported_join_credentials (CcRealmKerberosMembership *object)
8309 {
8310 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8311 GVariant *value;
8312 g_mutex_lock (&skeleton->priv->lock);
8313 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[1]));
8314 g_mutex_unlock (&skeleton->priv->lock);
8315 return value;
8316 }
8317
8318 static GVariant *
8319 cc_realm_kerberos_membership_skeleton_get_supported_leave_credentials (CcRealmKerberosMembership *object)
8320 {
8321 CcRealmKerberosMembershipSkeleton *skeleton = CC_REALM_KERBEROS_MEMBERSHIP_SKELETON (object);
8322 GVariant *value;
8323 g_mutex_lock (&skeleton->priv->lock);
8324 value = g_marshal_value_peek_variant (&(skeleton->priv->properties[2]));
8325 g_mutex_unlock (&skeleton->priv->lock);
8326 return value;
8327 }
8328
8329 static void
8330 cc_realm_kerberos_membership_skeleton_class_init (CcRealmKerberosMembershipSkeletonClass *klass)
8331 {
8332 GObjectClass *gobject_class;
8333 GDBusInterfaceSkeletonClass *skeleton_class;
8334
8335 gobject_class = G_OBJECT_CLASS (klass);
8336 gobject_class->finalize = cc_realm_kerberos_membership_skeleton_finalize;
8337 gobject_class->get_property = cc_realm_kerberos_membership_skeleton_get_property;
8338 gobject_class->set_property = cc_realm_kerberos_membership_skeleton_set_property;
8339 gobject_class->notify = cc_realm_kerberos_membership_skeleton_notify;
8340
8341
8342 cc_realm_kerberos_membership_override_properties (gobject_class, 1);
8343
8344 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8345 skeleton_class->get_info = cc_realm_kerberos_membership_skeleton_dbus_interface_get_info;
8346 skeleton_class->get_properties = cc_realm_kerberos_membership_skeleton_dbus_interface_get_properties;
8347 skeleton_class->flush = cc_realm_kerberos_membership_skeleton_dbus_interface_flush;
8348 skeleton_class->get_vtable = cc_realm_kerberos_membership_skeleton_dbus_interface_get_vtable;
8349
8350 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8351 g_type_class_add_private (klass, sizeof (CcRealmKerberosMembershipSkeletonPrivate));
8352 #endif
8353 }
8354
8355 static void
8356 cc_realm_kerberos_membership_skeleton_iface_init (CcRealmKerberosMembershipIface *iface)
8357 {
8358 iface->get_suggested_administrator = cc_realm_kerberos_membership_skeleton_get_suggested_administrator;
8359 iface->get_supported_join_credentials = cc_realm_kerberos_membership_skeleton_get_supported_join_credentials;
8360 iface->get_supported_leave_credentials = cc_realm_kerberos_membership_skeleton_get_supported_leave_credentials;
8361 }
8362
8363 /**
8364 * cc_realm_kerberos_membership_skeleton_new:
8365 *
8366 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>.
8367 *
8368 * Returns: (transfer full) (type CcRealmKerberosMembershipSkeleton): The skeleton object.
8369 */
8370 CcRealmKerberosMembership *
8371 cc_realm_kerberos_membership_skeleton_new (void)
8372 {
8373 return CC_REALM_KERBEROS_MEMBERSHIP (g_object_new (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_SKELETON, NULL));
8374 }
8375
8376 /* ------------------------------------------------------------------------
8377 * Code for Object, ObjectProxy and ObjectSkeleton
8378 * ------------------------------------------------------------------------
8379 */
8380
8381 /**
8382 * SECTION:CcRealmObject
8383 * @title: CcRealmObject
8384 * @short_description: Specialized GDBusObject types
8385 *
8386 * This section contains the #CcRealmObject, #CcRealmObjectProxy, and #CcRealmObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
8387 */
8388
8389 /**
8390 * CcRealmObject:
8391 *
8392 * The #CcRealmObject type is a specialized container of interfaces.
8393 */
8394
8395 /**
8396 * CcRealmObjectIface:
8397 * @parent_iface: The parent interface.
8398 *
8399 * Virtual table for the #CcRealmObject interface.
8400 */
8401
8402 typedef CcRealmObjectIface CcRealmObjectInterface;
8403 G_DEFINE_INTERFACE_WITH_CODE (CcRealmObject, cc_realm_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT);)
8404
8405 static void
8406 cc_realm_object_default_init (CcRealmObjectIface *iface)
8407 {
8408 /**
8409 * CcRealmObject:provider:
8410 *
8411 * The #CcRealmProvider instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link>, if any.
8412 *
8413 * Connect to the #GObject::notify signal to get informed of property changes.
8414 */
8415 g_object_interface_install_property (iface, g_param_spec_object ("provider", "provider", "provider", CC_REALM_TYPE_PROVIDER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8416
8417 /**
8418 * CcRealmObject:service:
8419 *
8420 * The #CcRealmService instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link>, if any.
8421 *
8422 * Connect to the #GObject::notify signal to get informed of property changes.
8423 */
8424 g_object_interface_install_property (iface, g_param_spec_object ("service", "service", "service", CC_REALM_TYPE_SERVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8425
8426 /**
8427 * CcRealmObject:common:
8428 *
8429 * The #CcRealmCommon instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link>, if any.
8430 *
8431 * Connect to the #GObject::notify signal to get informed of property changes.
8432 */
8433 g_object_interface_install_property (iface, g_param_spec_object ("common", "common", "common", CC_REALM_TYPE_COMMON, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8434
8435 /**
8436 * CcRealmObject:kerberos:
8437 *
8438 * The #CcRealmKerberos instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link>, if any.
8439 *
8440 * Connect to the #GObject::notify signal to get informed of property changes.
8441 */
8442 g_object_interface_install_property (iface, g_param_spec_object ("kerberos", "kerberos", "kerberos", CC_REALM_TYPE_KERBEROS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8443
8444 /**
8445 * CcRealmObject:kerberos-membership:
8446 *
8447 * The #CcRealmKerberosMembership instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link>, if any.
8448 *
8449 * Connect to the #GObject::notify signal to get informed of property changes.
8450 */
8451 g_object_interface_install_property (iface, g_param_spec_object ("kerberos-membership", "kerberos-membership", "kerberos-membership", CC_REALM_TYPE_KERBEROS_MEMBERSHIP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8452
8453 }
8454
8455 /**
8456 * cc_realm_object_get_provider:
8457 * @object: A #CcRealmObject.
8458 *
8459 * Gets the #CcRealmProvider instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link> on @object, if any.
8460 *
8461 * Returns: (transfer full) (nullable): A #CcRealmProvider that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8462 */
8463 CcRealmProvider *cc_realm_object_get_provider (CcRealmObject *object)
8464 {
8465 GDBusInterface *ret;
8466 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider");
8467 if (ret == NULL)
8468 return NULL;
8469 return CC_REALM_PROVIDER (ret);
8470 }
8471
8472 /**
8473 * cc_realm_object_get_service:
8474 * @object: A #CcRealmObject.
8475 *
8476 * Gets the #CcRealmService instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link> on @object, if any.
8477 *
8478 * Returns: (transfer full) (nullable): A #CcRealmService that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8479 */
8480 CcRealmService *cc_realm_object_get_service (CcRealmObject *object)
8481 {
8482 GDBusInterface *ret;
8483 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service");
8484 if (ret == NULL)
8485 return NULL;
8486 return CC_REALM_SERVICE (ret);
8487 }
8488
8489 /**
8490 * cc_realm_object_get_common:
8491 * @object: A #CcRealmObject.
8492 *
8493 * Gets the #CcRealmCommon instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link> on @object, if any.
8494 *
8495 * Returns: (transfer full) (nullable): A #CcRealmCommon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8496 */
8497 CcRealmCommon *cc_realm_object_get_common (CcRealmObject *object)
8498 {
8499 GDBusInterface *ret;
8500 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm");
8501 if (ret == NULL)
8502 return NULL;
8503 return CC_REALM_COMMON (ret);
8504 }
8505
8506 /**
8507 * cc_realm_object_get_kerberos:
8508 * @object: A #CcRealmObject.
8509 *
8510 * Gets the #CcRealmKerberos instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link> on @object, if any.
8511 *
8512 * Returns: (transfer full) (nullable): A #CcRealmKerberos that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8513 */
8514 CcRealmKerberos *cc_realm_object_get_kerberos (CcRealmObject *object)
8515 {
8516 GDBusInterface *ret;
8517 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos");
8518 if (ret == NULL)
8519 return NULL;
8520 return CC_REALM_KERBEROS (ret);
8521 }
8522
8523 /**
8524 * cc_realm_object_get_kerberos_membership:
8525 * @object: A #CcRealmObject.
8526 *
8527 * Gets the #CcRealmKerberosMembership instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link> on @object, if any.
8528 *
8529 * Returns: (transfer full) (nullable): A #CcRealmKerberosMembership that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8530 */
8531 CcRealmKerberosMembership *cc_realm_object_get_kerberos_membership (CcRealmObject *object)
8532 {
8533 GDBusInterface *ret;
8534 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership");
8535 if (ret == NULL)
8536 return NULL;
8537 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
8538 }
8539
8540
8541 /**
8542 * cc_realm_object_peek_provider: (skip)
8543 * @object: A #CcRealmObject.
8544 *
8545 * Like cc_realm_object_get_provider() but doesn't increase the reference count on the returned object.
8546 *
8547 * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.
8548 *
8549 * Returns: (transfer none) (nullable): A #CcRealmProvider or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8550 */
8551 CcRealmProvider *cc_realm_object_peek_provider (CcRealmObject *object)
8552 {
8553 GDBusInterface *ret;
8554 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider");
8555 if (ret == NULL)
8556 return NULL;
8557 g_object_unref (ret);
8558 return CC_REALM_PROVIDER (ret);
8559 }
8560
8561 /**
8562 * cc_realm_object_peek_service: (skip)
8563 * @object: A #CcRealmObject.
8564 *
8565 * Like cc_realm_object_get_service() but doesn't increase the reference count on the returned object.
8566 *
8567 * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.
8568 *
8569 * Returns: (transfer none) (nullable): A #CcRealmService or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8570 */
8571 CcRealmService *cc_realm_object_peek_service (CcRealmObject *object)
8572 {
8573 GDBusInterface *ret;
8574 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service");
8575 if (ret == NULL)
8576 return NULL;
8577 g_object_unref (ret);
8578 return CC_REALM_SERVICE (ret);
8579 }
8580
8581 /**
8582 * cc_realm_object_peek_common: (skip)
8583 * @object: A #CcRealmObject.
8584 *
8585 * Like cc_realm_object_get_common() but doesn't increase the reference count on the returned object.
8586 *
8587 * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.
8588 *
8589 * Returns: (transfer none) (nullable): A #CcRealmCommon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8590 */
8591 CcRealmCommon *cc_realm_object_peek_common (CcRealmObject *object)
8592 {
8593 GDBusInterface *ret;
8594 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm");
8595 if (ret == NULL)
8596 return NULL;
8597 g_object_unref (ret);
8598 return CC_REALM_COMMON (ret);
8599 }
8600
8601 /**
8602 * cc_realm_object_peek_kerberos: (skip)
8603 * @object: A #CcRealmObject.
8604 *
8605 * Like cc_realm_object_get_kerberos() but doesn't increase the reference count on the returned object.
8606 *
8607 * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.
8608 *
8609 * Returns: (transfer none) (nullable): A #CcRealmKerberos or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8610 */
8611 CcRealmKerberos *cc_realm_object_peek_kerberos (CcRealmObject *object)
8612 {
8613 GDBusInterface *ret;
8614 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos");
8615 if (ret == NULL)
8616 return NULL;
8617 g_object_unref (ret);
8618 return CC_REALM_KERBEROS (ret);
8619 }
8620
8621 /**
8622 * cc_realm_object_peek_kerberos_membership: (skip)
8623 * @object: A #CcRealmObject.
8624 *
8625 * Like cc_realm_object_get_kerberos_membership() but doesn't increase the reference count on the returned object.
8626 *
8627 * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.
8628 *
8629 * Returns: (transfer none) (nullable): A #CcRealmKerberosMembership or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8630 */
8631 CcRealmKerberosMembership *cc_realm_object_peek_kerberos_membership (CcRealmObject *object)
8632 {
8633 GDBusInterface *ret;
8634 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership");
8635 if (ret == NULL)
8636 return NULL;
8637 g_object_unref (ret);
8638 return CC_REALM_KERBEROS_MEMBERSHIP (ret);
8639 }
8640
8641
8642 static void
8643 cc_realm_object_notify (GDBusObject *object, GDBusInterface *interface)
8644 {
8645 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
8646 /* info can be NULL if the other end is using a D-Bus interface we don't know
8647 * anything about, for example old generated code in this process talking to
8648 * newer generated code in the other process. */
8649 if (info != NULL)
8650 g_object_notify (G_OBJECT (object), info->hyphen_name);
8651 }
8652
8653 /**
8654 * CcRealmObjectProxy:
8655 *
8656 * The #CcRealmObjectProxy structure contains only private data and should only be accessed using the provided API.
8657 */
8658
8659 /**
8660 * CcRealmObjectProxyClass:
8661 * @parent_class: The parent class.
8662 *
8663 * Class structure for #CcRealmObjectProxy.
8664 */
8665
8666 static void
8667 cc_realm_object_proxy__cc_realm_object_iface_init (CcRealmObjectIface *iface G_GNUC_UNUSED)
8668 {
8669 }
8670
8671 static void
8672 cc_realm_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
8673 {
8674 iface->interface_added = cc_realm_object_notify;
8675 iface->interface_removed = cc_realm_object_notify;
8676 }
8677
8678
8679 G_DEFINE_TYPE_WITH_CODE (CcRealmObjectProxy, cc_realm_object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
8680 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_OBJECT, cc_realm_object_proxy__cc_realm_object_iface_init)
8681 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, cc_realm_object_proxy__g_dbus_object_iface_init))
8682
8683 static void
8684 cc_realm_object_proxy_init (CcRealmObjectProxy *object G_GNUC_UNUSED)
8685 {
8686 }
8687
8688 static void
8689 cc_realm_object_proxy_set_property (GObject *gobject,
8690 guint prop_id,
8691 const GValue *value G_GNUC_UNUSED,
8692 GParamSpec *pspec)
8693 {
8694 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8695 }
8696
8697 static void
8698 cc_realm_object_proxy_get_property (GObject *gobject,
8699 guint prop_id,
8700 GValue *value,
8701 GParamSpec *pspec)
8702 {
8703 CcRealmObjectProxy *object = CC_REALM_OBJECT_PROXY (gobject);
8704 GDBusInterface *interface;
8705
8706 switch (prop_id)
8707 {
8708 case 1:
8709 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider");
8710 g_value_take_object (value, interface);
8711 break;
8712
8713 case 2:
8714 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service");
8715 g_value_take_object (value, interface);
8716 break;
8717
8718 case 3:
8719 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm");
8720 g_value_take_object (value, interface);
8721 break;
8722
8723 case 4:
8724 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos");
8725 g_value_take_object (value, interface);
8726 break;
8727
8728 case 5:
8729 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership");
8730 g_value_take_object (value, interface);
8731 break;
8732
8733 default:
8734 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8735 break;
8736 }
8737 }
8738
8739 static void
8740 cc_realm_object_proxy_class_init (CcRealmObjectProxyClass *klass)
8741 {
8742 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
8743
8744 gobject_class->set_property = cc_realm_object_proxy_set_property;
8745 gobject_class->get_property = cc_realm_object_proxy_get_property;
8746
8747 g_object_class_override_property (gobject_class, 1, "provider");
8748 g_object_class_override_property (gobject_class, 2, "service");
8749 g_object_class_override_property (gobject_class, 3, "common");
8750 g_object_class_override_property (gobject_class, 4, "kerberos");
8751 g_object_class_override_property (gobject_class, 5, "kerberos-membership");
8752 }
8753
8754 /**
8755 * cc_realm_object_proxy_new:
8756 * @connection: A #GDBusConnection.
8757 * @object_path: An object path.
8758 *
8759 * Creates a new proxy object.
8760 *
8761 * Returns: (transfer full): The proxy object.
8762 */
8763 CcRealmObjectProxy *
8764 cc_realm_object_proxy_new (GDBusConnection *connection,
8765 const gchar *object_path)
8766 {
8767 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
8768 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
8769 return CC_REALM_OBJECT_PROXY (g_object_new (CC_REALM_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
8770 }
8771
8772 /**
8773 * CcRealmObjectSkeleton:
8774 *
8775 * The #CcRealmObjectSkeleton structure contains only private data and should only be accessed using the provided API.
8776 */
8777
8778 /**
8779 * CcRealmObjectSkeletonClass:
8780 * @parent_class: The parent class.
8781 *
8782 * Class structure for #CcRealmObjectSkeleton.
8783 */
8784
8785 static void
8786 cc_realm_object_skeleton__cc_realm_object_iface_init (CcRealmObjectIface *iface G_GNUC_UNUSED)
8787 {
8788 }
8789
8790
8791 static void
8792 cc_realm_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
8793 {
8794 iface->interface_added = cc_realm_object_notify;
8795 iface->interface_removed = cc_realm_object_notify;
8796 }
8797
8798 G_DEFINE_TYPE_WITH_CODE (CcRealmObjectSkeleton, cc_realm_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
8799 G_IMPLEMENT_INTERFACE (CC_REALM_TYPE_OBJECT, cc_realm_object_skeleton__cc_realm_object_iface_init)
8800 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, cc_realm_object_skeleton__g_dbus_object_iface_init))
8801
8802 static void
8803 cc_realm_object_skeleton_init (CcRealmObjectSkeleton *object G_GNUC_UNUSED)
8804 {
8805 }
8806
8807 static void
8808 cc_realm_object_skeleton_set_property (GObject *gobject,
8809 guint prop_id,
8810 const GValue *value,
8811 GParamSpec *pspec)
8812 {
8813 CcRealmObjectSkeleton *object = CC_REALM_OBJECT_SKELETON (gobject);
8814 GDBusInterfaceSkeleton *interface;
8815
8816 switch (prop_id)
8817 {
8818 case 1:
8819 interface = g_value_get_object (value);
8820 if (interface != NULL)
8821 {
8822 g_warn_if_fail (CC_REALM_IS_PROVIDER (interface));
8823 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
8824 }
8825 else
8826 {
8827 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Provider");
8828 }
8829 break;
8830
8831 case 2:
8832 interface = g_value_get_object (value);
8833 if (interface != NULL)
8834 {
8835 g_warn_if_fail (CC_REALM_IS_SERVICE (interface));
8836 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
8837 }
8838 else
8839 {
8840 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Service");
8841 }
8842 break;
8843
8844 case 3:
8845 interface = g_value_get_object (value);
8846 if (interface != NULL)
8847 {
8848 g_warn_if_fail (CC_REALM_IS_COMMON (interface));
8849 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
8850 }
8851 else
8852 {
8853 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Realm");
8854 }
8855 break;
8856
8857 case 4:
8858 interface = g_value_get_object (value);
8859 if (interface != NULL)
8860 {
8861 g_warn_if_fail (CC_REALM_IS_KERBEROS (interface));
8862 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
8863 }
8864 else
8865 {
8866 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.Kerberos");
8867 }
8868 break;
8869
8870 case 5:
8871 interface = g_value_get_object (value);
8872 if (interface != NULL)
8873 {
8874 g_warn_if_fail (CC_REALM_IS_KERBEROS_MEMBERSHIP (interface));
8875 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
8876 }
8877 else
8878 {
8879 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.freedesktop.realmd.KerberosMembership");
8880 }
8881 break;
8882
8883 default:
8884 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8885 break;
8886 }
8887 }
8888
8889 static void
8890 cc_realm_object_skeleton_get_property (GObject *gobject,
8891 guint prop_id,
8892 GValue *value,
8893 GParamSpec *pspec)
8894 {
8895 CcRealmObjectSkeleton *object = CC_REALM_OBJECT_SKELETON (gobject);
8896 GDBusInterface *interface;
8897
8898 switch (prop_id)
8899 {
8900 case 1:
8901 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Provider");
8902 g_value_take_object (value, interface);
8903 break;
8904
8905 case 2:
8906 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Service");
8907 g_value_take_object (value, interface);
8908 break;
8909
8910 case 3:
8911 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Realm");
8912 g_value_take_object (value, interface);
8913 break;
8914
8915 case 4:
8916 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.Kerberos");
8917 g_value_take_object (value, interface);
8918 break;
8919
8920 case 5:
8921 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.freedesktop.realmd.KerberosMembership");
8922 g_value_take_object (value, interface);
8923 break;
8924
8925 default:
8926 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8927 break;
8928 }
8929 }
8930
8931 static void
8932 cc_realm_object_skeleton_class_init (CcRealmObjectSkeletonClass *klass)
8933 {
8934 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
8935
8936 gobject_class->set_property = cc_realm_object_skeleton_set_property;
8937 gobject_class->get_property = cc_realm_object_skeleton_get_property;
8938
8939 g_object_class_override_property (gobject_class, 1, "provider");
8940 g_object_class_override_property (gobject_class, 2, "service");
8941 g_object_class_override_property (gobject_class, 3, "common");
8942 g_object_class_override_property (gobject_class, 4, "kerberos");
8943 g_object_class_override_property (gobject_class, 5, "kerberos-membership");
8944 }
8945
8946 /**
8947 * cc_realm_object_skeleton_new:
8948 * @object_path: An object path.
8949 *
8950 * Creates a new skeleton object.
8951 *
8952 * Returns: (transfer full): The skeleton object.
8953 */
8954 CcRealmObjectSkeleton *
8955 cc_realm_object_skeleton_new (const gchar *object_path)
8956 {
8957 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
8958 return CC_REALM_OBJECT_SKELETON (g_object_new (CC_REALM_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
8959 }
8960
8961 /**
8962 * cc_realm_object_skeleton_set_provider:
8963 * @object: A #CcRealmObjectSkeleton.
8964 * @interface_: (nullable): A #CcRealmProvider or %NULL to clear the interface.
8965 *
8966 * Sets the #CcRealmProvider instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Provider.top_of_page">org.freedesktop.realmd.Provider</link> on @object.
8967 */
8968 void cc_realm_object_skeleton_set_provider (CcRealmObjectSkeleton *object, CcRealmProvider *interface_)
8969 {
8970 g_object_set (G_OBJECT (object), "provider", interface_, NULL);
8971 }
8972
8973 /**
8974 * cc_realm_object_skeleton_set_service:
8975 * @object: A #CcRealmObjectSkeleton.
8976 * @interface_: (nullable): A #CcRealmService or %NULL to clear the interface.
8977 *
8978 * Sets the #CcRealmService instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Service.top_of_page">org.freedesktop.realmd.Service</link> on @object.
8979 */
8980 void cc_realm_object_skeleton_set_service (CcRealmObjectSkeleton *object, CcRealmService *interface_)
8981 {
8982 g_object_set (G_OBJECT (object), "service", interface_, NULL);
8983 }
8984
8985 /**
8986 * cc_realm_object_skeleton_set_common:
8987 * @object: A #CcRealmObjectSkeleton.
8988 * @interface_: (nullable): A #CcRealmCommon or %NULL to clear the interface.
8989 *
8990 * Sets the #CcRealmCommon instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Realm.top_of_page">org.freedesktop.realmd.Realm</link> on @object.
8991 */
8992 void cc_realm_object_skeleton_set_common (CcRealmObjectSkeleton *object, CcRealmCommon *interface_)
8993 {
8994 g_object_set (G_OBJECT (object), "common", interface_, NULL);
8995 }
8996
8997 /**
8998 * cc_realm_object_skeleton_set_kerberos:
8999 * @object: A #CcRealmObjectSkeleton.
9000 * @interface_: (nullable): A #CcRealmKerberos or %NULL to clear the interface.
9001 *
9002 * Sets the #CcRealmKerberos instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-Kerberos.top_of_page">org.freedesktop.realmd.Kerberos</link> on @object.
9003 */
9004 void cc_realm_object_skeleton_set_kerberos (CcRealmObjectSkeleton *object, CcRealmKerberos *interface_)
9005 {
9006 g_object_set (G_OBJECT (object), "kerberos", interface_, NULL);
9007 }
9008
9009 /**
9010 * cc_realm_object_skeleton_set_kerberos_membership:
9011 * @object: A #CcRealmObjectSkeleton.
9012 * @interface_: (nullable): A #CcRealmKerberosMembership or %NULL to clear the interface.
9013 *
9014 * Sets the #CcRealmKerberosMembership instance for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-realmd-KerberosMembership.top_of_page">org.freedesktop.realmd.KerberosMembership</link> on @object.
9015 */
9016 void cc_realm_object_skeleton_set_kerberos_membership (CcRealmObjectSkeleton *object, CcRealmKerberosMembership *interface_)
9017 {
9018 g_object_set (G_OBJECT (object), "kerberos-membership", interface_, NULL);
9019 }
9020
9021
9022 /* ------------------------------------------------------------------------
9023 * Code for ObjectManager client
9024 * ------------------------------------------------------------------------
9025 */
9026
9027 /**
9028 * SECTION:CcRealmObjectManagerClient
9029 * @title: CcRealmObjectManagerClient
9030 * @short_description: Generated GDBusObjectManagerClient type
9031 *
9032 * This section contains a #GDBusObjectManagerClient that uses cc_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
9033 */
9034
9035 /**
9036 * CcRealmObjectManagerClient:
9037 *
9038 * The #CcRealmObjectManagerClient structure contains only private data and should only be accessed using the provided API.
9039 */
9040
9041 /**
9042 * CcRealmObjectManagerClientClass:
9043 * @parent_class: The parent class.
9044 *
9045 * Class structure for #CcRealmObjectManagerClient.
9046 */
9047
9048 G_DEFINE_TYPE (CcRealmObjectManagerClient, cc_realm_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)
9049
9050 static void
9051 cc_realm_object_manager_client_init (CcRealmObjectManagerClient *manager G_GNUC_UNUSED)
9052 {
9053 }
9054
9055 static void
9056 cc_realm_object_manager_client_class_init (CcRealmObjectManagerClientClass *klass G_GNUC_UNUSED)
9057 {
9058 }
9059
9060 /**
9061 * cc_realm_object_manager_client_get_proxy_type:
9062 * @manager: A #GDBusObjectManagerClient.
9063 * @object_path: The object path of the remote object (unused).
9064 * @interface_name: (nullable): Interface name of the remote object or %NULL to get the object proxy #GType.
9065 * @user_data: User data (unused).
9066 *
9067 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy derived and #GDBusProxy derived types.
9068 *
9069 * Returns: A #GDBusProxy derived #GType if @interface_name is not %NULL, otherwise the #GType for #CcRealmObjectProxy.
9070 */
9071 GType
9072 cc_realm_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
9073 {
9074 static gsize once_init_value = 0;
9075 static GHashTable *lookup_hash;
9076 GType ret;
9077
9078 if (interface_name == NULL)
9079 return CC_REALM_TYPE_OBJECT_PROXY;
9080 if (g_once_init_enter (&once_init_value))
9081 {
9082 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
9083 g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Provider", (gpointer) (guintptr) (CC_REALM_TYPE_PROVIDER_PROXY));
9084 g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Service", (gpointer) (guintptr) (CC_REALM_TYPE_SERVICE_PROXY));
9085 g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Realm", (gpointer) (guintptr) (CC_REALM_TYPE_COMMON_PROXY));
9086 g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.Kerberos", (gpointer) (guintptr) (CC_REALM_TYPE_KERBEROS_PROXY));
9087 g_hash_table_insert (lookup_hash, (gpointer) "org.freedesktop.realmd.KerberosMembership", (gpointer) (guintptr) (CC_REALM_TYPE_KERBEROS_MEMBERSHIP_PROXY));
9088 g_once_init_leave (&once_init_value, 1);
9089 }
9090 ret = (GType) (guintptr) (g_hash_table_lookup (lookup_hash, interface_name));
9091 if (ret == (GType) 0)
9092 ret = G_TYPE_DBUS_PROXY;
9093 return ret;
9094 }
9095
9096 /**
9097 * cc_realm_object_manager_client_new:
9098 * @connection: A #GDBusConnection.
9099 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9100 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9101 * @object_path: An object path.
9102 * @cancellable: (nullable): A #GCancellable or %NULL.
9103 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9104 * @user_data: User data to pass to @callback.
9105 *
9106 * Asynchronously creates #GDBusObjectManagerClient using cc_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
9107 *
9108 * 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()).
9109 * You can then call cc_realm_object_manager_client_new_finish() to get the result of the operation.
9110 *
9111 * See cc_realm_object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
9112 */
9113 void
9114 cc_realm_object_manager_client_new (
9115 GDBusConnection *connection,
9116 GDBusObjectManagerClientFlags flags,
9117 const gchar *name,
9118 const gchar *object_path,
9119 GCancellable *cancellable,
9120 GAsyncReadyCallback callback,
9121 gpointer user_data)
9122 {
9123 g_async_initable_new_async (CC_REALM_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", cc_realm_object_manager_client_get_proxy_type, NULL);
9124 }
9125
9126 /**
9127 * cc_realm_object_manager_client_new_finish:
9128 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_object_manager_client_new().
9129 * @error: Return location for error or %NULL
9130 *
9131 * Finishes an operation started with cc_realm_object_manager_client_new().
9132 *
9133 * Returns: (transfer full) (type CcRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9134 */
9135 GDBusObjectManager *
9136 cc_realm_object_manager_client_new_finish (
9137 GAsyncResult *res,
9138 GError **error)
9139 {
9140 GObject *ret;
9141 GObject *source_object;
9142 source_object = g_async_result_get_source_object (res);
9143 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9144 g_object_unref (source_object);
9145 if (ret != NULL)
9146 return G_DBUS_OBJECT_MANAGER (ret);
9147 else
9148 return NULL;
9149 }
9150
9151 /**
9152 * cc_realm_object_manager_client_new_sync:
9153 * @connection: A #GDBusConnection.
9154 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9155 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9156 * @object_path: An object path.
9157 * @cancellable: (nullable): A #GCancellable or %NULL.
9158 * @error: Return location for error or %NULL
9159 *
9160 * Synchronously creates #GDBusObjectManagerClient using cc_realm_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
9161 *
9162 * The calling thread is blocked until a reply is received.
9163 *
9164 * See cc_realm_object_manager_client_new() for the asynchronous version of this constructor.
9165 *
9166 * Returns: (transfer full) (type CcRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9167 */
9168 GDBusObjectManager *
9169 cc_realm_object_manager_client_new_sync (
9170 GDBusConnection *connection,
9171 GDBusObjectManagerClientFlags flags,
9172 const gchar *name,
9173 const gchar *object_path,
9174 GCancellable *cancellable,
9175 GError **error)
9176 {
9177 GInitable *ret;
9178 ret = g_initable_new (CC_REALM_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", cc_realm_object_manager_client_get_proxy_type, NULL);
9179 if (ret != NULL)
9180 return G_DBUS_OBJECT_MANAGER (ret);
9181 else
9182 return NULL;
9183 }
9184
9185
9186 /**
9187 * cc_realm_object_manager_client_new_for_bus:
9188 * @bus_type: A #GBusType.
9189 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9190 * @name: A bus name (well-known or unique).
9191 * @object_path: An object path.
9192 * @cancellable: (nullable): A #GCancellable or %NULL.
9193 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9194 * @user_data: User data to pass to @callback.
9195 *
9196 * Like cc_realm_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
9197 *
9198 * 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()).
9199 * You can then call cc_realm_object_manager_client_new_for_bus_finish() to get the result of the operation.
9200 *
9201 * See cc_realm_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9202 */
9203 void
9204 cc_realm_object_manager_client_new_for_bus (
9205 GBusType bus_type,
9206 GDBusObjectManagerClientFlags flags,
9207 const gchar *name,
9208 const gchar *object_path,
9209 GCancellable *cancellable,
9210 GAsyncReadyCallback callback,
9211 gpointer user_data)
9212 {
9213 g_async_initable_new_async (CC_REALM_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", cc_realm_object_manager_client_get_proxy_type, NULL);
9214 }
9215
9216 /**
9217 * cc_realm_object_manager_client_new_for_bus_finish:
9218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to cc_realm_object_manager_client_new_for_bus().
9219 * @error: Return location for error or %NULL
9220 *
9221 * Finishes an operation started with cc_realm_object_manager_client_new_for_bus().
9222 *
9223 * Returns: (transfer full) (type CcRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9224 */
9225 GDBusObjectManager *
9226 cc_realm_object_manager_client_new_for_bus_finish (
9227 GAsyncResult *res,
9228 GError **error)
9229 {
9230 GObject *ret;
9231 GObject *source_object;
9232 source_object = g_async_result_get_source_object (res);
9233 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9234 g_object_unref (source_object);
9235 if (ret != NULL)
9236 return G_DBUS_OBJECT_MANAGER (ret);
9237 else
9238 return NULL;
9239 }
9240
9241 /**
9242 * cc_realm_object_manager_client_new_for_bus_sync:
9243 * @bus_type: A #GBusType.
9244 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9245 * @name: A bus name (well-known or unique).
9246 * @object_path: An object path.
9247 * @cancellable: (nullable): A #GCancellable or %NULL.
9248 * @error: Return location for error or %NULL
9249 *
9250 * Like cc_realm_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9251 *
9252 * The calling thread is blocked until a reply is received.
9253 *
9254 * See cc_realm_object_manager_client_new_for_bus() for the asynchronous version of this constructor.
9255 *
9256 * Returns: (transfer full) (type CcRealmObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9257 */
9258 GDBusObjectManager *
9259 cc_realm_object_manager_client_new_for_bus_sync (
9260 GBusType bus_type,
9261 GDBusObjectManagerClientFlags flags,
9262 const gchar *name,
9263 const gchar *object_path,
9264 GCancellable *cancellable,
9265 GError **error)
9266 {
9267 GInitable *ret;
9268 ret = g_initable_new (CC_REALM_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", cc_realm_object_manager_client_get_proxy_type, NULL);
9269 if (ret != NULL)
9270 return G_DBUS_OBJECT_MANAGER (ret);
9271 else
9272 return NULL;
9273 }
9274
9275
9276