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 "xdp-dbus.h"
14
15 #include <string.h>
16 #ifdef G_OS_UNIX
17 # include <gio/gunixfdlist.h>
18 #endif
19
20 typedef struct
21 {
22 GDBusArgInfo parent_struct;
23 gboolean use_gvariant;
24 } _ExtendedGDBusArgInfo;
25
26 typedef struct
27 {
28 GDBusMethodInfo parent_struct;
29 const gchar *signal_name;
30 gboolean pass_fdlist;
31 } _ExtendedGDBusMethodInfo;
32
33 typedef struct
34 {
35 GDBusSignalInfo parent_struct;
36 const gchar *signal_name;
37 } _ExtendedGDBusSignalInfo;
38
39 typedef struct
40 {
41 GDBusPropertyInfo parent_struct;
42 const gchar *hyphen_name;
43 guint use_gvariant : 1;
44 guint emits_changed_signal : 1;
45 } _ExtendedGDBusPropertyInfo;
46
47 typedef struct
48 {
49 GDBusInterfaceInfo parent_struct;
50 const gchar *hyphen_name;
51 } _ExtendedGDBusInterfaceInfo;
52
53 typedef struct
54 {
55 const _ExtendedGDBusPropertyInfo *info;
56 guint prop_id;
57 GValue orig_value; /* the value before the change */
58 } ChangedProperty;
59
60 static void
_changed_property_free(ChangedProperty * data)61 _changed_property_free (ChangedProperty *data)
62 {
63 g_value_unset (&data->orig_value);
64 g_free (data);
65 }
66
67 static gboolean
_g_strv_equal0(gchar ** a,gchar ** b)68 _g_strv_equal0 (gchar **a, gchar **b)
69 {
70 gboolean ret = FALSE;
71 guint n;
72 if (a == NULL && b == NULL)
73 {
74 ret = TRUE;
75 goto out;
76 }
77 if (a == NULL || b == NULL)
78 goto out;
79 if (g_strv_length (a) != g_strv_length (b))
80 goto out;
81 for (n = 0; a[n] != NULL; n++)
82 if (g_strcmp0 (a[n], b[n]) != 0)
83 goto out;
84 ret = TRUE;
85 out:
86 return ret;
87 }
88
89 static gboolean
_g_variant_equal0(GVariant * a,GVariant * b)90 _g_variant_equal0 (GVariant *a, GVariant *b)
91 {
92 gboolean ret = FALSE;
93 if (a == NULL && b == NULL)
94 {
95 ret = TRUE;
96 goto out;
97 }
98 if (a == NULL || b == NULL)
99 goto out;
100 ret = g_variant_equal (a, b);
101 out:
102 return ret;
103 }
104
105 G_GNUC_UNUSED static gboolean
_g_value_equal(const GValue * a,const GValue * b)106 _g_value_equal (const GValue *a, const GValue *b)
107 {
108 gboolean ret = FALSE;
109 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
110 switch (G_VALUE_TYPE (a))
111 {
112 case G_TYPE_BOOLEAN:
113 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
114 break;
115 case G_TYPE_UCHAR:
116 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
117 break;
118 case G_TYPE_INT:
119 ret = (g_value_get_int (a) == g_value_get_int (b));
120 break;
121 case G_TYPE_UINT:
122 ret = (g_value_get_uint (a) == g_value_get_uint (b));
123 break;
124 case G_TYPE_INT64:
125 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
126 break;
127 case G_TYPE_UINT64:
128 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
129 break;
130 case G_TYPE_DOUBLE:
131 {
132 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
133 gdouble da = g_value_get_double (a);
134 gdouble db = g_value_get_double (b);
135 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
136 }
137 break;
138 case G_TYPE_STRING:
139 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
140 break;
141 case G_TYPE_VARIANT:
142 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
143 break;
144 default:
145 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
146 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
147 else
148 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
149 break;
150 }
151 return ret;
152 }
153
154 /* ------------------------------------------------------------------------
155 * Code for interface org.freedesktop.portal.Documents
156 * ------------------------------------------------------------------------
157 */
158
159 /**
160 * SECTION:GXdpDocuments
161 * @title: GXdpDocuments
162 * @short_description: Generated C code for the org.freedesktop.portal.Documents D-Bus interface
163 *
164 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link> D-Bus interface in C.
165 */
166
167 /* ---- Introspection data for org.freedesktop.portal.Documents ---- */
168
169 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_get_mount_point_OUT_ARG_path =
170 {
171 {
172 -1,
173 (gchar *) "path",
174 (gchar *) "ay",
175 NULL
176 },
177 FALSE
178 };
179
180 static const GDBusArgInfo * const _gxdp_documents_method_info_get_mount_point_OUT_ARG_pointers[] =
181 {
182 &_gxdp_documents_method_info_get_mount_point_OUT_ARG_path.parent_struct,
183 NULL
184 };
185
186 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_get_mount_point =
187 {
188 {
189 -1,
190 (gchar *) "GetMountPoint",
191 NULL,
192 (GDBusArgInfo **) &_gxdp_documents_method_info_get_mount_point_OUT_ARG_pointers,
193 NULL
194 },
195 "handle-get-mount-point",
196 FALSE
197 };
198
199 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_o_path_fd =
200 {
201 {
202 -1,
203 (gchar *) "o_path_fd",
204 (gchar *) "h",
205 NULL
206 },
207 FALSE
208 };
209
210 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_reuse_existing =
211 {
212 {
213 -1,
214 (gchar *) "reuse_existing",
215 (gchar *) "b",
216 NULL
217 },
218 FALSE
219 };
220
221 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_persistent =
222 {
223 {
224 -1,
225 (gchar *) "persistent",
226 (gchar *) "b",
227 NULL
228 },
229 FALSE
230 };
231
232 static const GDBusArgInfo * const _gxdp_documents_method_info_add_IN_ARG_pointers[] =
233 {
234 &_gxdp_documents_method_info_add_IN_ARG_o_path_fd.parent_struct,
235 &_gxdp_documents_method_info_add_IN_ARG_reuse_existing.parent_struct,
236 &_gxdp_documents_method_info_add_IN_ARG_persistent.parent_struct,
237 NULL
238 };
239
240 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_OUT_ARG_doc_id =
241 {
242 {
243 -1,
244 (gchar *) "doc_id",
245 (gchar *) "s",
246 NULL
247 },
248 FALSE
249 };
250
251 static const GDBusArgInfo * const _gxdp_documents_method_info_add_OUT_ARG_pointers[] =
252 {
253 &_gxdp_documents_method_info_add_OUT_ARG_doc_id.parent_struct,
254 NULL
255 };
256
257 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add =
258 {
259 {
260 -1,
261 (gchar *) "Add",
262 (GDBusArgInfo **) &_gxdp_documents_method_info_add_IN_ARG_pointers,
263 (GDBusArgInfo **) &_gxdp_documents_method_info_add_OUT_ARG_pointers,
264 NULL
265 },
266 "handle-add",
267 TRUE
268 };
269
270 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_o_path_parent_fd =
271 {
272 {
273 -1,
274 (gchar *) "o_path_parent_fd",
275 (gchar *) "h",
276 NULL
277 },
278 FALSE
279 };
280
281 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_filename =
282 {
283 {
284 -1,
285 (gchar *) "filename",
286 (gchar *) "ay",
287 NULL
288 },
289 FALSE
290 };
291
292 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_reuse_existing =
293 {
294 {
295 -1,
296 (gchar *) "reuse_existing",
297 (gchar *) "b",
298 NULL
299 },
300 FALSE
301 };
302
303 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_persistent =
304 {
305 {
306 -1,
307 (gchar *) "persistent",
308 (gchar *) "b",
309 NULL
310 },
311 FALSE
312 };
313
314 static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_IN_ARG_pointers[] =
315 {
316 &_gxdp_documents_method_info_add_named_IN_ARG_o_path_parent_fd.parent_struct,
317 &_gxdp_documents_method_info_add_named_IN_ARG_filename.parent_struct,
318 &_gxdp_documents_method_info_add_named_IN_ARG_reuse_existing.parent_struct,
319 &_gxdp_documents_method_info_add_named_IN_ARG_persistent.parent_struct,
320 NULL
321 };
322
323 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_OUT_ARG_doc_id =
324 {
325 {
326 -1,
327 (gchar *) "doc_id",
328 (gchar *) "s",
329 NULL
330 },
331 FALSE
332 };
333
334 static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_OUT_ARG_pointers[] =
335 {
336 &_gxdp_documents_method_info_add_named_OUT_ARG_doc_id.parent_struct,
337 NULL
338 };
339
340 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add_named =
341 {
342 {
343 -1,
344 (gchar *) "AddNamed",
345 (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_IN_ARG_pointers,
346 (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_OUT_ARG_pointers,
347 NULL
348 },
349 "handle-add-named",
350 TRUE
351 };
352
353 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_o_path_fds =
354 {
355 {
356 -1,
357 (gchar *) "o_path_fds",
358 (gchar *) "ah",
359 NULL
360 },
361 FALSE
362 };
363
364 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_flags =
365 {
366 {
367 -1,
368 (gchar *) "flags",
369 (gchar *) "u",
370 NULL
371 },
372 FALSE
373 };
374
375 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_app_id =
376 {
377 {
378 -1,
379 (gchar *) "app_id",
380 (gchar *) "s",
381 NULL
382 },
383 FALSE
384 };
385
386 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_permissions =
387 {
388 {
389 -1,
390 (gchar *) "permissions",
391 (gchar *) "as",
392 NULL
393 },
394 FALSE
395 };
396
397 static const GDBusArgInfo * const _gxdp_documents_method_info_add_full_IN_ARG_pointers[] =
398 {
399 &_gxdp_documents_method_info_add_full_IN_ARG_o_path_fds.parent_struct,
400 &_gxdp_documents_method_info_add_full_IN_ARG_flags.parent_struct,
401 &_gxdp_documents_method_info_add_full_IN_ARG_app_id.parent_struct,
402 &_gxdp_documents_method_info_add_full_IN_ARG_permissions.parent_struct,
403 NULL
404 };
405
406 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_OUT_ARG_doc_ids =
407 {
408 {
409 -1,
410 (gchar *) "doc_ids",
411 (gchar *) "as",
412 NULL
413 },
414 FALSE
415 };
416
417 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_OUT_ARG_extra_out =
418 {
419 {
420 -1,
421 (gchar *) "extra_out",
422 (gchar *) "a{sv}",
423 NULL
424 },
425 FALSE
426 };
427
428 static const GDBusArgInfo * const _gxdp_documents_method_info_add_full_OUT_ARG_pointers[] =
429 {
430 &_gxdp_documents_method_info_add_full_OUT_ARG_doc_ids.parent_struct,
431 &_gxdp_documents_method_info_add_full_OUT_ARG_extra_out.parent_struct,
432 NULL
433 };
434
435 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add_full =
436 {
437 {
438 -1,
439 (gchar *) "AddFull",
440 (GDBusArgInfo **) &_gxdp_documents_method_info_add_full_IN_ARG_pointers,
441 (GDBusArgInfo **) &_gxdp_documents_method_info_add_full_OUT_ARG_pointers,
442 NULL
443 },
444 "handle-add-full",
445 TRUE
446 };
447
448 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_IN_ARG_o_path_fd =
449 {
450 {
451 -1,
452 (gchar *) "o_path_fd",
453 (gchar *) "h",
454 NULL
455 },
456 FALSE
457 };
458
459 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_IN_ARG_filename =
460 {
461 {
462 -1,
463 (gchar *) "filename",
464 (gchar *) "ay",
465 NULL
466 },
467 FALSE
468 };
469
470 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_IN_ARG_flags =
471 {
472 {
473 -1,
474 (gchar *) "flags",
475 (gchar *) "u",
476 NULL
477 },
478 FALSE
479 };
480
481 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_IN_ARG_app_id =
482 {
483 {
484 -1,
485 (gchar *) "app_id",
486 (gchar *) "s",
487 NULL
488 },
489 FALSE
490 };
491
492 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_IN_ARG_permissions =
493 {
494 {
495 -1,
496 (gchar *) "permissions",
497 (gchar *) "as",
498 NULL
499 },
500 FALSE
501 };
502
503 static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_full_IN_ARG_pointers[] =
504 {
505 &_gxdp_documents_method_info_add_named_full_IN_ARG_o_path_fd.parent_struct,
506 &_gxdp_documents_method_info_add_named_full_IN_ARG_filename.parent_struct,
507 &_gxdp_documents_method_info_add_named_full_IN_ARG_flags.parent_struct,
508 &_gxdp_documents_method_info_add_named_full_IN_ARG_app_id.parent_struct,
509 &_gxdp_documents_method_info_add_named_full_IN_ARG_permissions.parent_struct,
510 NULL
511 };
512
513 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_OUT_ARG_doc_id =
514 {
515 {
516 -1,
517 (gchar *) "doc_id",
518 (gchar *) "s",
519 NULL
520 },
521 FALSE
522 };
523
524 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_full_OUT_ARG_extra_out =
525 {
526 {
527 -1,
528 (gchar *) "extra_out",
529 (gchar *) "a{sv}",
530 NULL
531 },
532 FALSE
533 };
534
535 static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_full_OUT_ARG_pointers[] =
536 {
537 &_gxdp_documents_method_info_add_named_full_OUT_ARG_doc_id.parent_struct,
538 &_gxdp_documents_method_info_add_named_full_OUT_ARG_extra_out.parent_struct,
539 NULL
540 };
541
542 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add_named_full =
543 {
544 {
545 -1,
546 (gchar *) "AddNamedFull",
547 (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_full_IN_ARG_pointers,
548 (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_full_OUT_ARG_pointers,
549 NULL
550 },
551 "handle-add-named-full",
552 TRUE
553 };
554
555 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_doc_id =
556 {
557 {
558 -1,
559 (gchar *) "doc_id",
560 (gchar *) "s",
561 NULL
562 },
563 FALSE
564 };
565
566 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_app_id =
567 {
568 {
569 -1,
570 (gchar *) "app_id",
571 (gchar *) "s",
572 NULL
573 },
574 FALSE
575 };
576
577 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_permissions =
578 {
579 {
580 -1,
581 (gchar *) "permissions",
582 (gchar *) "as",
583 NULL
584 },
585 FALSE
586 };
587
588 static const GDBusArgInfo * const _gxdp_documents_method_info_grant_permissions_IN_ARG_pointers[] =
589 {
590 &_gxdp_documents_method_info_grant_permissions_IN_ARG_doc_id.parent_struct,
591 &_gxdp_documents_method_info_grant_permissions_IN_ARG_app_id.parent_struct,
592 &_gxdp_documents_method_info_grant_permissions_IN_ARG_permissions.parent_struct,
593 NULL
594 };
595
596 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_grant_permissions =
597 {
598 {
599 -1,
600 (gchar *) "GrantPermissions",
601 (GDBusArgInfo **) &_gxdp_documents_method_info_grant_permissions_IN_ARG_pointers,
602 NULL,
603 NULL
604 },
605 "handle-grant-permissions",
606 FALSE
607 };
608
609 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_doc_id =
610 {
611 {
612 -1,
613 (gchar *) "doc_id",
614 (gchar *) "s",
615 NULL
616 },
617 FALSE
618 };
619
620 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_app_id =
621 {
622 {
623 -1,
624 (gchar *) "app_id",
625 (gchar *) "s",
626 NULL
627 },
628 FALSE
629 };
630
631 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_permissions =
632 {
633 {
634 -1,
635 (gchar *) "permissions",
636 (gchar *) "as",
637 NULL
638 },
639 FALSE
640 };
641
642 static const GDBusArgInfo * const _gxdp_documents_method_info_revoke_permissions_IN_ARG_pointers[] =
643 {
644 &_gxdp_documents_method_info_revoke_permissions_IN_ARG_doc_id.parent_struct,
645 &_gxdp_documents_method_info_revoke_permissions_IN_ARG_app_id.parent_struct,
646 &_gxdp_documents_method_info_revoke_permissions_IN_ARG_permissions.parent_struct,
647 NULL
648 };
649
650 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_revoke_permissions =
651 {
652 {
653 -1,
654 (gchar *) "RevokePermissions",
655 (GDBusArgInfo **) &_gxdp_documents_method_info_revoke_permissions_IN_ARG_pointers,
656 NULL,
657 NULL
658 },
659 "handle-revoke-permissions",
660 FALSE
661 };
662
663 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_delete_IN_ARG_doc_id =
664 {
665 {
666 -1,
667 (gchar *) "doc_id",
668 (gchar *) "s",
669 NULL
670 },
671 FALSE
672 };
673
674 static const GDBusArgInfo * const _gxdp_documents_method_info_delete_IN_ARG_pointers[] =
675 {
676 &_gxdp_documents_method_info_delete_IN_ARG_doc_id.parent_struct,
677 NULL
678 };
679
680 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_delete =
681 {
682 {
683 -1,
684 (gchar *) "Delete",
685 (GDBusArgInfo **) &_gxdp_documents_method_info_delete_IN_ARG_pointers,
686 NULL,
687 NULL
688 },
689 "handle-delete",
690 FALSE
691 };
692
693 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_lookup_IN_ARG_filename =
694 {
695 {
696 -1,
697 (gchar *) "filename",
698 (gchar *) "ay",
699 NULL
700 },
701 FALSE
702 };
703
704 static const GDBusArgInfo * const _gxdp_documents_method_info_lookup_IN_ARG_pointers[] =
705 {
706 &_gxdp_documents_method_info_lookup_IN_ARG_filename.parent_struct,
707 NULL
708 };
709
710 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_lookup_OUT_ARG_doc_id =
711 {
712 {
713 -1,
714 (gchar *) "doc_id",
715 (gchar *) "s",
716 NULL
717 },
718 FALSE
719 };
720
721 static const GDBusArgInfo * const _gxdp_documents_method_info_lookup_OUT_ARG_pointers[] =
722 {
723 &_gxdp_documents_method_info_lookup_OUT_ARG_doc_id.parent_struct,
724 NULL
725 };
726
727 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_lookup =
728 {
729 {
730 -1,
731 (gchar *) "Lookup",
732 (GDBusArgInfo **) &_gxdp_documents_method_info_lookup_IN_ARG_pointers,
733 (GDBusArgInfo **) &_gxdp_documents_method_info_lookup_OUT_ARG_pointers,
734 NULL
735 },
736 "handle-lookup",
737 FALSE
738 };
739
740 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_IN_ARG_doc_id =
741 {
742 {
743 -1,
744 (gchar *) "doc_id",
745 (gchar *) "s",
746 NULL
747 },
748 FALSE
749 };
750
751 static const GDBusArgInfo * const _gxdp_documents_method_info_info_IN_ARG_pointers[] =
752 {
753 &_gxdp_documents_method_info_info_IN_ARG_doc_id.parent_struct,
754 NULL
755 };
756
757 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_OUT_ARG_path =
758 {
759 {
760 -1,
761 (gchar *) "path",
762 (gchar *) "ay",
763 NULL
764 },
765 FALSE
766 };
767
768 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_OUT_ARG_apps =
769 {
770 {
771 -1,
772 (gchar *) "apps",
773 (gchar *) "a{sas}",
774 NULL
775 },
776 FALSE
777 };
778
779 static const GDBusArgInfo * const _gxdp_documents_method_info_info_OUT_ARG_pointers[] =
780 {
781 &_gxdp_documents_method_info_info_OUT_ARG_path.parent_struct,
782 &_gxdp_documents_method_info_info_OUT_ARG_apps.parent_struct,
783 NULL
784 };
785
786 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_info =
787 {
788 {
789 -1,
790 (gchar *) "Info",
791 (GDBusArgInfo **) &_gxdp_documents_method_info_info_IN_ARG_pointers,
792 (GDBusArgInfo **) &_gxdp_documents_method_info_info_OUT_ARG_pointers,
793 NULL
794 },
795 "handle-info",
796 FALSE
797 };
798
799 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_list_IN_ARG_app_id =
800 {
801 {
802 -1,
803 (gchar *) "app_id",
804 (gchar *) "s",
805 NULL
806 },
807 FALSE
808 };
809
810 static const GDBusArgInfo * const _gxdp_documents_method_info_list_IN_ARG_pointers[] =
811 {
812 &_gxdp_documents_method_info_list_IN_ARG_app_id.parent_struct,
813 NULL
814 };
815
816 static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_list_OUT_ARG_docs =
817 {
818 {
819 -1,
820 (gchar *) "docs",
821 (gchar *) "a{say}",
822 NULL
823 },
824 FALSE
825 };
826
827 static const GDBusArgInfo * const _gxdp_documents_method_info_list_OUT_ARG_pointers[] =
828 {
829 &_gxdp_documents_method_info_list_OUT_ARG_docs.parent_struct,
830 NULL
831 };
832
833 static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_list =
834 {
835 {
836 -1,
837 (gchar *) "List",
838 (GDBusArgInfo **) &_gxdp_documents_method_info_list_IN_ARG_pointers,
839 (GDBusArgInfo **) &_gxdp_documents_method_info_list_OUT_ARG_pointers,
840 NULL
841 },
842 "handle-list",
843 FALSE
844 };
845
846 static const GDBusMethodInfo * const _gxdp_documents_method_info_pointers[] =
847 {
848 &_gxdp_documents_method_info_get_mount_point.parent_struct,
849 &_gxdp_documents_method_info_add.parent_struct,
850 &_gxdp_documents_method_info_add_named.parent_struct,
851 &_gxdp_documents_method_info_add_full.parent_struct,
852 &_gxdp_documents_method_info_add_named_full.parent_struct,
853 &_gxdp_documents_method_info_grant_permissions.parent_struct,
854 &_gxdp_documents_method_info_revoke_permissions.parent_struct,
855 &_gxdp_documents_method_info_delete.parent_struct,
856 &_gxdp_documents_method_info_lookup.parent_struct,
857 &_gxdp_documents_method_info_info.parent_struct,
858 &_gxdp_documents_method_info_list.parent_struct,
859 NULL
860 };
861
862 static const _ExtendedGDBusPropertyInfo _gxdp_documents_property_info_version =
863 {
864 {
865 -1,
866 (gchar *) "version",
867 (gchar *) "u",
868 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
869 NULL
870 },
871 "version",
872 FALSE,
873 TRUE
874 };
875
876 static const GDBusPropertyInfo * const _gxdp_documents_property_info_pointers[] =
877 {
878 &_gxdp_documents_property_info_version.parent_struct,
879 NULL
880 };
881
882 static const _ExtendedGDBusInterfaceInfo _gxdp_documents_interface_info =
883 {
884 {
885 -1,
886 (gchar *) "org.freedesktop.portal.Documents",
887 (GDBusMethodInfo **) &_gxdp_documents_method_info_pointers,
888 NULL,
889 (GDBusPropertyInfo **) &_gxdp_documents_property_info_pointers,
890 NULL
891 },
892 "documents",
893 };
894
895
896 /**
897 * gxdp_documents_interface_info:
898 *
899 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link> D-Bus interface.
900 *
901 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
902 */
903 GDBusInterfaceInfo *
gxdp_documents_interface_info(void)904 gxdp_documents_interface_info (void)
905 {
906 return (GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct;
907 }
908
909 /**
910 * gxdp_documents_override_properties:
911 * @klass: The class structure for a #GObject derived class.
912 * @property_id_begin: The property id to assign to the first overridden property.
913 *
914 * Overrides all #GObject properties in the #GXdpDocuments interface for a concrete class.
915 * The properties are overridden in the order they are defined.
916 *
917 * Returns: The last property id.
918 */
919 guint
gxdp_documents_override_properties(GObjectClass * klass,guint property_id_begin)920 gxdp_documents_override_properties (GObjectClass *klass, guint property_id_begin)
921 {
922 g_object_class_override_property (klass, property_id_begin++, "version");
923 return property_id_begin - 1;
924 }
925
926
927
928 /**
929 * GXdpDocuments:
930 *
931 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>.
932 */
933
934 /**
935 * GXdpDocumentsIface:
936 * @parent_iface: The parent interface.
937 * @handle_add: Handler for the #GXdpDocuments::handle-add signal.
938 * @handle_add_full: Handler for the #GXdpDocuments::handle-add-full signal.
939 * @handle_add_named: Handler for the #GXdpDocuments::handle-add-named signal.
940 * @handle_add_named_full: Handler for the #GXdpDocuments::handle-add-named-full signal.
941 * @handle_delete: Handler for the #GXdpDocuments::handle-delete signal.
942 * @handle_get_mount_point: Handler for the #GXdpDocuments::handle-get-mount-point signal.
943 * @handle_grant_permissions: Handler for the #GXdpDocuments::handle-grant-permissions signal.
944 * @handle_info: Handler for the #GXdpDocuments::handle-info signal.
945 * @handle_list: Handler for the #GXdpDocuments::handle-list signal.
946 * @handle_lookup: Handler for the #GXdpDocuments::handle-lookup signal.
947 * @handle_revoke_permissions: Handler for the #GXdpDocuments::handle-revoke-permissions signal.
948 * @get_version: Getter for the #GXdpDocuments:version property.
949 *
950 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>.
951 */
952
953 typedef GXdpDocumentsIface GXdpDocumentsInterface;
G_DEFINE_INTERFACE(GXdpDocuments,gxdp_documents,G_TYPE_OBJECT)954 G_DEFINE_INTERFACE (GXdpDocuments, gxdp_documents, G_TYPE_OBJECT)
955
956 static void
957 gxdp_documents_default_init (GXdpDocumentsIface *iface)
958 {
959 /* GObject signals for incoming D-Bus method calls: */
960 /**
961 * GXdpDocuments::handle-get-mount-point:
962 * @object: A #GXdpDocuments.
963 * @invocation: A #GDBusMethodInvocation.
964 *
965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</link> D-Bus method.
966 *
967 * 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 gxdp_documents_complete_get_mount_point() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
968 *
969 * 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.
970 */
971 g_signal_new ("handle-get-mount-point",
972 G_TYPE_FROM_INTERFACE (iface),
973 G_SIGNAL_RUN_LAST,
974 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_get_mount_point),
975 g_signal_accumulator_true_handled,
976 NULL,
977 g_cclosure_marshal_generic,
978 G_TYPE_BOOLEAN,
979 1,
980 G_TYPE_DBUS_METHOD_INVOCATION);
981
982 /**
983 * GXdpDocuments::handle-add:
984 * @object: A #GXdpDocuments.
985 * @invocation: A #GDBusMethodInvocation.
986 * @fd_list: (nullable): A #GUnixFDList or %NULL.
987 * @arg_o_path_fd: Argument passed by remote caller.
988 * @arg_reuse_existing: Argument passed by remote caller.
989 * @arg_persistent: Argument passed by remote caller.
990 *
991 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</link> D-Bus method.
992 *
993 * 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 gxdp_documents_complete_add() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
994 *
995 * 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.
996 */
997 g_signal_new ("handle-add",
998 G_TYPE_FROM_INTERFACE (iface),
999 G_SIGNAL_RUN_LAST,
1000 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add),
1001 g_signal_accumulator_true_handled,
1002 NULL,
1003 g_cclosure_marshal_generic,
1004 G_TYPE_BOOLEAN,
1005 5,
1006 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
1007
1008 /**
1009 * GXdpDocuments::handle-add-named:
1010 * @object: A #GXdpDocuments.
1011 * @invocation: A #GDBusMethodInvocation.
1012 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1013 * @arg_o_path_parent_fd: Argument passed by remote caller.
1014 * @arg_filename: Argument passed by remote caller.
1015 * @arg_reuse_existing: Argument passed by remote caller.
1016 * @arg_persistent: Argument passed by remote caller.
1017 *
1018 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</link> D-Bus method.
1019 *
1020 * 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 gxdp_documents_complete_add_named() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1021 *
1022 * 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.
1023 */
1024 g_signal_new ("handle-add-named",
1025 G_TYPE_FROM_INTERFACE (iface),
1026 G_SIGNAL_RUN_LAST,
1027 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add_named),
1028 g_signal_accumulator_true_handled,
1029 NULL,
1030 g_cclosure_marshal_generic,
1031 G_TYPE_BOOLEAN,
1032 6,
1033 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
1034
1035 /**
1036 * GXdpDocuments::handle-add-full:
1037 * @object: A #GXdpDocuments.
1038 * @invocation: A #GDBusMethodInvocation.
1039 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1040 * @arg_o_path_fds: Argument passed by remote caller.
1041 * @arg_flags: Argument passed by remote caller.
1042 * @arg_app_id: Argument passed by remote caller.
1043 * @arg_permissions: Argument passed by remote caller.
1044 *
1045 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</link> D-Bus method.
1046 *
1047 * 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 gxdp_documents_complete_add_full() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1048 *
1049 * 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.
1050 */
1051 g_signal_new ("handle-add-full",
1052 G_TYPE_FROM_INTERFACE (iface),
1053 G_SIGNAL_RUN_LAST,
1054 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add_full),
1055 g_signal_accumulator_true_handled,
1056 NULL,
1057 g_cclosure_marshal_generic,
1058 G_TYPE_BOOLEAN,
1059 6,
1060 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRV);
1061
1062 /**
1063 * GXdpDocuments::handle-add-named-full:
1064 * @object: A #GXdpDocuments.
1065 * @invocation: A #GDBusMethodInvocation.
1066 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1067 * @arg_o_path_fd: Argument passed by remote caller.
1068 * @arg_filename: Argument passed by remote caller.
1069 * @arg_flags: Argument passed by remote caller.
1070 * @arg_app_id: Argument passed by remote caller.
1071 * @arg_permissions: Argument passed by remote caller.
1072 *
1073 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamedFull">AddNamedFull()</link> D-Bus method.
1074 *
1075 * 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 gxdp_documents_complete_add_named_full() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1076 *
1077 * 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.
1078 */
1079 g_signal_new ("handle-add-named-full",
1080 G_TYPE_FROM_INTERFACE (iface),
1081 G_SIGNAL_RUN_LAST,
1082 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add_named_full),
1083 g_signal_accumulator_true_handled,
1084 NULL,
1085 g_cclosure_marshal_generic,
1086 G_TYPE_BOOLEAN,
1087 7,
1088 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRV);
1089
1090 /**
1091 * GXdpDocuments::handle-grant-permissions:
1092 * @object: A #GXdpDocuments.
1093 * @invocation: A #GDBusMethodInvocation.
1094 * @arg_doc_id: Argument passed by remote caller.
1095 * @arg_app_id: Argument passed by remote caller.
1096 * @arg_permissions: Argument passed by remote caller.
1097 *
1098 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</link> D-Bus method.
1099 *
1100 * 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 gxdp_documents_complete_grant_permissions() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1101 *
1102 * 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.
1103 */
1104 g_signal_new ("handle-grant-permissions",
1105 G_TYPE_FROM_INTERFACE (iface),
1106 G_SIGNAL_RUN_LAST,
1107 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_grant_permissions),
1108 g_signal_accumulator_true_handled,
1109 NULL,
1110 g_cclosure_marshal_generic,
1111 G_TYPE_BOOLEAN,
1112 4,
1113 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV);
1114
1115 /**
1116 * GXdpDocuments::handle-revoke-permissions:
1117 * @object: A #GXdpDocuments.
1118 * @invocation: A #GDBusMethodInvocation.
1119 * @arg_doc_id: Argument passed by remote caller.
1120 * @arg_app_id: Argument passed by remote caller.
1121 * @arg_permissions: Argument passed by remote caller.
1122 *
1123 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</link> D-Bus method.
1124 *
1125 * 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 gxdp_documents_complete_revoke_permissions() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1126 *
1127 * 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.
1128 */
1129 g_signal_new ("handle-revoke-permissions",
1130 G_TYPE_FROM_INTERFACE (iface),
1131 G_SIGNAL_RUN_LAST,
1132 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_revoke_permissions),
1133 g_signal_accumulator_true_handled,
1134 NULL,
1135 g_cclosure_marshal_generic,
1136 G_TYPE_BOOLEAN,
1137 4,
1138 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV);
1139
1140 /**
1141 * GXdpDocuments::handle-delete:
1142 * @object: A #GXdpDocuments.
1143 * @invocation: A #GDBusMethodInvocation.
1144 * @arg_doc_id: Argument passed by remote caller.
1145 *
1146 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</link> D-Bus method.
1147 *
1148 * 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 gxdp_documents_complete_delete() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1149 *
1150 * 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.
1151 */
1152 g_signal_new ("handle-delete",
1153 G_TYPE_FROM_INTERFACE (iface),
1154 G_SIGNAL_RUN_LAST,
1155 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_delete),
1156 g_signal_accumulator_true_handled,
1157 NULL,
1158 g_cclosure_marshal_generic,
1159 G_TYPE_BOOLEAN,
1160 2,
1161 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
1162
1163 /**
1164 * GXdpDocuments::handle-lookup:
1165 * @object: A #GXdpDocuments.
1166 * @invocation: A #GDBusMethodInvocation.
1167 * @arg_filename: Argument passed by remote caller.
1168 *
1169 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</link> D-Bus method.
1170 *
1171 * 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 gxdp_documents_complete_lookup() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1172 *
1173 * 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.
1174 */
1175 g_signal_new ("handle-lookup",
1176 G_TYPE_FROM_INTERFACE (iface),
1177 G_SIGNAL_RUN_LAST,
1178 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_lookup),
1179 g_signal_accumulator_true_handled,
1180 NULL,
1181 g_cclosure_marshal_generic,
1182 G_TYPE_BOOLEAN,
1183 2,
1184 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
1185
1186 /**
1187 * GXdpDocuments::handle-info:
1188 * @object: A #GXdpDocuments.
1189 * @invocation: A #GDBusMethodInvocation.
1190 * @arg_doc_id: Argument passed by remote caller.
1191 *
1192 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</link> D-Bus method.
1193 *
1194 * 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 gxdp_documents_complete_info() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1195 *
1196 * 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.
1197 */
1198 g_signal_new ("handle-info",
1199 G_TYPE_FROM_INTERFACE (iface),
1200 G_SIGNAL_RUN_LAST,
1201 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_info),
1202 g_signal_accumulator_true_handled,
1203 NULL,
1204 g_cclosure_marshal_generic,
1205 G_TYPE_BOOLEAN,
1206 2,
1207 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
1208
1209 /**
1210 * GXdpDocuments::handle-list:
1211 * @object: A #GXdpDocuments.
1212 * @invocation: A #GDBusMethodInvocation.
1213 * @arg_app_id: Argument passed by remote caller.
1214 *
1215 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</link> D-Bus method.
1216 *
1217 * 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 gxdp_documents_complete_list() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1218 *
1219 * 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.
1220 */
1221 g_signal_new ("handle-list",
1222 G_TYPE_FROM_INTERFACE (iface),
1223 G_SIGNAL_RUN_LAST,
1224 G_STRUCT_OFFSET (GXdpDocumentsIface, handle_list),
1225 g_signal_accumulator_true_handled,
1226 NULL,
1227 g_cclosure_marshal_generic,
1228 G_TYPE_BOOLEAN,
1229 2,
1230 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
1231
1232 /* GObject properties for D-Bus properties: */
1233 /**
1234 * GXdpDocuments:version:
1235 *
1236 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link>.
1237 *
1238 * 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.
1239 */
1240 g_object_interface_install_property (iface,
1241 g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1242 }
1243
1244 /**
1245 * gxdp_documents_get_version: (skip)
1246 * @object: A #GXdpDocuments.
1247 *
1248 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link> D-Bus property.
1249 *
1250 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1251 *
1252 * Returns: The property value.
1253 */
1254 guint
gxdp_documents_get_version(GXdpDocuments * object)1255 gxdp_documents_get_version (GXdpDocuments *object)
1256 {
1257 return GXDP_DOCUMENTS_GET_IFACE (object)->get_version (object);
1258 }
1259
1260 /**
1261 * gxdp_documents_set_version: (skip)
1262 * @object: A #GXdpDocuments.
1263 * @value: The value to set.
1264 *
1265 * Sets the <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link> D-Bus property to @value.
1266 *
1267 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1268 */
1269 void
gxdp_documents_set_version(GXdpDocuments * object,guint value)1270 gxdp_documents_set_version (GXdpDocuments *object, guint value)
1271 {
1272 g_object_set (G_OBJECT (object), "version", value, NULL);
1273 }
1274
1275 /**
1276 * gxdp_documents_call_get_mount_point:
1277 * @proxy: A #GXdpDocumentsProxy.
1278 * @cancellable: (nullable): A #GCancellable or %NULL.
1279 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1280 * @user_data: User data to pass to @callback.
1281 *
1282 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</link> D-Bus method on @proxy.
1283 * 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()).
1284 * You can then call gxdp_documents_call_get_mount_point_finish() to get the result of the operation.
1285 *
1286 * See gxdp_documents_call_get_mount_point_sync() for the synchronous, blocking version of this method.
1287 */
1288 void
gxdp_documents_call_get_mount_point(GXdpDocuments * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1289 gxdp_documents_call_get_mount_point (
1290 GXdpDocuments *proxy,
1291 GCancellable *cancellable,
1292 GAsyncReadyCallback callback,
1293 gpointer user_data)
1294 {
1295 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1296 "GetMountPoint",
1297 g_variant_new ("()"),
1298 G_DBUS_CALL_FLAGS_NONE,
1299 -1,
1300 cancellable,
1301 callback,
1302 user_data);
1303 }
1304
1305 /**
1306 * gxdp_documents_call_get_mount_point_finish:
1307 * @proxy: A #GXdpDocumentsProxy.
1308 * @out_path: (out) (optional): Return location for return parameter or %NULL to ignore.
1309 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_get_mount_point().
1310 * @error: Return location for error or %NULL.
1311 *
1312 * Finishes an operation started with gxdp_documents_call_get_mount_point().
1313 *
1314 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1315 */
1316 gboolean
gxdp_documents_call_get_mount_point_finish(GXdpDocuments * proxy,gchar ** out_path,GAsyncResult * res,GError ** error)1317 gxdp_documents_call_get_mount_point_finish (
1318 GXdpDocuments *proxy,
1319 gchar **out_path,
1320 GAsyncResult *res,
1321 GError **error)
1322 {
1323 GVariant *_ret;
1324 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1325 if (_ret == NULL)
1326 goto _out;
1327 g_variant_get (_ret,
1328 "(^ay)",
1329 out_path);
1330 g_variant_unref (_ret);
1331 _out:
1332 return _ret != NULL;
1333 }
1334
1335 /**
1336 * gxdp_documents_call_get_mount_point_sync:
1337 * @proxy: A #GXdpDocumentsProxy.
1338 * @out_path: (out) (optional): Return location for return parameter or %NULL to ignore.
1339 * @cancellable: (nullable): A #GCancellable or %NULL.
1340 * @error: Return location for error or %NULL.
1341 *
1342 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1343 *
1344 * See gxdp_documents_call_get_mount_point() for the asynchronous version of this method.
1345 *
1346 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1347 */
1348 gboolean
gxdp_documents_call_get_mount_point_sync(GXdpDocuments * proxy,gchar ** out_path,GCancellable * cancellable,GError ** error)1349 gxdp_documents_call_get_mount_point_sync (
1350 GXdpDocuments *proxy,
1351 gchar **out_path,
1352 GCancellable *cancellable,
1353 GError **error)
1354 {
1355 GVariant *_ret;
1356 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1357 "GetMountPoint",
1358 g_variant_new ("()"),
1359 G_DBUS_CALL_FLAGS_NONE,
1360 -1,
1361 cancellable,
1362 error);
1363 if (_ret == NULL)
1364 goto _out;
1365 g_variant_get (_ret,
1366 "(^ay)",
1367 out_path);
1368 g_variant_unref (_ret);
1369 _out:
1370 return _ret != NULL;
1371 }
1372
1373 /**
1374 * gxdp_documents_call_add:
1375 * @proxy: A #GXdpDocumentsProxy.
1376 * @arg_o_path_fd: Argument to pass with the method invocation.
1377 * @arg_reuse_existing: Argument to pass with the method invocation.
1378 * @arg_persistent: Argument to pass with the method invocation.
1379 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1380 * @cancellable: (nullable): A #GCancellable or %NULL.
1381 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1382 * @user_data: User data to pass to @callback.
1383 *
1384 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</link> D-Bus method on @proxy.
1385 * 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()).
1386 * You can then call gxdp_documents_call_add_finish() to get the result of the operation.
1387 *
1388 * See gxdp_documents_call_add_sync() for the synchronous, blocking version of this method.
1389 */
1390 void
gxdp_documents_call_add(GXdpDocuments * proxy,GVariant * arg_o_path_fd,gboolean arg_reuse_existing,gboolean arg_persistent,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1391 gxdp_documents_call_add (
1392 GXdpDocuments *proxy,
1393 GVariant *arg_o_path_fd,
1394 gboolean arg_reuse_existing,
1395 gboolean arg_persistent,
1396 GUnixFDList *fd_list,
1397 GCancellable *cancellable,
1398 GAsyncReadyCallback callback,
1399 gpointer user_data)
1400 {
1401 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
1402 "Add",
1403 g_variant_new ("(@hbb)",
1404 arg_o_path_fd,
1405 arg_reuse_existing,
1406 arg_persistent),
1407 G_DBUS_CALL_FLAGS_NONE,
1408 -1,
1409 fd_list,
1410 cancellable,
1411 callback,
1412 user_data);
1413 }
1414
1415 /**
1416 * gxdp_documents_call_add_finish:
1417 * @proxy: A #GXdpDocumentsProxy.
1418 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1419 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
1420 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add().
1421 * @error: Return location for error or %NULL.
1422 *
1423 * Finishes an operation started with gxdp_documents_call_add().
1424 *
1425 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1426 */
1427 gboolean
gxdp_documents_call_add_finish(GXdpDocuments * proxy,gchar ** out_doc_id,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)1428 gxdp_documents_call_add_finish (
1429 GXdpDocuments *proxy,
1430 gchar **out_doc_id,
1431 GUnixFDList **out_fd_list,
1432 GAsyncResult *res,
1433 GError **error)
1434 {
1435 GVariant *_ret;
1436 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
1437 if (_ret == NULL)
1438 goto _out;
1439 g_variant_get (_ret,
1440 "(s)",
1441 out_doc_id);
1442 g_variant_unref (_ret);
1443 _out:
1444 return _ret != NULL;
1445 }
1446
1447 /**
1448 * gxdp_documents_call_add_sync:
1449 * @proxy: A #GXdpDocumentsProxy.
1450 * @arg_o_path_fd: Argument to pass with the method invocation.
1451 * @arg_reuse_existing: Argument to pass with the method invocation.
1452 * @arg_persistent: Argument to pass with the method invocation.
1453 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1454 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1455 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
1456 * @cancellable: (nullable): A #GCancellable or %NULL.
1457 * @error: Return location for error or %NULL.
1458 *
1459 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1460 *
1461 * See gxdp_documents_call_add() for the asynchronous version of this method.
1462 *
1463 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1464 */
1465 gboolean
gxdp_documents_call_add_sync(GXdpDocuments * proxy,GVariant * arg_o_path_fd,gboolean arg_reuse_existing,gboolean arg_persistent,GUnixFDList * fd_list,gchar ** out_doc_id,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)1466 gxdp_documents_call_add_sync (
1467 GXdpDocuments *proxy,
1468 GVariant *arg_o_path_fd,
1469 gboolean arg_reuse_existing,
1470 gboolean arg_persistent,
1471 GUnixFDList *fd_list,
1472 gchar **out_doc_id,
1473 GUnixFDList **out_fd_list,
1474 GCancellable *cancellable,
1475 GError **error)
1476 {
1477 GVariant *_ret;
1478 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
1479 "Add",
1480 g_variant_new ("(@hbb)",
1481 arg_o_path_fd,
1482 arg_reuse_existing,
1483 arg_persistent),
1484 G_DBUS_CALL_FLAGS_NONE,
1485 -1,
1486 fd_list,
1487 out_fd_list,
1488 cancellable,
1489 error);
1490 if (_ret == NULL)
1491 goto _out;
1492 g_variant_get (_ret,
1493 "(s)",
1494 out_doc_id);
1495 g_variant_unref (_ret);
1496 _out:
1497 return _ret != NULL;
1498 }
1499
1500 /**
1501 * gxdp_documents_call_add_named:
1502 * @proxy: A #GXdpDocumentsProxy.
1503 * @arg_o_path_parent_fd: Argument to pass with the method invocation.
1504 * @arg_filename: Argument to pass with the method invocation.
1505 * @arg_reuse_existing: Argument to pass with the method invocation.
1506 * @arg_persistent: Argument to pass with the method invocation.
1507 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1508 * @cancellable: (nullable): A #GCancellable or %NULL.
1509 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1510 * @user_data: User data to pass to @callback.
1511 *
1512 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</link> D-Bus method on @proxy.
1513 * 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()).
1514 * You can then call gxdp_documents_call_add_named_finish() to get the result of the operation.
1515 *
1516 * See gxdp_documents_call_add_named_sync() for the synchronous, blocking version of this method.
1517 */
1518 void
gxdp_documents_call_add_named(GXdpDocuments * proxy,GVariant * arg_o_path_parent_fd,const gchar * arg_filename,gboolean arg_reuse_existing,gboolean arg_persistent,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1519 gxdp_documents_call_add_named (
1520 GXdpDocuments *proxy,
1521 GVariant *arg_o_path_parent_fd,
1522 const gchar *arg_filename,
1523 gboolean arg_reuse_existing,
1524 gboolean arg_persistent,
1525 GUnixFDList *fd_list,
1526 GCancellable *cancellable,
1527 GAsyncReadyCallback callback,
1528 gpointer user_data)
1529 {
1530 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
1531 "AddNamed",
1532 g_variant_new ("(@h^aybb)",
1533 arg_o_path_parent_fd,
1534 arg_filename,
1535 arg_reuse_existing,
1536 arg_persistent),
1537 G_DBUS_CALL_FLAGS_NONE,
1538 -1,
1539 fd_list,
1540 cancellable,
1541 callback,
1542 user_data);
1543 }
1544
1545 /**
1546 * gxdp_documents_call_add_named_finish:
1547 * @proxy: A #GXdpDocumentsProxy.
1548 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1549 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
1550 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add_named().
1551 * @error: Return location for error or %NULL.
1552 *
1553 * Finishes an operation started with gxdp_documents_call_add_named().
1554 *
1555 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1556 */
1557 gboolean
gxdp_documents_call_add_named_finish(GXdpDocuments * proxy,gchar ** out_doc_id,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)1558 gxdp_documents_call_add_named_finish (
1559 GXdpDocuments *proxy,
1560 gchar **out_doc_id,
1561 GUnixFDList **out_fd_list,
1562 GAsyncResult *res,
1563 GError **error)
1564 {
1565 GVariant *_ret;
1566 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
1567 if (_ret == NULL)
1568 goto _out;
1569 g_variant_get (_ret,
1570 "(s)",
1571 out_doc_id);
1572 g_variant_unref (_ret);
1573 _out:
1574 return _ret != NULL;
1575 }
1576
1577 /**
1578 * gxdp_documents_call_add_named_sync:
1579 * @proxy: A #GXdpDocumentsProxy.
1580 * @arg_o_path_parent_fd: Argument to pass with the method invocation.
1581 * @arg_filename: Argument to pass with the method invocation.
1582 * @arg_reuse_existing: Argument to pass with the method invocation.
1583 * @arg_persistent: Argument to pass with the method invocation.
1584 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1585 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1586 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
1587 * @cancellable: (nullable): A #GCancellable or %NULL.
1588 * @error: Return location for error or %NULL.
1589 *
1590 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1591 *
1592 * See gxdp_documents_call_add_named() for the asynchronous version of this method.
1593 *
1594 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1595 */
1596 gboolean
gxdp_documents_call_add_named_sync(GXdpDocuments * proxy,GVariant * arg_o_path_parent_fd,const gchar * arg_filename,gboolean arg_reuse_existing,gboolean arg_persistent,GUnixFDList * fd_list,gchar ** out_doc_id,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)1597 gxdp_documents_call_add_named_sync (
1598 GXdpDocuments *proxy,
1599 GVariant *arg_o_path_parent_fd,
1600 const gchar *arg_filename,
1601 gboolean arg_reuse_existing,
1602 gboolean arg_persistent,
1603 GUnixFDList *fd_list,
1604 gchar **out_doc_id,
1605 GUnixFDList **out_fd_list,
1606 GCancellable *cancellable,
1607 GError **error)
1608 {
1609 GVariant *_ret;
1610 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
1611 "AddNamed",
1612 g_variant_new ("(@h^aybb)",
1613 arg_o_path_parent_fd,
1614 arg_filename,
1615 arg_reuse_existing,
1616 arg_persistent),
1617 G_DBUS_CALL_FLAGS_NONE,
1618 -1,
1619 fd_list,
1620 out_fd_list,
1621 cancellable,
1622 error);
1623 if (_ret == NULL)
1624 goto _out;
1625 g_variant_get (_ret,
1626 "(s)",
1627 out_doc_id);
1628 g_variant_unref (_ret);
1629 _out:
1630 return _ret != NULL;
1631 }
1632
1633 /**
1634 * gxdp_documents_call_add_full:
1635 * @proxy: A #GXdpDocumentsProxy.
1636 * @arg_o_path_fds: Argument to pass with the method invocation.
1637 * @arg_flags: Argument to pass with the method invocation.
1638 * @arg_app_id: Argument to pass with the method invocation.
1639 * @arg_permissions: Argument to pass with the method invocation.
1640 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1641 * @cancellable: (nullable): A #GCancellable or %NULL.
1642 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1643 * @user_data: User data to pass to @callback.
1644 *
1645 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</link> D-Bus method on @proxy.
1646 * 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()).
1647 * You can then call gxdp_documents_call_add_full_finish() to get the result of the operation.
1648 *
1649 * See gxdp_documents_call_add_full_sync() for the synchronous, blocking version of this method.
1650 */
1651 void
gxdp_documents_call_add_full(GXdpDocuments * proxy,GVariant * arg_o_path_fds,guint arg_flags,const gchar * arg_app_id,const gchar * const * arg_permissions,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1652 gxdp_documents_call_add_full (
1653 GXdpDocuments *proxy,
1654 GVariant *arg_o_path_fds,
1655 guint arg_flags,
1656 const gchar *arg_app_id,
1657 const gchar *const *arg_permissions,
1658 GUnixFDList *fd_list,
1659 GCancellable *cancellable,
1660 GAsyncReadyCallback callback,
1661 gpointer user_data)
1662 {
1663 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
1664 "AddFull",
1665 g_variant_new ("(@ahus^as)",
1666 arg_o_path_fds,
1667 arg_flags,
1668 arg_app_id,
1669 arg_permissions),
1670 G_DBUS_CALL_FLAGS_NONE,
1671 -1,
1672 fd_list,
1673 cancellable,
1674 callback,
1675 user_data);
1676 }
1677
1678 /**
1679 * gxdp_documents_call_add_full_finish:
1680 * @proxy: A #GXdpDocumentsProxy.
1681 * @out_doc_ids: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
1682 * @out_extra_out: (out) (optional): Return location for return parameter or %NULL to ignore.
1683 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
1684 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add_full().
1685 * @error: Return location for error or %NULL.
1686 *
1687 * Finishes an operation started with gxdp_documents_call_add_full().
1688 *
1689 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1690 */
1691 gboolean
gxdp_documents_call_add_full_finish(GXdpDocuments * proxy,gchar *** out_doc_ids,GVariant ** out_extra_out,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)1692 gxdp_documents_call_add_full_finish (
1693 GXdpDocuments *proxy,
1694 gchar ***out_doc_ids,
1695 GVariant **out_extra_out,
1696 GUnixFDList **out_fd_list,
1697 GAsyncResult *res,
1698 GError **error)
1699 {
1700 GVariant *_ret;
1701 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
1702 if (_ret == NULL)
1703 goto _out;
1704 g_variant_get (_ret,
1705 "(^as@a{sv})",
1706 out_doc_ids,
1707 out_extra_out);
1708 g_variant_unref (_ret);
1709 _out:
1710 return _ret != NULL;
1711 }
1712
1713 /**
1714 * gxdp_documents_call_add_full_sync:
1715 * @proxy: A #GXdpDocumentsProxy.
1716 * @arg_o_path_fds: Argument to pass with the method invocation.
1717 * @arg_flags: Argument to pass with the method invocation.
1718 * @arg_app_id: Argument to pass with the method invocation.
1719 * @arg_permissions: Argument to pass with the method invocation.
1720 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1721 * @out_doc_ids: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
1722 * @out_extra_out: (out) (optional): Return location for return parameter or %NULL to ignore.
1723 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
1724 * @cancellable: (nullable): A #GCancellable or %NULL.
1725 * @error: Return location for error or %NULL.
1726 *
1727 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1728 *
1729 * See gxdp_documents_call_add_full() for the asynchronous version of this method.
1730 *
1731 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1732 */
1733 gboolean
gxdp_documents_call_add_full_sync(GXdpDocuments * proxy,GVariant * arg_o_path_fds,guint arg_flags,const gchar * arg_app_id,const gchar * const * arg_permissions,GUnixFDList * fd_list,gchar *** out_doc_ids,GVariant ** out_extra_out,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)1734 gxdp_documents_call_add_full_sync (
1735 GXdpDocuments *proxy,
1736 GVariant *arg_o_path_fds,
1737 guint arg_flags,
1738 const gchar *arg_app_id,
1739 const gchar *const *arg_permissions,
1740 GUnixFDList *fd_list,
1741 gchar ***out_doc_ids,
1742 GVariant **out_extra_out,
1743 GUnixFDList **out_fd_list,
1744 GCancellable *cancellable,
1745 GError **error)
1746 {
1747 GVariant *_ret;
1748 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
1749 "AddFull",
1750 g_variant_new ("(@ahus^as)",
1751 arg_o_path_fds,
1752 arg_flags,
1753 arg_app_id,
1754 arg_permissions),
1755 G_DBUS_CALL_FLAGS_NONE,
1756 -1,
1757 fd_list,
1758 out_fd_list,
1759 cancellable,
1760 error);
1761 if (_ret == NULL)
1762 goto _out;
1763 g_variant_get (_ret,
1764 "(^as@a{sv})",
1765 out_doc_ids,
1766 out_extra_out);
1767 g_variant_unref (_ret);
1768 _out:
1769 return _ret != NULL;
1770 }
1771
1772 /**
1773 * gxdp_documents_call_add_named_full:
1774 * @proxy: A #GXdpDocumentsProxy.
1775 * @arg_o_path_fd: Argument to pass with the method invocation.
1776 * @arg_filename: Argument to pass with the method invocation.
1777 * @arg_flags: Argument to pass with the method invocation.
1778 * @arg_app_id: Argument to pass with the method invocation.
1779 * @arg_permissions: Argument to pass with the method invocation.
1780 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1781 * @cancellable: (nullable): A #GCancellable or %NULL.
1782 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1783 * @user_data: User data to pass to @callback.
1784 *
1785 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamedFull">AddNamedFull()</link> D-Bus method on @proxy.
1786 * 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()).
1787 * You can then call gxdp_documents_call_add_named_full_finish() to get the result of the operation.
1788 *
1789 * See gxdp_documents_call_add_named_full_sync() for the synchronous, blocking version of this method.
1790 */
1791 void
gxdp_documents_call_add_named_full(GXdpDocuments * proxy,GVariant * arg_o_path_fd,const gchar * arg_filename,guint arg_flags,const gchar * arg_app_id,const gchar * const * arg_permissions,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1792 gxdp_documents_call_add_named_full (
1793 GXdpDocuments *proxy,
1794 GVariant *arg_o_path_fd,
1795 const gchar *arg_filename,
1796 guint arg_flags,
1797 const gchar *arg_app_id,
1798 const gchar *const *arg_permissions,
1799 GUnixFDList *fd_list,
1800 GCancellable *cancellable,
1801 GAsyncReadyCallback callback,
1802 gpointer user_data)
1803 {
1804 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
1805 "AddNamedFull",
1806 g_variant_new ("(@h^ayus^as)",
1807 arg_o_path_fd,
1808 arg_filename,
1809 arg_flags,
1810 arg_app_id,
1811 arg_permissions),
1812 G_DBUS_CALL_FLAGS_NONE,
1813 -1,
1814 fd_list,
1815 cancellable,
1816 callback,
1817 user_data);
1818 }
1819
1820 /**
1821 * gxdp_documents_call_add_named_full_finish:
1822 * @proxy: A #GXdpDocumentsProxy.
1823 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1824 * @out_extra_out: (out) (optional): Return location for return parameter or %NULL to ignore.
1825 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
1826 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add_named_full().
1827 * @error: Return location for error or %NULL.
1828 *
1829 * Finishes an operation started with gxdp_documents_call_add_named_full().
1830 *
1831 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1832 */
1833 gboolean
gxdp_documents_call_add_named_full_finish(GXdpDocuments * proxy,gchar ** out_doc_id,GVariant ** out_extra_out,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)1834 gxdp_documents_call_add_named_full_finish (
1835 GXdpDocuments *proxy,
1836 gchar **out_doc_id,
1837 GVariant **out_extra_out,
1838 GUnixFDList **out_fd_list,
1839 GAsyncResult *res,
1840 GError **error)
1841 {
1842 GVariant *_ret;
1843 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
1844 if (_ret == NULL)
1845 goto _out;
1846 g_variant_get (_ret,
1847 "(s@a{sv})",
1848 out_doc_id,
1849 out_extra_out);
1850 g_variant_unref (_ret);
1851 _out:
1852 return _ret != NULL;
1853 }
1854
1855 /**
1856 * gxdp_documents_call_add_named_full_sync:
1857 * @proxy: A #GXdpDocumentsProxy.
1858 * @arg_o_path_fd: Argument to pass with the method invocation.
1859 * @arg_filename: Argument to pass with the method invocation.
1860 * @arg_flags: Argument to pass with the method invocation.
1861 * @arg_app_id: Argument to pass with the method invocation.
1862 * @arg_permissions: Argument to pass with the method invocation.
1863 * @fd_list: (nullable): A #GUnixFDList or %NULL.
1864 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
1865 * @out_extra_out: (out) (optional): Return location for return parameter or %NULL to ignore.
1866 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
1867 * @cancellable: (nullable): A #GCancellable or %NULL.
1868 * @error: Return location for error or %NULL.
1869 *
1870 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamedFull">AddNamedFull()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1871 *
1872 * See gxdp_documents_call_add_named_full() for the asynchronous version of this method.
1873 *
1874 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1875 */
1876 gboolean
gxdp_documents_call_add_named_full_sync(GXdpDocuments * proxy,GVariant * arg_o_path_fd,const gchar * arg_filename,guint arg_flags,const gchar * arg_app_id,const gchar * const * arg_permissions,GUnixFDList * fd_list,gchar ** out_doc_id,GVariant ** out_extra_out,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)1877 gxdp_documents_call_add_named_full_sync (
1878 GXdpDocuments *proxy,
1879 GVariant *arg_o_path_fd,
1880 const gchar *arg_filename,
1881 guint arg_flags,
1882 const gchar *arg_app_id,
1883 const gchar *const *arg_permissions,
1884 GUnixFDList *fd_list,
1885 gchar **out_doc_id,
1886 GVariant **out_extra_out,
1887 GUnixFDList **out_fd_list,
1888 GCancellable *cancellable,
1889 GError **error)
1890 {
1891 GVariant *_ret;
1892 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
1893 "AddNamedFull",
1894 g_variant_new ("(@h^ayus^as)",
1895 arg_o_path_fd,
1896 arg_filename,
1897 arg_flags,
1898 arg_app_id,
1899 arg_permissions),
1900 G_DBUS_CALL_FLAGS_NONE,
1901 -1,
1902 fd_list,
1903 out_fd_list,
1904 cancellable,
1905 error);
1906 if (_ret == NULL)
1907 goto _out;
1908 g_variant_get (_ret,
1909 "(s@a{sv})",
1910 out_doc_id,
1911 out_extra_out);
1912 g_variant_unref (_ret);
1913 _out:
1914 return _ret != NULL;
1915 }
1916
1917 /**
1918 * gxdp_documents_call_grant_permissions:
1919 * @proxy: A #GXdpDocumentsProxy.
1920 * @arg_doc_id: Argument to pass with the method invocation.
1921 * @arg_app_id: Argument to pass with the method invocation.
1922 * @arg_permissions: Argument to pass with the method invocation.
1923 * @cancellable: (nullable): A #GCancellable or %NULL.
1924 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1925 * @user_data: User data to pass to @callback.
1926 *
1927 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</link> D-Bus method on @proxy.
1928 * 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()).
1929 * You can then call gxdp_documents_call_grant_permissions_finish() to get the result of the operation.
1930 *
1931 * See gxdp_documents_call_grant_permissions_sync() for the synchronous, blocking version of this method.
1932 */
1933 void
gxdp_documents_call_grant_permissions(GXdpDocuments * proxy,const gchar * arg_doc_id,const gchar * arg_app_id,const gchar * const * arg_permissions,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1934 gxdp_documents_call_grant_permissions (
1935 GXdpDocuments *proxy,
1936 const gchar *arg_doc_id,
1937 const gchar *arg_app_id,
1938 const gchar *const *arg_permissions,
1939 GCancellable *cancellable,
1940 GAsyncReadyCallback callback,
1941 gpointer user_data)
1942 {
1943 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1944 "GrantPermissions",
1945 g_variant_new ("(ss^as)",
1946 arg_doc_id,
1947 arg_app_id,
1948 arg_permissions),
1949 G_DBUS_CALL_FLAGS_NONE,
1950 -1,
1951 cancellable,
1952 callback,
1953 user_data);
1954 }
1955
1956 /**
1957 * gxdp_documents_call_grant_permissions_finish:
1958 * @proxy: A #GXdpDocumentsProxy.
1959 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_grant_permissions().
1960 * @error: Return location for error or %NULL.
1961 *
1962 * Finishes an operation started with gxdp_documents_call_grant_permissions().
1963 *
1964 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1965 */
1966 gboolean
gxdp_documents_call_grant_permissions_finish(GXdpDocuments * proxy,GAsyncResult * res,GError ** error)1967 gxdp_documents_call_grant_permissions_finish (
1968 GXdpDocuments *proxy,
1969 GAsyncResult *res,
1970 GError **error)
1971 {
1972 GVariant *_ret;
1973 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1974 if (_ret == NULL)
1975 goto _out;
1976 g_variant_get (_ret,
1977 "()");
1978 g_variant_unref (_ret);
1979 _out:
1980 return _ret != NULL;
1981 }
1982
1983 /**
1984 * gxdp_documents_call_grant_permissions_sync:
1985 * @proxy: A #GXdpDocumentsProxy.
1986 * @arg_doc_id: Argument to pass with the method invocation.
1987 * @arg_app_id: Argument to pass with the method invocation.
1988 * @arg_permissions: Argument to pass with the method invocation.
1989 * @cancellable: (nullable): A #GCancellable or %NULL.
1990 * @error: Return location for error or %NULL.
1991 *
1992 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1993 *
1994 * See gxdp_documents_call_grant_permissions() for the asynchronous version of this method.
1995 *
1996 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1997 */
1998 gboolean
gxdp_documents_call_grant_permissions_sync(GXdpDocuments * proxy,const gchar * arg_doc_id,const gchar * arg_app_id,const gchar * const * arg_permissions,GCancellable * cancellable,GError ** error)1999 gxdp_documents_call_grant_permissions_sync (
2000 GXdpDocuments *proxy,
2001 const gchar *arg_doc_id,
2002 const gchar *arg_app_id,
2003 const gchar *const *arg_permissions,
2004 GCancellable *cancellable,
2005 GError **error)
2006 {
2007 GVariant *_ret;
2008 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2009 "GrantPermissions",
2010 g_variant_new ("(ss^as)",
2011 arg_doc_id,
2012 arg_app_id,
2013 arg_permissions),
2014 G_DBUS_CALL_FLAGS_NONE,
2015 -1,
2016 cancellable,
2017 error);
2018 if (_ret == NULL)
2019 goto _out;
2020 g_variant_get (_ret,
2021 "()");
2022 g_variant_unref (_ret);
2023 _out:
2024 return _ret != NULL;
2025 }
2026
2027 /**
2028 * gxdp_documents_call_revoke_permissions:
2029 * @proxy: A #GXdpDocumentsProxy.
2030 * @arg_doc_id: Argument to pass with the method invocation.
2031 * @arg_app_id: Argument to pass with the method invocation.
2032 * @arg_permissions: Argument to pass with the method invocation.
2033 * @cancellable: (nullable): A #GCancellable or %NULL.
2034 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2035 * @user_data: User data to pass to @callback.
2036 *
2037 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</link> D-Bus method on @proxy.
2038 * 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()).
2039 * You can then call gxdp_documents_call_revoke_permissions_finish() to get the result of the operation.
2040 *
2041 * See gxdp_documents_call_revoke_permissions_sync() for the synchronous, blocking version of this method.
2042 */
2043 void
gxdp_documents_call_revoke_permissions(GXdpDocuments * proxy,const gchar * arg_doc_id,const gchar * arg_app_id,const gchar * const * arg_permissions,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2044 gxdp_documents_call_revoke_permissions (
2045 GXdpDocuments *proxy,
2046 const gchar *arg_doc_id,
2047 const gchar *arg_app_id,
2048 const gchar *const *arg_permissions,
2049 GCancellable *cancellable,
2050 GAsyncReadyCallback callback,
2051 gpointer user_data)
2052 {
2053 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2054 "RevokePermissions",
2055 g_variant_new ("(ss^as)",
2056 arg_doc_id,
2057 arg_app_id,
2058 arg_permissions),
2059 G_DBUS_CALL_FLAGS_NONE,
2060 -1,
2061 cancellable,
2062 callback,
2063 user_data);
2064 }
2065
2066 /**
2067 * gxdp_documents_call_revoke_permissions_finish:
2068 * @proxy: A #GXdpDocumentsProxy.
2069 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_revoke_permissions().
2070 * @error: Return location for error or %NULL.
2071 *
2072 * Finishes an operation started with gxdp_documents_call_revoke_permissions().
2073 *
2074 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2075 */
2076 gboolean
gxdp_documents_call_revoke_permissions_finish(GXdpDocuments * proxy,GAsyncResult * res,GError ** error)2077 gxdp_documents_call_revoke_permissions_finish (
2078 GXdpDocuments *proxy,
2079 GAsyncResult *res,
2080 GError **error)
2081 {
2082 GVariant *_ret;
2083 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2084 if (_ret == NULL)
2085 goto _out;
2086 g_variant_get (_ret,
2087 "()");
2088 g_variant_unref (_ret);
2089 _out:
2090 return _ret != NULL;
2091 }
2092
2093 /**
2094 * gxdp_documents_call_revoke_permissions_sync:
2095 * @proxy: A #GXdpDocumentsProxy.
2096 * @arg_doc_id: Argument to pass with the method invocation.
2097 * @arg_app_id: Argument to pass with the method invocation.
2098 * @arg_permissions: Argument to pass with the method invocation.
2099 * @cancellable: (nullable): A #GCancellable or %NULL.
2100 * @error: Return location for error or %NULL.
2101 *
2102 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2103 *
2104 * See gxdp_documents_call_revoke_permissions() for the asynchronous version of this method.
2105 *
2106 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2107 */
2108 gboolean
gxdp_documents_call_revoke_permissions_sync(GXdpDocuments * proxy,const gchar * arg_doc_id,const gchar * arg_app_id,const gchar * const * arg_permissions,GCancellable * cancellable,GError ** error)2109 gxdp_documents_call_revoke_permissions_sync (
2110 GXdpDocuments *proxy,
2111 const gchar *arg_doc_id,
2112 const gchar *arg_app_id,
2113 const gchar *const *arg_permissions,
2114 GCancellable *cancellable,
2115 GError **error)
2116 {
2117 GVariant *_ret;
2118 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2119 "RevokePermissions",
2120 g_variant_new ("(ss^as)",
2121 arg_doc_id,
2122 arg_app_id,
2123 arg_permissions),
2124 G_DBUS_CALL_FLAGS_NONE,
2125 -1,
2126 cancellable,
2127 error);
2128 if (_ret == NULL)
2129 goto _out;
2130 g_variant_get (_ret,
2131 "()");
2132 g_variant_unref (_ret);
2133 _out:
2134 return _ret != NULL;
2135 }
2136
2137 /**
2138 * gxdp_documents_call_delete:
2139 * @proxy: A #GXdpDocumentsProxy.
2140 * @arg_doc_id: Argument to pass with the method invocation.
2141 * @cancellable: (nullable): A #GCancellable or %NULL.
2142 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2143 * @user_data: User data to pass to @callback.
2144 *
2145 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</link> D-Bus method on @proxy.
2146 * 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()).
2147 * You can then call gxdp_documents_call_delete_finish() to get the result of the operation.
2148 *
2149 * See gxdp_documents_call_delete_sync() for the synchronous, blocking version of this method.
2150 */
2151 void
gxdp_documents_call_delete(GXdpDocuments * proxy,const gchar * arg_doc_id,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2152 gxdp_documents_call_delete (
2153 GXdpDocuments *proxy,
2154 const gchar *arg_doc_id,
2155 GCancellable *cancellable,
2156 GAsyncReadyCallback callback,
2157 gpointer user_data)
2158 {
2159 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2160 "Delete",
2161 g_variant_new ("(s)",
2162 arg_doc_id),
2163 G_DBUS_CALL_FLAGS_NONE,
2164 -1,
2165 cancellable,
2166 callback,
2167 user_data);
2168 }
2169
2170 /**
2171 * gxdp_documents_call_delete_finish:
2172 * @proxy: A #GXdpDocumentsProxy.
2173 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_delete().
2174 * @error: Return location for error or %NULL.
2175 *
2176 * Finishes an operation started with gxdp_documents_call_delete().
2177 *
2178 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2179 */
2180 gboolean
gxdp_documents_call_delete_finish(GXdpDocuments * proxy,GAsyncResult * res,GError ** error)2181 gxdp_documents_call_delete_finish (
2182 GXdpDocuments *proxy,
2183 GAsyncResult *res,
2184 GError **error)
2185 {
2186 GVariant *_ret;
2187 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2188 if (_ret == NULL)
2189 goto _out;
2190 g_variant_get (_ret,
2191 "()");
2192 g_variant_unref (_ret);
2193 _out:
2194 return _ret != NULL;
2195 }
2196
2197 /**
2198 * gxdp_documents_call_delete_sync:
2199 * @proxy: A #GXdpDocumentsProxy.
2200 * @arg_doc_id: Argument to pass with the method invocation.
2201 * @cancellable: (nullable): A #GCancellable or %NULL.
2202 * @error: Return location for error or %NULL.
2203 *
2204 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2205 *
2206 * See gxdp_documents_call_delete() for the asynchronous version of this method.
2207 *
2208 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2209 */
2210 gboolean
gxdp_documents_call_delete_sync(GXdpDocuments * proxy,const gchar * arg_doc_id,GCancellable * cancellable,GError ** error)2211 gxdp_documents_call_delete_sync (
2212 GXdpDocuments *proxy,
2213 const gchar *arg_doc_id,
2214 GCancellable *cancellable,
2215 GError **error)
2216 {
2217 GVariant *_ret;
2218 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2219 "Delete",
2220 g_variant_new ("(s)",
2221 arg_doc_id),
2222 G_DBUS_CALL_FLAGS_NONE,
2223 -1,
2224 cancellable,
2225 error);
2226 if (_ret == NULL)
2227 goto _out;
2228 g_variant_get (_ret,
2229 "()");
2230 g_variant_unref (_ret);
2231 _out:
2232 return _ret != NULL;
2233 }
2234
2235 /**
2236 * gxdp_documents_call_lookup:
2237 * @proxy: A #GXdpDocumentsProxy.
2238 * @arg_filename: Argument to pass with the method invocation.
2239 * @cancellable: (nullable): A #GCancellable or %NULL.
2240 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2241 * @user_data: User data to pass to @callback.
2242 *
2243 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</link> D-Bus method on @proxy.
2244 * 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()).
2245 * You can then call gxdp_documents_call_lookup_finish() to get the result of the operation.
2246 *
2247 * See gxdp_documents_call_lookup_sync() for the synchronous, blocking version of this method.
2248 */
2249 void
gxdp_documents_call_lookup(GXdpDocuments * proxy,const gchar * arg_filename,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2250 gxdp_documents_call_lookup (
2251 GXdpDocuments *proxy,
2252 const gchar *arg_filename,
2253 GCancellable *cancellable,
2254 GAsyncReadyCallback callback,
2255 gpointer user_data)
2256 {
2257 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2258 "Lookup",
2259 g_variant_new ("(^ay)",
2260 arg_filename),
2261 G_DBUS_CALL_FLAGS_NONE,
2262 -1,
2263 cancellable,
2264 callback,
2265 user_data);
2266 }
2267
2268 /**
2269 * gxdp_documents_call_lookup_finish:
2270 * @proxy: A #GXdpDocumentsProxy.
2271 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
2272 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_lookup().
2273 * @error: Return location for error or %NULL.
2274 *
2275 * Finishes an operation started with gxdp_documents_call_lookup().
2276 *
2277 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2278 */
2279 gboolean
gxdp_documents_call_lookup_finish(GXdpDocuments * proxy,gchar ** out_doc_id,GAsyncResult * res,GError ** error)2280 gxdp_documents_call_lookup_finish (
2281 GXdpDocuments *proxy,
2282 gchar **out_doc_id,
2283 GAsyncResult *res,
2284 GError **error)
2285 {
2286 GVariant *_ret;
2287 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2288 if (_ret == NULL)
2289 goto _out;
2290 g_variant_get (_ret,
2291 "(s)",
2292 out_doc_id);
2293 g_variant_unref (_ret);
2294 _out:
2295 return _ret != NULL;
2296 }
2297
2298 /**
2299 * gxdp_documents_call_lookup_sync:
2300 * @proxy: A #GXdpDocumentsProxy.
2301 * @arg_filename: Argument to pass with the method invocation.
2302 * @out_doc_id: (out) (optional): Return location for return parameter or %NULL to ignore.
2303 * @cancellable: (nullable): A #GCancellable or %NULL.
2304 * @error: Return location for error or %NULL.
2305 *
2306 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2307 *
2308 * See gxdp_documents_call_lookup() for the asynchronous version of this method.
2309 *
2310 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2311 */
2312 gboolean
gxdp_documents_call_lookup_sync(GXdpDocuments * proxy,const gchar * arg_filename,gchar ** out_doc_id,GCancellable * cancellable,GError ** error)2313 gxdp_documents_call_lookup_sync (
2314 GXdpDocuments *proxy,
2315 const gchar *arg_filename,
2316 gchar **out_doc_id,
2317 GCancellable *cancellable,
2318 GError **error)
2319 {
2320 GVariant *_ret;
2321 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2322 "Lookup",
2323 g_variant_new ("(^ay)",
2324 arg_filename),
2325 G_DBUS_CALL_FLAGS_NONE,
2326 -1,
2327 cancellable,
2328 error);
2329 if (_ret == NULL)
2330 goto _out;
2331 g_variant_get (_ret,
2332 "(s)",
2333 out_doc_id);
2334 g_variant_unref (_ret);
2335 _out:
2336 return _ret != NULL;
2337 }
2338
2339 /**
2340 * gxdp_documents_call_info:
2341 * @proxy: A #GXdpDocumentsProxy.
2342 * @arg_doc_id: Argument to pass with the method invocation.
2343 * @cancellable: (nullable): A #GCancellable or %NULL.
2344 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2345 * @user_data: User data to pass to @callback.
2346 *
2347 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</link> D-Bus method on @proxy.
2348 * 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()).
2349 * You can then call gxdp_documents_call_info_finish() to get the result of the operation.
2350 *
2351 * See gxdp_documents_call_info_sync() for the synchronous, blocking version of this method.
2352 */
2353 void
gxdp_documents_call_info(GXdpDocuments * proxy,const gchar * arg_doc_id,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2354 gxdp_documents_call_info (
2355 GXdpDocuments *proxy,
2356 const gchar *arg_doc_id,
2357 GCancellable *cancellable,
2358 GAsyncReadyCallback callback,
2359 gpointer user_data)
2360 {
2361 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2362 "Info",
2363 g_variant_new ("(s)",
2364 arg_doc_id),
2365 G_DBUS_CALL_FLAGS_NONE,
2366 -1,
2367 cancellable,
2368 callback,
2369 user_data);
2370 }
2371
2372 /**
2373 * gxdp_documents_call_info_finish:
2374 * @proxy: A #GXdpDocumentsProxy.
2375 * @out_path: (out) (optional): Return location for return parameter or %NULL to ignore.
2376 * @out_apps: (out) (optional): Return location for return parameter or %NULL to ignore.
2377 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_info().
2378 * @error: Return location for error or %NULL.
2379 *
2380 * Finishes an operation started with gxdp_documents_call_info().
2381 *
2382 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2383 */
2384 gboolean
gxdp_documents_call_info_finish(GXdpDocuments * proxy,gchar ** out_path,GVariant ** out_apps,GAsyncResult * res,GError ** error)2385 gxdp_documents_call_info_finish (
2386 GXdpDocuments *proxy,
2387 gchar **out_path,
2388 GVariant **out_apps,
2389 GAsyncResult *res,
2390 GError **error)
2391 {
2392 GVariant *_ret;
2393 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2394 if (_ret == NULL)
2395 goto _out;
2396 g_variant_get (_ret,
2397 "(^ay@a{sas})",
2398 out_path,
2399 out_apps);
2400 g_variant_unref (_ret);
2401 _out:
2402 return _ret != NULL;
2403 }
2404
2405 /**
2406 * gxdp_documents_call_info_sync:
2407 * @proxy: A #GXdpDocumentsProxy.
2408 * @arg_doc_id: Argument to pass with the method invocation.
2409 * @out_path: (out) (optional): Return location for return parameter or %NULL to ignore.
2410 * @out_apps: (out) (optional): Return location for return parameter or %NULL to ignore.
2411 * @cancellable: (nullable): A #GCancellable or %NULL.
2412 * @error: Return location for error or %NULL.
2413 *
2414 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2415 *
2416 * See gxdp_documents_call_info() for the asynchronous version of this method.
2417 *
2418 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2419 */
2420 gboolean
gxdp_documents_call_info_sync(GXdpDocuments * proxy,const gchar * arg_doc_id,gchar ** out_path,GVariant ** out_apps,GCancellable * cancellable,GError ** error)2421 gxdp_documents_call_info_sync (
2422 GXdpDocuments *proxy,
2423 const gchar *arg_doc_id,
2424 gchar **out_path,
2425 GVariant **out_apps,
2426 GCancellable *cancellable,
2427 GError **error)
2428 {
2429 GVariant *_ret;
2430 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2431 "Info",
2432 g_variant_new ("(s)",
2433 arg_doc_id),
2434 G_DBUS_CALL_FLAGS_NONE,
2435 -1,
2436 cancellable,
2437 error);
2438 if (_ret == NULL)
2439 goto _out;
2440 g_variant_get (_ret,
2441 "(^ay@a{sas})",
2442 out_path,
2443 out_apps);
2444 g_variant_unref (_ret);
2445 _out:
2446 return _ret != NULL;
2447 }
2448
2449 /**
2450 * gxdp_documents_call_list:
2451 * @proxy: A #GXdpDocumentsProxy.
2452 * @arg_app_id: Argument to pass with the method invocation.
2453 * @cancellable: (nullable): A #GCancellable or %NULL.
2454 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2455 * @user_data: User data to pass to @callback.
2456 *
2457 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</link> D-Bus method on @proxy.
2458 * 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()).
2459 * You can then call gxdp_documents_call_list_finish() to get the result of the operation.
2460 *
2461 * See gxdp_documents_call_list_sync() for the synchronous, blocking version of this method.
2462 */
2463 void
gxdp_documents_call_list(GXdpDocuments * proxy,const gchar * arg_app_id,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2464 gxdp_documents_call_list (
2465 GXdpDocuments *proxy,
2466 const gchar *arg_app_id,
2467 GCancellable *cancellable,
2468 GAsyncReadyCallback callback,
2469 gpointer user_data)
2470 {
2471 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2472 "List",
2473 g_variant_new ("(s)",
2474 arg_app_id),
2475 G_DBUS_CALL_FLAGS_NONE,
2476 -1,
2477 cancellable,
2478 callback,
2479 user_data);
2480 }
2481
2482 /**
2483 * gxdp_documents_call_list_finish:
2484 * @proxy: A #GXdpDocumentsProxy.
2485 * @out_docs: (out) (optional): Return location for return parameter or %NULL to ignore.
2486 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_list().
2487 * @error: Return location for error or %NULL.
2488 *
2489 * Finishes an operation started with gxdp_documents_call_list().
2490 *
2491 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2492 */
2493 gboolean
gxdp_documents_call_list_finish(GXdpDocuments * proxy,GVariant ** out_docs,GAsyncResult * res,GError ** error)2494 gxdp_documents_call_list_finish (
2495 GXdpDocuments *proxy,
2496 GVariant **out_docs,
2497 GAsyncResult *res,
2498 GError **error)
2499 {
2500 GVariant *_ret;
2501 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2502 if (_ret == NULL)
2503 goto _out;
2504 g_variant_get (_ret,
2505 "(@a{say})",
2506 out_docs);
2507 g_variant_unref (_ret);
2508 _out:
2509 return _ret != NULL;
2510 }
2511
2512 /**
2513 * gxdp_documents_call_list_sync:
2514 * @proxy: A #GXdpDocumentsProxy.
2515 * @arg_app_id: Argument to pass with the method invocation.
2516 * @out_docs: (out) (optional): Return location for return parameter or %NULL to ignore.
2517 * @cancellable: (nullable): A #GCancellable or %NULL.
2518 * @error: Return location for error or %NULL.
2519 *
2520 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2521 *
2522 * See gxdp_documents_call_list() for the asynchronous version of this method.
2523 *
2524 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2525 */
2526 gboolean
gxdp_documents_call_list_sync(GXdpDocuments * proxy,const gchar * arg_app_id,GVariant ** out_docs,GCancellable * cancellable,GError ** error)2527 gxdp_documents_call_list_sync (
2528 GXdpDocuments *proxy,
2529 const gchar *arg_app_id,
2530 GVariant **out_docs,
2531 GCancellable *cancellable,
2532 GError **error)
2533 {
2534 GVariant *_ret;
2535 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2536 "List",
2537 g_variant_new ("(s)",
2538 arg_app_id),
2539 G_DBUS_CALL_FLAGS_NONE,
2540 -1,
2541 cancellable,
2542 error);
2543 if (_ret == NULL)
2544 goto _out;
2545 g_variant_get (_ret,
2546 "(@a{say})",
2547 out_docs);
2548 g_variant_unref (_ret);
2549 _out:
2550 return _ret != NULL;
2551 }
2552
2553 /**
2554 * gxdp_documents_complete_get_mount_point:
2555 * @object: A #GXdpDocuments.
2556 * @invocation: (transfer full): A #GDBusMethodInvocation.
2557 * @path: Parameter to return.
2558 *
2559 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</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.
2560 *
2561 * This method will free @invocation, you cannot use it afterwards.
2562 */
2563 void
gxdp_documents_complete_get_mount_point(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * path)2564 gxdp_documents_complete_get_mount_point (
2565 GXdpDocuments *object G_GNUC_UNUSED,
2566 GDBusMethodInvocation *invocation,
2567 const gchar *path)
2568 {
2569 g_dbus_method_invocation_return_value (invocation,
2570 g_variant_new ("(^ay)",
2571 path));
2572 }
2573
2574 /**
2575 * gxdp_documents_complete_add:
2576 * @object: A #GXdpDocuments.
2577 * @invocation: (transfer full): A #GDBusMethodInvocation.
2578 * @fd_list: (nullable): A #GUnixFDList or %NULL.
2579 * @doc_id: Parameter to return.
2580 *
2581 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</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.
2582 *
2583 * This method will free @invocation, you cannot use it afterwards.
2584 */
2585 void
gxdp_documents_complete_add(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * doc_id)2586 gxdp_documents_complete_add (
2587 GXdpDocuments *object G_GNUC_UNUSED,
2588 GDBusMethodInvocation *invocation,
2589 GUnixFDList *fd_list,
2590 const gchar *doc_id)
2591 {
2592 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
2593 g_variant_new ("(s)",
2594 doc_id),
2595 fd_list);
2596 }
2597
2598 /**
2599 * gxdp_documents_complete_add_named:
2600 * @object: A #GXdpDocuments.
2601 * @invocation: (transfer full): A #GDBusMethodInvocation.
2602 * @fd_list: (nullable): A #GUnixFDList or %NULL.
2603 * @doc_id: Parameter to return.
2604 *
2605 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</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.
2606 *
2607 * This method will free @invocation, you cannot use it afterwards.
2608 */
2609 void
gxdp_documents_complete_add_named(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * doc_id)2610 gxdp_documents_complete_add_named (
2611 GXdpDocuments *object G_GNUC_UNUSED,
2612 GDBusMethodInvocation *invocation,
2613 GUnixFDList *fd_list,
2614 const gchar *doc_id)
2615 {
2616 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
2617 g_variant_new ("(s)",
2618 doc_id),
2619 fd_list);
2620 }
2621
2622 /**
2623 * gxdp_documents_complete_add_full:
2624 * @object: A #GXdpDocuments.
2625 * @invocation: (transfer full): A #GDBusMethodInvocation.
2626 * @fd_list: (nullable): A #GUnixFDList or %NULL.
2627 * @doc_ids: Parameter to return.
2628 * @extra_out: Parameter to return.
2629 *
2630 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</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.
2631 *
2632 * This method will free @invocation, you cannot use it afterwards.
2633 */
2634 void
gxdp_documents_complete_add_full(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * const * doc_ids,GVariant * extra_out)2635 gxdp_documents_complete_add_full (
2636 GXdpDocuments *object G_GNUC_UNUSED,
2637 GDBusMethodInvocation *invocation,
2638 GUnixFDList *fd_list,
2639 const gchar *const *doc_ids,
2640 GVariant *extra_out)
2641 {
2642 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
2643 g_variant_new ("(^as@a{sv})",
2644 doc_ids,
2645 extra_out),
2646 fd_list);
2647 }
2648
2649 /**
2650 * gxdp_documents_complete_add_named_full:
2651 * @object: A #GXdpDocuments.
2652 * @invocation: (transfer full): A #GDBusMethodInvocation.
2653 * @fd_list: (nullable): A #GUnixFDList or %NULL.
2654 * @doc_id: Parameter to return.
2655 * @extra_out: Parameter to return.
2656 *
2657 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamedFull">AddNamedFull()</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.
2658 *
2659 * This method will free @invocation, you cannot use it afterwards.
2660 */
2661 void
gxdp_documents_complete_add_named_full(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * doc_id,GVariant * extra_out)2662 gxdp_documents_complete_add_named_full (
2663 GXdpDocuments *object G_GNUC_UNUSED,
2664 GDBusMethodInvocation *invocation,
2665 GUnixFDList *fd_list,
2666 const gchar *doc_id,
2667 GVariant *extra_out)
2668 {
2669 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
2670 g_variant_new ("(s@a{sv})",
2671 doc_id,
2672 extra_out),
2673 fd_list);
2674 }
2675
2676 /**
2677 * gxdp_documents_complete_grant_permissions:
2678 * @object: A #GXdpDocuments.
2679 * @invocation: (transfer full): A #GDBusMethodInvocation.
2680 *
2681 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</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.
2682 *
2683 * This method will free @invocation, you cannot use it afterwards.
2684 */
2685 void
gxdp_documents_complete_grant_permissions(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2686 gxdp_documents_complete_grant_permissions (
2687 GXdpDocuments *object G_GNUC_UNUSED,
2688 GDBusMethodInvocation *invocation)
2689 {
2690 g_dbus_method_invocation_return_value (invocation,
2691 g_variant_new ("()"));
2692 }
2693
2694 /**
2695 * gxdp_documents_complete_revoke_permissions:
2696 * @object: A #GXdpDocuments.
2697 * @invocation: (transfer full): A #GDBusMethodInvocation.
2698 *
2699 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</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.
2700 *
2701 * This method will free @invocation, you cannot use it afterwards.
2702 */
2703 void
gxdp_documents_complete_revoke_permissions(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2704 gxdp_documents_complete_revoke_permissions (
2705 GXdpDocuments *object G_GNUC_UNUSED,
2706 GDBusMethodInvocation *invocation)
2707 {
2708 g_dbus_method_invocation_return_value (invocation,
2709 g_variant_new ("()"));
2710 }
2711
2712 /**
2713 * gxdp_documents_complete_delete:
2714 * @object: A #GXdpDocuments.
2715 * @invocation: (transfer full): A #GDBusMethodInvocation.
2716 *
2717 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</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.
2718 *
2719 * This method will free @invocation, you cannot use it afterwards.
2720 */
2721 void
gxdp_documents_complete_delete(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2722 gxdp_documents_complete_delete (
2723 GXdpDocuments *object G_GNUC_UNUSED,
2724 GDBusMethodInvocation *invocation)
2725 {
2726 g_dbus_method_invocation_return_value (invocation,
2727 g_variant_new ("()"));
2728 }
2729
2730 /**
2731 * gxdp_documents_complete_lookup:
2732 * @object: A #GXdpDocuments.
2733 * @invocation: (transfer full): A #GDBusMethodInvocation.
2734 * @doc_id: Parameter to return.
2735 *
2736 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</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.
2737 *
2738 * This method will free @invocation, you cannot use it afterwards.
2739 */
2740 void
gxdp_documents_complete_lookup(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * doc_id)2741 gxdp_documents_complete_lookup (
2742 GXdpDocuments *object G_GNUC_UNUSED,
2743 GDBusMethodInvocation *invocation,
2744 const gchar *doc_id)
2745 {
2746 g_dbus_method_invocation_return_value (invocation,
2747 g_variant_new ("(s)",
2748 doc_id));
2749 }
2750
2751 /**
2752 * gxdp_documents_complete_info:
2753 * @object: A #GXdpDocuments.
2754 * @invocation: (transfer full): A #GDBusMethodInvocation.
2755 * @path: Parameter to return.
2756 * @apps: Parameter to return.
2757 *
2758 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</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.
2759 *
2760 * This method will free @invocation, you cannot use it afterwards.
2761 */
2762 void
gxdp_documents_complete_info(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * path,GVariant * apps)2763 gxdp_documents_complete_info (
2764 GXdpDocuments *object G_GNUC_UNUSED,
2765 GDBusMethodInvocation *invocation,
2766 const gchar *path,
2767 GVariant *apps)
2768 {
2769 g_dbus_method_invocation_return_value (invocation,
2770 g_variant_new ("(^ay@a{sas})",
2771 path,
2772 apps));
2773 }
2774
2775 /**
2776 * gxdp_documents_complete_list:
2777 * @object: A #GXdpDocuments.
2778 * @invocation: (transfer full): A #GDBusMethodInvocation.
2779 * @docs: Parameter to return.
2780 *
2781 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</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.
2782 *
2783 * This method will free @invocation, you cannot use it afterwards.
2784 */
2785 void
gxdp_documents_complete_list(GXdpDocuments * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * docs)2786 gxdp_documents_complete_list (
2787 GXdpDocuments *object G_GNUC_UNUSED,
2788 GDBusMethodInvocation *invocation,
2789 GVariant *docs)
2790 {
2791 g_dbus_method_invocation_return_value (invocation,
2792 g_variant_new ("(@a{say})",
2793 docs));
2794 }
2795
2796 /* ------------------------------------------------------------------------ */
2797
2798 /**
2799 * GXdpDocumentsProxy:
2800 *
2801 * The #GXdpDocumentsProxy structure contains only private data and should only be accessed using the provided API.
2802 */
2803
2804 /**
2805 * GXdpDocumentsProxyClass:
2806 * @parent_class: The parent class.
2807 *
2808 * Class structure for #GXdpDocumentsProxy.
2809 */
2810
2811 struct _GXdpDocumentsProxyPrivate
2812 {
2813 GData *qdata;
2814 };
2815
2816 static void gxdp_documents_proxy_iface_init (GXdpDocumentsIface *iface);
2817
2818 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpDocumentsProxy,gxdp_documents_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (GXdpDocumentsProxy)G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS,gxdp_documents_proxy_iface_init))2819 G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsProxy, gxdp_documents_proxy, G_TYPE_DBUS_PROXY,
2820 G_ADD_PRIVATE (GXdpDocumentsProxy)
2821 G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_proxy_iface_init))
2822
2823 #else
2824 G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsProxy, gxdp_documents_proxy, G_TYPE_DBUS_PROXY,
2825 G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_proxy_iface_init))
2826
2827 #endif
2828 static void
2829 gxdp_documents_proxy_finalize (GObject *object)
2830 {
2831 GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (object);
2832 g_datalist_clear (&proxy->priv->qdata);
2833 G_OBJECT_CLASS (gxdp_documents_proxy_parent_class)->finalize (object);
2834 }
2835
2836 static void
gxdp_documents_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2837 gxdp_documents_proxy_get_property (GObject *object,
2838 guint prop_id,
2839 GValue *value,
2840 GParamSpec *pspec G_GNUC_UNUSED)
2841 {
2842 const _ExtendedGDBusPropertyInfo *info;
2843 GVariant *variant;
2844 g_assert (prop_id != 0 && prop_id - 1 < 1);
2845 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1];
2846 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2847 if (info->use_gvariant)
2848 {
2849 g_value_set_variant (value, variant);
2850 }
2851 else
2852 {
2853 if (variant != NULL)
2854 g_dbus_gvariant_to_gvalue (variant, value);
2855 }
2856 if (variant != NULL)
2857 g_variant_unref (variant);
2858 }
2859
2860 static void
gxdp_documents_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)2861 gxdp_documents_proxy_set_property_cb (GDBusProxy *proxy,
2862 GAsyncResult *res,
2863 gpointer user_data)
2864 {
2865 const _ExtendedGDBusPropertyInfo *info = user_data;
2866 GError *error;
2867 GVariant *_ret;
2868 error = NULL;
2869 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2870 if (!_ret)
2871 {
2872 g_warning ("Error setting property '%s' on interface org.freedesktop.portal.Documents: %s (%s, %d)",
2873 info->parent_struct.name,
2874 error->message, g_quark_to_string (error->domain), error->code);
2875 g_error_free (error);
2876 }
2877 else
2878 {
2879 g_variant_unref (_ret);
2880 }
2881 }
2882
2883 static void
gxdp_documents_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2884 gxdp_documents_proxy_set_property (GObject *object,
2885 guint prop_id,
2886 const GValue *value,
2887 GParamSpec *pspec G_GNUC_UNUSED)
2888 {
2889 const _ExtendedGDBusPropertyInfo *info;
2890 GVariant *variant;
2891 g_assert (prop_id != 0 && prop_id - 1 < 1);
2892 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1];
2893 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2894 g_dbus_proxy_call (G_DBUS_PROXY (object),
2895 "org.freedesktop.DBus.Properties.Set",
2896 g_variant_new ("(ssv)", "org.freedesktop.portal.Documents", info->parent_struct.name, variant),
2897 G_DBUS_CALL_FLAGS_NONE,
2898 -1,
2899 NULL, (GAsyncReadyCallback) gxdp_documents_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2900 g_variant_unref (variant);
2901 }
2902
2903 static void
gxdp_documents_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)2904 gxdp_documents_proxy_g_signal (GDBusProxy *proxy,
2905 const gchar *sender_name G_GNUC_UNUSED,
2906 const gchar *signal_name,
2907 GVariant *parameters)
2908 {
2909 _ExtendedGDBusSignalInfo *info;
2910 GVariantIter iter;
2911 GVariant *child;
2912 GValue *paramv;
2913 gsize num_params;
2914 gsize n;
2915 guint signal_id;
2916 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, signal_name);
2917 if (info == NULL)
2918 return;
2919 num_params = g_variant_n_children (parameters);
2920 paramv = g_new0 (GValue, num_params + 1);
2921 g_value_init (¶mv[0], GXDP_TYPE_DOCUMENTS);
2922 g_value_set_object (¶mv[0], proxy);
2923 g_variant_iter_init (&iter, parameters);
2924 n = 1;
2925 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2926 {
2927 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2928 if (arg_info->use_gvariant)
2929 {
2930 g_value_init (¶mv[n], G_TYPE_VARIANT);
2931 g_value_set_variant (¶mv[n], child);
2932 n++;
2933 }
2934 else
2935 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
2936 g_variant_unref (child);
2937 }
2938 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_DOCUMENTS);
2939 g_signal_emitv (paramv, signal_id, 0, NULL);
2940 for (n = 0; n < num_params + 1; n++)
2941 g_value_unset (¶mv[n]);
2942 g_free (paramv);
2943 }
2944
2945 static void
gxdp_documents_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)2946 gxdp_documents_proxy_g_properties_changed (GDBusProxy *_proxy,
2947 GVariant *changed_properties,
2948 const gchar *const *invalidated_properties)
2949 {
2950 GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (_proxy);
2951 guint n;
2952 const gchar *key;
2953 GVariantIter *iter;
2954 _ExtendedGDBusPropertyInfo *info;
2955 g_variant_get (changed_properties, "a{sv}", &iter);
2956 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2957 {
2958 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, key);
2959 g_datalist_remove_data (&proxy->priv->qdata, key);
2960 if (info != NULL)
2961 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2962 }
2963 g_variant_iter_free (iter);
2964 for (n = 0; invalidated_properties[n] != NULL; n++)
2965 {
2966 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, invalidated_properties[n]);
2967 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2968 if (info != NULL)
2969 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2970 }
2971 }
2972
2973 static guint
gxdp_documents_proxy_get_version(GXdpDocuments * object)2974 gxdp_documents_proxy_get_version (GXdpDocuments *object)
2975 {
2976 GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (object);
2977 GVariant *variant;
2978 guint value = 0;
2979 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
2980 if (variant != NULL)
2981 {
2982 value = g_variant_get_uint32 (variant);
2983 g_variant_unref (variant);
2984 }
2985 return value;
2986 }
2987
2988 static void
gxdp_documents_proxy_init(GXdpDocumentsProxy * proxy)2989 gxdp_documents_proxy_init (GXdpDocumentsProxy *proxy)
2990 {
2991 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2992 proxy->priv = gxdp_documents_proxy_get_instance_private (proxy);
2993 #else
2994 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_DOCUMENTS_PROXY, GXdpDocumentsProxyPrivate);
2995 #endif
2996
2997 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_documents_interface_info ());
2998 }
2999
3000 static void
gxdp_documents_proxy_class_init(GXdpDocumentsProxyClass * klass)3001 gxdp_documents_proxy_class_init (GXdpDocumentsProxyClass *klass)
3002 {
3003 GObjectClass *gobject_class;
3004 GDBusProxyClass *proxy_class;
3005
3006 gobject_class = G_OBJECT_CLASS (klass);
3007 gobject_class->finalize = gxdp_documents_proxy_finalize;
3008 gobject_class->get_property = gxdp_documents_proxy_get_property;
3009 gobject_class->set_property = gxdp_documents_proxy_set_property;
3010
3011 proxy_class = G_DBUS_PROXY_CLASS (klass);
3012 proxy_class->g_signal = gxdp_documents_proxy_g_signal;
3013 proxy_class->g_properties_changed = gxdp_documents_proxy_g_properties_changed;
3014
3015 gxdp_documents_override_properties (gobject_class, 1);
3016
3017 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3018 g_type_class_add_private (klass, sizeof (GXdpDocumentsProxyPrivate));
3019 #endif
3020 }
3021
3022 static void
gxdp_documents_proxy_iface_init(GXdpDocumentsIface * iface)3023 gxdp_documents_proxy_iface_init (GXdpDocumentsIface *iface)
3024 {
3025 iface->get_version = gxdp_documents_proxy_get_version;
3026 }
3027
3028 /**
3029 * gxdp_documents_proxy_new:
3030 * @connection: A #GDBusConnection.
3031 * @flags: Flags from the #GDBusProxyFlags enumeration.
3032 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3033 * @object_path: An object path.
3034 * @cancellable: (nullable): A #GCancellable or %NULL.
3035 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3036 * @user_data: User data to pass to @callback.
3037 *
3038 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>. See g_dbus_proxy_new() for more details.
3039 *
3040 * 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()).
3041 * You can then call gxdp_documents_proxy_new_finish() to get the result of the operation.
3042 *
3043 * See gxdp_documents_proxy_new_sync() for the synchronous, blocking version of this constructor.
3044 */
3045 void
gxdp_documents_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3046 gxdp_documents_proxy_new (
3047 GDBusConnection *connection,
3048 GDBusProxyFlags flags,
3049 const gchar *name,
3050 const gchar *object_path,
3051 GCancellable *cancellable,
3052 GAsyncReadyCallback callback,
3053 gpointer user_data)
3054 {
3055 g_async_initable_new_async (GXDP_TYPE_DOCUMENTS_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.portal.Documents", NULL);
3056 }
3057
3058 /**
3059 * gxdp_documents_proxy_new_finish:
3060 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_proxy_new().
3061 * @error: Return location for error or %NULL
3062 *
3063 * Finishes an operation started with gxdp_documents_proxy_new().
3064 *
3065 * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set.
3066 */
3067 GXdpDocuments *
gxdp_documents_proxy_new_finish(GAsyncResult * res,GError ** error)3068 gxdp_documents_proxy_new_finish (
3069 GAsyncResult *res,
3070 GError **error)
3071 {
3072 GObject *ret;
3073 GObject *source_object;
3074 source_object = g_async_result_get_source_object (res);
3075 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3076 g_object_unref (source_object);
3077 if (ret != NULL)
3078 return GXDP_DOCUMENTS (ret);
3079 else
3080 return NULL;
3081 }
3082
3083 /**
3084 * gxdp_documents_proxy_new_sync:
3085 * @connection: A #GDBusConnection.
3086 * @flags: Flags from the #GDBusProxyFlags enumeration.
3087 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3088 * @object_path: An object path.
3089 * @cancellable: (nullable): A #GCancellable or %NULL.
3090 * @error: Return location for error or %NULL
3091 *
3092 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>. See g_dbus_proxy_new_sync() for more details.
3093 *
3094 * The calling thread is blocked until a reply is received.
3095 *
3096 * See gxdp_documents_proxy_new() for the asynchronous version of this constructor.
3097 *
3098 * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set.
3099 */
3100 GXdpDocuments *
gxdp_documents_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3101 gxdp_documents_proxy_new_sync (
3102 GDBusConnection *connection,
3103 GDBusProxyFlags flags,
3104 const gchar *name,
3105 const gchar *object_path,
3106 GCancellable *cancellable,
3107 GError **error)
3108 {
3109 GInitable *ret;
3110 ret = g_initable_new (GXDP_TYPE_DOCUMENTS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.Documents", NULL);
3111 if (ret != NULL)
3112 return GXDP_DOCUMENTS (ret);
3113 else
3114 return NULL;
3115 }
3116
3117
3118 /**
3119 * gxdp_documents_proxy_new_for_bus:
3120 * @bus_type: A #GBusType.
3121 * @flags: Flags from the #GDBusProxyFlags enumeration.
3122 * @name: A bus name (well-known or unique).
3123 * @object_path: An object path.
3124 * @cancellable: (nullable): A #GCancellable or %NULL.
3125 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3126 * @user_data: User data to pass to @callback.
3127 *
3128 * Like gxdp_documents_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3129 *
3130 * 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()).
3131 * You can then call gxdp_documents_proxy_new_for_bus_finish() to get the result of the operation.
3132 *
3133 * See gxdp_documents_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3134 */
3135 void
gxdp_documents_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)3136 gxdp_documents_proxy_new_for_bus (
3137 GBusType bus_type,
3138 GDBusProxyFlags flags,
3139 const gchar *name,
3140 const gchar *object_path,
3141 GCancellable *cancellable,
3142 GAsyncReadyCallback callback,
3143 gpointer user_data)
3144 {
3145 g_async_initable_new_async (GXDP_TYPE_DOCUMENTS_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.portal.Documents", NULL);
3146 }
3147
3148 /**
3149 * gxdp_documents_proxy_new_for_bus_finish:
3150 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_proxy_new_for_bus().
3151 * @error: Return location for error or %NULL
3152 *
3153 * Finishes an operation started with gxdp_documents_proxy_new_for_bus().
3154 *
3155 * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set.
3156 */
3157 GXdpDocuments *
gxdp_documents_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)3158 gxdp_documents_proxy_new_for_bus_finish (
3159 GAsyncResult *res,
3160 GError **error)
3161 {
3162 GObject *ret;
3163 GObject *source_object;
3164 source_object = g_async_result_get_source_object (res);
3165 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3166 g_object_unref (source_object);
3167 if (ret != NULL)
3168 return GXDP_DOCUMENTS (ret);
3169 else
3170 return NULL;
3171 }
3172
3173 /**
3174 * gxdp_documents_proxy_new_for_bus_sync:
3175 * @bus_type: A #GBusType.
3176 * @flags: Flags from the #GDBusProxyFlags enumeration.
3177 * @name: A bus name (well-known or unique).
3178 * @object_path: An object path.
3179 * @cancellable: (nullable): A #GCancellable or %NULL.
3180 * @error: Return location for error or %NULL
3181 *
3182 * Like gxdp_documents_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3183 *
3184 * The calling thread is blocked until a reply is received.
3185 *
3186 * See gxdp_documents_proxy_new_for_bus() for the asynchronous version of this constructor.
3187 *
3188 * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set.
3189 */
3190 GXdpDocuments *
gxdp_documents_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)3191 gxdp_documents_proxy_new_for_bus_sync (
3192 GBusType bus_type,
3193 GDBusProxyFlags flags,
3194 const gchar *name,
3195 const gchar *object_path,
3196 GCancellable *cancellable,
3197 GError **error)
3198 {
3199 GInitable *ret;
3200 ret = g_initable_new (GXDP_TYPE_DOCUMENTS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.Documents", NULL);
3201 if (ret != NULL)
3202 return GXDP_DOCUMENTS (ret);
3203 else
3204 return NULL;
3205 }
3206
3207
3208 /* ------------------------------------------------------------------------ */
3209
3210 /**
3211 * GXdpDocumentsSkeleton:
3212 *
3213 * The #GXdpDocumentsSkeleton structure contains only private data and should only be accessed using the provided API.
3214 */
3215
3216 /**
3217 * GXdpDocumentsSkeletonClass:
3218 * @parent_class: The parent class.
3219 *
3220 * Class structure for #GXdpDocumentsSkeleton.
3221 */
3222
3223 struct _GXdpDocumentsSkeletonPrivate
3224 {
3225 GValue *properties;
3226 GList *changed_properties;
3227 GSource *changed_properties_idle_source;
3228 GMainContext *context;
3229 GMutex lock;
3230 };
3231
3232 static void
_gxdp_documents_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)3233 _gxdp_documents_skeleton_handle_method_call (
3234 GDBusConnection *connection G_GNUC_UNUSED,
3235 const gchar *sender G_GNUC_UNUSED,
3236 const gchar *object_path G_GNUC_UNUSED,
3237 const gchar *interface_name,
3238 const gchar *method_name,
3239 GVariant *parameters,
3240 GDBusMethodInvocation *invocation,
3241 gpointer user_data)
3242 {
3243 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data);
3244 _ExtendedGDBusMethodInfo *info;
3245 GVariantIter iter;
3246 GVariant *child;
3247 GValue *paramv;
3248 gsize num_params;
3249 guint num_extra;
3250 gsize n;
3251 guint signal_id;
3252 GValue return_value = G_VALUE_INIT;
3253 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3254 g_assert (info != NULL);
3255 num_params = g_variant_n_children (parameters);
3256 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3257 n = 0;
3258 g_value_init (¶mv[n], GXDP_TYPE_DOCUMENTS);
3259 g_value_set_object (¶mv[n++], skeleton);
3260 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3261 g_value_set_object (¶mv[n++], invocation);
3262 if (info->pass_fdlist)
3263 {
3264 #ifdef G_OS_UNIX
3265 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
3266 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3267 #else
3268 g_assert_not_reached ();
3269 #endif
3270 }
3271 g_variant_iter_init (&iter, parameters);
3272 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3273 {
3274 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3275 if (arg_info->use_gvariant)
3276 {
3277 g_value_init (¶mv[n], G_TYPE_VARIANT);
3278 g_value_set_variant (¶mv[n], child);
3279 n++;
3280 }
3281 else
3282 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
3283 g_variant_unref (child);
3284 }
3285 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_DOCUMENTS);
3286 g_value_init (&return_value, G_TYPE_BOOLEAN);
3287 g_signal_emitv (paramv, signal_id, 0, &return_value);
3288 if (!g_value_get_boolean (&return_value))
3289 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);
3290 g_value_unset (&return_value);
3291 for (n = 0; n < num_params + num_extra; n++)
3292 g_value_unset (¶mv[n]);
3293 g_free (paramv);
3294 }
3295
3296 static GVariant *
_gxdp_documents_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)3297 _gxdp_documents_skeleton_handle_get_property (
3298 GDBusConnection *connection G_GNUC_UNUSED,
3299 const gchar *sender G_GNUC_UNUSED,
3300 const gchar *object_path G_GNUC_UNUSED,
3301 const gchar *interface_name G_GNUC_UNUSED,
3302 const gchar *property_name,
3303 GError **error,
3304 gpointer user_data)
3305 {
3306 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data);
3307 GValue value = G_VALUE_INIT;
3308 GParamSpec *pspec;
3309 _ExtendedGDBusPropertyInfo *info;
3310 GVariant *ret;
3311 ret = NULL;
3312 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, property_name);
3313 g_assert (info != NULL);
3314 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3315 if (pspec == NULL)
3316 {
3317 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3318 }
3319 else
3320 {
3321 g_value_init (&value, pspec->value_type);
3322 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3323 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3324 g_value_unset (&value);
3325 }
3326 return ret;
3327 }
3328
3329 static gboolean
_gxdp_documents_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)3330 _gxdp_documents_skeleton_handle_set_property (
3331 GDBusConnection *connection G_GNUC_UNUSED,
3332 const gchar *sender G_GNUC_UNUSED,
3333 const gchar *object_path G_GNUC_UNUSED,
3334 const gchar *interface_name G_GNUC_UNUSED,
3335 const gchar *property_name,
3336 GVariant *variant,
3337 GError **error,
3338 gpointer user_data)
3339 {
3340 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data);
3341 GValue value = G_VALUE_INIT;
3342 GParamSpec *pspec;
3343 _ExtendedGDBusPropertyInfo *info;
3344 gboolean ret;
3345 ret = FALSE;
3346 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, property_name);
3347 g_assert (info != NULL);
3348 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3349 if (pspec == NULL)
3350 {
3351 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3352 }
3353 else
3354 {
3355 if (info->use_gvariant)
3356 g_value_set_variant (&value, variant);
3357 else
3358 g_dbus_gvariant_to_gvalue (variant, &value);
3359 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3360 g_value_unset (&value);
3361 ret = TRUE;
3362 }
3363 return ret;
3364 }
3365
3366 static const GDBusInterfaceVTable _gxdp_documents_skeleton_vtable =
3367 {
3368 _gxdp_documents_skeleton_handle_method_call,
3369 _gxdp_documents_skeleton_handle_get_property,
3370 _gxdp_documents_skeleton_handle_set_property,
3371 {NULL}
3372 };
3373
3374 static GDBusInterfaceInfo *
gxdp_documents_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3375 gxdp_documents_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3376 {
3377 return gxdp_documents_interface_info ();
3378 }
3379
3380 static GDBusInterfaceVTable *
gxdp_documents_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)3381 gxdp_documents_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3382 {
3383 return (GDBusInterfaceVTable *) &_gxdp_documents_skeleton_vtable;
3384 }
3385
3386 static GVariant *
gxdp_documents_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)3387 gxdp_documents_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3388 {
3389 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (_skeleton);
3390
3391 GVariantBuilder builder;
3392 guint n;
3393 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3394 if (_gxdp_documents_interface_info.parent_struct.properties == NULL)
3395 goto out;
3396 for (n = 0; _gxdp_documents_interface_info.parent_struct.properties[n] != NULL; n++)
3397 {
3398 GDBusPropertyInfo *info = _gxdp_documents_interface_info.parent_struct.properties[n];
3399 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3400 {
3401 GVariant *value;
3402 value = _gxdp_documents_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.portal.Documents", info->name, NULL, skeleton);
3403 if (value != NULL)
3404 {
3405 g_variant_take_ref (value);
3406 g_variant_builder_add (&builder, "{sv}", info->name, value);
3407 g_variant_unref (value);
3408 }
3409 }
3410 }
3411 out:
3412 return g_variant_builder_end (&builder);
3413 }
3414
3415 static gboolean _gxdp_documents_emit_changed (gpointer user_data);
3416
3417 static void
gxdp_documents_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)3418 gxdp_documents_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3419 {
3420 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (_skeleton);
3421 gboolean emit_changed = FALSE;
3422
3423 g_mutex_lock (&skeleton->priv->lock);
3424 if (skeleton->priv->changed_properties_idle_source != NULL)
3425 {
3426 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3427 skeleton->priv->changed_properties_idle_source = NULL;
3428 emit_changed = TRUE;
3429 }
3430 g_mutex_unlock (&skeleton->priv->lock);
3431
3432 if (emit_changed)
3433 _gxdp_documents_emit_changed (skeleton);
3434 }
3435
3436 static void gxdp_documents_skeleton_iface_init (GXdpDocumentsIface *iface);
3437 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpDocumentsSkeleton,gxdp_documents_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (GXdpDocumentsSkeleton)G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS,gxdp_documents_skeleton_iface_init))3438 G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsSkeleton, gxdp_documents_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3439 G_ADD_PRIVATE (GXdpDocumentsSkeleton)
3440 G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_skeleton_iface_init))
3441
3442 #else
3443 G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsSkeleton, gxdp_documents_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3444 G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_skeleton_iface_init))
3445
3446 #endif
3447 static void
3448 gxdp_documents_skeleton_finalize (GObject *object)
3449 {
3450 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object);
3451 guint n;
3452 for (n = 0; n < 1; n++)
3453 g_value_unset (&skeleton->priv->properties[n]);
3454 g_free (skeleton->priv->properties);
3455 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3456 if (skeleton->priv->changed_properties_idle_source != NULL)
3457 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3458 g_main_context_unref (skeleton->priv->context);
3459 g_mutex_clear (&skeleton->priv->lock);
3460 G_OBJECT_CLASS (gxdp_documents_skeleton_parent_class)->finalize (object);
3461 }
3462
3463 static void
gxdp_documents_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)3464 gxdp_documents_skeleton_get_property (GObject *object,
3465 guint prop_id,
3466 GValue *value,
3467 GParamSpec *pspec G_GNUC_UNUSED)
3468 {
3469 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object);
3470 g_assert (prop_id != 0 && prop_id - 1 < 1);
3471 g_mutex_lock (&skeleton->priv->lock);
3472 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3473 g_mutex_unlock (&skeleton->priv->lock);
3474 }
3475
3476 static gboolean
_gxdp_documents_emit_changed(gpointer user_data)3477 _gxdp_documents_emit_changed (gpointer user_data)
3478 {
3479 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data);
3480 GList *l;
3481 GVariantBuilder builder;
3482 GVariantBuilder invalidated_builder;
3483 guint num_changes;
3484
3485 g_mutex_lock (&skeleton->priv->lock);
3486 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3487 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3488 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3489 {
3490 ChangedProperty *cp = l->data;
3491 GVariant *variant;
3492 const GValue *cur_value;
3493
3494 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3495 if (!_g_value_equal (cur_value, &cp->orig_value))
3496 {
3497 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3498 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3499 g_variant_unref (variant);
3500 num_changes++;
3501 }
3502 }
3503 if (num_changes > 0)
3504 {
3505 GList *connections, *ll;
3506 GVariant *signal_variant;
3507 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.Documents",
3508 &builder, &invalidated_builder));
3509 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3510 for (ll = connections; ll != NULL; ll = ll->next)
3511 {
3512 GDBusConnection *connection = ll->data;
3513
3514 g_dbus_connection_emit_signal (connection,
3515 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3516 "org.freedesktop.DBus.Properties",
3517 "PropertiesChanged",
3518 signal_variant,
3519 NULL);
3520 }
3521 g_variant_unref (signal_variant);
3522 g_list_free_full (connections, g_object_unref);
3523 }
3524 else
3525 {
3526 g_variant_builder_clear (&builder);
3527 g_variant_builder_clear (&invalidated_builder);
3528 }
3529 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3530 skeleton->priv->changed_properties = NULL;
3531 skeleton->priv->changed_properties_idle_source = NULL;
3532 g_mutex_unlock (&skeleton->priv->lock);
3533 return FALSE;
3534 }
3535
3536 static void
_gxdp_documents_schedule_emit_changed(GXdpDocumentsSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)3537 _gxdp_documents_schedule_emit_changed (GXdpDocumentsSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3538 {
3539 ChangedProperty *cp;
3540 GList *l;
3541 cp = NULL;
3542 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3543 {
3544 ChangedProperty *i_cp = l->data;
3545 if (i_cp->info == info)
3546 {
3547 cp = i_cp;
3548 break;
3549 }
3550 }
3551 if (cp == NULL)
3552 {
3553 cp = g_new0 (ChangedProperty, 1);
3554 cp->prop_id = prop_id;
3555 cp->info = info;
3556 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3557 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3558 g_value_copy (orig_value, &cp->orig_value);
3559 }
3560 }
3561
3562 static void
gxdp_documents_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)3563 gxdp_documents_skeleton_notify (GObject *object,
3564 GParamSpec *pspec G_GNUC_UNUSED)
3565 {
3566 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object);
3567 g_mutex_lock (&skeleton->priv->lock);
3568 if (skeleton->priv->changed_properties != NULL &&
3569 skeleton->priv->changed_properties_idle_source == NULL)
3570 {
3571 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3572 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3573 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_documents_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3574 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_documents_emit_changed");
3575 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3576 g_source_unref (skeleton->priv->changed_properties_idle_source);
3577 }
3578 g_mutex_unlock (&skeleton->priv->lock);
3579 }
3580
3581 static void
gxdp_documents_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)3582 gxdp_documents_skeleton_set_property (GObject *object,
3583 guint prop_id,
3584 const GValue *value,
3585 GParamSpec *pspec)
3586 {
3587 const _ExtendedGDBusPropertyInfo *info;
3588 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object);
3589 g_assert (prop_id != 0 && prop_id - 1 < 1);
3590 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1];
3591 g_mutex_lock (&skeleton->priv->lock);
3592 g_object_freeze_notify (object);
3593 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3594 {
3595 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
3596 info->emits_changed_signal)
3597 _gxdp_documents_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
3598 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3599 g_object_notify_by_pspec (object, pspec);
3600 }
3601 g_mutex_unlock (&skeleton->priv->lock);
3602 g_object_thaw_notify (object);
3603 }
3604
3605 static void
gxdp_documents_skeleton_init(GXdpDocumentsSkeleton * skeleton)3606 gxdp_documents_skeleton_init (GXdpDocumentsSkeleton *skeleton)
3607 {
3608 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3609 skeleton->priv = gxdp_documents_skeleton_get_instance_private (skeleton);
3610 #else
3611 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_DOCUMENTS_SKELETON, GXdpDocumentsSkeletonPrivate);
3612 #endif
3613
3614 g_mutex_init (&skeleton->priv->lock);
3615 skeleton->priv->context = g_main_context_ref_thread_default ();
3616 skeleton->priv->properties = g_new0 (GValue, 1);
3617 g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
3618 }
3619
3620 static guint
gxdp_documents_skeleton_get_version(GXdpDocuments * object)3621 gxdp_documents_skeleton_get_version (GXdpDocuments *object)
3622 {
3623 GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object);
3624 guint value;
3625 g_mutex_lock (&skeleton->priv->lock);
3626 value = g_value_get_uint (&(skeleton->priv->properties[0]));
3627 g_mutex_unlock (&skeleton->priv->lock);
3628 return value;
3629 }
3630
3631 static void
gxdp_documents_skeleton_class_init(GXdpDocumentsSkeletonClass * klass)3632 gxdp_documents_skeleton_class_init (GXdpDocumentsSkeletonClass *klass)
3633 {
3634 GObjectClass *gobject_class;
3635 GDBusInterfaceSkeletonClass *skeleton_class;
3636
3637 gobject_class = G_OBJECT_CLASS (klass);
3638 gobject_class->finalize = gxdp_documents_skeleton_finalize;
3639 gobject_class->get_property = gxdp_documents_skeleton_get_property;
3640 gobject_class->set_property = gxdp_documents_skeleton_set_property;
3641 gobject_class->notify = gxdp_documents_skeleton_notify;
3642
3643
3644 gxdp_documents_override_properties (gobject_class, 1);
3645
3646 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3647 skeleton_class->get_info = gxdp_documents_skeleton_dbus_interface_get_info;
3648 skeleton_class->get_properties = gxdp_documents_skeleton_dbus_interface_get_properties;
3649 skeleton_class->flush = gxdp_documents_skeleton_dbus_interface_flush;
3650 skeleton_class->get_vtable = gxdp_documents_skeleton_dbus_interface_get_vtable;
3651
3652 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3653 g_type_class_add_private (klass, sizeof (GXdpDocumentsSkeletonPrivate));
3654 #endif
3655 }
3656
3657 static void
gxdp_documents_skeleton_iface_init(GXdpDocumentsIface * iface)3658 gxdp_documents_skeleton_iface_init (GXdpDocumentsIface *iface)
3659 {
3660 iface->get_version = gxdp_documents_skeleton_get_version;
3661 }
3662
3663 /**
3664 * gxdp_documents_skeleton_new:
3665 *
3666 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>.
3667 *
3668 * Returns: (transfer full) (type GXdpDocumentsSkeleton): The skeleton object.
3669 */
3670 GXdpDocuments *
gxdp_documents_skeleton_new(void)3671 gxdp_documents_skeleton_new (void)
3672 {
3673 return GXDP_DOCUMENTS (g_object_new (GXDP_TYPE_DOCUMENTS_SKELETON, NULL));
3674 }
3675
3676 /* ------------------------------------------------------------------------
3677 * Code for interface org.freedesktop.portal.OpenURI
3678 * ------------------------------------------------------------------------
3679 */
3680
3681 /**
3682 * SECTION:GXdpOpenURI
3683 * @title: GXdpOpenURI
3684 * @short_description: Generated C code for the org.freedesktop.portal.OpenURI D-Bus interface
3685 *
3686 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link> D-Bus interface in C.
3687 */
3688
3689 /* ---- Introspection data for org.freedesktop.portal.OpenURI ---- */
3690
3691 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_parent_window =
3692 {
3693 {
3694 -1,
3695 (gchar *) "parent_window",
3696 (gchar *) "s",
3697 NULL
3698 },
3699 FALSE
3700 };
3701
3702 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_uri =
3703 {
3704 {
3705 -1,
3706 (gchar *) "uri",
3707 (gchar *) "s",
3708 NULL
3709 },
3710 FALSE
3711 };
3712
3713 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_options =
3714 {
3715 {
3716 -1,
3717 (gchar *) "options",
3718 (gchar *) "a{sv}",
3719 NULL
3720 },
3721 FALSE
3722 };
3723
3724 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_uri_IN_ARG_pointers[] =
3725 {
3726 &_gxdp_open_uri_method_info_open_uri_IN_ARG_parent_window.parent_struct,
3727 &_gxdp_open_uri_method_info_open_uri_IN_ARG_uri.parent_struct,
3728 &_gxdp_open_uri_method_info_open_uri_IN_ARG_options.parent_struct,
3729 NULL
3730 };
3731
3732 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_OUT_ARG_handle =
3733 {
3734 {
3735 -1,
3736 (gchar *) "handle",
3737 (gchar *) "o",
3738 NULL
3739 },
3740 FALSE
3741 };
3742
3743 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_uri_OUT_ARG_pointers[] =
3744 {
3745 &_gxdp_open_uri_method_info_open_uri_OUT_ARG_handle.parent_struct,
3746 NULL
3747 };
3748
3749 static const _ExtendedGDBusMethodInfo _gxdp_open_uri_method_info_open_uri =
3750 {
3751 {
3752 -1,
3753 (gchar *) "OpenURI",
3754 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_uri_IN_ARG_pointers,
3755 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_uri_OUT_ARG_pointers,
3756 NULL
3757 },
3758 "handle-open-uri",
3759 FALSE
3760 };
3761
3762 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_parent_window =
3763 {
3764 {
3765 -1,
3766 (gchar *) "parent_window",
3767 (gchar *) "s",
3768 NULL
3769 },
3770 FALSE
3771 };
3772
3773 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_fd =
3774 {
3775 {
3776 -1,
3777 (gchar *) "fd",
3778 (gchar *) "h",
3779 NULL
3780 },
3781 FALSE
3782 };
3783
3784 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_options =
3785 {
3786 {
3787 -1,
3788 (gchar *) "options",
3789 (gchar *) "a{sv}",
3790 NULL
3791 },
3792 FALSE
3793 };
3794
3795 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_file_IN_ARG_pointers[] =
3796 {
3797 &_gxdp_open_uri_method_info_open_file_IN_ARG_parent_window.parent_struct,
3798 &_gxdp_open_uri_method_info_open_file_IN_ARG_fd.parent_struct,
3799 &_gxdp_open_uri_method_info_open_file_IN_ARG_options.parent_struct,
3800 NULL
3801 };
3802
3803 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_OUT_ARG_handle =
3804 {
3805 {
3806 -1,
3807 (gchar *) "handle",
3808 (gchar *) "o",
3809 NULL
3810 },
3811 FALSE
3812 };
3813
3814 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_file_OUT_ARG_pointers[] =
3815 {
3816 &_gxdp_open_uri_method_info_open_file_OUT_ARG_handle.parent_struct,
3817 NULL
3818 };
3819
3820 static const _ExtendedGDBusMethodInfo _gxdp_open_uri_method_info_open_file =
3821 {
3822 {
3823 -1,
3824 (gchar *) "OpenFile",
3825 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_file_IN_ARG_pointers,
3826 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_file_OUT_ARG_pointers,
3827 NULL
3828 },
3829 "handle-open-file",
3830 TRUE
3831 };
3832
3833 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_directory_IN_ARG_parent_window =
3834 {
3835 {
3836 -1,
3837 (gchar *) "parent_window",
3838 (gchar *) "s",
3839 NULL
3840 },
3841 FALSE
3842 };
3843
3844 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_directory_IN_ARG_fd =
3845 {
3846 {
3847 -1,
3848 (gchar *) "fd",
3849 (gchar *) "h",
3850 NULL
3851 },
3852 FALSE
3853 };
3854
3855 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_directory_IN_ARG_options =
3856 {
3857 {
3858 -1,
3859 (gchar *) "options",
3860 (gchar *) "a{sv}",
3861 NULL
3862 },
3863 FALSE
3864 };
3865
3866 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_directory_IN_ARG_pointers[] =
3867 {
3868 &_gxdp_open_uri_method_info_open_directory_IN_ARG_parent_window.parent_struct,
3869 &_gxdp_open_uri_method_info_open_directory_IN_ARG_fd.parent_struct,
3870 &_gxdp_open_uri_method_info_open_directory_IN_ARG_options.parent_struct,
3871 NULL
3872 };
3873
3874 static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_directory_OUT_ARG_handle =
3875 {
3876 {
3877 -1,
3878 (gchar *) "handle",
3879 (gchar *) "o",
3880 NULL
3881 },
3882 FALSE
3883 };
3884
3885 static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_directory_OUT_ARG_pointers[] =
3886 {
3887 &_gxdp_open_uri_method_info_open_directory_OUT_ARG_handle.parent_struct,
3888 NULL
3889 };
3890
3891 static const _ExtendedGDBusMethodInfo _gxdp_open_uri_method_info_open_directory =
3892 {
3893 {
3894 -1,
3895 (gchar *) "OpenDirectory",
3896 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_directory_IN_ARG_pointers,
3897 (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_directory_OUT_ARG_pointers,
3898 NULL
3899 },
3900 "handle-open-directory",
3901 TRUE
3902 };
3903
3904 static const GDBusMethodInfo * const _gxdp_open_uri_method_info_pointers[] =
3905 {
3906 &_gxdp_open_uri_method_info_open_uri.parent_struct,
3907 &_gxdp_open_uri_method_info_open_file.parent_struct,
3908 &_gxdp_open_uri_method_info_open_directory.parent_struct,
3909 NULL
3910 };
3911
3912 static const _ExtendedGDBusPropertyInfo _gxdp_open_uri_property_info_version =
3913 {
3914 {
3915 -1,
3916 (gchar *) "version",
3917 (gchar *) "u",
3918 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3919 NULL
3920 },
3921 "version",
3922 FALSE,
3923 TRUE
3924 };
3925
3926 static const GDBusPropertyInfo * const _gxdp_open_uri_property_info_pointers[] =
3927 {
3928 &_gxdp_open_uri_property_info_version.parent_struct,
3929 NULL
3930 };
3931
3932 static const _ExtendedGDBusInterfaceInfo _gxdp_open_uri_interface_info =
3933 {
3934 {
3935 -1,
3936 (gchar *) "org.freedesktop.portal.OpenURI",
3937 (GDBusMethodInfo **) &_gxdp_open_uri_method_info_pointers,
3938 NULL,
3939 (GDBusPropertyInfo **) &_gxdp_open_uri_property_info_pointers,
3940 NULL
3941 },
3942 "open-uri",
3943 };
3944
3945
3946 /**
3947 * gxdp_open_uri_interface_info:
3948 *
3949 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link> D-Bus interface.
3950 *
3951 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3952 */
3953 GDBusInterfaceInfo *
gxdp_open_uri_interface_info(void)3954 gxdp_open_uri_interface_info (void)
3955 {
3956 return (GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct;
3957 }
3958
3959 /**
3960 * gxdp_open_uri_override_properties:
3961 * @klass: The class structure for a #GObject derived class.
3962 * @property_id_begin: The property id to assign to the first overridden property.
3963 *
3964 * Overrides all #GObject properties in the #GXdpOpenURI interface for a concrete class.
3965 * The properties are overridden in the order they are defined.
3966 *
3967 * Returns: The last property id.
3968 */
3969 guint
gxdp_open_uri_override_properties(GObjectClass * klass,guint property_id_begin)3970 gxdp_open_uri_override_properties (GObjectClass *klass, guint property_id_begin)
3971 {
3972 g_object_class_override_property (klass, property_id_begin++, "version");
3973 return property_id_begin - 1;
3974 }
3975
3976
3977
3978 /**
3979 * GXdpOpenURI:
3980 *
3981 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>.
3982 */
3983
3984 /**
3985 * GXdpOpenURIIface:
3986 * @parent_iface: The parent interface.
3987 * @handle_open_directory: Handler for the #GXdpOpenURI::handle-open-directory signal.
3988 * @handle_open_file: Handler for the #GXdpOpenURI::handle-open-file signal.
3989 * @handle_open_uri: Handler for the #GXdpOpenURI::handle-open-uri signal.
3990 * @get_version: Getter for the #GXdpOpenURI:version property.
3991 *
3992 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>.
3993 */
3994
3995 typedef GXdpOpenURIIface GXdpOpenURIInterface;
G_DEFINE_INTERFACE(GXdpOpenURI,gxdp_open_uri,G_TYPE_OBJECT)3996 G_DEFINE_INTERFACE (GXdpOpenURI, gxdp_open_uri, G_TYPE_OBJECT)
3997
3998 static void
3999 gxdp_open_uri_default_init (GXdpOpenURIIface *iface)
4000 {
4001 /* GObject signals for incoming D-Bus method calls: */
4002 /**
4003 * GXdpOpenURI::handle-open-uri:
4004 * @object: A #GXdpOpenURI.
4005 * @invocation: A #GDBusMethodInvocation.
4006 * @arg_parent_window: Argument passed by remote caller.
4007 * @arg_uri: Argument passed by remote caller.
4008 * @arg_options: Argument passed by remote caller.
4009 *
4010 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</link> D-Bus method.
4011 *
4012 * 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 gxdp_open_uri_complete_open_uri() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4013 *
4014 * 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.
4015 */
4016 g_signal_new ("handle-open-uri",
4017 G_TYPE_FROM_INTERFACE (iface),
4018 G_SIGNAL_RUN_LAST,
4019 G_STRUCT_OFFSET (GXdpOpenURIIface, handle_open_uri),
4020 g_signal_accumulator_true_handled,
4021 NULL,
4022 g_cclosure_marshal_generic,
4023 G_TYPE_BOOLEAN,
4024 4,
4025 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT);
4026
4027 /**
4028 * GXdpOpenURI::handle-open-file:
4029 * @object: A #GXdpOpenURI.
4030 * @invocation: A #GDBusMethodInvocation.
4031 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4032 * @arg_parent_window: Argument passed by remote caller.
4033 * @arg_fd: Argument passed by remote caller.
4034 * @arg_options: Argument passed by remote caller.
4035 *
4036 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</link> D-Bus method.
4037 *
4038 * 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 gxdp_open_uri_complete_open_file() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4039 *
4040 * 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.
4041 */
4042 g_signal_new ("handle-open-file",
4043 G_TYPE_FROM_INTERFACE (iface),
4044 G_SIGNAL_RUN_LAST,
4045 G_STRUCT_OFFSET (GXdpOpenURIIface, handle_open_file),
4046 g_signal_accumulator_true_handled,
4047 NULL,
4048 g_cclosure_marshal_generic,
4049 G_TYPE_BOOLEAN,
4050 5,
4051 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_VARIANT);
4052
4053 /**
4054 * GXdpOpenURI::handle-open-directory:
4055 * @object: A #GXdpOpenURI.
4056 * @invocation: A #GDBusMethodInvocation.
4057 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4058 * @arg_parent_window: Argument passed by remote caller.
4059 * @arg_fd: Argument passed by remote caller.
4060 * @arg_options: Argument passed by remote caller.
4061 *
4062 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenDirectory">OpenDirectory()</link> D-Bus method.
4063 *
4064 * 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 gxdp_open_uri_complete_open_directory() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4065 *
4066 * 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.
4067 */
4068 g_signal_new ("handle-open-directory",
4069 G_TYPE_FROM_INTERFACE (iface),
4070 G_SIGNAL_RUN_LAST,
4071 G_STRUCT_OFFSET (GXdpOpenURIIface, handle_open_directory),
4072 g_signal_accumulator_true_handled,
4073 NULL,
4074 g_cclosure_marshal_generic,
4075 G_TYPE_BOOLEAN,
4076 5,
4077 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_VARIANT);
4078
4079 /* GObject properties for D-Bus properties: */
4080 /**
4081 * GXdpOpenURI:version:
4082 *
4083 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link>.
4084 *
4085 * 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.
4086 */
4087 g_object_interface_install_property (iface,
4088 g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4089 }
4090
4091 /**
4092 * gxdp_open_uri_get_version: (skip)
4093 * @object: A #GXdpOpenURI.
4094 *
4095 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link> D-Bus property.
4096 *
4097 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4098 *
4099 * Returns: The property value.
4100 */
4101 guint
gxdp_open_uri_get_version(GXdpOpenURI * object)4102 gxdp_open_uri_get_version (GXdpOpenURI *object)
4103 {
4104 return GXDP_OPEN_URI_GET_IFACE (object)->get_version (object);
4105 }
4106
4107 /**
4108 * gxdp_open_uri_set_version: (skip)
4109 * @object: A #GXdpOpenURI.
4110 * @value: The value to set.
4111 *
4112 * Sets the <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link> D-Bus property to @value.
4113 *
4114 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4115 */
4116 void
gxdp_open_uri_set_version(GXdpOpenURI * object,guint value)4117 gxdp_open_uri_set_version (GXdpOpenURI *object, guint value)
4118 {
4119 g_object_set (G_OBJECT (object), "version", value, NULL);
4120 }
4121
4122 /**
4123 * gxdp_open_uri_call_open_uri:
4124 * @proxy: A #GXdpOpenURIProxy.
4125 * @arg_parent_window: Argument to pass with the method invocation.
4126 * @arg_uri: Argument to pass with the method invocation.
4127 * @arg_options: Argument to pass with the method invocation.
4128 * @cancellable: (nullable): A #GCancellable or %NULL.
4129 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4130 * @user_data: User data to pass to @callback.
4131 *
4132 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</link> D-Bus method on @proxy.
4133 * 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()).
4134 * You can then call gxdp_open_uri_call_open_uri_finish() to get the result of the operation.
4135 *
4136 * See gxdp_open_uri_call_open_uri_sync() for the synchronous, blocking version of this method.
4137 */
4138 void
gxdp_open_uri_call_open_uri(GXdpOpenURI * proxy,const gchar * arg_parent_window,const gchar * arg_uri,GVariant * arg_options,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4139 gxdp_open_uri_call_open_uri (
4140 GXdpOpenURI *proxy,
4141 const gchar *arg_parent_window,
4142 const gchar *arg_uri,
4143 GVariant *arg_options,
4144 GCancellable *cancellable,
4145 GAsyncReadyCallback callback,
4146 gpointer user_data)
4147 {
4148 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4149 "OpenURI",
4150 g_variant_new ("(ss@a{sv})",
4151 arg_parent_window,
4152 arg_uri,
4153 arg_options),
4154 G_DBUS_CALL_FLAGS_NONE,
4155 -1,
4156 cancellable,
4157 callback,
4158 user_data);
4159 }
4160
4161 /**
4162 * gxdp_open_uri_call_open_uri_finish:
4163 * @proxy: A #GXdpOpenURIProxy.
4164 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4165 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_call_open_uri().
4166 * @error: Return location for error or %NULL.
4167 *
4168 * Finishes an operation started with gxdp_open_uri_call_open_uri().
4169 *
4170 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4171 */
4172 gboolean
gxdp_open_uri_call_open_uri_finish(GXdpOpenURI * proxy,gchar ** out_handle,GAsyncResult * res,GError ** error)4173 gxdp_open_uri_call_open_uri_finish (
4174 GXdpOpenURI *proxy,
4175 gchar **out_handle,
4176 GAsyncResult *res,
4177 GError **error)
4178 {
4179 GVariant *_ret;
4180 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4181 if (_ret == NULL)
4182 goto _out;
4183 g_variant_get (_ret,
4184 "(o)",
4185 out_handle);
4186 g_variant_unref (_ret);
4187 _out:
4188 return _ret != NULL;
4189 }
4190
4191 /**
4192 * gxdp_open_uri_call_open_uri_sync:
4193 * @proxy: A #GXdpOpenURIProxy.
4194 * @arg_parent_window: Argument to pass with the method invocation.
4195 * @arg_uri: Argument to pass with the method invocation.
4196 * @arg_options: Argument to pass with the method invocation.
4197 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4198 * @cancellable: (nullable): A #GCancellable or %NULL.
4199 * @error: Return location for error or %NULL.
4200 *
4201 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4202 *
4203 * See gxdp_open_uri_call_open_uri() for the asynchronous version of this method.
4204 *
4205 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4206 */
4207 gboolean
gxdp_open_uri_call_open_uri_sync(GXdpOpenURI * proxy,const gchar * arg_parent_window,const gchar * arg_uri,GVariant * arg_options,gchar ** out_handle,GCancellable * cancellable,GError ** error)4208 gxdp_open_uri_call_open_uri_sync (
4209 GXdpOpenURI *proxy,
4210 const gchar *arg_parent_window,
4211 const gchar *arg_uri,
4212 GVariant *arg_options,
4213 gchar **out_handle,
4214 GCancellable *cancellable,
4215 GError **error)
4216 {
4217 GVariant *_ret;
4218 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4219 "OpenURI",
4220 g_variant_new ("(ss@a{sv})",
4221 arg_parent_window,
4222 arg_uri,
4223 arg_options),
4224 G_DBUS_CALL_FLAGS_NONE,
4225 -1,
4226 cancellable,
4227 error);
4228 if (_ret == NULL)
4229 goto _out;
4230 g_variant_get (_ret,
4231 "(o)",
4232 out_handle);
4233 g_variant_unref (_ret);
4234 _out:
4235 return _ret != NULL;
4236 }
4237
4238 /**
4239 * gxdp_open_uri_call_open_file:
4240 * @proxy: A #GXdpOpenURIProxy.
4241 * @arg_parent_window: Argument to pass with the method invocation.
4242 * @arg_fd: Argument to pass with the method invocation.
4243 * @arg_options: Argument to pass with the method invocation.
4244 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4245 * @cancellable: (nullable): A #GCancellable or %NULL.
4246 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4247 * @user_data: User data to pass to @callback.
4248 *
4249 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</link> D-Bus method on @proxy.
4250 * 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()).
4251 * You can then call gxdp_open_uri_call_open_file_finish() to get the result of the operation.
4252 *
4253 * See gxdp_open_uri_call_open_file_sync() for the synchronous, blocking version of this method.
4254 */
4255 void
gxdp_open_uri_call_open_file(GXdpOpenURI * proxy,const gchar * arg_parent_window,GVariant * arg_fd,GVariant * arg_options,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4256 gxdp_open_uri_call_open_file (
4257 GXdpOpenURI *proxy,
4258 const gchar *arg_parent_window,
4259 GVariant *arg_fd,
4260 GVariant *arg_options,
4261 GUnixFDList *fd_list,
4262 GCancellable *cancellable,
4263 GAsyncReadyCallback callback,
4264 gpointer user_data)
4265 {
4266 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
4267 "OpenFile",
4268 g_variant_new ("(s@h@a{sv})",
4269 arg_parent_window,
4270 arg_fd,
4271 arg_options),
4272 G_DBUS_CALL_FLAGS_NONE,
4273 -1,
4274 fd_list,
4275 cancellable,
4276 callback,
4277 user_data);
4278 }
4279
4280 /**
4281 * gxdp_open_uri_call_open_file_finish:
4282 * @proxy: A #GXdpOpenURIProxy.
4283 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4284 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
4285 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_call_open_file().
4286 * @error: Return location for error or %NULL.
4287 *
4288 * Finishes an operation started with gxdp_open_uri_call_open_file().
4289 *
4290 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4291 */
4292 gboolean
gxdp_open_uri_call_open_file_finish(GXdpOpenURI * proxy,gchar ** out_handle,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)4293 gxdp_open_uri_call_open_file_finish (
4294 GXdpOpenURI *proxy,
4295 gchar **out_handle,
4296 GUnixFDList **out_fd_list,
4297 GAsyncResult *res,
4298 GError **error)
4299 {
4300 GVariant *_ret;
4301 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
4302 if (_ret == NULL)
4303 goto _out;
4304 g_variant_get (_ret,
4305 "(o)",
4306 out_handle);
4307 g_variant_unref (_ret);
4308 _out:
4309 return _ret != NULL;
4310 }
4311
4312 /**
4313 * gxdp_open_uri_call_open_file_sync:
4314 * @proxy: A #GXdpOpenURIProxy.
4315 * @arg_parent_window: Argument to pass with the method invocation.
4316 * @arg_fd: Argument to pass with the method invocation.
4317 * @arg_options: Argument to pass with the method invocation.
4318 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4319 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4320 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
4321 * @cancellable: (nullable): A #GCancellable or %NULL.
4322 * @error: Return location for error or %NULL.
4323 *
4324 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4325 *
4326 * See gxdp_open_uri_call_open_file() for the asynchronous version of this method.
4327 *
4328 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4329 */
4330 gboolean
gxdp_open_uri_call_open_file_sync(GXdpOpenURI * proxy,const gchar * arg_parent_window,GVariant * arg_fd,GVariant * arg_options,GUnixFDList * fd_list,gchar ** out_handle,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)4331 gxdp_open_uri_call_open_file_sync (
4332 GXdpOpenURI *proxy,
4333 const gchar *arg_parent_window,
4334 GVariant *arg_fd,
4335 GVariant *arg_options,
4336 GUnixFDList *fd_list,
4337 gchar **out_handle,
4338 GUnixFDList **out_fd_list,
4339 GCancellable *cancellable,
4340 GError **error)
4341 {
4342 GVariant *_ret;
4343 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
4344 "OpenFile",
4345 g_variant_new ("(s@h@a{sv})",
4346 arg_parent_window,
4347 arg_fd,
4348 arg_options),
4349 G_DBUS_CALL_FLAGS_NONE,
4350 -1,
4351 fd_list,
4352 out_fd_list,
4353 cancellable,
4354 error);
4355 if (_ret == NULL)
4356 goto _out;
4357 g_variant_get (_ret,
4358 "(o)",
4359 out_handle);
4360 g_variant_unref (_ret);
4361 _out:
4362 return _ret != NULL;
4363 }
4364
4365 /**
4366 * gxdp_open_uri_call_open_directory:
4367 * @proxy: A #GXdpOpenURIProxy.
4368 * @arg_parent_window: Argument to pass with the method invocation.
4369 * @arg_fd: Argument to pass with the method invocation.
4370 * @arg_options: Argument to pass with the method invocation.
4371 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4372 * @cancellable: (nullable): A #GCancellable or %NULL.
4373 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4374 * @user_data: User data to pass to @callback.
4375 *
4376 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenDirectory">OpenDirectory()</link> D-Bus method on @proxy.
4377 * 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()).
4378 * You can then call gxdp_open_uri_call_open_directory_finish() to get the result of the operation.
4379 *
4380 * See gxdp_open_uri_call_open_directory_sync() for the synchronous, blocking version of this method.
4381 */
4382 void
gxdp_open_uri_call_open_directory(GXdpOpenURI * proxy,const gchar * arg_parent_window,GVariant * arg_fd,GVariant * arg_options,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4383 gxdp_open_uri_call_open_directory (
4384 GXdpOpenURI *proxy,
4385 const gchar *arg_parent_window,
4386 GVariant *arg_fd,
4387 GVariant *arg_options,
4388 GUnixFDList *fd_list,
4389 GCancellable *cancellable,
4390 GAsyncReadyCallback callback,
4391 gpointer user_data)
4392 {
4393 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
4394 "OpenDirectory",
4395 g_variant_new ("(s@h@a{sv})",
4396 arg_parent_window,
4397 arg_fd,
4398 arg_options),
4399 G_DBUS_CALL_FLAGS_NONE,
4400 -1,
4401 fd_list,
4402 cancellable,
4403 callback,
4404 user_data);
4405 }
4406
4407 /**
4408 * gxdp_open_uri_call_open_directory_finish:
4409 * @proxy: A #GXdpOpenURIProxy.
4410 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4411 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
4412 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_call_open_directory().
4413 * @error: Return location for error or %NULL.
4414 *
4415 * Finishes an operation started with gxdp_open_uri_call_open_directory().
4416 *
4417 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4418 */
4419 gboolean
gxdp_open_uri_call_open_directory_finish(GXdpOpenURI * proxy,gchar ** out_handle,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)4420 gxdp_open_uri_call_open_directory_finish (
4421 GXdpOpenURI *proxy,
4422 gchar **out_handle,
4423 GUnixFDList **out_fd_list,
4424 GAsyncResult *res,
4425 GError **error)
4426 {
4427 GVariant *_ret;
4428 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
4429 if (_ret == NULL)
4430 goto _out;
4431 g_variant_get (_ret,
4432 "(o)",
4433 out_handle);
4434 g_variant_unref (_ret);
4435 _out:
4436 return _ret != NULL;
4437 }
4438
4439 /**
4440 * gxdp_open_uri_call_open_directory_sync:
4441 * @proxy: A #GXdpOpenURIProxy.
4442 * @arg_parent_window: Argument to pass with the method invocation.
4443 * @arg_fd: Argument to pass with the method invocation.
4444 * @arg_options: Argument to pass with the method invocation.
4445 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4446 * @out_handle: (out) (optional): Return location for return parameter or %NULL to ignore.
4447 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
4448 * @cancellable: (nullable): A #GCancellable or %NULL.
4449 * @error: Return location for error or %NULL.
4450 *
4451 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenDirectory">OpenDirectory()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4452 *
4453 * See gxdp_open_uri_call_open_directory() for the asynchronous version of this method.
4454 *
4455 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
4456 */
4457 gboolean
gxdp_open_uri_call_open_directory_sync(GXdpOpenURI * proxy,const gchar * arg_parent_window,GVariant * arg_fd,GVariant * arg_options,GUnixFDList * fd_list,gchar ** out_handle,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)4458 gxdp_open_uri_call_open_directory_sync (
4459 GXdpOpenURI *proxy,
4460 const gchar *arg_parent_window,
4461 GVariant *arg_fd,
4462 GVariant *arg_options,
4463 GUnixFDList *fd_list,
4464 gchar **out_handle,
4465 GUnixFDList **out_fd_list,
4466 GCancellable *cancellable,
4467 GError **error)
4468 {
4469 GVariant *_ret;
4470 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
4471 "OpenDirectory",
4472 g_variant_new ("(s@h@a{sv})",
4473 arg_parent_window,
4474 arg_fd,
4475 arg_options),
4476 G_DBUS_CALL_FLAGS_NONE,
4477 -1,
4478 fd_list,
4479 out_fd_list,
4480 cancellable,
4481 error);
4482 if (_ret == NULL)
4483 goto _out;
4484 g_variant_get (_ret,
4485 "(o)",
4486 out_handle);
4487 g_variant_unref (_ret);
4488 _out:
4489 return _ret != NULL;
4490 }
4491
4492 /**
4493 * gxdp_open_uri_complete_open_uri:
4494 * @object: A #GXdpOpenURI.
4495 * @invocation: (transfer full): A #GDBusMethodInvocation.
4496 * @handle: Parameter to return.
4497 *
4498 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</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.
4499 *
4500 * This method will free @invocation, you cannot use it afterwards.
4501 */
4502 void
gxdp_open_uri_complete_open_uri(GXdpOpenURI * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * handle)4503 gxdp_open_uri_complete_open_uri (
4504 GXdpOpenURI *object G_GNUC_UNUSED,
4505 GDBusMethodInvocation *invocation,
4506 const gchar *handle)
4507 {
4508 g_dbus_method_invocation_return_value (invocation,
4509 g_variant_new ("(o)",
4510 handle));
4511 }
4512
4513 /**
4514 * gxdp_open_uri_complete_open_file:
4515 * @object: A #GXdpOpenURI.
4516 * @invocation: (transfer full): A #GDBusMethodInvocation.
4517 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4518 * @handle: Parameter to return.
4519 *
4520 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</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.
4521 *
4522 * This method will free @invocation, you cannot use it afterwards.
4523 */
4524 void
gxdp_open_uri_complete_open_file(GXdpOpenURI * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * handle)4525 gxdp_open_uri_complete_open_file (
4526 GXdpOpenURI *object G_GNUC_UNUSED,
4527 GDBusMethodInvocation *invocation,
4528 GUnixFDList *fd_list,
4529 const gchar *handle)
4530 {
4531 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
4532 g_variant_new ("(o)",
4533 handle),
4534 fd_list);
4535 }
4536
4537 /**
4538 * gxdp_open_uri_complete_open_directory:
4539 * @object: A #GXdpOpenURI.
4540 * @invocation: (transfer full): A #GDBusMethodInvocation.
4541 * @fd_list: (nullable): A #GUnixFDList or %NULL.
4542 * @handle: Parameter to return.
4543 *
4544 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenDirectory">OpenDirectory()</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.
4545 *
4546 * This method will free @invocation, you cannot use it afterwards.
4547 */
4548 void
gxdp_open_uri_complete_open_directory(GXdpOpenURI * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,const gchar * handle)4549 gxdp_open_uri_complete_open_directory (
4550 GXdpOpenURI *object G_GNUC_UNUSED,
4551 GDBusMethodInvocation *invocation,
4552 GUnixFDList *fd_list,
4553 const gchar *handle)
4554 {
4555 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
4556 g_variant_new ("(o)",
4557 handle),
4558 fd_list);
4559 }
4560
4561 /* ------------------------------------------------------------------------ */
4562
4563 /**
4564 * GXdpOpenURIProxy:
4565 *
4566 * The #GXdpOpenURIProxy structure contains only private data and should only be accessed using the provided API.
4567 */
4568
4569 /**
4570 * GXdpOpenURIProxyClass:
4571 * @parent_class: The parent class.
4572 *
4573 * Class structure for #GXdpOpenURIProxy.
4574 */
4575
4576 struct _GXdpOpenURIProxyPrivate
4577 {
4578 GData *qdata;
4579 };
4580
4581 static void gxdp_open_uri_proxy_iface_init (GXdpOpenURIIface *iface);
4582
4583 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpOpenURIProxy,gxdp_open_uri_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (GXdpOpenURIProxy)G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI,gxdp_open_uri_proxy_iface_init))4584 G_DEFINE_TYPE_WITH_CODE (GXdpOpenURIProxy, gxdp_open_uri_proxy, G_TYPE_DBUS_PROXY,
4585 G_ADD_PRIVATE (GXdpOpenURIProxy)
4586 G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_proxy_iface_init))
4587
4588 #else
4589 G_DEFINE_TYPE_WITH_CODE (GXdpOpenURIProxy, gxdp_open_uri_proxy, G_TYPE_DBUS_PROXY,
4590 G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_proxy_iface_init))
4591
4592 #endif
4593 static void
4594 gxdp_open_uri_proxy_finalize (GObject *object)
4595 {
4596 GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (object);
4597 g_datalist_clear (&proxy->priv->qdata);
4598 G_OBJECT_CLASS (gxdp_open_uri_proxy_parent_class)->finalize (object);
4599 }
4600
4601 static void
gxdp_open_uri_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)4602 gxdp_open_uri_proxy_get_property (GObject *object,
4603 guint prop_id,
4604 GValue *value,
4605 GParamSpec *pspec G_GNUC_UNUSED)
4606 {
4607 const _ExtendedGDBusPropertyInfo *info;
4608 GVariant *variant;
4609 g_assert (prop_id != 0 && prop_id - 1 < 1);
4610 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1];
4611 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4612 if (info->use_gvariant)
4613 {
4614 g_value_set_variant (value, variant);
4615 }
4616 else
4617 {
4618 if (variant != NULL)
4619 g_dbus_gvariant_to_gvalue (variant, value);
4620 }
4621 if (variant != NULL)
4622 g_variant_unref (variant);
4623 }
4624
4625 static void
gxdp_open_uri_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)4626 gxdp_open_uri_proxy_set_property_cb (GDBusProxy *proxy,
4627 GAsyncResult *res,
4628 gpointer user_data)
4629 {
4630 const _ExtendedGDBusPropertyInfo *info = user_data;
4631 GError *error;
4632 GVariant *_ret;
4633 error = NULL;
4634 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4635 if (!_ret)
4636 {
4637 g_warning ("Error setting property '%s' on interface org.freedesktop.portal.OpenURI: %s (%s, %d)",
4638 info->parent_struct.name,
4639 error->message, g_quark_to_string (error->domain), error->code);
4640 g_error_free (error);
4641 }
4642 else
4643 {
4644 g_variant_unref (_ret);
4645 }
4646 }
4647
4648 static void
gxdp_open_uri_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)4649 gxdp_open_uri_proxy_set_property (GObject *object,
4650 guint prop_id,
4651 const GValue *value,
4652 GParamSpec *pspec G_GNUC_UNUSED)
4653 {
4654 const _ExtendedGDBusPropertyInfo *info;
4655 GVariant *variant;
4656 g_assert (prop_id != 0 && prop_id - 1 < 1);
4657 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1];
4658 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4659 g_dbus_proxy_call (G_DBUS_PROXY (object),
4660 "org.freedesktop.DBus.Properties.Set",
4661 g_variant_new ("(ssv)", "org.freedesktop.portal.OpenURI", info->parent_struct.name, variant),
4662 G_DBUS_CALL_FLAGS_NONE,
4663 -1,
4664 NULL, (GAsyncReadyCallback) gxdp_open_uri_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4665 g_variant_unref (variant);
4666 }
4667
4668 static void
gxdp_open_uri_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)4669 gxdp_open_uri_proxy_g_signal (GDBusProxy *proxy,
4670 const gchar *sender_name G_GNUC_UNUSED,
4671 const gchar *signal_name,
4672 GVariant *parameters)
4673 {
4674 _ExtendedGDBusSignalInfo *info;
4675 GVariantIter iter;
4676 GVariant *child;
4677 GValue *paramv;
4678 gsize num_params;
4679 gsize n;
4680 guint signal_id;
4681 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, signal_name);
4682 if (info == NULL)
4683 return;
4684 num_params = g_variant_n_children (parameters);
4685 paramv = g_new0 (GValue, num_params + 1);
4686 g_value_init (¶mv[0], GXDP_TYPE_OPEN_URI);
4687 g_value_set_object (¶mv[0], proxy);
4688 g_variant_iter_init (&iter, parameters);
4689 n = 1;
4690 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4691 {
4692 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4693 if (arg_info->use_gvariant)
4694 {
4695 g_value_init (¶mv[n], G_TYPE_VARIANT);
4696 g_value_set_variant (¶mv[n], child);
4697 n++;
4698 }
4699 else
4700 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
4701 g_variant_unref (child);
4702 }
4703 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_OPEN_URI);
4704 g_signal_emitv (paramv, signal_id, 0, NULL);
4705 for (n = 0; n < num_params + 1; n++)
4706 g_value_unset (¶mv[n]);
4707 g_free (paramv);
4708 }
4709
4710 static void
gxdp_open_uri_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)4711 gxdp_open_uri_proxy_g_properties_changed (GDBusProxy *_proxy,
4712 GVariant *changed_properties,
4713 const gchar *const *invalidated_properties)
4714 {
4715 GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (_proxy);
4716 guint n;
4717 const gchar *key;
4718 GVariantIter *iter;
4719 _ExtendedGDBusPropertyInfo *info;
4720 g_variant_get (changed_properties, "a{sv}", &iter);
4721 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4722 {
4723 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, key);
4724 g_datalist_remove_data (&proxy->priv->qdata, key);
4725 if (info != NULL)
4726 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4727 }
4728 g_variant_iter_free (iter);
4729 for (n = 0; invalidated_properties[n] != NULL; n++)
4730 {
4731 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, invalidated_properties[n]);
4732 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4733 if (info != NULL)
4734 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4735 }
4736 }
4737
4738 static guint
gxdp_open_uri_proxy_get_version(GXdpOpenURI * object)4739 gxdp_open_uri_proxy_get_version (GXdpOpenURI *object)
4740 {
4741 GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (object);
4742 GVariant *variant;
4743 guint value = 0;
4744 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
4745 if (variant != NULL)
4746 {
4747 value = g_variant_get_uint32 (variant);
4748 g_variant_unref (variant);
4749 }
4750 return value;
4751 }
4752
4753 static void
gxdp_open_uri_proxy_init(GXdpOpenURIProxy * proxy)4754 gxdp_open_uri_proxy_init (GXdpOpenURIProxy *proxy)
4755 {
4756 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4757 proxy->priv = gxdp_open_uri_proxy_get_instance_private (proxy);
4758 #else
4759 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_OPEN_URI_PROXY, GXdpOpenURIProxyPrivate);
4760 #endif
4761
4762 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_open_uri_interface_info ());
4763 }
4764
4765 static void
gxdp_open_uri_proxy_class_init(GXdpOpenURIProxyClass * klass)4766 gxdp_open_uri_proxy_class_init (GXdpOpenURIProxyClass *klass)
4767 {
4768 GObjectClass *gobject_class;
4769 GDBusProxyClass *proxy_class;
4770
4771 gobject_class = G_OBJECT_CLASS (klass);
4772 gobject_class->finalize = gxdp_open_uri_proxy_finalize;
4773 gobject_class->get_property = gxdp_open_uri_proxy_get_property;
4774 gobject_class->set_property = gxdp_open_uri_proxy_set_property;
4775
4776 proxy_class = G_DBUS_PROXY_CLASS (klass);
4777 proxy_class->g_signal = gxdp_open_uri_proxy_g_signal;
4778 proxy_class->g_properties_changed = gxdp_open_uri_proxy_g_properties_changed;
4779
4780 gxdp_open_uri_override_properties (gobject_class, 1);
4781
4782 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4783 g_type_class_add_private (klass, sizeof (GXdpOpenURIProxyPrivate));
4784 #endif
4785 }
4786
4787 static void
gxdp_open_uri_proxy_iface_init(GXdpOpenURIIface * iface)4788 gxdp_open_uri_proxy_iface_init (GXdpOpenURIIface *iface)
4789 {
4790 iface->get_version = gxdp_open_uri_proxy_get_version;
4791 }
4792
4793 /**
4794 * gxdp_open_uri_proxy_new:
4795 * @connection: A #GDBusConnection.
4796 * @flags: Flags from the #GDBusProxyFlags enumeration.
4797 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4798 * @object_path: An object path.
4799 * @cancellable: (nullable): A #GCancellable or %NULL.
4800 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4801 * @user_data: User data to pass to @callback.
4802 *
4803 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>. See g_dbus_proxy_new() for more details.
4804 *
4805 * 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()).
4806 * You can then call gxdp_open_uri_proxy_new_finish() to get the result of the operation.
4807 *
4808 * See gxdp_open_uri_proxy_new_sync() for the synchronous, blocking version of this constructor.
4809 */
4810 void
gxdp_open_uri_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4811 gxdp_open_uri_proxy_new (
4812 GDBusConnection *connection,
4813 GDBusProxyFlags flags,
4814 const gchar *name,
4815 const gchar *object_path,
4816 GCancellable *cancellable,
4817 GAsyncReadyCallback callback,
4818 gpointer user_data)
4819 {
4820 g_async_initable_new_async (GXDP_TYPE_OPEN_URI_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.portal.OpenURI", NULL);
4821 }
4822
4823 /**
4824 * gxdp_open_uri_proxy_new_finish:
4825 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_proxy_new().
4826 * @error: Return location for error or %NULL
4827 *
4828 * Finishes an operation started with gxdp_open_uri_proxy_new().
4829 *
4830 * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set.
4831 */
4832 GXdpOpenURI *
gxdp_open_uri_proxy_new_finish(GAsyncResult * res,GError ** error)4833 gxdp_open_uri_proxy_new_finish (
4834 GAsyncResult *res,
4835 GError **error)
4836 {
4837 GObject *ret;
4838 GObject *source_object;
4839 source_object = g_async_result_get_source_object (res);
4840 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4841 g_object_unref (source_object);
4842 if (ret != NULL)
4843 return GXDP_OPEN_URI (ret);
4844 else
4845 return NULL;
4846 }
4847
4848 /**
4849 * gxdp_open_uri_proxy_new_sync:
4850 * @connection: A #GDBusConnection.
4851 * @flags: Flags from the #GDBusProxyFlags enumeration.
4852 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4853 * @object_path: An object path.
4854 * @cancellable: (nullable): A #GCancellable or %NULL.
4855 * @error: Return location for error or %NULL
4856 *
4857 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>. See g_dbus_proxy_new_sync() for more details.
4858 *
4859 * The calling thread is blocked until a reply is received.
4860 *
4861 * See gxdp_open_uri_proxy_new() for the asynchronous version of this constructor.
4862 *
4863 * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set.
4864 */
4865 GXdpOpenURI *
gxdp_open_uri_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)4866 gxdp_open_uri_proxy_new_sync (
4867 GDBusConnection *connection,
4868 GDBusProxyFlags flags,
4869 const gchar *name,
4870 const gchar *object_path,
4871 GCancellable *cancellable,
4872 GError **error)
4873 {
4874 GInitable *ret;
4875 ret = g_initable_new (GXDP_TYPE_OPEN_URI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.OpenURI", NULL);
4876 if (ret != NULL)
4877 return GXDP_OPEN_URI (ret);
4878 else
4879 return NULL;
4880 }
4881
4882
4883 /**
4884 * gxdp_open_uri_proxy_new_for_bus:
4885 * @bus_type: A #GBusType.
4886 * @flags: Flags from the #GDBusProxyFlags enumeration.
4887 * @name: A bus name (well-known or unique).
4888 * @object_path: An object path.
4889 * @cancellable: (nullable): A #GCancellable or %NULL.
4890 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4891 * @user_data: User data to pass to @callback.
4892 *
4893 * Like gxdp_open_uri_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4894 *
4895 * 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()).
4896 * You can then call gxdp_open_uri_proxy_new_for_bus_finish() to get the result of the operation.
4897 *
4898 * See gxdp_open_uri_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4899 */
4900 void
gxdp_open_uri_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)4901 gxdp_open_uri_proxy_new_for_bus (
4902 GBusType bus_type,
4903 GDBusProxyFlags flags,
4904 const gchar *name,
4905 const gchar *object_path,
4906 GCancellable *cancellable,
4907 GAsyncReadyCallback callback,
4908 gpointer user_data)
4909 {
4910 g_async_initable_new_async (GXDP_TYPE_OPEN_URI_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.portal.OpenURI", NULL);
4911 }
4912
4913 /**
4914 * gxdp_open_uri_proxy_new_for_bus_finish:
4915 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_proxy_new_for_bus().
4916 * @error: Return location for error or %NULL
4917 *
4918 * Finishes an operation started with gxdp_open_uri_proxy_new_for_bus().
4919 *
4920 * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set.
4921 */
4922 GXdpOpenURI *
gxdp_open_uri_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)4923 gxdp_open_uri_proxy_new_for_bus_finish (
4924 GAsyncResult *res,
4925 GError **error)
4926 {
4927 GObject *ret;
4928 GObject *source_object;
4929 source_object = g_async_result_get_source_object (res);
4930 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4931 g_object_unref (source_object);
4932 if (ret != NULL)
4933 return GXDP_OPEN_URI (ret);
4934 else
4935 return NULL;
4936 }
4937
4938 /**
4939 * gxdp_open_uri_proxy_new_for_bus_sync:
4940 * @bus_type: A #GBusType.
4941 * @flags: Flags from the #GDBusProxyFlags enumeration.
4942 * @name: A bus name (well-known or unique).
4943 * @object_path: An object path.
4944 * @cancellable: (nullable): A #GCancellable or %NULL.
4945 * @error: Return location for error or %NULL
4946 *
4947 * Like gxdp_open_uri_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4948 *
4949 * The calling thread is blocked until a reply is received.
4950 *
4951 * See gxdp_open_uri_proxy_new_for_bus() for the asynchronous version of this constructor.
4952 *
4953 * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set.
4954 */
4955 GXdpOpenURI *
gxdp_open_uri_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)4956 gxdp_open_uri_proxy_new_for_bus_sync (
4957 GBusType bus_type,
4958 GDBusProxyFlags flags,
4959 const gchar *name,
4960 const gchar *object_path,
4961 GCancellable *cancellable,
4962 GError **error)
4963 {
4964 GInitable *ret;
4965 ret = g_initable_new (GXDP_TYPE_OPEN_URI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.OpenURI", NULL);
4966 if (ret != NULL)
4967 return GXDP_OPEN_URI (ret);
4968 else
4969 return NULL;
4970 }
4971
4972
4973 /* ------------------------------------------------------------------------ */
4974
4975 /**
4976 * GXdpOpenURISkeleton:
4977 *
4978 * The #GXdpOpenURISkeleton structure contains only private data and should only be accessed using the provided API.
4979 */
4980
4981 /**
4982 * GXdpOpenURISkeletonClass:
4983 * @parent_class: The parent class.
4984 *
4985 * Class structure for #GXdpOpenURISkeleton.
4986 */
4987
4988 struct _GXdpOpenURISkeletonPrivate
4989 {
4990 GValue *properties;
4991 GList *changed_properties;
4992 GSource *changed_properties_idle_source;
4993 GMainContext *context;
4994 GMutex lock;
4995 };
4996
4997 static void
_gxdp_open_uri_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)4998 _gxdp_open_uri_skeleton_handle_method_call (
4999 GDBusConnection *connection G_GNUC_UNUSED,
5000 const gchar *sender G_GNUC_UNUSED,
5001 const gchar *object_path G_GNUC_UNUSED,
5002 const gchar *interface_name,
5003 const gchar *method_name,
5004 GVariant *parameters,
5005 GDBusMethodInvocation *invocation,
5006 gpointer user_data)
5007 {
5008 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data);
5009 _ExtendedGDBusMethodInfo *info;
5010 GVariantIter iter;
5011 GVariant *child;
5012 GValue *paramv;
5013 gsize num_params;
5014 guint num_extra;
5015 gsize n;
5016 guint signal_id;
5017 GValue return_value = G_VALUE_INIT;
5018 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5019 g_assert (info != NULL);
5020 num_params = g_variant_n_children (parameters);
5021 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5022 n = 0;
5023 g_value_init (¶mv[n], GXDP_TYPE_OPEN_URI);
5024 g_value_set_object (¶mv[n++], skeleton);
5025 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5026 g_value_set_object (¶mv[n++], invocation);
5027 if (info->pass_fdlist)
5028 {
5029 #ifdef G_OS_UNIX
5030 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
5031 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5032 #else
5033 g_assert_not_reached ();
5034 #endif
5035 }
5036 g_variant_iter_init (&iter, parameters);
5037 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5038 {
5039 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5040 if (arg_info->use_gvariant)
5041 {
5042 g_value_init (¶mv[n], G_TYPE_VARIANT);
5043 g_value_set_variant (¶mv[n], child);
5044 n++;
5045 }
5046 else
5047 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
5048 g_variant_unref (child);
5049 }
5050 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_OPEN_URI);
5051 g_value_init (&return_value, G_TYPE_BOOLEAN);
5052 g_signal_emitv (paramv, signal_id, 0, &return_value);
5053 if (!g_value_get_boolean (&return_value))
5054 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);
5055 g_value_unset (&return_value);
5056 for (n = 0; n < num_params + num_extra; n++)
5057 g_value_unset (¶mv[n]);
5058 g_free (paramv);
5059 }
5060
5061 static GVariant *
_gxdp_open_uri_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)5062 _gxdp_open_uri_skeleton_handle_get_property (
5063 GDBusConnection *connection G_GNUC_UNUSED,
5064 const gchar *sender G_GNUC_UNUSED,
5065 const gchar *object_path G_GNUC_UNUSED,
5066 const gchar *interface_name G_GNUC_UNUSED,
5067 const gchar *property_name,
5068 GError **error,
5069 gpointer user_data)
5070 {
5071 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data);
5072 GValue value = G_VALUE_INIT;
5073 GParamSpec *pspec;
5074 _ExtendedGDBusPropertyInfo *info;
5075 GVariant *ret;
5076 ret = NULL;
5077 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, property_name);
5078 g_assert (info != NULL);
5079 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5080 if (pspec == NULL)
5081 {
5082 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5083 }
5084 else
5085 {
5086 g_value_init (&value, pspec->value_type);
5087 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5088 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5089 g_value_unset (&value);
5090 }
5091 return ret;
5092 }
5093
5094 static gboolean
_gxdp_open_uri_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)5095 _gxdp_open_uri_skeleton_handle_set_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 GVariant *variant,
5102 GError **error,
5103 gpointer user_data)
5104 {
5105 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data);
5106 GValue value = G_VALUE_INIT;
5107 GParamSpec *pspec;
5108 _ExtendedGDBusPropertyInfo *info;
5109 gboolean ret;
5110 ret = FALSE;
5111 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, property_name);
5112 g_assert (info != NULL);
5113 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5114 if (pspec == NULL)
5115 {
5116 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5117 }
5118 else
5119 {
5120 if (info->use_gvariant)
5121 g_value_set_variant (&value, variant);
5122 else
5123 g_dbus_gvariant_to_gvalue (variant, &value);
5124 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5125 g_value_unset (&value);
5126 ret = TRUE;
5127 }
5128 return ret;
5129 }
5130
5131 static const GDBusInterfaceVTable _gxdp_open_uri_skeleton_vtable =
5132 {
5133 _gxdp_open_uri_skeleton_handle_method_call,
5134 _gxdp_open_uri_skeleton_handle_get_property,
5135 _gxdp_open_uri_skeleton_handle_set_property,
5136 {NULL}
5137 };
5138
5139 static GDBusInterfaceInfo *
gxdp_open_uri_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)5140 gxdp_open_uri_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5141 {
5142 return gxdp_open_uri_interface_info ();
5143 }
5144
5145 static GDBusInterfaceVTable *
gxdp_open_uri_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)5146 gxdp_open_uri_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5147 {
5148 return (GDBusInterfaceVTable *) &_gxdp_open_uri_skeleton_vtable;
5149 }
5150
5151 static GVariant *
gxdp_open_uri_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)5152 gxdp_open_uri_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5153 {
5154 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (_skeleton);
5155
5156 GVariantBuilder builder;
5157 guint n;
5158 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5159 if (_gxdp_open_uri_interface_info.parent_struct.properties == NULL)
5160 goto out;
5161 for (n = 0; _gxdp_open_uri_interface_info.parent_struct.properties[n] != NULL; n++)
5162 {
5163 GDBusPropertyInfo *info = _gxdp_open_uri_interface_info.parent_struct.properties[n];
5164 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5165 {
5166 GVariant *value;
5167 value = _gxdp_open_uri_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.portal.OpenURI", info->name, NULL, skeleton);
5168 if (value != NULL)
5169 {
5170 g_variant_take_ref (value);
5171 g_variant_builder_add (&builder, "{sv}", info->name, value);
5172 g_variant_unref (value);
5173 }
5174 }
5175 }
5176 out:
5177 return g_variant_builder_end (&builder);
5178 }
5179
5180 static gboolean _gxdp_open_uri_emit_changed (gpointer user_data);
5181
5182 static void
gxdp_open_uri_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)5183 gxdp_open_uri_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5184 {
5185 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (_skeleton);
5186 gboolean emit_changed = FALSE;
5187
5188 g_mutex_lock (&skeleton->priv->lock);
5189 if (skeleton->priv->changed_properties_idle_source != NULL)
5190 {
5191 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5192 skeleton->priv->changed_properties_idle_source = NULL;
5193 emit_changed = TRUE;
5194 }
5195 g_mutex_unlock (&skeleton->priv->lock);
5196
5197 if (emit_changed)
5198 _gxdp_open_uri_emit_changed (skeleton);
5199 }
5200
5201 static void gxdp_open_uri_skeleton_iface_init (GXdpOpenURIIface *iface);
5202 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpOpenURISkeleton,gxdp_open_uri_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (GXdpOpenURISkeleton)G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI,gxdp_open_uri_skeleton_iface_init))5203 G_DEFINE_TYPE_WITH_CODE (GXdpOpenURISkeleton, gxdp_open_uri_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5204 G_ADD_PRIVATE (GXdpOpenURISkeleton)
5205 G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_skeleton_iface_init))
5206
5207 #else
5208 G_DEFINE_TYPE_WITH_CODE (GXdpOpenURISkeleton, gxdp_open_uri_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5209 G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_skeleton_iface_init))
5210
5211 #endif
5212 static void
5213 gxdp_open_uri_skeleton_finalize (GObject *object)
5214 {
5215 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object);
5216 guint n;
5217 for (n = 0; n < 1; n++)
5218 g_value_unset (&skeleton->priv->properties[n]);
5219 g_free (skeleton->priv->properties);
5220 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5221 if (skeleton->priv->changed_properties_idle_source != NULL)
5222 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5223 g_main_context_unref (skeleton->priv->context);
5224 g_mutex_clear (&skeleton->priv->lock);
5225 G_OBJECT_CLASS (gxdp_open_uri_skeleton_parent_class)->finalize (object);
5226 }
5227
5228 static void
gxdp_open_uri_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5229 gxdp_open_uri_skeleton_get_property (GObject *object,
5230 guint prop_id,
5231 GValue *value,
5232 GParamSpec *pspec G_GNUC_UNUSED)
5233 {
5234 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object);
5235 g_assert (prop_id != 0 && prop_id - 1 < 1);
5236 g_mutex_lock (&skeleton->priv->lock);
5237 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5238 g_mutex_unlock (&skeleton->priv->lock);
5239 }
5240
5241 static gboolean
_gxdp_open_uri_emit_changed(gpointer user_data)5242 _gxdp_open_uri_emit_changed (gpointer user_data)
5243 {
5244 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data);
5245 GList *l;
5246 GVariantBuilder builder;
5247 GVariantBuilder invalidated_builder;
5248 guint num_changes;
5249
5250 g_mutex_lock (&skeleton->priv->lock);
5251 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5252 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5253 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5254 {
5255 ChangedProperty *cp = l->data;
5256 GVariant *variant;
5257 const GValue *cur_value;
5258
5259 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5260 if (!_g_value_equal (cur_value, &cp->orig_value))
5261 {
5262 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5263 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5264 g_variant_unref (variant);
5265 num_changes++;
5266 }
5267 }
5268 if (num_changes > 0)
5269 {
5270 GList *connections, *ll;
5271 GVariant *signal_variant;
5272 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.OpenURI",
5273 &builder, &invalidated_builder));
5274 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5275 for (ll = connections; ll != NULL; ll = ll->next)
5276 {
5277 GDBusConnection *connection = ll->data;
5278
5279 g_dbus_connection_emit_signal (connection,
5280 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5281 "org.freedesktop.DBus.Properties",
5282 "PropertiesChanged",
5283 signal_variant,
5284 NULL);
5285 }
5286 g_variant_unref (signal_variant);
5287 g_list_free_full (connections, g_object_unref);
5288 }
5289 else
5290 {
5291 g_variant_builder_clear (&builder);
5292 g_variant_builder_clear (&invalidated_builder);
5293 }
5294 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5295 skeleton->priv->changed_properties = NULL;
5296 skeleton->priv->changed_properties_idle_source = NULL;
5297 g_mutex_unlock (&skeleton->priv->lock);
5298 return FALSE;
5299 }
5300
5301 static void
_gxdp_open_uri_schedule_emit_changed(GXdpOpenURISkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)5302 _gxdp_open_uri_schedule_emit_changed (GXdpOpenURISkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5303 {
5304 ChangedProperty *cp;
5305 GList *l;
5306 cp = NULL;
5307 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5308 {
5309 ChangedProperty *i_cp = l->data;
5310 if (i_cp->info == info)
5311 {
5312 cp = i_cp;
5313 break;
5314 }
5315 }
5316 if (cp == NULL)
5317 {
5318 cp = g_new0 (ChangedProperty, 1);
5319 cp->prop_id = prop_id;
5320 cp->info = info;
5321 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5322 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5323 g_value_copy (orig_value, &cp->orig_value);
5324 }
5325 }
5326
5327 static void
gxdp_open_uri_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)5328 gxdp_open_uri_skeleton_notify (GObject *object,
5329 GParamSpec *pspec G_GNUC_UNUSED)
5330 {
5331 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object);
5332 g_mutex_lock (&skeleton->priv->lock);
5333 if (skeleton->priv->changed_properties != NULL &&
5334 skeleton->priv->changed_properties_idle_source == NULL)
5335 {
5336 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5337 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5338 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_open_uri_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5339 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_open_uri_emit_changed");
5340 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5341 g_source_unref (skeleton->priv->changed_properties_idle_source);
5342 }
5343 g_mutex_unlock (&skeleton->priv->lock);
5344 }
5345
5346 static void
gxdp_open_uri_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)5347 gxdp_open_uri_skeleton_set_property (GObject *object,
5348 guint prop_id,
5349 const GValue *value,
5350 GParamSpec *pspec)
5351 {
5352 const _ExtendedGDBusPropertyInfo *info;
5353 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object);
5354 g_assert (prop_id != 0 && prop_id - 1 < 1);
5355 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1];
5356 g_mutex_lock (&skeleton->priv->lock);
5357 g_object_freeze_notify (object);
5358 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5359 {
5360 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
5361 info->emits_changed_signal)
5362 _gxdp_open_uri_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
5363 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5364 g_object_notify_by_pspec (object, pspec);
5365 }
5366 g_mutex_unlock (&skeleton->priv->lock);
5367 g_object_thaw_notify (object);
5368 }
5369
5370 static void
gxdp_open_uri_skeleton_init(GXdpOpenURISkeleton * skeleton)5371 gxdp_open_uri_skeleton_init (GXdpOpenURISkeleton *skeleton)
5372 {
5373 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5374 skeleton->priv = gxdp_open_uri_skeleton_get_instance_private (skeleton);
5375 #else
5376 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_OPEN_URI_SKELETON, GXdpOpenURISkeletonPrivate);
5377 #endif
5378
5379 g_mutex_init (&skeleton->priv->lock);
5380 skeleton->priv->context = g_main_context_ref_thread_default ();
5381 skeleton->priv->properties = g_new0 (GValue, 1);
5382 g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
5383 }
5384
5385 static guint
gxdp_open_uri_skeleton_get_version(GXdpOpenURI * object)5386 gxdp_open_uri_skeleton_get_version (GXdpOpenURI *object)
5387 {
5388 GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object);
5389 guint value;
5390 g_mutex_lock (&skeleton->priv->lock);
5391 value = g_value_get_uint (&(skeleton->priv->properties[0]));
5392 g_mutex_unlock (&skeleton->priv->lock);
5393 return value;
5394 }
5395
5396 static void
gxdp_open_uri_skeleton_class_init(GXdpOpenURISkeletonClass * klass)5397 gxdp_open_uri_skeleton_class_init (GXdpOpenURISkeletonClass *klass)
5398 {
5399 GObjectClass *gobject_class;
5400 GDBusInterfaceSkeletonClass *skeleton_class;
5401
5402 gobject_class = G_OBJECT_CLASS (klass);
5403 gobject_class->finalize = gxdp_open_uri_skeleton_finalize;
5404 gobject_class->get_property = gxdp_open_uri_skeleton_get_property;
5405 gobject_class->set_property = gxdp_open_uri_skeleton_set_property;
5406 gobject_class->notify = gxdp_open_uri_skeleton_notify;
5407
5408
5409 gxdp_open_uri_override_properties (gobject_class, 1);
5410
5411 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5412 skeleton_class->get_info = gxdp_open_uri_skeleton_dbus_interface_get_info;
5413 skeleton_class->get_properties = gxdp_open_uri_skeleton_dbus_interface_get_properties;
5414 skeleton_class->flush = gxdp_open_uri_skeleton_dbus_interface_flush;
5415 skeleton_class->get_vtable = gxdp_open_uri_skeleton_dbus_interface_get_vtable;
5416
5417 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5418 g_type_class_add_private (klass, sizeof (GXdpOpenURISkeletonPrivate));
5419 #endif
5420 }
5421
5422 static void
gxdp_open_uri_skeleton_iface_init(GXdpOpenURIIface * iface)5423 gxdp_open_uri_skeleton_iface_init (GXdpOpenURIIface *iface)
5424 {
5425 iface->get_version = gxdp_open_uri_skeleton_get_version;
5426 }
5427
5428 /**
5429 * gxdp_open_uri_skeleton_new:
5430 *
5431 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>.
5432 *
5433 * Returns: (transfer full) (type GXdpOpenURISkeleton): The skeleton object.
5434 */
5435 GXdpOpenURI *
gxdp_open_uri_skeleton_new(void)5436 gxdp_open_uri_skeleton_new (void)
5437 {
5438 return GXDP_OPEN_URI (g_object_new (GXDP_TYPE_OPEN_URI_SKELETON, NULL));
5439 }
5440
5441 /* ------------------------------------------------------------------------
5442 * Code for interface org.freedesktop.portal.ProxyResolver
5443 * ------------------------------------------------------------------------
5444 */
5445
5446 /**
5447 * SECTION:GXdpProxyResolver
5448 * @title: GXdpProxyResolver
5449 * @short_description: Generated C code for the org.freedesktop.portal.ProxyResolver D-Bus interface
5450 *
5451 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link> D-Bus interface in C.
5452 */
5453
5454 /* ---- Introspection data for org.freedesktop.portal.ProxyResolver ---- */
5455
5456 static const _ExtendedGDBusArgInfo _gxdp_proxy_resolver_method_info_lookup_IN_ARG_uri =
5457 {
5458 {
5459 -1,
5460 (gchar *) "uri",
5461 (gchar *) "s",
5462 NULL
5463 },
5464 FALSE
5465 };
5466
5467 static const GDBusArgInfo * const _gxdp_proxy_resolver_method_info_lookup_IN_ARG_pointers[] =
5468 {
5469 &_gxdp_proxy_resolver_method_info_lookup_IN_ARG_uri.parent_struct,
5470 NULL
5471 };
5472
5473 static const _ExtendedGDBusArgInfo _gxdp_proxy_resolver_method_info_lookup_OUT_ARG_proxies =
5474 {
5475 {
5476 -1,
5477 (gchar *) "proxies",
5478 (gchar *) "as",
5479 NULL
5480 },
5481 FALSE
5482 };
5483
5484 static const GDBusArgInfo * const _gxdp_proxy_resolver_method_info_lookup_OUT_ARG_pointers[] =
5485 {
5486 &_gxdp_proxy_resolver_method_info_lookup_OUT_ARG_proxies.parent_struct,
5487 NULL
5488 };
5489
5490 static const _ExtendedGDBusMethodInfo _gxdp_proxy_resolver_method_info_lookup =
5491 {
5492 {
5493 -1,
5494 (gchar *) "Lookup",
5495 (GDBusArgInfo **) &_gxdp_proxy_resolver_method_info_lookup_IN_ARG_pointers,
5496 (GDBusArgInfo **) &_gxdp_proxy_resolver_method_info_lookup_OUT_ARG_pointers,
5497 NULL
5498 },
5499 "handle-lookup",
5500 FALSE
5501 };
5502
5503 static const GDBusMethodInfo * const _gxdp_proxy_resolver_method_info_pointers[] =
5504 {
5505 &_gxdp_proxy_resolver_method_info_lookup.parent_struct,
5506 NULL
5507 };
5508
5509 static const _ExtendedGDBusPropertyInfo _gxdp_proxy_resolver_property_info_version =
5510 {
5511 {
5512 -1,
5513 (gchar *) "version",
5514 (gchar *) "u",
5515 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5516 NULL
5517 },
5518 "version",
5519 FALSE,
5520 TRUE
5521 };
5522
5523 static const GDBusPropertyInfo * const _gxdp_proxy_resolver_property_info_pointers[] =
5524 {
5525 &_gxdp_proxy_resolver_property_info_version.parent_struct,
5526 NULL
5527 };
5528
5529 static const _ExtendedGDBusInterfaceInfo _gxdp_proxy_resolver_interface_info =
5530 {
5531 {
5532 -1,
5533 (gchar *) "org.freedesktop.portal.ProxyResolver",
5534 (GDBusMethodInfo **) &_gxdp_proxy_resolver_method_info_pointers,
5535 NULL,
5536 (GDBusPropertyInfo **) &_gxdp_proxy_resolver_property_info_pointers,
5537 NULL
5538 },
5539 "proxy-resolver",
5540 };
5541
5542
5543 /**
5544 * gxdp_proxy_resolver_interface_info:
5545 *
5546 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link> D-Bus interface.
5547 *
5548 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5549 */
5550 GDBusInterfaceInfo *
gxdp_proxy_resolver_interface_info(void)5551 gxdp_proxy_resolver_interface_info (void)
5552 {
5553 return (GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct;
5554 }
5555
5556 /**
5557 * gxdp_proxy_resolver_override_properties:
5558 * @klass: The class structure for a #GObject derived class.
5559 * @property_id_begin: The property id to assign to the first overridden property.
5560 *
5561 * Overrides all #GObject properties in the #GXdpProxyResolver interface for a concrete class.
5562 * The properties are overridden in the order they are defined.
5563 *
5564 * Returns: The last property id.
5565 */
5566 guint
gxdp_proxy_resolver_override_properties(GObjectClass * klass,guint property_id_begin)5567 gxdp_proxy_resolver_override_properties (GObjectClass *klass, guint property_id_begin)
5568 {
5569 g_object_class_override_property (klass, property_id_begin++, "version");
5570 return property_id_begin - 1;
5571 }
5572
5573
5574
5575 /**
5576 * GXdpProxyResolver:
5577 *
5578 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>.
5579 */
5580
5581 /**
5582 * GXdpProxyResolverIface:
5583 * @parent_iface: The parent interface.
5584 * @handle_lookup: Handler for the #GXdpProxyResolver::handle-lookup signal.
5585 * @get_version: Getter for the #GXdpProxyResolver:version property.
5586 *
5587 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>.
5588 */
5589
5590 typedef GXdpProxyResolverIface GXdpProxyResolverInterface;
G_DEFINE_INTERFACE(GXdpProxyResolver,gxdp_proxy_resolver,G_TYPE_OBJECT)5591 G_DEFINE_INTERFACE (GXdpProxyResolver, gxdp_proxy_resolver, G_TYPE_OBJECT)
5592
5593 static void
5594 gxdp_proxy_resolver_default_init (GXdpProxyResolverIface *iface)
5595 {
5596 /* GObject signals for incoming D-Bus method calls: */
5597 /**
5598 * GXdpProxyResolver::handle-lookup:
5599 * @object: A #GXdpProxyResolver.
5600 * @invocation: A #GDBusMethodInvocation.
5601 * @arg_uri: Argument passed by remote caller.
5602 *
5603 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</link> D-Bus method.
5604 *
5605 * 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 gxdp_proxy_resolver_complete_lookup() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
5606 *
5607 * 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.
5608 */
5609 g_signal_new ("handle-lookup",
5610 G_TYPE_FROM_INTERFACE (iface),
5611 G_SIGNAL_RUN_LAST,
5612 G_STRUCT_OFFSET (GXdpProxyResolverIface, handle_lookup),
5613 g_signal_accumulator_true_handled,
5614 NULL,
5615 g_cclosure_marshal_generic,
5616 G_TYPE_BOOLEAN,
5617 2,
5618 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
5619
5620 /* GObject properties for D-Bus properties: */
5621 /**
5622 * GXdpProxyResolver:version:
5623 *
5624 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-ProxyResolver.version">"version"</link>.
5625 *
5626 * 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.
5627 */
5628 g_object_interface_install_property (iface,
5629 g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5630 }
5631
5632 /**
5633 * gxdp_proxy_resolver_get_version: (skip)
5634 * @object: A #GXdpProxyResolver.
5635 *
5636 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-ProxyResolver.version">"version"</link> D-Bus property.
5637 *
5638 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5639 *
5640 * Returns: The property value.
5641 */
5642 guint
gxdp_proxy_resolver_get_version(GXdpProxyResolver * object)5643 gxdp_proxy_resolver_get_version (GXdpProxyResolver *object)
5644 {
5645 return GXDP_PROXY_RESOLVER_GET_IFACE (object)->get_version (object);
5646 }
5647
5648 /**
5649 * gxdp_proxy_resolver_set_version: (skip)
5650 * @object: A #GXdpProxyResolver.
5651 * @value: The value to set.
5652 *
5653 * Sets the <link linkend="gdbus-property-org-freedesktop-portal-ProxyResolver.version">"version"</link> D-Bus property to @value.
5654 *
5655 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5656 */
5657 void
gxdp_proxy_resolver_set_version(GXdpProxyResolver * object,guint value)5658 gxdp_proxy_resolver_set_version (GXdpProxyResolver *object, guint value)
5659 {
5660 g_object_set (G_OBJECT (object), "version", value, NULL);
5661 }
5662
5663 /**
5664 * gxdp_proxy_resolver_call_lookup:
5665 * @proxy: A #GXdpProxyResolverProxy.
5666 * @arg_uri: Argument to pass with the method invocation.
5667 * @cancellable: (nullable): A #GCancellable or %NULL.
5668 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5669 * @user_data: User data to pass to @callback.
5670 *
5671 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</link> D-Bus method on @proxy.
5672 * 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()).
5673 * You can then call gxdp_proxy_resolver_call_lookup_finish() to get the result of the operation.
5674 *
5675 * See gxdp_proxy_resolver_call_lookup_sync() for the synchronous, blocking version of this method.
5676 */
5677 void
gxdp_proxy_resolver_call_lookup(GXdpProxyResolver * proxy,const gchar * arg_uri,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)5678 gxdp_proxy_resolver_call_lookup (
5679 GXdpProxyResolver *proxy,
5680 const gchar *arg_uri,
5681 GCancellable *cancellable,
5682 GAsyncReadyCallback callback,
5683 gpointer user_data)
5684 {
5685 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5686 "Lookup",
5687 g_variant_new ("(s)",
5688 arg_uri),
5689 G_DBUS_CALL_FLAGS_NONE,
5690 -1,
5691 cancellable,
5692 callback,
5693 user_data);
5694 }
5695
5696 /**
5697 * gxdp_proxy_resolver_call_lookup_finish:
5698 * @proxy: A #GXdpProxyResolverProxy.
5699 * @out_proxies: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
5700 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_call_lookup().
5701 * @error: Return location for error or %NULL.
5702 *
5703 * Finishes an operation started with gxdp_proxy_resolver_call_lookup().
5704 *
5705 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
5706 */
5707 gboolean
gxdp_proxy_resolver_call_lookup_finish(GXdpProxyResolver * proxy,gchar *** out_proxies,GAsyncResult * res,GError ** error)5708 gxdp_proxy_resolver_call_lookup_finish (
5709 GXdpProxyResolver *proxy,
5710 gchar ***out_proxies,
5711 GAsyncResult *res,
5712 GError **error)
5713 {
5714 GVariant *_ret;
5715 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5716 if (_ret == NULL)
5717 goto _out;
5718 g_variant_get (_ret,
5719 "(^as)",
5720 out_proxies);
5721 g_variant_unref (_ret);
5722 _out:
5723 return _ret != NULL;
5724 }
5725
5726 /**
5727 * gxdp_proxy_resolver_call_lookup_sync:
5728 * @proxy: A #GXdpProxyResolverProxy.
5729 * @arg_uri: Argument to pass with the method invocation.
5730 * @out_proxies: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
5731 * @cancellable: (nullable): A #GCancellable or %NULL.
5732 * @error: Return location for error or %NULL.
5733 *
5734 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5735 *
5736 * See gxdp_proxy_resolver_call_lookup() for the asynchronous version of this method.
5737 *
5738 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
5739 */
5740 gboolean
gxdp_proxy_resolver_call_lookup_sync(GXdpProxyResolver * proxy,const gchar * arg_uri,gchar *** out_proxies,GCancellable * cancellable,GError ** error)5741 gxdp_proxy_resolver_call_lookup_sync (
5742 GXdpProxyResolver *proxy,
5743 const gchar *arg_uri,
5744 gchar ***out_proxies,
5745 GCancellable *cancellable,
5746 GError **error)
5747 {
5748 GVariant *_ret;
5749 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5750 "Lookup",
5751 g_variant_new ("(s)",
5752 arg_uri),
5753 G_DBUS_CALL_FLAGS_NONE,
5754 -1,
5755 cancellable,
5756 error);
5757 if (_ret == NULL)
5758 goto _out;
5759 g_variant_get (_ret,
5760 "(^as)",
5761 out_proxies);
5762 g_variant_unref (_ret);
5763 _out:
5764 return _ret != NULL;
5765 }
5766
5767 /**
5768 * gxdp_proxy_resolver_complete_lookup:
5769 * @object: A #GXdpProxyResolver.
5770 * @invocation: (transfer full): A #GDBusMethodInvocation.
5771 * @proxies: Parameter to return.
5772 *
5773 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</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.
5774 *
5775 * This method will free @invocation, you cannot use it afterwards.
5776 */
5777 void
gxdp_proxy_resolver_complete_lookup(GXdpProxyResolver * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * const * proxies)5778 gxdp_proxy_resolver_complete_lookup (
5779 GXdpProxyResolver *object G_GNUC_UNUSED,
5780 GDBusMethodInvocation *invocation,
5781 const gchar *const *proxies)
5782 {
5783 g_dbus_method_invocation_return_value (invocation,
5784 g_variant_new ("(^as)",
5785 proxies));
5786 }
5787
5788 /* ------------------------------------------------------------------------ */
5789
5790 /**
5791 * GXdpProxyResolverProxy:
5792 *
5793 * The #GXdpProxyResolverProxy structure contains only private data and should only be accessed using the provided API.
5794 */
5795
5796 /**
5797 * GXdpProxyResolverProxyClass:
5798 * @parent_class: The parent class.
5799 *
5800 * Class structure for #GXdpProxyResolverProxy.
5801 */
5802
5803 struct _GXdpProxyResolverProxyPrivate
5804 {
5805 GData *qdata;
5806 };
5807
5808 static void gxdp_proxy_resolver_proxy_iface_init (GXdpProxyResolverIface *iface);
5809
5810 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpProxyResolverProxy,gxdp_proxy_resolver_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (GXdpProxyResolverProxy)G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER,gxdp_proxy_resolver_proxy_iface_init))5811 G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverProxy, gxdp_proxy_resolver_proxy, G_TYPE_DBUS_PROXY,
5812 G_ADD_PRIVATE (GXdpProxyResolverProxy)
5813 G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_proxy_iface_init))
5814
5815 #else
5816 G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverProxy, gxdp_proxy_resolver_proxy, G_TYPE_DBUS_PROXY,
5817 G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_proxy_iface_init))
5818
5819 #endif
5820 static void
5821 gxdp_proxy_resolver_proxy_finalize (GObject *object)
5822 {
5823 GXdpProxyResolverProxy *proxy = GXDP_PROXY_RESOLVER_PROXY (object);
5824 g_datalist_clear (&proxy->priv->qdata);
5825 G_OBJECT_CLASS (gxdp_proxy_resolver_proxy_parent_class)->finalize (object);
5826 }
5827
5828 static void
gxdp_proxy_resolver_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5829 gxdp_proxy_resolver_proxy_get_property (GObject *object,
5830 guint prop_id,
5831 GValue *value,
5832 GParamSpec *pspec G_GNUC_UNUSED)
5833 {
5834 const _ExtendedGDBusPropertyInfo *info;
5835 GVariant *variant;
5836 g_assert (prop_id != 0 && prop_id - 1 < 1);
5837 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_proxy_resolver_property_info_pointers[prop_id - 1];
5838 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5839 if (info->use_gvariant)
5840 {
5841 g_value_set_variant (value, variant);
5842 }
5843 else
5844 {
5845 if (variant != NULL)
5846 g_dbus_gvariant_to_gvalue (variant, value);
5847 }
5848 if (variant != NULL)
5849 g_variant_unref (variant);
5850 }
5851
5852 static void
gxdp_proxy_resolver_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)5853 gxdp_proxy_resolver_proxy_set_property_cb (GDBusProxy *proxy,
5854 GAsyncResult *res,
5855 gpointer user_data)
5856 {
5857 const _ExtendedGDBusPropertyInfo *info = user_data;
5858 GError *error;
5859 GVariant *_ret;
5860 error = NULL;
5861 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5862 if (!_ret)
5863 {
5864 g_warning ("Error setting property '%s' on interface org.freedesktop.portal.ProxyResolver: %s (%s, %d)",
5865 info->parent_struct.name,
5866 error->message, g_quark_to_string (error->domain), error->code);
5867 g_error_free (error);
5868 }
5869 else
5870 {
5871 g_variant_unref (_ret);
5872 }
5873 }
5874
5875 static void
gxdp_proxy_resolver_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)5876 gxdp_proxy_resolver_proxy_set_property (GObject *object,
5877 guint prop_id,
5878 const GValue *value,
5879 GParamSpec *pspec G_GNUC_UNUSED)
5880 {
5881 const _ExtendedGDBusPropertyInfo *info;
5882 GVariant *variant;
5883 g_assert (prop_id != 0 && prop_id - 1 < 1);
5884 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_proxy_resolver_property_info_pointers[prop_id - 1];
5885 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5886 g_dbus_proxy_call (G_DBUS_PROXY (object),
5887 "org.freedesktop.DBus.Properties.Set",
5888 g_variant_new ("(ssv)", "org.freedesktop.portal.ProxyResolver", info->parent_struct.name, variant),
5889 G_DBUS_CALL_FLAGS_NONE,
5890 -1,
5891 NULL, (GAsyncReadyCallback) gxdp_proxy_resolver_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5892 g_variant_unref (variant);
5893 }
5894
5895 static void
gxdp_proxy_resolver_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)5896 gxdp_proxy_resolver_proxy_g_signal (GDBusProxy *proxy,
5897 const gchar *sender_name G_GNUC_UNUSED,
5898 const gchar *signal_name,
5899 GVariant *parameters)
5900 {
5901 _ExtendedGDBusSignalInfo *info;
5902 GVariantIter iter;
5903 GVariant *child;
5904 GValue *paramv;
5905 gsize num_params;
5906 gsize n;
5907 guint signal_id;
5908 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, signal_name);
5909 if (info == NULL)
5910 return;
5911 num_params = g_variant_n_children (parameters);
5912 paramv = g_new0 (GValue, num_params + 1);
5913 g_value_init (¶mv[0], GXDP_TYPE_PROXY_RESOLVER);
5914 g_value_set_object (¶mv[0], proxy);
5915 g_variant_iter_init (&iter, parameters);
5916 n = 1;
5917 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5918 {
5919 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5920 if (arg_info->use_gvariant)
5921 {
5922 g_value_init (¶mv[n], G_TYPE_VARIANT);
5923 g_value_set_variant (¶mv[n], child);
5924 n++;
5925 }
5926 else
5927 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
5928 g_variant_unref (child);
5929 }
5930 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_PROXY_RESOLVER);
5931 g_signal_emitv (paramv, signal_id, 0, NULL);
5932 for (n = 0; n < num_params + 1; n++)
5933 g_value_unset (¶mv[n]);
5934 g_free (paramv);
5935 }
5936
5937 static void
gxdp_proxy_resolver_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)5938 gxdp_proxy_resolver_proxy_g_properties_changed (GDBusProxy *_proxy,
5939 GVariant *changed_properties,
5940 const gchar *const *invalidated_properties)
5941 {
5942 GXdpProxyResolverProxy *proxy = GXDP_PROXY_RESOLVER_PROXY (_proxy);
5943 guint n;
5944 const gchar *key;
5945 GVariantIter *iter;
5946 _ExtendedGDBusPropertyInfo *info;
5947 g_variant_get (changed_properties, "a{sv}", &iter);
5948 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5949 {
5950 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, key);
5951 g_datalist_remove_data (&proxy->priv->qdata, key);
5952 if (info != NULL)
5953 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5954 }
5955 g_variant_iter_free (iter);
5956 for (n = 0; invalidated_properties[n] != NULL; n++)
5957 {
5958 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, invalidated_properties[n]);
5959 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5960 if (info != NULL)
5961 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5962 }
5963 }
5964
5965 static guint
gxdp_proxy_resolver_proxy_get_version(GXdpProxyResolver * object)5966 gxdp_proxy_resolver_proxy_get_version (GXdpProxyResolver *object)
5967 {
5968 GXdpProxyResolverProxy *proxy = GXDP_PROXY_RESOLVER_PROXY (object);
5969 GVariant *variant;
5970 guint value = 0;
5971 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
5972 if (variant != NULL)
5973 {
5974 value = g_variant_get_uint32 (variant);
5975 g_variant_unref (variant);
5976 }
5977 return value;
5978 }
5979
5980 static void
gxdp_proxy_resolver_proxy_init(GXdpProxyResolverProxy * proxy)5981 gxdp_proxy_resolver_proxy_init (GXdpProxyResolverProxy *proxy)
5982 {
5983 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5984 proxy->priv = gxdp_proxy_resolver_proxy_get_instance_private (proxy);
5985 #else
5986 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_PROXY_RESOLVER_PROXY, GXdpProxyResolverProxyPrivate);
5987 #endif
5988
5989 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_proxy_resolver_interface_info ());
5990 }
5991
5992 static void
gxdp_proxy_resolver_proxy_class_init(GXdpProxyResolverProxyClass * klass)5993 gxdp_proxy_resolver_proxy_class_init (GXdpProxyResolverProxyClass *klass)
5994 {
5995 GObjectClass *gobject_class;
5996 GDBusProxyClass *proxy_class;
5997
5998 gobject_class = G_OBJECT_CLASS (klass);
5999 gobject_class->finalize = gxdp_proxy_resolver_proxy_finalize;
6000 gobject_class->get_property = gxdp_proxy_resolver_proxy_get_property;
6001 gobject_class->set_property = gxdp_proxy_resolver_proxy_set_property;
6002
6003 proxy_class = G_DBUS_PROXY_CLASS (klass);
6004 proxy_class->g_signal = gxdp_proxy_resolver_proxy_g_signal;
6005 proxy_class->g_properties_changed = gxdp_proxy_resolver_proxy_g_properties_changed;
6006
6007 gxdp_proxy_resolver_override_properties (gobject_class, 1);
6008
6009 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6010 g_type_class_add_private (klass, sizeof (GXdpProxyResolverProxyPrivate));
6011 #endif
6012 }
6013
6014 static void
gxdp_proxy_resolver_proxy_iface_init(GXdpProxyResolverIface * iface)6015 gxdp_proxy_resolver_proxy_iface_init (GXdpProxyResolverIface *iface)
6016 {
6017 iface->get_version = gxdp_proxy_resolver_proxy_get_version;
6018 }
6019
6020 /**
6021 * gxdp_proxy_resolver_proxy_new:
6022 * @connection: A #GDBusConnection.
6023 * @flags: Flags from the #GDBusProxyFlags enumeration.
6024 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6025 * @object_path: An object path.
6026 * @cancellable: (nullable): A #GCancellable or %NULL.
6027 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6028 * @user_data: User data to pass to @callback.
6029 *
6030 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>. See g_dbus_proxy_new() for more details.
6031 *
6032 * 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()).
6033 * You can then call gxdp_proxy_resolver_proxy_new_finish() to get the result of the operation.
6034 *
6035 * See gxdp_proxy_resolver_proxy_new_sync() for the synchronous, blocking version of this constructor.
6036 */
6037 void
gxdp_proxy_resolver_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)6038 gxdp_proxy_resolver_proxy_new (
6039 GDBusConnection *connection,
6040 GDBusProxyFlags flags,
6041 const gchar *name,
6042 const gchar *object_path,
6043 GCancellable *cancellable,
6044 GAsyncReadyCallback callback,
6045 gpointer user_data)
6046 {
6047 g_async_initable_new_async (GXDP_TYPE_PROXY_RESOLVER_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.portal.ProxyResolver", NULL);
6048 }
6049
6050 /**
6051 * gxdp_proxy_resolver_proxy_new_finish:
6052 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_proxy_new().
6053 * @error: Return location for error or %NULL
6054 *
6055 * Finishes an operation started with gxdp_proxy_resolver_proxy_new().
6056 *
6057 * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set.
6058 */
6059 GXdpProxyResolver *
gxdp_proxy_resolver_proxy_new_finish(GAsyncResult * res,GError ** error)6060 gxdp_proxy_resolver_proxy_new_finish (
6061 GAsyncResult *res,
6062 GError **error)
6063 {
6064 GObject *ret;
6065 GObject *source_object;
6066 source_object = g_async_result_get_source_object (res);
6067 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6068 g_object_unref (source_object);
6069 if (ret != NULL)
6070 return GXDP_PROXY_RESOLVER (ret);
6071 else
6072 return NULL;
6073 }
6074
6075 /**
6076 * gxdp_proxy_resolver_proxy_new_sync:
6077 * @connection: A #GDBusConnection.
6078 * @flags: Flags from the #GDBusProxyFlags enumeration.
6079 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6080 * @object_path: An object path.
6081 * @cancellable: (nullable): A #GCancellable or %NULL.
6082 * @error: Return location for error or %NULL
6083 *
6084 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>. See g_dbus_proxy_new_sync() for more details.
6085 *
6086 * The calling thread is blocked until a reply is received.
6087 *
6088 * See gxdp_proxy_resolver_proxy_new() for the asynchronous version of this constructor.
6089 *
6090 * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set.
6091 */
6092 GXdpProxyResolver *
gxdp_proxy_resolver_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)6093 gxdp_proxy_resolver_proxy_new_sync (
6094 GDBusConnection *connection,
6095 GDBusProxyFlags flags,
6096 const gchar *name,
6097 const gchar *object_path,
6098 GCancellable *cancellable,
6099 GError **error)
6100 {
6101 GInitable *ret;
6102 ret = g_initable_new (GXDP_TYPE_PROXY_RESOLVER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.ProxyResolver", NULL);
6103 if (ret != NULL)
6104 return GXDP_PROXY_RESOLVER (ret);
6105 else
6106 return NULL;
6107 }
6108
6109
6110 /**
6111 * gxdp_proxy_resolver_proxy_new_for_bus:
6112 * @bus_type: A #GBusType.
6113 * @flags: Flags from the #GDBusProxyFlags enumeration.
6114 * @name: A bus name (well-known or unique).
6115 * @object_path: An object path.
6116 * @cancellable: (nullable): A #GCancellable or %NULL.
6117 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6118 * @user_data: User data to pass to @callback.
6119 *
6120 * Like gxdp_proxy_resolver_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6121 *
6122 * 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()).
6123 * You can then call gxdp_proxy_resolver_proxy_new_for_bus_finish() to get the result of the operation.
6124 *
6125 * See gxdp_proxy_resolver_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6126 */
6127 void
gxdp_proxy_resolver_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)6128 gxdp_proxy_resolver_proxy_new_for_bus (
6129 GBusType bus_type,
6130 GDBusProxyFlags flags,
6131 const gchar *name,
6132 const gchar *object_path,
6133 GCancellable *cancellable,
6134 GAsyncReadyCallback callback,
6135 gpointer user_data)
6136 {
6137 g_async_initable_new_async (GXDP_TYPE_PROXY_RESOLVER_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.portal.ProxyResolver", NULL);
6138 }
6139
6140 /**
6141 * gxdp_proxy_resolver_proxy_new_for_bus_finish:
6142 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_proxy_new_for_bus().
6143 * @error: Return location for error or %NULL
6144 *
6145 * Finishes an operation started with gxdp_proxy_resolver_proxy_new_for_bus().
6146 *
6147 * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set.
6148 */
6149 GXdpProxyResolver *
gxdp_proxy_resolver_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)6150 gxdp_proxy_resolver_proxy_new_for_bus_finish (
6151 GAsyncResult *res,
6152 GError **error)
6153 {
6154 GObject *ret;
6155 GObject *source_object;
6156 source_object = g_async_result_get_source_object (res);
6157 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6158 g_object_unref (source_object);
6159 if (ret != NULL)
6160 return GXDP_PROXY_RESOLVER (ret);
6161 else
6162 return NULL;
6163 }
6164
6165 /**
6166 * gxdp_proxy_resolver_proxy_new_for_bus_sync:
6167 * @bus_type: A #GBusType.
6168 * @flags: Flags from the #GDBusProxyFlags enumeration.
6169 * @name: A bus name (well-known or unique).
6170 * @object_path: An object path.
6171 * @cancellable: (nullable): A #GCancellable or %NULL.
6172 * @error: Return location for error or %NULL
6173 *
6174 * Like gxdp_proxy_resolver_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6175 *
6176 * The calling thread is blocked until a reply is received.
6177 *
6178 * See gxdp_proxy_resolver_proxy_new_for_bus() for the asynchronous version of this constructor.
6179 *
6180 * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set.
6181 */
6182 GXdpProxyResolver *
gxdp_proxy_resolver_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)6183 gxdp_proxy_resolver_proxy_new_for_bus_sync (
6184 GBusType bus_type,
6185 GDBusProxyFlags flags,
6186 const gchar *name,
6187 const gchar *object_path,
6188 GCancellable *cancellable,
6189 GError **error)
6190 {
6191 GInitable *ret;
6192 ret = g_initable_new (GXDP_TYPE_PROXY_RESOLVER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.ProxyResolver", NULL);
6193 if (ret != NULL)
6194 return GXDP_PROXY_RESOLVER (ret);
6195 else
6196 return NULL;
6197 }
6198
6199
6200 /* ------------------------------------------------------------------------ */
6201
6202 /**
6203 * GXdpProxyResolverSkeleton:
6204 *
6205 * The #GXdpProxyResolverSkeleton structure contains only private data and should only be accessed using the provided API.
6206 */
6207
6208 /**
6209 * GXdpProxyResolverSkeletonClass:
6210 * @parent_class: The parent class.
6211 *
6212 * Class structure for #GXdpProxyResolverSkeleton.
6213 */
6214
6215 struct _GXdpProxyResolverSkeletonPrivate
6216 {
6217 GValue *properties;
6218 GList *changed_properties;
6219 GSource *changed_properties_idle_source;
6220 GMainContext *context;
6221 GMutex lock;
6222 };
6223
6224 static void
_gxdp_proxy_resolver_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)6225 _gxdp_proxy_resolver_skeleton_handle_method_call (
6226 GDBusConnection *connection G_GNUC_UNUSED,
6227 const gchar *sender G_GNUC_UNUSED,
6228 const gchar *object_path G_GNUC_UNUSED,
6229 const gchar *interface_name,
6230 const gchar *method_name,
6231 GVariant *parameters,
6232 GDBusMethodInvocation *invocation,
6233 gpointer user_data)
6234 {
6235 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data);
6236 _ExtendedGDBusMethodInfo *info;
6237 GVariantIter iter;
6238 GVariant *child;
6239 GValue *paramv;
6240 gsize num_params;
6241 guint num_extra;
6242 gsize n;
6243 guint signal_id;
6244 GValue return_value = G_VALUE_INIT;
6245 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6246 g_assert (info != NULL);
6247 num_params = g_variant_n_children (parameters);
6248 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6249 n = 0;
6250 g_value_init (¶mv[n], GXDP_TYPE_PROXY_RESOLVER);
6251 g_value_set_object (¶mv[n++], skeleton);
6252 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6253 g_value_set_object (¶mv[n++], invocation);
6254 if (info->pass_fdlist)
6255 {
6256 #ifdef G_OS_UNIX
6257 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
6258 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6259 #else
6260 g_assert_not_reached ();
6261 #endif
6262 }
6263 g_variant_iter_init (&iter, parameters);
6264 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6265 {
6266 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6267 if (arg_info->use_gvariant)
6268 {
6269 g_value_init (¶mv[n], G_TYPE_VARIANT);
6270 g_value_set_variant (¶mv[n], child);
6271 n++;
6272 }
6273 else
6274 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
6275 g_variant_unref (child);
6276 }
6277 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_PROXY_RESOLVER);
6278 g_value_init (&return_value, G_TYPE_BOOLEAN);
6279 g_signal_emitv (paramv, signal_id, 0, &return_value);
6280 if (!g_value_get_boolean (&return_value))
6281 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);
6282 g_value_unset (&return_value);
6283 for (n = 0; n < num_params + num_extra; n++)
6284 g_value_unset (¶mv[n]);
6285 g_free (paramv);
6286 }
6287
6288 static GVariant *
_gxdp_proxy_resolver_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)6289 _gxdp_proxy_resolver_skeleton_handle_get_property (
6290 GDBusConnection *connection G_GNUC_UNUSED,
6291 const gchar *sender G_GNUC_UNUSED,
6292 const gchar *object_path G_GNUC_UNUSED,
6293 const gchar *interface_name G_GNUC_UNUSED,
6294 const gchar *property_name,
6295 GError **error,
6296 gpointer user_data)
6297 {
6298 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data);
6299 GValue value = G_VALUE_INIT;
6300 GParamSpec *pspec;
6301 _ExtendedGDBusPropertyInfo *info;
6302 GVariant *ret;
6303 ret = NULL;
6304 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, property_name);
6305 g_assert (info != NULL);
6306 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6307 if (pspec == NULL)
6308 {
6309 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6310 }
6311 else
6312 {
6313 g_value_init (&value, pspec->value_type);
6314 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6315 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6316 g_value_unset (&value);
6317 }
6318 return ret;
6319 }
6320
6321 static gboolean
_gxdp_proxy_resolver_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)6322 _gxdp_proxy_resolver_skeleton_handle_set_property (
6323 GDBusConnection *connection G_GNUC_UNUSED,
6324 const gchar *sender G_GNUC_UNUSED,
6325 const gchar *object_path G_GNUC_UNUSED,
6326 const gchar *interface_name G_GNUC_UNUSED,
6327 const gchar *property_name,
6328 GVariant *variant,
6329 GError **error,
6330 gpointer user_data)
6331 {
6332 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data);
6333 GValue value = G_VALUE_INIT;
6334 GParamSpec *pspec;
6335 _ExtendedGDBusPropertyInfo *info;
6336 gboolean ret;
6337 ret = FALSE;
6338 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, property_name);
6339 g_assert (info != NULL);
6340 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6341 if (pspec == NULL)
6342 {
6343 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6344 }
6345 else
6346 {
6347 if (info->use_gvariant)
6348 g_value_set_variant (&value, variant);
6349 else
6350 g_dbus_gvariant_to_gvalue (variant, &value);
6351 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6352 g_value_unset (&value);
6353 ret = TRUE;
6354 }
6355 return ret;
6356 }
6357
6358 static const GDBusInterfaceVTable _gxdp_proxy_resolver_skeleton_vtable =
6359 {
6360 _gxdp_proxy_resolver_skeleton_handle_method_call,
6361 _gxdp_proxy_resolver_skeleton_handle_get_property,
6362 _gxdp_proxy_resolver_skeleton_handle_set_property,
6363 {NULL}
6364 };
6365
6366 static GDBusInterfaceInfo *
gxdp_proxy_resolver_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)6367 gxdp_proxy_resolver_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6368 {
6369 return gxdp_proxy_resolver_interface_info ();
6370 }
6371
6372 static GDBusInterfaceVTable *
gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)6373 gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6374 {
6375 return (GDBusInterfaceVTable *) &_gxdp_proxy_resolver_skeleton_vtable;
6376 }
6377
6378 static GVariant *
gxdp_proxy_resolver_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)6379 gxdp_proxy_resolver_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6380 {
6381 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (_skeleton);
6382
6383 GVariantBuilder builder;
6384 guint n;
6385 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6386 if (_gxdp_proxy_resolver_interface_info.parent_struct.properties == NULL)
6387 goto out;
6388 for (n = 0; _gxdp_proxy_resolver_interface_info.parent_struct.properties[n] != NULL; n++)
6389 {
6390 GDBusPropertyInfo *info = _gxdp_proxy_resolver_interface_info.parent_struct.properties[n];
6391 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6392 {
6393 GVariant *value;
6394 value = _gxdp_proxy_resolver_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.portal.ProxyResolver", info->name, NULL, skeleton);
6395 if (value != NULL)
6396 {
6397 g_variant_take_ref (value);
6398 g_variant_builder_add (&builder, "{sv}", info->name, value);
6399 g_variant_unref (value);
6400 }
6401 }
6402 }
6403 out:
6404 return g_variant_builder_end (&builder);
6405 }
6406
6407 static gboolean _gxdp_proxy_resolver_emit_changed (gpointer user_data);
6408
6409 static void
gxdp_proxy_resolver_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)6410 gxdp_proxy_resolver_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6411 {
6412 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (_skeleton);
6413 gboolean emit_changed = FALSE;
6414
6415 g_mutex_lock (&skeleton->priv->lock);
6416 if (skeleton->priv->changed_properties_idle_source != NULL)
6417 {
6418 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6419 skeleton->priv->changed_properties_idle_source = NULL;
6420 emit_changed = TRUE;
6421 }
6422 g_mutex_unlock (&skeleton->priv->lock);
6423
6424 if (emit_changed)
6425 _gxdp_proxy_resolver_emit_changed (skeleton);
6426 }
6427
6428 static void gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface);
6429 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpProxyResolverSkeleton,gxdp_proxy_resolver_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (GXdpProxyResolverSkeleton)G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER,gxdp_proxy_resolver_skeleton_iface_init))6430 G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6431 G_ADD_PRIVATE (GXdpProxyResolverSkeleton)
6432 G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init))
6433
6434 #else
6435 G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6436 G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init))
6437
6438 #endif
6439 static void
6440 gxdp_proxy_resolver_skeleton_finalize (GObject *object)
6441 {
6442 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
6443 guint n;
6444 for (n = 0; n < 1; n++)
6445 g_value_unset (&skeleton->priv->properties[n]);
6446 g_free (skeleton->priv->properties);
6447 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6448 if (skeleton->priv->changed_properties_idle_source != NULL)
6449 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6450 g_main_context_unref (skeleton->priv->context);
6451 g_mutex_clear (&skeleton->priv->lock);
6452 G_OBJECT_CLASS (gxdp_proxy_resolver_skeleton_parent_class)->finalize (object);
6453 }
6454
6455 static void
gxdp_proxy_resolver_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)6456 gxdp_proxy_resolver_skeleton_get_property (GObject *object,
6457 guint prop_id,
6458 GValue *value,
6459 GParamSpec *pspec G_GNUC_UNUSED)
6460 {
6461 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
6462 g_assert (prop_id != 0 && prop_id - 1 < 1);
6463 g_mutex_lock (&skeleton->priv->lock);
6464 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6465 g_mutex_unlock (&skeleton->priv->lock);
6466 }
6467
6468 static gboolean
_gxdp_proxy_resolver_emit_changed(gpointer user_data)6469 _gxdp_proxy_resolver_emit_changed (gpointer user_data)
6470 {
6471 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data);
6472 GList *l;
6473 GVariantBuilder builder;
6474 GVariantBuilder invalidated_builder;
6475 guint num_changes;
6476
6477 g_mutex_lock (&skeleton->priv->lock);
6478 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6479 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6480 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6481 {
6482 ChangedProperty *cp = l->data;
6483 GVariant *variant;
6484 const GValue *cur_value;
6485
6486 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6487 if (!_g_value_equal (cur_value, &cp->orig_value))
6488 {
6489 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6490 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6491 g_variant_unref (variant);
6492 num_changes++;
6493 }
6494 }
6495 if (num_changes > 0)
6496 {
6497 GList *connections, *ll;
6498 GVariant *signal_variant;
6499 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.ProxyResolver",
6500 &builder, &invalidated_builder));
6501 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6502 for (ll = connections; ll != NULL; ll = ll->next)
6503 {
6504 GDBusConnection *connection = ll->data;
6505
6506 g_dbus_connection_emit_signal (connection,
6507 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6508 "org.freedesktop.DBus.Properties",
6509 "PropertiesChanged",
6510 signal_variant,
6511 NULL);
6512 }
6513 g_variant_unref (signal_variant);
6514 g_list_free_full (connections, g_object_unref);
6515 }
6516 else
6517 {
6518 g_variant_builder_clear (&builder);
6519 g_variant_builder_clear (&invalidated_builder);
6520 }
6521 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6522 skeleton->priv->changed_properties = NULL;
6523 skeleton->priv->changed_properties_idle_source = NULL;
6524 g_mutex_unlock (&skeleton->priv->lock);
6525 return FALSE;
6526 }
6527
6528 static void
_gxdp_proxy_resolver_schedule_emit_changed(GXdpProxyResolverSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)6529 _gxdp_proxy_resolver_schedule_emit_changed (GXdpProxyResolverSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6530 {
6531 ChangedProperty *cp;
6532 GList *l;
6533 cp = NULL;
6534 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6535 {
6536 ChangedProperty *i_cp = l->data;
6537 if (i_cp->info == info)
6538 {
6539 cp = i_cp;
6540 break;
6541 }
6542 }
6543 if (cp == NULL)
6544 {
6545 cp = g_new0 (ChangedProperty, 1);
6546 cp->prop_id = prop_id;
6547 cp->info = info;
6548 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6549 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6550 g_value_copy (orig_value, &cp->orig_value);
6551 }
6552 }
6553
6554 static void
gxdp_proxy_resolver_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)6555 gxdp_proxy_resolver_skeleton_notify (GObject *object,
6556 GParamSpec *pspec G_GNUC_UNUSED)
6557 {
6558 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
6559 g_mutex_lock (&skeleton->priv->lock);
6560 if (skeleton->priv->changed_properties != NULL &&
6561 skeleton->priv->changed_properties_idle_source == NULL)
6562 {
6563 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6564 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6565 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_proxy_resolver_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6566 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_proxy_resolver_emit_changed");
6567 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6568 g_source_unref (skeleton->priv->changed_properties_idle_source);
6569 }
6570 g_mutex_unlock (&skeleton->priv->lock);
6571 }
6572
6573 static void
gxdp_proxy_resolver_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)6574 gxdp_proxy_resolver_skeleton_set_property (GObject *object,
6575 guint prop_id,
6576 const GValue *value,
6577 GParamSpec *pspec)
6578 {
6579 const _ExtendedGDBusPropertyInfo *info;
6580 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
6581 g_assert (prop_id != 0 && prop_id - 1 < 1);
6582 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_proxy_resolver_property_info_pointers[prop_id - 1];
6583 g_mutex_lock (&skeleton->priv->lock);
6584 g_object_freeze_notify (object);
6585 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6586 {
6587 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
6588 info->emits_changed_signal)
6589 _gxdp_proxy_resolver_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
6590 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6591 g_object_notify_by_pspec (object, pspec);
6592 }
6593 g_mutex_unlock (&skeleton->priv->lock);
6594 g_object_thaw_notify (object);
6595 }
6596
6597 static void
gxdp_proxy_resolver_skeleton_init(GXdpProxyResolverSkeleton * skeleton)6598 gxdp_proxy_resolver_skeleton_init (GXdpProxyResolverSkeleton *skeleton)
6599 {
6600 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6601 skeleton->priv = gxdp_proxy_resolver_skeleton_get_instance_private (skeleton);
6602 #else
6603 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_PROXY_RESOLVER_SKELETON, GXdpProxyResolverSkeletonPrivate);
6604 #endif
6605
6606 g_mutex_init (&skeleton->priv->lock);
6607 skeleton->priv->context = g_main_context_ref_thread_default ();
6608 skeleton->priv->properties = g_new0 (GValue, 1);
6609 g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
6610 }
6611
6612 static guint
gxdp_proxy_resolver_skeleton_get_version(GXdpProxyResolver * object)6613 gxdp_proxy_resolver_skeleton_get_version (GXdpProxyResolver *object)
6614 {
6615 GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object);
6616 guint value;
6617 g_mutex_lock (&skeleton->priv->lock);
6618 value = g_value_get_uint (&(skeleton->priv->properties[0]));
6619 g_mutex_unlock (&skeleton->priv->lock);
6620 return value;
6621 }
6622
6623 static void
gxdp_proxy_resolver_skeleton_class_init(GXdpProxyResolverSkeletonClass * klass)6624 gxdp_proxy_resolver_skeleton_class_init (GXdpProxyResolverSkeletonClass *klass)
6625 {
6626 GObjectClass *gobject_class;
6627 GDBusInterfaceSkeletonClass *skeleton_class;
6628
6629 gobject_class = G_OBJECT_CLASS (klass);
6630 gobject_class->finalize = gxdp_proxy_resolver_skeleton_finalize;
6631 gobject_class->get_property = gxdp_proxy_resolver_skeleton_get_property;
6632 gobject_class->set_property = gxdp_proxy_resolver_skeleton_set_property;
6633 gobject_class->notify = gxdp_proxy_resolver_skeleton_notify;
6634
6635
6636 gxdp_proxy_resolver_override_properties (gobject_class, 1);
6637
6638 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6639 skeleton_class->get_info = gxdp_proxy_resolver_skeleton_dbus_interface_get_info;
6640 skeleton_class->get_properties = gxdp_proxy_resolver_skeleton_dbus_interface_get_properties;
6641 skeleton_class->flush = gxdp_proxy_resolver_skeleton_dbus_interface_flush;
6642 skeleton_class->get_vtable = gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable;
6643
6644 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6645 g_type_class_add_private (klass, sizeof (GXdpProxyResolverSkeletonPrivate));
6646 #endif
6647 }
6648
6649 static void
gxdp_proxy_resolver_skeleton_iface_init(GXdpProxyResolverIface * iface)6650 gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface)
6651 {
6652 iface->get_version = gxdp_proxy_resolver_skeleton_get_version;
6653 }
6654
6655 /**
6656 * gxdp_proxy_resolver_skeleton_new:
6657 *
6658 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>.
6659 *
6660 * Returns: (transfer full) (type GXdpProxyResolverSkeleton): The skeleton object.
6661 */
6662 GXdpProxyResolver *
gxdp_proxy_resolver_skeleton_new(void)6663 gxdp_proxy_resolver_skeleton_new (void)
6664 {
6665 return GXDP_PROXY_RESOLVER (g_object_new (GXDP_TYPE_PROXY_RESOLVER_SKELETON, NULL));
6666 }
6667
6668 /* ------------------------------------------------------------------------
6669 * Code for interface org.freedesktop.portal.Trash
6670 * ------------------------------------------------------------------------
6671 */
6672
6673 /**
6674 * SECTION:GXdpTrash
6675 * @title: GXdpTrash
6676 * @short_description: Generated C code for the org.freedesktop.portal.Trash D-Bus interface
6677 *
6678 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link> D-Bus interface in C.
6679 */
6680
6681 /* ---- Introspection data for org.freedesktop.portal.Trash ---- */
6682
6683 static const _ExtendedGDBusArgInfo _gxdp_trash_method_info_trash_file_IN_ARG_fd =
6684 {
6685 {
6686 -1,
6687 (gchar *) "fd",
6688 (gchar *) "h",
6689 NULL
6690 },
6691 FALSE
6692 };
6693
6694 static const GDBusArgInfo * const _gxdp_trash_method_info_trash_file_IN_ARG_pointers[] =
6695 {
6696 &_gxdp_trash_method_info_trash_file_IN_ARG_fd.parent_struct,
6697 NULL
6698 };
6699
6700 static const _ExtendedGDBusArgInfo _gxdp_trash_method_info_trash_file_OUT_ARG_result =
6701 {
6702 {
6703 -1,
6704 (gchar *) "result",
6705 (gchar *) "u",
6706 NULL
6707 },
6708 FALSE
6709 };
6710
6711 static const GDBusArgInfo * const _gxdp_trash_method_info_trash_file_OUT_ARG_pointers[] =
6712 {
6713 &_gxdp_trash_method_info_trash_file_OUT_ARG_result.parent_struct,
6714 NULL
6715 };
6716
6717 static const _ExtendedGDBusMethodInfo _gxdp_trash_method_info_trash_file =
6718 {
6719 {
6720 -1,
6721 (gchar *) "TrashFile",
6722 (GDBusArgInfo **) &_gxdp_trash_method_info_trash_file_IN_ARG_pointers,
6723 (GDBusArgInfo **) &_gxdp_trash_method_info_trash_file_OUT_ARG_pointers,
6724 NULL
6725 },
6726 "handle-trash-file",
6727 TRUE
6728 };
6729
6730 static const GDBusMethodInfo * const _gxdp_trash_method_info_pointers[] =
6731 {
6732 &_gxdp_trash_method_info_trash_file.parent_struct,
6733 NULL
6734 };
6735
6736 static const _ExtendedGDBusPropertyInfo _gxdp_trash_property_info_version =
6737 {
6738 {
6739 -1,
6740 (gchar *) "version",
6741 (gchar *) "u",
6742 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6743 NULL
6744 },
6745 "version",
6746 FALSE,
6747 TRUE
6748 };
6749
6750 static const GDBusPropertyInfo * const _gxdp_trash_property_info_pointers[] =
6751 {
6752 &_gxdp_trash_property_info_version.parent_struct,
6753 NULL
6754 };
6755
6756 static const _ExtendedGDBusInterfaceInfo _gxdp_trash_interface_info =
6757 {
6758 {
6759 -1,
6760 (gchar *) "org.freedesktop.portal.Trash",
6761 (GDBusMethodInfo **) &_gxdp_trash_method_info_pointers,
6762 NULL,
6763 (GDBusPropertyInfo **) &_gxdp_trash_property_info_pointers,
6764 NULL
6765 },
6766 "trash",
6767 };
6768
6769
6770 /**
6771 * gxdp_trash_interface_info:
6772 *
6773 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link> D-Bus interface.
6774 *
6775 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6776 */
6777 GDBusInterfaceInfo *
gxdp_trash_interface_info(void)6778 gxdp_trash_interface_info (void)
6779 {
6780 return (GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct;
6781 }
6782
6783 /**
6784 * gxdp_trash_override_properties:
6785 * @klass: The class structure for a #GObject derived class.
6786 * @property_id_begin: The property id to assign to the first overridden property.
6787 *
6788 * Overrides all #GObject properties in the #GXdpTrash interface for a concrete class.
6789 * The properties are overridden in the order they are defined.
6790 *
6791 * Returns: The last property id.
6792 */
6793 guint
gxdp_trash_override_properties(GObjectClass * klass,guint property_id_begin)6794 gxdp_trash_override_properties (GObjectClass *klass, guint property_id_begin)
6795 {
6796 g_object_class_override_property (klass, property_id_begin++, "version");
6797 return property_id_begin - 1;
6798 }
6799
6800
6801
6802 /**
6803 * GXdpTrash:
6804 *
6805 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>.
6806 */
6807
6808 /**
6809 * GXdpTrashIface:
6810 * @parent_iface: The parent interface.
6811 * @handle_trash_file: Handler for the #GXdpTrash::handle-trash-file signal.
6812 * @get_version: Getter for the #GXdpTrash:version property.
6813 *
6814 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>.
6815 */
6816
6817 typedef GXdpTrashIface GXdpTrashInterface;
G_DEFINE_INTERFACE(GXdpTrash,gxdp_trash,G_TYPE_OBJECT)6818 G_DEFINE_INTERFACE (GXdpTrash, gxdp_trash, G_TYPE_OBJECT)
6819
6820 static void
6821 gxdp_trash_default_init (GXdpTrashIface *iface)
6822 {
6823 /* GObject signals for incoming D-Bus method calls: */
6824 /**
6825 * GXdpTrash::handle-trash-file:
6826 * @object: A #GXdpTrash.
6827 * @invocation: A #GDBusMethodInvocation.
6828 * @fd_list: (nullable): A #GUnixFDList or %NULL.
6829 * @arg_fd: Argument passed by remote caller.
6830 *
6831 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method.
6832 *
6833 * 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 gxdp_trash_complete_trash_file() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
6834 *
6835 * 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.
6836 */
6837 g_signal_new ("handle-trash-file",
6838 G_TYPE_FROM_INTERFACE (iface),
6839 G_SIGNAL_RUN_LAST,
6840 G_STRUCT_OFFSET (GXdpTrashIface, handle_trash_file),
6841 g_signal_accumulator_true_handled,
6842 NULL,
6843 g_cclosure_marshal_generic,
6844 G_TYPE_BOOLEAN,
6845 3,
6846 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT);
6847
6848 /* GObject properties for D-Bus properties: */
6849 /**
6850 * GXdpTrash:version:
6851 *
6852 * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link>.
6853 *
6854 * 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.
6855 */
6856 g_object_interface_install_property (iface,
6857 g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6858 }
6859
6860 /**
6861 * gxdp_trash_get_version: (skip)
6862 * @object: A #GXdpTrash.
6863 *
6864 * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link> D-Bus property.
6865 *
6866 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6867 *
6868 * Returns: The property value.
6869 */
6870 guint
gxdp_trash_get_version(GXdpTrash * object)6871 gxdp_trash_get_version (GXdpTrash *object)
6872 {
6873 return GXDP_TRASH_GET_IFACE (object)->get_version (object);
6874 }
6875
6876 /**
6877 * gxdp_trash_set_version: (skip)
6878 * @object: A #GXdpTrash.
6879 * @value: The value to set.
6880 *
6881 * Sets the <link linkend="gdbus-property-org-freedesktop-portal-Trash.version">"version"</link> D-Bus property to @value.
6882 *
6883 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6884 */
6885 void
gxdp_trash_set_version(GXdpTrash * object,guint value)6886 gxdp_trash_set_version (GXdpTrash *object, guint value)
6887 {
6888 g_object_set (G_OBJECT (object), "version", value, NULL);
6889 }
6890
6891 /**
6892 * gxdp_trash_call_trash_file:
6893 * @proxy: A #GXdpTrashProxy.
6894 * @arg_fd: Argument to pass with the method invocation.
6895 * @fd_list: (nullable): A #GUnixFDList or %NULL.
6896 * @cancellable: (nullable): A #GCancellable or %NULL.
6897 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6898 * @user_data: User data to pass to @callback.
6899 *
6900 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method on @proxy.
6901 * 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()).
6902 * You can then call gxdp_trash_call_trash_file_finish() to get the result of the operation.
6903 *
6904 * See gxdp_trash_call_trash_file_sync() for the synchronous, blocking version of this method.
6905 */
6906 void
gxdp_trash_call_trash_file(GXdpTrash * proxy,GVariant * arg_fd,GUnixFDList * fd_list,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)6907 gxdp_trash_call_trash_file (
6908 GXdpTrash *proxy,
6909 GVariant *arg_fd,
6910 GUnixFDList *fd_list,
6911 GCancellable *cancellable,
6912 GAsyncReadyCallback callback,
6913 gpointer user_data)
6914 {
6915 g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
6916 "TrashFile",
6917 g_variant_new ("(@h)",
6918 arg_fd),
6919 G_DBUS_CALL_FLAGS_NONE,
6920 -1,
6921 fd_list,
6922 cancellable,
6923 callback,
6924 user_data);
6925 }
6926
6927 /**
6928 * gxdp_trash_call_trash_file_finish:
6929 * @proxy: A #GXdpTrashProxy.
6930 * @out_result: (out) (optional): Return location for return parameter or %NULL to ignore.
6931 * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
6932 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_call_trash_file().
6933 * @error: Return location for error or %NULL.
6934 *
6935 * Finishes an operation started with gxdp_trash_call_trash_file().
6936 *
6937 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
6938 */
6939 gboolean
gxdp_trash_call_trash_file_finish(GXdpTrash * proxy,guint * out_result,GUnixFDList ** out_fd_list,GAsyncResult * res,GError ** error)6940 gxdp_trash_call_trash_file_finish (
6941 GXdpTrash *proxy,
6942 guint *out_result,
6943 GUnixFDList **out_fd_list,
6944 GAsyncResult *res,
6945 GError **error)
6946 {
6947 GVariant *_ret;
6948 _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
6949 if (_ret == NULL)
6950 goto _out;
6951 g_variant_get (_ret,
6952 "(u)",
6953 out_result);
6954 g_variant_unref (_ret);
6955 _out:
6956 return _ret != NULL;
6957 }
6958
6959 /**
6960 * gxdp_trash_call_trash_file_sync:
6961 * @proxy: A #GXdpTrashProxy.
6962 * @arg_fd: Argument to pass with the method invocation.
6963 * @fd_list: (nullable): A #GUnixFDList or %NULL.
6964 * @out_result: (out) (optional): Return location for return parameter or %NULL to ignore.
6965 * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
6966 * @cancellable: (nullable): A #GCancellable or %NULL.
6967 * @error: Return location for error or %NULL.
6968 *
6969 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
6970 *
6971 * See gxdp_trash_call_trash_file() for the asynchronous version of this method.
6972 *
6973 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
6974 */
6975 gboolean
gxdp_trash_call_trash_file_sync(GXdpTrash * proxy,GVariant * arg_fd,GUnixFDList * fd_list,guint * out_result,GUnixFDList ** out_fd_list,GCancellable * cancellable,GError ** error)6976 gxdp_trash_call_trash_file_sync (
6977 GXdpTrash *proxy,
6978 GVariant *arg_fd,
6979 GUnixFDList *fd_list,
6980 guint *out_result,
6981 GUnixFDList **out_fd_list,
6982 GCancellable *cancellable,
6983 GError **error)
6984 {
6985 GVariant *_ret;
6986 _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
6987 "TrashFile",
6988 g_variant_new ("(@h)",
6989 arg_fd),
6990 G_DBUS_CALL_FLAGS_NONE,
6991 -1,
6992 fd_list,
6993 out_fd_list,
6994 cancellable,
6995 error);
6996 if (_ret == NULL)
6997 goto _out;
6998 g_variant_get (_ret,
6999 "(u)",
7000 out_result);
7001 g_variant_unref (_ret);
7002 _out:
7003 return _ret != NULL;
7004 }
7005
7006 /**
7007 * gxdp_trash_complete_trash_file:
7008 * @object: A #GXdpTrash.
7009 * @invocation: (transfer full): A #GDBusMethodInvocation.
7010 * @fd_list: (nullable): A #GUnixFDList or %NULL.
7011 * @result: Parameter to return.
7012 *
7013 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-portal-Trash.TrashFile">TrashFile()</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.
7014 *
7015 * This method will free @invocation, you cannot use it afterwards.
7016 */
7017 void
gxdp_trash_complete_trash_file(GXdpTrash * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GUnixFDList * fd_list,guint result)7018 gxdp_trash_complete_trash_file (
7019 GXdpTrash *object G_GNUC_UNUSED,
7020 GDBusMethodInvocation *invocation,
7021 GUnixFDList *fd_list,
7022 guint result)
7023 {
7024 g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
7025 g_variant_new ("(u)",
7026 result),
7027 fd_list);
7028 }
7029
7030 /* ------------------------------------------------------------------------ */
7031
7032 /**
7033 * GXdpTrashProxy:
7034 *
7035 * The #GXdpTrashProxy structure contains only private data and should only be accessed using the provided API.
7036 */
7037
7038 /**
7039 * GXdpTrashProxyClass:
7040 * @parent_class: The parent class.
7041 *
7042 * Class structure for #GXdpTrashProxy.
7043 */
7044
7045 struct _GXdpTrashProxyPrivate
7046 {
7047 GData *qdata;
7048 };
7049
7050 static void gxdp_trash_proxy_iface_init (GXdpTrashIface *iface);
7051
7052 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpTrashProxy,gxdp_trash_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (GXdpTrashProxy)G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH,gxdp_trash_proxy_iface_init))7053 G_DEFINE_TYPE_WITH_CODE (GXdpTrashProxy, gxdp_trash_proxy, G_TYPE_DBUS_PROXY,
7054 G_ADD_PRIVATE (GXdpTrashProxy)
7055 G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_proxy_iface_init))
7056
7057 #else
7058 G_DEFINE_TYPE_WITH_CODE (GXdpTrashProxy, gxdp_trash_proxy, G_TYPE_DBUS_PROXY,
7059 G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_proxy_iface_init))
7060
7061 #endif
7062 static void
7063 gxdp_trash_proxy_finalize (GObject *object)
7064 {
7065 GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (object);
7066 g_datalist_clear (&proxy->priv->qdata);
7067 G_OBJECT_CLASS (gxdp_trash_proxy_parent_class)->finalize (object);
7068 }
7069
7070 static void
gxdp_trash_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7071 gxdp_trash_proxy_get_property (GObject *object,
7072 guint prop_id,
7073 GValue *value,
7074 GParamSpec *pspec G_GNUC_UNUSED)
7075 {
7076 const _ExtendedGDBusPropertyInfo *info;
7077 GVariant *variant;
7078 g_assert (prop_id != 0 && prop_id - 1 < 1);
7079 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_trash_property_info_pointers[prop_id - 1];
7080 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7081 if (info->use_gvariant)
7082 {
7083 g_value_set_variant (value, variant);
7084 }
7085 else
7086 {
7087 if (variant != NULL)
7088 g_dbus_gvariant_to_gvalue (variant, value);
7089 }
7090 if (variant != NULL)
7091 g_variant_unref (variant);
7092 }
7093
7094 static void
gxdp_trash_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)7095 gxdp_trash_proxy_set_property_cb (GDBusProxy *proxy,
7096 GAsyncResult *res,
7097 gpointer user_data)
7098 {
7099 const _ExtendedGDBusPropertyInfo *info = user_data;
7100 GError *error;
7101 GVariant *_ret;
7102 error = NULL;
7103 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7104 if (!_ret)
7105 {
7106 g_warning ("Error setting property '%s' on interface org.freedesktop.portal.Trash: %s (%s, %d)",
7107 info->parent_struct.name,
7108 error->message, g_quark_to_string (error->domain), error->code);
7109 g_error_free (error);
7110 }
7111 else
7112 {
7113 g_variant_unref (_ret);
7114 }
7115 }
7116
7117 static void
gxdp_trash_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7118 gxdp_trash_proxy_set_property (GObject *object,
7119 guint prop_id,
7120 const GValue *value,
7121 GParamSpec *pspec G_GNUC_UNUSED)
7122 {
7123 const _ExtendedGDBusPropertyInfo *info;
7124 GVariant *variant;
7125 g_assert (prop_id != 0 && prop_id - 1 < 1);
7126 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_trash_property_info_pointers[prop_id - 1];
7127 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7128 g_dbus_proxy_call (G_DBUS_PROXY (object),
7129 "org.freedesktop.DBus.Properties.Set",
7130 g_variant_new ("(ssv)", "org.freedesktop.portal.Trash", info->parent_struct.name, variant),
7131 G_DBUS_CALL_FLAGS_NONE,
7132 -1,
7133 NULL, (GAsyncReadyCallback) gxdp_trash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7134 g_variant_unref (variant);
7135 }
7136
7137 static void
gxdp_trash_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)7138 gxdp_trash_proxy_g_signal (GDBusProxy *proxy,
7139 const gchar *sender_name G_GNUC_UNUSED,
7140 const gchar *signal_name,
7141 GVariant *parameters)
7142 {
7143 _ExtendedGDBusSignalInfo *info;
7144 GVariantIter iter;
7145 GVariant *child;
7146 GValue *paramv;
7147 gsize num_params;
7148 gsize n;
7149 guint signal_id;
7150 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, signal_name);
7151 if (info == NULL)
7152 return;
7153 num_params = g_variant_n_children (parameters);
7154 paramv = g_new0 (GValue, num_params + 1);
7155 g_value_init (¶mv[0], GXDP_TYPE_TRASH);
7156 g_value_set_object (¶mv[0], proxy);
7157 g_variant_iter_init (&iter, parameters);
7158 n = 1;
7159 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7160 {
7161 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7162 if (arg_info->use_gvariant)
7163 {
7164 g_value_init (¶mv[n], G_TYPE_VARIANT);
7165 g_value_set_variant (¶mv[n], child);
7166 n++;
7167 }
7168 else
7169 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
7170 g_variant_unref (child);
7171 }
7172 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_TRASH);
7173 g_signal_emitv (paramv, signal_id, 0, NULL);
7174 for (n = 0; n < num_params + 1; n++)
7175 g_value_unset (¶mv[n]);
7176 g_free (paramv);
7177 }
7178
7179 static void
gxdp_trash_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)7180 gxdp_trash_proxy_g_properties_changed (GDBusProxy *_proxy,
7181 GVariant *changed_properties,
7182 const gchar *const *invalidated_properties)
7183 {
7184 GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (_proxy);
7185 guint n;
7186 const gchar *key;
7187 GVariantIter *iter;
7188 _ExtendedGDBusPropertyInfo *info;
7189 g_variant_get (changed_properties, "a{sv}", &iter);
7190 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7191 {
7192 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, key);
7193 g_datalist_remove_data (&proxy->priv->qdata, key);
7194 if (info != NULL)
7195 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7196 }
7197 g_variant_iter_free (iter);
7198 for (n = 0; invalidated_properties[n] != NULL; n++)
7199 {
7200 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, invalidated_properties[n]);
7201 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7202 if (info != NULL)
7203 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7204 }
7205 }
7206
7207 static guint
gxdp_trash_proxy_get_version(GXdpTrash * object)7208 gxdp_trash_proxy_get_version (GXdpTrash *object)
7209 {
7210 GXdpTrashProxy *proxy = GXDP_TRASH_PROXY (object);
7211 GVariant *variant;
7212 guint value = 0;
7213 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
7214 if (variant != NULL)
7215 {
7216 value = g_variant_get_uint32 (variant);
7217 g_variant_unref (variant);
7218 }
7219 return value;
7220 }
7221
7222 static void
gxdp_trash_proxy_init(GXdpTrashProxy * proxy)7223 gxdp_trash_proxy_init (GXdpTrashProxy *proxy)
7224 {
7225 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7226 proxy->priv = gxdp_trash_proxy_get_instance_private (proxy);
7227 #else
7228 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_TRASH_PROXY, GXdpTrashProxyPrivate);
7229 #endif
7230
7231 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_trash_interface_info ());
7232 }
7233
7234 static void
gxdp_trash_proxy_class_init(GXdpTrashProxyClass * klass)7235 gxdp_trash_proxy_class_init (GXdpTrashProxyClass *klass)
7236 {
7237 GObjectClass *gobject_class;
7238 GDBusProxyClass *proxy_class;
7239
7240 gobject_class = G_OBJECT_CLASS (klass);
7241 gobject_class->finalize = gxdp_trash_proxy_finalize;
7242 gobject_class->get_property = gxdp_trash_proxy_get_property;
7243 gobject_class->set_property = gxdp_trash_proxy_set_property;
7244
7245 proxy_class = G_DBUS_PROXY_CLASS (klass);
7246 proxy_class->g_signal = gxdp_trash_proxy_g_signal;
7247 proxy_class->g_properties_changed = gxdp_trash_proxy_g_properties_changed;
7248
7249 gxdp_trash_override_properties (gobject_class, 1);
7250
7251 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7252 g_type_class_add_private (klass, sizeof (GXdpTrashProxyPrivate));
7253 #endif
7254 }
7255
7256 static void
gxdp_trash_proxy_iface_init(GXdpTrashIface * iface)7257 gxdp_trash_proxy_iface_init (GXdpTrashIface *iface)
7258 {
7259 iface->get_version = gxdp_trash_proxy_get_version;
7260 }
7261
7262 /**
7263 * gxdp_trash_proxy_new:
7264 * @connection: A #GDBusConnection.
7265 * @flags: Flags from the #GDBusProxyFlags enumeration.
7266 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7267 * @object_path: An object path.
7268 * @cancellable: (nullable): A #GCancellable or %NULL.
7269 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7270 * @user_data: User data to pass to @callback.
7271 *
7272 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>. See g_dbus_proxy_new() for more details.
7273 *
7274 * 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()).
7275 * You can then call gxdp_trash_proxy_new_finish() to get the result of the operation.
7276 *
7277 * See gxdp_trash_proxy_new_sync() for the synchronous, blocking version of this constructor.
7278 */
7279 void
gxdp_trash_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)7280 gxdp_trash_proxy_new (
7281 GDBusConnection *connection,
7282 GDBusProxyFlags flags,
7283 const gchar *name,
7284 const gchar *object_path,
7285 GCancellable *cancellable,
7286 GAsyncReadyCallback callback,
7287 gpointer user_data)
7288 {
7289 g_async_initable_new_async (GXDP_TYPE_TRASH_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.portal.Trash", NULL);
7290 }
7291
7292 /**
7293 * gxdp_trash_proxy_new_finish:
7294 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_proxy_new().
7295 * @error: Return location for error or %NULL
7296 *
7297 * Finishes an operation started with gxdp_trash_proxy_new().
7298 *
7299 * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
7300 */
7301 GXdpTrash *
gxdp_trash_proxy_new_finish(GAsyncResult * res,GError ** error)7302 gxdp_trash_proxy_new_finish (
7303 GAsyncResult *res,
7304 GError **error)
7305 {
7306 GObject *ret;
7307 GObject *source_object;
7308 source_object = g_async_result_get_source_object (res);
7309 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7310 g_object_unref (source_object);
7311 if (ret != NULL)
7312 return GXDP_TRASH (ret);
7313 else
7314 return NULL;
7315 }
7316
7317 /**
7318 * gxdp_trash_proxy_new_sync:
7319 * @connection: A #GDBusConnection.
7320 * @flags: Flags from the #GDBusProxyFlags enumeration.
7321 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7322 * @object_path: An object path.
7323 * @cancellable: (nullable): A #GCancellable or %NULL.
7324 * @error: Return location for error or %NULL
7325 *
7326 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>. See g_dbus_proxy_new_sync() for more details.
7327 *
7328 * The calling thread is blocked until a reply is received.
7329 *
7330 * See gxdp_trash_proxy_new() for the asynchronous version of this constructor.
7331 *
7332 * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
7333 */
7334 GXdpTrash *
gxdp_trash_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)7335 gxdp_trash_proxy_new_sync (
7336 GDBusConnection *connection,
7337 GDBusProxyFlags flags,
7338 const gchar *name,
7339 const gchar *object_path,
7340 GCancellable *cancellable,
7341 GError **error)
7342 {
7343 GInitable *ret;
7344 ret = g_initable_new (GXDP_TYPE_TRASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.Trash", NULL);
7345 if (ret != NULL)
7346 return GXDP_TRASH (ret);
7347 else
7348 return NULL;
7349 }
7350
7351
7352 /**
7353 * gxdp_trash_proxy_new_for_bus:
7354 * @bus_type: A #GBusType.
7355 * @flags: Flags from the #GDBusProxyFlags enumeration.
7356 * @name: A bus name (well-known or unique).
7357 * @object_path: An object path.
7358 * @cancellable: (nullable): A #GCancellable or %NULL.
7359 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7360 * @user_data: User data to pass to @callback.
7361 *
7362 * Like gxdp_trash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7363 *
7364 * 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()).
7365 * You can then call gxdp_trash_proxy_new_for_bus_finish() to get the result of the operation.
7366 *
7367 * See gxdp_trash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7368 */
7369 void
gxdp_trash_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)7370 gxdp_trash_proxy_new_for_bus (
7371 GBusType bus_type,
7372 GDBusProxyFlags flags,
7373 const gchar *name,
7374 const gchar *object_path,
7375 GCancellable *cancellable,
7376 GAsyncReadyCallback callback,
7377 gpointer user_data)
7378 {
7379 g_async_initable_new_async (GXDP_TYPE_TRASH_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.portal.Trash", NULL);
7380 }
7381
7382 /**
7383 * gxdp_trash_proxy_new_for_bus_finish:
7384 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_trash_proxy_new_for_bus().
7385 * @error: Return location for error or %NULL
7386 *
7387 * Finishes an operation started with gxdp_trash_proxy_new_for_bus().
7388 *
7389 * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
7390 */
7391 GXdpTrash *
gxdp_trash_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)7392 gxdp_trash_proxy_new_for_bus_finish (
7393 GAsyncResult *res,
7394 GError **error)
7395 {
7396 GObject *ret;
7397 GObject *source_object;
7398 source_object = g_async_result_get_source_object (res);
7399 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7400 g_object_unref (source_object);
7401 if (ret != NULL)
7402 return GXDP_TRASH (ret);
7403 else
7404 return NULL;
7405 }
7406
7407 /**
7408 * gxdp_trash_proxy_new_for_bus_sync:
7409 * @bus_type: A #GBusType.
7410 * @flags: Flags from the #GDBusProxyFlags enumeration.
7411 * @name: A bus name (well-known or unique).
7412 * @object_path: An object path.
7413 * @cancellable: (nullable): A #GCancellable or %NULL.
7414 * @error: Return location for error or %NULL
7415 *
7416 * Like gxdp_trash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7417 *
7418 * The calling thread is blocked until a reply is received.
7419 *
7420 * See gxdp_trash_proxy_new_for_bus() for the asynchronous version of this constructor.
7421 *
7422 * Returns: (transfer full) (type GXdpTrashProxy): The constructed proxy object or %NULL if @error is set.
7423 */
7424 GXdpTrash *
gxdp_trash_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)7425 gxdp_trash_proxy_new_for_bus_sync (
7426 GBusType bus_type,
7427 GDBusProxyFlags flags,
7428 const gchar *name,
7429 const gchar *object_path,
7430 GCancellable *cancellable,
7431 GError **error)
7432 {
7433 GInitable *ret;
7434 ret = g_initable_new (GXDP_TYPE_TRASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.portal.Trash", NULL);
7435 if (ret != NULL)
7436 return GXDP_TRASH (ret);
7437 else
7438 return NULL;
7439 }
7440
7441
7442 /* ------------------------------------------------------------------------ */
7443
7444 /**
7445 * GXdpTrashSkeleton:
7446 *
7447 * The #GXdpTrashSkeleton structure contains only private data and should only be accessed using the provided API.
7448 */
7449
7450 /**
7451 * GXdpTrashSkeletonClass:
7452 * @parent_class: The parent class.
7453 *
7454 * Class structure for #GXdpTrashSkeleton.
7455 */
7456
7457 struct _GXdpTrashSkeletonPrivate
7458 {
7459 GValue *properties;
7460 GList *changed_properties;
7461 GSource *changed_properties_idle_source;
7462 GMainContext *context;
7463 GMutex lock;
7464 };
7465
7466 static void
_gxdp_trash_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)7467 _gxdp_trash_skeleton_handle_method_call (
7468 GDBusConnection *connection G_GNUC_UNUSED,
7469 const gchar *sender G_GNUC_UNUSED,
7470 const gchar *object_path G_GNUC_UNUSED,
7471 const gchar *interface_name,
7472 const gchar *method_name,
7473 GVariant *parameters,
7474 GDBusMethodInvocation *invocation,
7475 gpointer user_data)
7476 {
7477 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (user_data);
7478 _ExtendedGDBusMethodInfo *info;
7479 GVariantIter iter;
7480 GVariant *child;
7481 GValue *paramv;
7482 gsize num_params;
7483 guint num_extra;
7484 gsize n;
7485 guint signal_id;
7486 GValue return_value = G_VALUE_INIT;
7487 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7488 g_assert (info != NULL);
7489 num_params = g_variant_n_children (parameters);
7490 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7491 n = 0;
7492 g_value_init (¶mv[n], GXDP_TYPE_TRASH);
7493 g_value_set_object (¶mv[n++], skeleton);
7494 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7495 g_value_set_object (¶mv[n++], invocation);
7496 if (info->pass_fdlist)
7497 {
7498 #ifdef G_OS_UNIX
7499 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
7500 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7501 #else
7502 g_assert_not_reached ();
7503 #endif
7504 }
7505 g_variant_iter_init (&iter, parameters);
7506 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7507 {
7508 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7509 if (arg_info->use_gvariant)
7510 {
7511 g_value_init (¶mv[n], G_TYPE_VARIANT);
7512 g_value_set_variant (¶mv[n], child);
7513 n++;
7514 }
7515 else
7516 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
7517 g_variant_unref (child);
7518 }
7519 signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_TRASH);
7520 g_value_init (&return_value, G_TYPE_BOOLEAN);
7521 g_signal_emitv (paramv, signal_id, 0, &return_value);
7522 if (!g_value_get_boolean (&return_value))
7523 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);
7524 g_value_unset (&return_value);
7525 for (n = 0; n < num_params + num_extra; n++)
7526 g_value_unset (¶mv[n]);
7527 g_free (paramv);
7528 }
7529
7530 static GVariant *
_gxdp_trash_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)7531 _gxdp_trash_skeleton_handle_get_property (
7532 GDBusConnection *connection G_GNUC_UNUSED,
7533 const gchar *sender G_GNUC_UNUSED,
7534 const gchar *object_path G_GNUC_UNUSED,
7535 const gchar *interface_name G_GNUC_UNUSED,
7536 const gchar *property_name,
7537 GError **error,
7538 gpointer user_data)
7539 {
7540 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (user_data);
7541 GValue value = G_VALUE_INIT;
7542 GParamSpec *pspec;
7543 _ExtendedGDBusPropertyInfo *info;
7544 GVariant *ret;
7545 ret = NULL;
7546 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, property_name);
7547 g_assert (info != NULL);
7548 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7549 if (pspec == NULL)
7550 {
7551 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7552 }
7553 else
7554 {
7555 g_value_init (&value, pspec->value_type);
7556 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7557 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7558 g_value_unset (&value);
7559 }
7560 return ret;
7561 }
7562
7563 static gboolean
_gxdp_trash_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)7564 _gxdp_trash_skeleton_handle_set_property (
7565 GDBusConnection *connection G_GNUC_UNUSED,
7566 const gchar *sender G_GNUC_UNUSED,
7567 const gchar *object_path G_GNUC_UNUSED,
7568 const gchar *interface_name G_GNUC_UNUSED,
7569 const gchar *property_name,
7570 GVariant *variant,
7571 GError **error,
7572 gpointer user_data)
7573 {
7574 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (user_data);
7575 GValue value = G_VALUE_INIT;
7576 GParamSpec *pspec;
7577 _ExtendedGDBusPropertyInfo *info;
7578 gboolean ret;
7579 ret = FALSE;
7580 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_trash_interface_info.parent_struct, property_name);
7581 g_assert (info != NULL);
7582 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7583 if (pspec == NULL)
7584 {
7585 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7586 }
7587 else
7588 {
7589 if (info->use_gvariant)
7590 g_value_set_variant (&value, variant);
7591 else
7592 g_dbus_gvariant_to_gvalue (variant, &value);
7593 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7594 g_value_unset (&value);
7595 ret = TRUE;
7596 }
7597 return ret;
7598 }
7599
7600 static const GDBusInterfaceVTable _gxdp_trash_skeleton_vtable =
7601 {
7602 _gxdp_trash_skeleton_handle_method_call,
7603 _gxdp_trash_skeleton_handle_get_property,
7604 _gxdp_trash_skeleton_handle_set_property,
7605 {NULL}
7606 };
7607
7608 static GDBusInterfaceInfo *
gxdp_trash_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)7609 gxdp_trash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7610 {
7611 return gxdp_trash_interface_info ();
7612 }
7613
7614 static GDBusInterfaceVTable *
gxdp_trash_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)7615 gxdp_trash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7616 {
7617 return (GDBusInterfaceVTable *) &_gxdp_trash_skeleton_vtable;
7618 }
7619
7620 static GVariant *
gxdp_trash_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)7621 gxdp_trash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7622 {
7623 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (_skeleton);
7624
7625 GVariantBuilder builder;
7626 guint n;
7627 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7628 if (_gxdp_trash_interface_info.parent_struct.properties == NULL)
7629 goto out;
7630 for (n = 0; _gxdp_trash_interface_info.parent_struct.properties[n] != NULL; n++)
7631 {
7632 GDBusPropertyInfo *info = _gxdp_trash_interface_info.parent_struct.properties[n];
7633 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7634 {
7635 GVariant *value;
7636 value = _gxdp_trash_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.portal.Trash", info->name, NULL, skeleton);
7637 if (value != NULL)
7638 {
7639 g_variant_take_ref (value);
7640 g_variant_builder_add (&builder, "{sv}", info->name, value);
7641 g_variant_unref (value);
7642 }
7643 }
7644 }
7645 out:
7646 return g_variant_builder_end (&builder);
7647 }
7648
7649 static gboolean _gxdp_trash_emit_changed (gpointer user_data);
7650
7651 static void
gxdp_trash_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)7652 gxdp_trash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7653 {
7654 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (_skeleton);
7655 gboolean emit_changed = FALSE;
7656
7657 g_mutex_lock (&skeleton->priv->lock);
7658 if (skeleton->priv->changed_properties_idle_source != NULL)
7659 {
7660 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7661 skeleton->priv->changed_properties_idle_source = NULL;
7662 emit_changed = TRUE;
7663 }
7664 g_mutex_unlock (&skeleton->priv->lock);
7665
7666 if (emit_changed)
7667 _gxdp_trash_emit_changed (skeleton);
7668 }
7669
7670 static void gxdp_trash_skeleton_iface_init (GXdpTrashIface *iface);
7671 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(GXdpTrashSkeleton,gxdp_trash_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (GXdpTrashSkeleton)G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH,gxdp_trash_skeleton_iface_init))7672 G_DEFINE_TYPE_WITH_CODE (GXdpTrashSkeleton, gxdp_trash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7673 G_ADD_PRIVATE (GXdpTrashSkeleton)
7674 G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_skeleton_iface_init))
7675
7676 #else
7677 G_DEFINE_TYPE_WITH_CODE (GXdpTrashSkeleton, gxdp_trash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7678 G_IMPLEMENT_INTERFACE (GXDP_TYPE_TRASH, gxdp_trash_skeleton_iface_init))
7679
7680 #endif
7681 static void
7682 gxdp_trash_skeleton_finalize (GObject *object)
7683 {
7684 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (object);
7685 guint n;
7686 for (n = 0; n < 1; n++)
7687 g_value_unset (&skeleton->priv->properties[n]);
7688 g_free (skeleton->priv->properties);
7689 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7690 if (skeleton->priv->changed_properties_idle_source != NULL)
7691 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7692 g_main_context_unref (skeleton->priv->context);
7693 g_mutex_clear (&skeleton->priv->lock);
7694 G_OBJECT_CLASS (gxdp_trash_skeleton_parent_class)->finalize (object);
7695 }
7696
7697 static void
gxdp_trash_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)7698 gxdp_trash_skeleton_get_property (GObject *object,
7699 guint prop_id,
7700 GValue *value,
7701 GParamSpec *pspec G_GNUC_UNUSED)
7702 {
7703 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (object);
7704 g_assert (prop_id != 0 && prop_id - 1 < 1);
7705 g_mutex_lock (&skeleton->priv->lock);
7706 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7707 g_mutex_unlock (&skeleton->priv->lock);
7708 }
7709
7710 static gboolean
_gxdp_trash_emit_changed(gpointer user_data)7711 _gxdp_trash_emit_changed (gpointer user_data)
7712 {
7713 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (user_data);
7714 GList *l;
7715 GVariantBuilder builder;
7716 GVariantBuilder invalidated_builder;
7717 guint num_changes;
7718
7719 g_mutex_lock (&skeleton->priv->lock);
7720 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7721 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7722 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7723 {
7724 ChangedProperty *cp = l->data;
7725 GVariant *variant;
7726 const GValue *cur_value;
7727
7728 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7729 if (!_g_value_equal (cur_value, &cp->orig_value))
7730 {
7731 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7732 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7733 g_variant_unref (variant);
7734 num_changes++;
7735 }
7736 }
7737 if (num_changes > 0)
7738 {
7739 GList *connections, *ll;
7740 GVariant *signal_variant;
7741 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.Trash",
7742 &builder, &invalidated_builder));
7743 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7744 for (ll = connections; ll != NULL; ll = ll->next)
7745 {
7746 GDBusConnection *connection = ll->data;
7747
7748 g_dbus_connection_emit_signal (connection,
7749 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7750 "org.freedesktop.DBus.Properties",
7751 "PropertiesChanged",
7752 signal_variant,
7753 NULL);
7754 }
7755 g_variant_unref (signal_variant);
7756 g_list_free_full (connections, g_object_unref);
7757 }
7758 else
7759 {
7760 g_variant_builder_clear (&builder);
7761 g_variant_builder_clear (&invalidated_builder);
7762 }
7763 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7764 skeleton->priv->changed_properties = NULL;
7765 skeleton->priv->changed_properties_idle_source = NULL;
7766 g_mutex_unlock (&skeleton->priv->lock);
7767 return FALSE;
7768 }
7769
7770 static void
_gxdp_trash_schedule_emit_changed(GXdpTrashSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)7771 _gxdp_trash_schedule_emit_changed (GXdpTrashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7772 {
7773 ChangedProperty *cp;
7774 GList *l;
7775 cp = NULL;
7776 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7777 {
7778 ChangedProperty *i_cp = l->data;
7779 if (i_cp->info == info)
7780 {
7781 cp = i_cp;
7782 break;
7783 }
7784 }
7785 if (cp == NULL)
7786 {
7787 cp = g_new0 (ChangedProperty, 1);
7788 cp->prop_id = prop_id;
7789 cp->info = info;
7790 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7791 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7792 g_value_copy (orig_value, &cp->orig_value);
7793 }
7794 }
7795
7796 static void
gxdp_trash_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)7797 gxdp_trash_skeleton_notify (GObject *object,
7798 GParamSpec *pspec G_GNUC_UNUSED)
7799 {
7800 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (object);
7801 g_mutex_lock (&skeleton->priv->lock);
7802 if (skeleton->priv->changed_properties != NULL &&
7803 skeleton->priv->changed_properties_idle_source == NULL)
7804 {
7805 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7806 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7807 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_trash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7808 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_trash_emit_changed");
7809 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7810 g_source_unref (skeleton->priv->changed_properties_idle_source);
7811 }
7812 g_mutex_unlock (&skeleton->priv->lock);
7813 }
7814
7815 static void
gxdp_trash_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)7816 gxdp_trash_skeleton_set_property (GObject *object,
7817 guint prop_id,
7818 const GValue *value,
7819 GParamSpec *pspec)
7820 {
7821 const _ExtendedGDBusPropertyInfo *info;
7822 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (object);
7823 g_assert (prop_id != 0 && prop_id - 1 < 1);
7824 info = (const _ExtendedGDBusPropertyInfo *) _gxdp_trash_property_info_pointers[prop_id - 1];
7825 g_mutex_lock (&skeleton->priv->lock);
7826 g_object_freeze_notify (object);
7827 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7828 {
7829 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
7830 info->emits_changed_signal)
7831 _gxdp_trash_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
7832 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7833 g_object_notify_by_pspec (object, pspec);
7834 }
7835 g_mutex_unlock (&skeleton->priv->lock);
7836 g_object_thaw_notify (object);
7837 }
7838
7839 static void
gxdp_trash_skeleton_init(GXdpTrashSkeleton * skeleton)7840 gxdp_trash_skeleton_init (GXdpTrashSkeleton *skeleton)
7841 {
7842 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7843 skeleton->priv = gxdp_trash_skeleton_get_instance_private (skeleton);
7844 #else
7845 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_TRASH_SKELETON, GXdpTrashSkeletonPrivate);
7846 #endif
7847
7848 g_mutex_init (&skeleton->priv->lock);
7849 skeleton->priv->context = g_main_context_ref_thread_default ();
7850 skeleton->priv->properties = g_new0 (GValue, 1);
7851 g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
7852 }
7853
7854 static guint
gxdp_trash_skeleton_get_version(GXdpTrash * object)7855 gxdp_trash_skeleton_get_version (GXdpTrash *object)
7856 {
7857 GXdpTrashSkeleton *skeleton = GXDP_TRASH_SKELETON (object);
7858 guint value;
7859 g_mutex_lock (&skeleton->priv->lock);
7860 value = g_value_get_uint (&(skeleton->priv->properties[0]));
7861 g_mutex_unlock (&skeleton->priv->lock);
7862 return value;
7863 }
7864
7865 static void
gxdp_trash_skeleton_class_init(GXdpTrashSkeletonClass * klass)7866 gxdp_trash_skeleton_class_init (GXdpTrashSkeletonClass *klass)
7867 {
7868 GObjectClass *gobject_class;
7869 GDBusInterfaceSkeletonClass *skeleton_class;
7870
7871 gobject_class = G_OBJECT_CLASS (klass);
7872 gobject_class->finalize = gxdp_trash_skeleton_finalize;
7873 gobject_class->get_property = gxdp_trash_skeleton_get_property;
7874 gobject_class->set_property = gxdp_trash_skeleton_set_property;
7875 gobject_class->notify = gxdp_trash_skeleton_notify;
7876
7877
7878 gxdp_trash_override_properties (gobject_class, 1);
7879
7880 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7881 skeleton_class->get_info = gxdp_trash_skeleton_dbus_interface_get_info;
7882 skeleton_class->get_properties = gxdp_trash_skeleton_dbus_interface_get_properties;
7883 skeleton_class->flush = gxdp_trash_skeleton_dbus_interface_flush;
7884 skeleton_class->get_vtable = gxdp_trash_skeleton_dbus_interface_get_vtable;
7885
7886 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7887 g_type_class_add_private (klass, sizeof (GXdpTrashSkeletonPrivate));
7888 #endif
7889 }
7890
7891 static void
gxdp_trash_skeleton_iface_init(GXdpTrashIface * iface)7892 gxdp_trash_skeleton_iface_init (GXdpTrashIface *iface)
7893 {
7894 iface->get_version = gxdp_trash_skeleton_get_version;
7895 }
7896
7897 /**
7898 * gxdp_trash_skeleton_new:
7899 *
7900 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Trash.top_of_page">org.freedesktop.portal.Trash</link>.
7901 *
7902 * Returns: (transfer full) (type GXdpTrashSkeleton): The skeleton object.
7903 */
7904 GXdpTrash *
gxdp_trash_skeleton_new(void)7905 gxdp_trash_skeleton_new (void)
7906 {
7907 return GXDP_TRASH (g_object_new (GXDP_TYPE_TRASH_SKELETON, NULL));
7908 }
7909
7910