/work/meson/gio/xdp-dbus.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Generated by gdbus-codegen 2.59.0 from org.freedesktop.portal.Documents.xml, org.freedesktop.portal.OpenURI.xml, org.freedesktop.portal.ProxyResolver.xml. DO NOT EDIT. |
3 | | * |
4 | | * The license of this code is the same as for the D-Bus interface description |
5 | | * it was derived from. |
6 | | */ |
7 | | |
8 | | #ifdef HAVE_CONFIG_H |
9 | | # include "config.h" |
10 | | #endif |
11 | | |
12 | | #include "xdp-dbus.h" |
13 | | |
14 | | #include <string.h> |
15 | | #ifdef G_OS_UNIX |
16 | | # include <gio/gunixfdlist.h> |
17 | | #endif |
18 | | |
19 | | typedef struct |
20 | | { |
21 | | GDBusArgInfo parent_struct; |
22 | | gboolean use_gvariant; |
23 | | } _ExtendedGDBusArgInfo; |
24 | | |
25 | | typedef struct |
26 | | { |
27 | | GDBusMethodInfo parent_struct; |
28 | | const gchar *signal_name; |
29 | | gboolean pass_fdlist; |
30 | | } _ExtendedGDBusMethodInfo; |
31 | | |
32 | | typedef struct |
33 | | { |
34 | | GDBusSignalInfo parent_struct; |
35 | | const gchar *signal_name; |
36 | | } _ExtendedGDBusSignalInfo; |
37 | | |
38 | | typedef struct |
39 | | { |
40 | | GDBusPropertyInfo parent_struct; |
41 | | const gchar *hyphen_name; |
42 | | gboolean use_gvariant; |
43 | | } _ExtendedGDBusPropertyInfo; |
44 | | |
45 | | typedef struct |
46 | | { |
47 | | GDBusInterfaceInfo parent_struct; |
48 | | const gchar *hyphen_name; |
49 | | } _ExtendedGDBusInterfaceInfo; |
50 | | |
51 | | typedef struct |
52 | | { |
53 | | const _ExtendedGDBusPropertyInfo *info; |
54 | | guint prop_id; |
55 | | GValue orig_value; /* the value before the change */ |
56 | | } ChangedProperty; |
57 | | |
58 | | static void |
59 | | _changed_property_free (ChangedProperty *data) |
60 | 0 | { |
61 | 0 | g_value_unset (&data->orig_value); |
62 | 0 | g_free (data); |
63 | 0 | } |
64 | | |
65 | | static gboolean |
66 | | _g_strv_equal0 (gchar **a, gchar **b) |
67 | 0 | { |
68 | 0 | gboolean ret = FALSE; |
69 | 0 | guint n; |
70 | 0 | if (a == NULL && b == NULL) |
71 | 0 | { |
72 | 0 | ret = TRUE; |
73 | 0 | goto out; |
74 | 0 | } |
75 | 0 | if (a == NULL || b == NULL) |
76 | 0 | goto out; |
77 | 0 | if (g_strv_length (a) != g_strv_length (b)) |
78 | 0 | goto out; |
79 | 0 | for (n = 0; a[n] != NULL; n++) |
80 | 0 | if (g_strcmp0 (a[n], b[n]) != 0) |
81 | 0 | goto out; |
82 | 0 | ret = TRUE; |
83 | 0 | out: |
84 | 0 | return ret; |
85 | 0 | } |
86 | | |
87 | | static gboolean |
88 | | _g_variant_equal0 (GVariant *a, GVariant *b) |
89 | 0 | { |
90 | 0 | gboolean ret = FALSE; |
91 | 0 | if (a == NULL && b == NULL) |
92 | 0 | { |
93 | 0 | ret = TRUE; |
94 | 0 | goto out; |
95 | 0 | } |
96 | 0 | if (a == NULL || b == NULL) |
97 | 0 | goto out; |
98 | 0 | ret = g_variant_equal (a, b); |
99 | 0 | out: |
100 | 0 | return ret; |
101 | 0 | } |
102 | | |
103 | | G_GNUC_UNUSED static gboolean |
104 | | _g_value_equal (const GValue *a, const GValue *b) |
105 | 0 | { |
106 | 0 | gboolean ret = FALSE; |
107 | 0 | g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
108 | 0 | switch (G_VALUE_TYPE (a)) |
109 | 0 | { |
110 | 0 | case G_TYPE_BOOLEAN: |
111 | 0 | ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
112 | 0 | break; |
113 | 0 | case G_TYPE_UCHAR: |
114 | 0 | ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
115 | 0 | break; |
116 | 0 | case G_TYPE_INT: |
117 | 0 | ret = (g_value_get_int (a) == g_value_get_int (b)); |
118 | 0 | break; |
119 | 0 | case G_TYPE_UINT: |
120 | 0 | ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
121 | 0 | break; |
122 | 0 | case G_TYPE_INT64: |
123 | 0 | ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
124 | 0 | break; |
125 | 0 | case G_TYPE_UINT64: |
126 | 0 | ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
127 | 0 | break; |
128 | 0 | case G_TYPE_DOUBLE: |
129 | 0 | { |
130 | 0 | /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
131 | 0 | gdouble da = g_value_get_double (a); |
132 | 0 | gdouble db = g_value_get_double (b); |
133 | 0 | ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
134 | 0 | } |
135 | 0 | break; |
136 | 0 | case G_TYPE_STRING: |
137 | 0 | ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
138 | 0 | break; |
139 | 0 | case G_TYPE_VARIANT: |
140 | 0 | ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
141 | 0 | break; |
142 | 0 | default: |
143 | 0 | if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
144 | 0 | ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
145 | 0 | else |
146 | 0 | g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
147 | 0 | break; |
148 | 0 | } |
149 | 0 | return ret; |
150 | 0 | } |
151 | | |
152 | | /* ------------------------------------------------------------------------ |
153 | | * Code for interface org.freedesktop.portal.Documents |
154 | | * ------------------------------------------------------------------------ |
155 | | */ |
156 | | |
157 | | /** |
158 | | * SECTION:GXdpDocuments |
159 | | * @title: GXdpDocuments |
160 | | * @short_description: Generated C code for the org.freedesktop.portal.Documents D-Bus interface |
161 | | * |
162 | | * 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. |
163 | | */ |
164 | | |
165 | | /* ---- Introspection data for org.freedesktop.portal.Documents ---- */ |
166 | | |
167 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_get_mount_point_OUT_ARG_path = |
168 | | { |
169 | | { |
170 | | -1, |
171 | | (gchar *) "path", |
172 | | (gchar *) "ay", |
173 | | NULL |
174 | | }, |
175 | | FALSE |
176 | | }; |
177 | | |
178 | | static const GDBusArgInfo * const _gxdp_documents_method_info_get_mount_point_OUT_ARG_pointers[] = |
179 | | { |
180 | | &_gxdp_documents_method_info_get_mount_point_OUT_ARG_path.parent_struct, |
181 | | NULL |
182 | | }; |
183 | | |
184 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_get_mount_point = |
185 | | { |
186 | | { |
187 | | -1, |
188 | | (gchar *) "GetMountPoint", |
189 | | NULL, |
190 | | (GDBusArgInfo **) &_gxdp_documents_method_info_get_mount_point_OUT_ARG_pointers, |
191 | | NULL |
192 | | }, |
193 | | "handle-get-mount-point", |
194 | | FALSE |
195 | | }; |
196 | | |
197 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_o_path_fd = |
198 | | { |
199 | | { |
200 | | -1, |
201 | | (gchar *) "o_path_fd", |
202 | | (gchar *) "h", |
203 | | NULL |
204 | | }, |
205 | | FALSE |
206 | | }; |
207 | | |
208 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_reuse_existing = |
209 | | { |
210 | | { |
211 | | -1, |
212 | | (gchar *) "reuse_existing", |
213 | | (gchar *) "b", |
214 | | NULL |
215 | | }, |
216 | | FALSE |
217 | | }; |
218 | | |
219 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_IN_ARG_persistent = |
220 | | { |
221 | | { |
222 | | -1, |
223 | | (gchar *) "persistent", |
224 | | (gchar *) "b", |
225 | | NULL |
226 | | }, |
227 | | FALSE |
228 | | }; |
229 | | |
230 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_IN_ARG_pointers[] = |
231 | | { |
232 | | &_gxdp_documents_method_info_add_IN_ARG_o_path_fd.parent_struct, |
233 | | &_gxdp_documents_method_info_add_IN_ARG_reuse_existing.parent_struct, |
234 | | &_gxdp_documents_method_info_add_IN_ARG_persistent.parent_struct, |
235 | | NULL |
236 | | }; |
237 | | |
238 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_OUT_ARG_doc_id = |
239 | | { |
240 | | { |
241 | | -1, |
242 | | (gchar *) "doc_id", |
243 | | (gchar *) "s", |
244 | | NULL |
245 | | }, |
246 | | FALSE |
247 | | }; |
248 | | |
249 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_OUT_ARG_pointers[] = |
250 | | { |
251 | | &_gxdp_documents_method_info_add_OUT_ARG_doc_id.parent_struct, |
252 | | NULL |
253 | | }; |
254 | | |
255 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add = |
256 | | { |
257 | | { |
258 | | -1, |
259 | | (gchar *) "Add", |
260 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_IN_ARG_pointers, |
261 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_OUT_ARG_pointers, |
262 | | NULL |
263 | | }, |
264 | | "handle-add", |
265 | | TRUE |
266 | | }; |
267 | | |
268 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_o_path_parent_fd = |
269 | | { |
270 | | { |
271 | | -1, |
272 | | (gchar *) "o_path_parent_fd", |
273 | | (gchar *) "h", |
274 | | NULL |
275 | | }, |
276 | | FALSE |
277 | | }; |
278 | | |
279 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_filename = |
280 | | { |
281 | | { |
282 | | -1, |
283 | | (gchar *) "filename", |
284 | | (gchar *) "ay", |
285 | | NULL |
286 | | }, |
287 | | FALSE |
288 | | }; |
289 | | |
290 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_reuse_existing = |
291 | | { |
292 | | { |
293 | | -1, |
294 | | (gchar *) "reuse_existing", |
295 | | (gchar *) "b", |
296 | | NULL |
297 | | }, |
298 | | FALSE |
299 | | }; |
300 | | |
301 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_IN_ARG_persistent = |
302 | | { |
303 | | { |
304 | | -1, |
305 | | (gchar *) "persistent", |
306 | | (gchar *) "b", |
307 | | NULL |
308 | | }, |
309 | | FALSE |
310 | | }; |
311 | | |
312 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_IN_ARG_pointers[] = |
313 | | { |
314 | | &_gxdp_documents_method_info_add_named_IN_ARG_o_path_parent_fd.parent_struct, |
315 | | &_gxdp_documents_method_info_add_named_IN_ARG_filename.parent_struct, |
316 | | &_gxdp_documents_method_info_add_named_IN_ARG_reuse_existing.parent_struct, |
317 | | &_gxdp_documents_method_info_add_named_IN_ARG_persistent.parent_struct, |
318 | | NULL |
319 | | }; |
320 | | |
321 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_named_OUT_ARG_doc_id = |
322 | | { |
323 | | { |
324 | | -1, |
325 | | (gchar *) "doc_id", |
326 | | (gchar *) "s", |
327 | | NULL |
328 | | }, |
329 | | FALSE |
330 | | }; |
331 | | |
332 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_named_OUT_ARG_pointers[] = |
333 | | { |
334 | | &_gxdp_documents_method_info_add_named_OUT_ARG_doc_id.parent_struct, |
335 | | NULL |
336 | | }; |
337 | | |
338 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add_named = |
339 | | { |
340 | | { |
341 | | -1, |
342 | | (gchar *) "AddNamed", |
343 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_IN_ARG_pointers, |
344 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_named_OUT_ARG_pointers, |
345 | | NULL |
346 | | }, |
347 | | "handle-add-named", |
348 | | TRUE |
349 | | }; |
350 | | |
351 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_o_path_fds = |
352 | | { |
353 | | { |
354 | | -1, |
355 | | (gchar *) "o_path_fds", |
356 | | (gchar *) "ah", |
357 | | NULL |
358 | | }, |
359 | | FALSE |
360 | | }; |
361 | | |
362 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_flags = |
363 | | { |
364 | | { |
365 | | -1, |
366 | | (gchar *) "flags", |
367 | | (gchar *) "u", |
368 | | NULL |
369 | | }, |
370 | | FALSE |
371 | | }; |
372 | | |
373 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_app_id = |
374 | | { |
375 | | { |
376 | | -1, |
377 | | (gchar *) "app_id", |
378 | | (gchar *) "s", |
379 | | NULL |
380 | | }, |
381 | | FALSE |
382 | | }; |
383 | | |
384 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_IN_ARG_permissions = |
385 | | { |
386 | | { |
387 | | -1, |
388 | | (gchar *) "permissions", |
389 | | (gchar *) "as", |
390 | | NULL |
391 | | }, |
392 | | FALSE |
393 | | }; |
394 | | |
395 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_full_IN_ARG_pointers[] = |
396 | | { |
397 | | &_gxdp_documents_method_info_add_full_IN_ARG_o_path_fds.parent_struct, |
398 | | &_gxdp_documents_method_info_add_full_IN_ARG_flags.parent_struct, |
399 | | &_gxdp_documents_method_info_add_full_IN_ARG_app_id.parent_struct, |
400 | | &_gxdp_documents_method_info_add_full_IN_ARG_permissions.parent_struct, |
401 | | NULL |
402 | | }; |
403 | | |
404 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_OUT_ARG_doc_ids = |
405 | | { |
406 | | { |
407 | | -1, |
408 | | (gchar *) "doc_ids", |
409 | | (gchar *) "as", |
410 | | NULL |
411 | | }, |
412 | | FALSE |
413 | | }; |
414 | | |
415 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_add_full_OUT_ARG_extra_out = |
416 | | { |
417 | | { |
418 | | -1, |
419 | | (gchar *) "extra_out", |
420 | | (gchar *) "a{sv}", |
421 | | NULL |
422 | | }, |
423 | | FALSE |
424 | | }; |
425 | | |
426 | | static const GDBusArgInfo * const _gxdp_documents_method_info_add_full_OUT_ARG_pointers[] = |
427 | | { |
428 | | &_gxdp_documents_method_info_add_full_OUT_ARG_doc_ids.parent_struct, |
429 | | &_gxdp_documents_method_info_add_full_OUT_ARG_extra_out.parent_struct, |
430 | | NULL |
431 | | }; |
432 | | |
433 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_add_full = |
434 | | { |
435 | | { |
436 | | -1, |
437 | | (gchar *) "AddFull", |
438 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_full_IN_ARG_pointers, |
439 | | (GDBusArgInfo **) &_gxdp_documents_method_info_add_full_OUT_ARG_pointers, |
440 | | NULL |
441 | | }, |
442 | | "handle-add-full", |
443 | | TRUE |
444 | | }; |
445 | | |
446 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_doc_id = |
447 | | { |
448 | | { |
449 | | -1, |
450 | | (gchar *) "doc_id", |
451 | | (gchar *) "s", |
452 | | NULL |
453 | | }, |
454 | | FALSE |
455 | | }; |
456 | | |
457 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_app_id = |
458 | | { |
459 | | { |
460 | | -1, |
461 | | (gchar *) "app_id", |
462 | | (gchar *) "s", |
463 | | NULL |
464 | | }, |
465 | | FALSE |
466 | | }; |
467 | | |
468 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_grant_permissions_IN_ARG_permissions = |
469 | | { |
470 | | { |
471 | | -1, |
472 | | (gchar *) "permissions", |
473 | | (gchar *) "as", |
474 | | NULL |
475 | | }, |
476 | | FALSE |
477 | | }; |
478 | | |
479 | | static const GDBusArgInfo * const _gxdp_documents_method_info_grant_permissions_IN_ARG_pointers[] = |
480 | | { |
481 | | &_gxdp_documents_method_info_grant_permissions_IN_ARG_doc_id.parent_struct, |
482 | | &_gxdp_documents_method_info_grant_permissions_IN_ARG_app_id.parent_struct, |
483 | | &_gxdp_documents_method_info_grant_permissions_IN_ARG_permissions.parent_struct, |
484 | | NULL |
485 | | }; |
486 | | |
487 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_grant_permissions = |
488 | | { |
489 | | { |
490 | | -1, |
491 | | (gchar *) "GrantPermissions", |
492 | | (GDBusArgInfo **) &_gxdp_documents_method_info_grant_permissions_IN_ARG_pointers, |
493 | | NULL, |
494 | | NULL |
495 | | }, |
496 | | "handle-grant-permissions", |
497 | | FALSE |
498 | | }; |
499 | | |
500 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_doc_id = |
501 | | { |
502 | | { |
503 | | -1, |
504 | | (gchar *) "doc_id", |
505 | | (gchar *) "s", |
506 | | NULL |
507 | | }, |
508 | | FALSE |
509 | | }; |
510 | | |
511 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_app_id = |
512 | | { |
513 | | { |
514 | | -1, |
515 | | (gchar *) "app_id", |
516 | | (gchar *) "s", |
517 | | NULL |
518 | | }, |
519 | | FALSE |
520 | | }; |
521 | | |
522 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_revoke_permissions_IN_ARG_permissions = |
523 | | { |
524 | | { |
525 | | -1, |
526 | | (gchar *) "permissions", |
527 | | (gchar *) "as", |
528 | | NULL |
529 | | }, |
530 | | FALSE |
531 | | }; |
532 | | |
533 | | static const GDBusArgInfo * const _gxdp_documents_method_info_revoke_permissions_IN_ARG_pointers[] = |
534 | | { |
535 | | &_gxdp_documents_method_info_revoke_permissions_IN_ARG_doc_id.parent_struct, |
536 | | &_gxdp_documents_method_info_revoke_permissions_IN_ARG_app_id.parent_struct, |
537 | | &_gxdp_documents_method_info_revoke_permissions_IN_ARG_permissions.parent_struct, |
538 | | NULL |
539 | | }; |
540 | | |
541 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_revoke_permissions = |
542 | | { |
543 | | { |
544 | | -1, |
545 | | (gchar *) "RevokePermissions", |
546 | | (GDBusArgInfo **) &_gxdp_documents_method_info_revoke_permissions_IN_ARG_pointers, |
547 | | NULL, |
548 | | NULL |
549 | | }, |
550 | | "handle-revoke-permissions", |
551 | | FALSE |
552 | | }; |
553 | | |
554 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_delete_IN_ARG_doc_id = |
555 | | { |
556 | | { |
557 | | -1, |
558 | | (gchar *) "doc_id", |
559 | | (gchar *) "s", |
560 | | NULL |
561 | | }, |
562 | | FALSE |
563 | | }; |
564 | | |
565 | | static const GDBusArgInfo * const _gxdp_documents_method_info_delete_IN_ARG_pointers[] = |
566 | | { |
567 | | &_gxdp_documents_method_info_delete_IN_ARG_doc_id.parent_struct, |
568 | | NULL |
569 | | }; |
570 | | |
571 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_delete = |
572 | | { |
573 | | { |
574 | | -1, |
575 | | (gchar *) "Delete", |
576 | | (GDBusArgInfo **) &_gxdp_documents_method_info_delete_IN_ARG_pointers, |
577 | | NULL, |
578 | | NULL |
579 | | }, |
580 | | "handle-delete", |
581 | | FALSE |
582 | | }; |
583 | | |
584 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_lookup_IN_ARG_filename = |
585 | | { |
586 | | { |
587 | | -1, |
588 | | (gchar *) "filename", |
589 | | (gchar *) "ay", |
590 | | NULL |
591 | | }, |
592 | | FALSE |
593 | | }; |
594 | | |
595 | | static const GDBusArgInfo * const _gxdp_documents_method_info_lookup_IN_ARG_pointers[] = |
596 | | { |
597 | | &_gxdp_documents_method_info_lookup_IN_ARG_filename.parent_struct, |
598 | | NULL |
599 | | }; |
600 | | |
601 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_lookup_OUT_ARG_doc_id = |
602 | | { |
603 | | { |
604 | | -1, |
605 | | (gchar *) "doc_id", |
606 | | (gchar *) "s", |
607 | | NULL |
608 | | }, |
609 | | FALSE |
610 | | }; |
611 | | |
612 | | static const GDBusArgInfo * const _gxdp_documents_method_info_lookup_OUT_ARG_pointers[] = |
613 | | { |
614 | | &_gxdp_documents_method_info_lookup_OUT_ARG_doc_id.parent_struct, |
615 | | NULL |
616 | | }; |
617 | | |
618 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_lookup = |
619 | | { |
620 | | { |
621 | | -1, |
622 | | (gchar *) "Lookup", |
623 | | (GDBusArgInfo **) &_gxdp_documents_method_info_lookup_IN_ARG_pointers, |
624 | | (GDBusArgInfo **) &_gxdp_documents_method_info_lookup_OUT_ARG_pointers, |
625 | | NULL |
626 | | }, |
627 | | "handle-lookup", |
628 | | FALSE |
629 | | }; |
630 | | |
631 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_IN_ARG_doc_id = |
632 | | { |
633 | | { |
634 | | -1, |
635 | | (gchar *) "doc_id", |
636 | | (gchar *) "s", |
637 | | NULL |
638 | | }, |
639 | | FALSE |
640 | | }; |
641 | | |
642 | | static const GDBusArgInfo * const _gxdp_documents_method_info_info_IN_ARG_pointers[] = |
643 | | { |
644 | | &_gxdp_documents_method_info_info_IN_ARG_doc_id.parent_struct, |
645 | | NULL |
646 | | }; |
647 | | |
648 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_OUT_ARG_path = |
649 | | { |
650 | | { |
651 | | -1, |
652 | | (gchar *) "path", |
653 | | (gchar *) "ay", |
654 | | NULL |
655 | | }, |
656 | | FALSE |
657 | | }; |
658 | | |
659 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_info_OUT_ARG_apps = |
660 | | { |
661 | | { |
662 | | -1, |
663 | | (gchar *) "apps", |
664 | | (gchar *) "a{sas}", |
665 | | NULL |
666 | | }, |
667 | | FALSE |
668 | | }; |
669 | | |
670 | | static const GDBusArgInfo * const _gxdp_documents_method_info_info_OUT_ARG_pointers[] = |
671 | | { |
672 | | &_gxdp_documents_method_info_info_OUT_ARG_path.parent_struct, |
673 | | &_gxdp_documents_method_info_info_OUT_ARG_apps.parent_struct, |
674 | | NULL |
675 | | }; |
676 | | |
677 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_info = |
678 | | { |
679 | | { |
680 | | -1, |
681 | | (gchar *) "Info", |
682 | | (GDBusArgInfo **) &_gxdp_documents_method_info_info_IN_ARG_pointers, |
683 | | (GDBusArgInfo **) &_gxdp_documents_method_info_info_OUT_ARG_pointers, |
684 | | NULL |
685 | | }, |
686 | | "handle-info", |
687 | | FALSE |
688 | | }; |
689 | | |
690 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_list_IN_ARG_app_id = |
691 | | { |
692 | | { |
693 | | -1, |
694 | | (gchar *) "app_id", |
695 | | (gchar *) "s", |
696 | | NULL |
697 | | }, |
698 | | FALSE |
699 | | }; |
700 | | |
701 | | static const GDBusArgInfo * const _gxdp_documents_method_info_list_IN_ARG_pointers[] = |
702 | | { |
703 | | &_gxdp_documents_method_info_list_IN_ARG_app_id.parent_struct, |
704 | | NULL |
705 | | }; |
706 | | |
707 | | static const _ExtendedGDBusArgInfo _gxdp_documents_method_info_list_OUT_ARG_docs = |
708 | | { |
709 | | { |
710 | | -1, |
711 | | (gchar *) "docs", |
712 | | (gchar *) "a{say}", |
713 | | NULL |
714 | | }, |
715 | | FALSE |
716 | | }; |
717 | | |
718 | | static const GDBusArgInfo * const _gxdp_documents_method_info_list_OUT_ARG_pointers[] = |
719 | | { |
720 | | &_gxdp_documents_method_info_list_OUT_ARG_docs.parent_struct, |
721 | | NULL |
722 | | }; |
723 | | |
724 | | static const _ExtendedGDBusMethodInfo _gxdp_documents_method_info_list = |
725 | | { |
726 | | { |
727 | | -1, |
728 | | (gchar *) "List", |
729 | | (GDBusArgInfo **) &_gxdp_documents_method_info_list_IN_ARG_pointers, |
730 | | (GDBusArgInfo **) &_gxdp_documents_method_info_list_OUT_ARG_pointers, |
731 | | NULL |
732 | | }, |
733 | | "handle-list", |
734 | | FALSE |
735 | | }; |
736 | | |
737 | | static const GDBusMethodInfo * const _gxdp_documents_method_info_pointers[] = |
738 | | { |
739 | | &_gxdp_documents_method_info_get_mount_point.parent_struct, |
740 | | &_gxdp_documents_method_info_add.parent_struct, |
741 | | &_gxdp_documents_method_info_add_named.parent_struct, |
742 | | &_gxdp_documents_method_info_add_full.parent_struct, |
743 | | &_gxdp_documents_method_info_grant_permissions.parent_struct, |
744 | | &_gxdp_documents_method_info_revoke_permissions.parent_struct, |
745 | | &_gxdp_documents_method_info_delete.parent_struct, |
746 | | &_gxdp_documents_method_info_lookup.parent_struct, |
747 | | &_gxdp_documents_method_info_info.parent_struct, |
748 | | &_gxdp_documents_method_info_list.parent_struct, |
749 | | NULL |
750 | | }; |
751 | | |
752 | | static const _ExtendedGDBusPropertyInfo _gxdp_documents_property_info_version = |
753 | | { |
754 | | { |
755 | | -1, |
756 | | (gchar *) "version", |
757 | | (gchar *) "u", |
758 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
759 | | NULL |
760 | | }, |
761 | | "version", |
762 | | FALSE |
763 | | }; |
764 | | |
765 | | static const GDBusPropertyInfo * const _gxdp_documents_property_info_pointers[] = |
766 | | { |
767 | | &_gxdp_documents_property_info_version.parent_struct, |
768 | | NULL |
769 | | }; |
770 | | |
771 | | static const _ExtendedGDBusInterfaceInfo _gxdp_documents_interface_info = |
772 | | { |
773 | | { |
774 | | -1, |
775 | | (gchar *) "org.freedesktop.portal.Documents", |
776 | | (GDBusMethodInfo **) &_gxdp_documents_method_info_pointers, |
777 | | NULL, |
778 | | (GDBusPropertyInfo **) &_gxdp_documents_property_info_pointers, |
779 | | NULL |
780 | | }, |
781 | | "documents", |
782 | | }; |
783 | | |
784 | | |
785 | | /** |
786 | | * gxdp_documents_interface_info: |
787 | | * |
788 | | * 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. |
789 | | * |
790 | | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
791 | | */ |
792 | | GDBusInterfaceInfo * |
793 | | gxdp_documents_interface_info (void) |
794 | 0 | { |
795 | 0 | return (GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct; |
796 | 0 | } |
797 | | |
798 | | /** |
799 | | * gxdp_documents_override_properties: |
800 | | * @klass: The class structure for a #GObject derived class. |
801 | | * @property_id_begin: The property id to assign to the first overridden property. |
802 | | * |
803 | | * Overrides all #GObject properties in the #GXdpDocuments interface for a concrete class. |
804 | | * The properties are overridden in the order they are defined. |
805 | | * |
806 | | * Returns: The last property id. |
807 | | */ |
808 | | guint |
809 | | gxdp_documents_override_properties (GObjectClass *klass, guint property_id_begin) |
810 | 0 | { |
811 | 0 | g_object_class_override_property (klass, property_id_begin++, "version"); |
812 | 0 | return property_id_begin - 1; |
813 | 0 | } |
814 | | |
815 | | |
816 | | |
817 | | /** |
818 | | * GXdpDocuments: |
819 | | * |
820 | | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>. |
821 | | */ |
822 | | |
823 | | /** |
824 | | * GXdpDocumentsIface: |
825 | | * @parent_iface: The parent interface. |
826 | | * @handle_add: Handler for the #GXdpDocuments::handle-add signal. |
827 | | * @handle_add_full: Handler for the #GXdpDocuments::handle-add-full signal. |
828 | | * @handle_add_named: Handler for the #GXdpDocuments::handle-add-named signal. |
829 | | * @handle_delete: Handler for the #GXdpDocuments::handle-delete signal. |
830 | | * @handle_get_mount_point: Handler for the #GXdpDocuments::handle-get-mount-point signal. |
831 | | * @handle_grant_permissions: Handler for the #GXdpDocuments::handle-grant-permissions signal. |
832 | | * @handle_info: Handler for the #GXdpDocuments::handle-info signal. |
833 | | * @handle_list: Handler for the #GXdpDocuments::handle-list signal. |
834 | | * @handle_lookup: Handler for the #GXdpDocuments::handle-lookup signal. |
835 | | * @handle_revoke_permissions: Handler for the #GXdpDocuments::handle-revoke-permissions signal. |
836 | | * @get_version: Getter for the #GXdpDocuments:version property. |
837 | | * |
838 | | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-Documents.top_of_page">org.freedesktop.portal.Documents</link>. |
839 | | */ |
840 | | |
841 | | typedef GXdpDocumentsIface GXdpDocumentsInterface; |
842 | | G_DEFINE_INTERFACE (GXdpDocuments, gxdp_documents, G_TYPE_OBJECT) |
843 | | |
844 | | static void |
845 | | gxdp_documents_default_init (GXdpDocumentsIface *iface) |
846 | 0 | { |
847 | 0 | /* GObject signals for incoming D-Bus method calls: */ |
848 | 0 | /** |
849 | 0 | * GXdpDocuments::handle-get-mount-point: |
850 | 0 | * @object: A #GXdpDocuments. |
851 | 0 | * @invocation: A #GDBusMethodInvocation. |
852 | 0 | * |
853 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</link> D-Bus method. |
854 | 0 | * |
855 | 0 | * 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. |
856 | 0 | * |
857 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
858 | 0 | */ |
859 | 0 | g_signal_new ("handle-get-mount-point", |
860 | 0 | G_TYPE_FROM_INTERFACE (iface), |
861 | 0 | G_SIGNAL_RUN_LAST, |
862 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_get_mount_point), |
863 | 0 | g_signal_accumulator_true_handled, |
864 | 0 | NULL, |
865 | 0 | g_cclosure_marshal_generic, |
866 | 0 | G_TYPE_BOOLEAN, |
867 | 0 | 1, |
868 | 0 | G_TYPE_DBUS_METHOD_INVOCATION); |
869 | 0 |
|
870 | 0 | /** |
871 | 0 | * GXdpDocuments::handle-add: |
872 | 0 | * @object: A #GXdpDocuments. |
873 | 0 | * @invocation: A #GDBusMethodInvocation. |
874 | 0 | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
875 | 0 | * @arg_o_path_fd: Argument passed by remote caller. |
876 | 0 | * @arg_reuse_existing: Argument passed by remote caller. |
877 | 0 | * @arg_persistent: Argument passed by remote caller. |
878 | 0 | * |
879 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</link> D-Bus method. |
880 | 0 | * |
881 | 0 | * 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. |
882 | 0 | * |
883 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
884 | 0 | */ |
885 | 0 | g_signal_new ("handle-add", |
886 | 0 | G_TYPE_FROM_INTERFACE (iface), |
887 | 0 | G_SIGNAL_RUN_LAST, |
888 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add), |
889 | 0 | g_signal_accumulator_true_handled, |
890 | 0 | NULL, |
891 | 0 | g_cclosure_marshal_generic, |
892 | 0 | G_TYPE_BOOLEAN, |
893 | 0 | 5, |
894 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); |
895 | 0 |
|
896 | 0 | /** |
897 | 0 | * GXdpDocuments::handle-add-named: |
898 | 0 | * @object: A #GXdpDocuments. |
899 | 0 | * @invocation: A #GDBusMethodInvocation. |
900 | 0 | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
901 | 0 | * @arg_o_path_parent_fd: Argument passed by remote caller. |
902 | 0 | * @arg_filename: Argument passed by remote caller. |
903 | 0 | * @arg_reuse_existing: Argument passed by remote caller. |
904 | 0 | * @arg_persistent: Argument passed by remote caller. |
905 | 0 | * |
906 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</link> D-Bus method. |
907 | 0 | * |
908 | 0 | * 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. |
909 | 0 | * |
910 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
911 | 0 | */ |
912 | 0 | g_signal_new ("handle-add-named", |
913 | 0 | G_TYPE_FROM_INTERFACE (iface), |
914 | 0 | G_SIGNAL_RUN_LAST, |
915 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add_named), |
916 | 0 | g_signal_accumulator_true_handled, |
917 | 0 | NULL, |
918 | 0 | g_cclosure_marshal_generic, |
919 | 0 | G_TYPE_BOOLEAN, |
920 | 0 | 6, |
921 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); |
922 | 0 |
|
923 | 0 | /** |
924 | 0 | * GXdpDocuments::handle-add-full: |
925 | 0 | * @object: A #GXdpDocuments. |
926 | 0 | * @invocation: A #GDBusMethodInvocation. |
927 | 0 | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
928 | 0 | * @arg_o_path_fds: Argument passed by remote caller. |
929 | 0 | * @arg_flags: Argument passed by remote caller. |
930 | 0 | * @arg_app_id: Argument passed by remote caller. |
931 | 0 | * @arg_permissions: Argument passed by remote caller. |
932 | 0 | * |
933 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</link> D-Bus method. |
934 | 0 | * |
935 | 0 | * 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. |
936 | 0 | * |
937 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
938 | 0 | */ |
939 | 0 | g_signal_new ("handle-add-full", |
940 | 0 | G_TYPE_FROM_INTERFACE (iface), |
941 | 0 | G_SIGNAL_RUN_LAST, |
942 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_add_full), |
943 | 0 | g_signal_accumulator_true_handled, |
944 | 0 | NULL, |
945 | 0 | g_cclosure_marshal_generic, |
946 | 0 | G_TYPE_BOOLEAN, |
947 | 0 | 6, |
948 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_VARIANT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRV); |
949 | 0 |
|
950 | 0 | /** |
951 | 0 | * GXdpDocuments::handle-grant-permissions: |
952 | 0 | * @object: A #GXdpDocuments. |
953 | 0 | * @invocation: A #GDBusMethodInvocation. |
954 | 0 | * @arg_doc_id: Argument passed by remote caller. |
955 | 0 | * @arg_app_id: Argument passed by remote caller. |
956 | 0 | * @arg_permissions: Argument passed by remote caller. |
957 | 0 | * |
958 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</link> D-Bus method. |
959 | 0 | * |
960 | 0 | * 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. |
961 | 0 | * |
962 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
963 | 0 | */ |
964 | 0 | g_signal_new ("handle-grant-permissions", |
965 | 0 | G_TYPE_FROM_INTERFACE (iface), |
966 | 0 | G_SIGNAL_RUN_LAST, |
967 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_grant_permissions), |
968 | 0 | g_signal_accumulator_true_handled, |
969 | 0 | NULL, |
970 | 0 | g_cclosure_marshal_generic, |
971 | 0 | G_TYPE_BOOLEAN, |
972 | 0 | 4, |
973 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV); |
974 | 0 |
|
975 | 0 | /** |
976 | 0 | * GXdpDocuments::handle-revoke-permissions: |
977 | 0 | * @object: A #GXdpDocuments. |
978 | 0 | * @invocation: A #GDBusMethodInvocation. |
979 | 0 | * @arg_doc_id: Argument passed by remote caller. |
980 | 0 | * @arg_app_id: Argument passed by remote caller. |
981 | 0 | * @arg_permissions: Argument passed by remote caller. |
982 | 0 | * |
983 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</link> D-Bus method. |
984 | 0 | * |
985 | 0 | * 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. |
986 | 0 | * |
987 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
988 | 0 | */ |
989 | 0 | g_signal_new ("handle-revoke-permissions", |
990 | 0 | G_TYPE_FROM_INTERFACE (iface), |
991 | 0 | G_SIGNAL_RUN_LAST, |
992 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_revoke_permissions), |
993 | 0 | g_signal_accumulator_true_handled, |
994 | 0 | NULL, |
995 | 0 | g_cclosure_marshal_generic, |
996 | 0 | G_TYPE_BOOLEAN, |
997 | 0 | 4, |
998 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV); |
999 | 0 |
|
1000 | 0 | /** |
1001 | 0 | * GXdpDocuments::handle-delete: |
1002 | 0 | * @object: A #GXdpDocuments. |
1003 | 0 | * @invocation: A #GDBusMethodInvocation. |
1004 | 0 | * @arg_doc_id: Argument passed by remote caller. |
1005 | 0 | * |
1006 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</link> D-Bus method. |
1007 | 0 | * |
1008 | 0 | * 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. |
1009 | 0 | * |
1010 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
1011 | 0 | */ |
1012 | 0 | g_signal_new ("handle-delete", |
1013 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1014 | 0 | G_SIGNAL_RUN_LAST, |
1015 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_delete), |
1016 | 0 | g_signal_accumulator_true_handled, |
1017 | 0 | NULL, |
1018 | 0 | g_cclosure_marshal_generic, |
1019 | 0 | G_TYPE_BOOLEAN, |
1020 | 0 | 2, |
1021 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
1022 | 0 |
|
1023 | 0 | /** |
1024 | 0 | * GXdpDocuments::handle-lookup: |
1025 | 0 | * @object: A #GXdpDocuments. |
1026 | 0 | * @invocation: A #GDBusMethodInvocation. |
1027 | 0 | * @arg_filename: Argument passed by remote caller. |
1028 | 0 | * |
1029 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</link> D-Bus method. |
1030 | 0 | * |
1031 | 0 | * 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. |
1032 | 0 | * |
1033 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
1034 | 0 | */ |
1035 | 0 | g_signal_new ("handle-lookup", |
1036 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1037 | 0 | G_SIGNAL_RUN_LAST, |
1038 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_lookup), |
1039 | 0 | g_signal_accumulator_true_handled, |
1040 | 0 | NULL, |
1041 | 0 | g_cclosure_marshal_generic, |
1042 | 0 | G_TYPE_BOOLEAN, |
1043 | 0 | 2, |
1044 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
1045 | 0 |
|
1046 | 0 | /** |
1047 | 0 | * GXdpDocuments::handle-info: |
1048 | 0 | * @object: A #GXdpDocuments. |
1049 | 0 | * @invocation: A #GDBusMethodInvocation. |
1050 | 0 | * @arg_doc_id: Argument passed by remote caller. |
1051 | 0 | * |
1052 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</link> D-Bus method. |
1053 | 0 | * |
1054 | 0 | * 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. |
1055 | 0 | * |
1056 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
1057 | 0 | */ |
1058 | 0 | g_signal_new ("handle-info", |
1059 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1060 | 0 | G_SIGNAL_RUN_LAST, |
1061 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_info), |
1062 | 0 | g_signal_accumulator_true_handled, |
1063 | 0 | NULL, |
1064 | 0 | g_cclosure_marshal_generic, |
1065 | 0 | G_TYPE_BOOLEAN, |
1066 | 0 | 2, |
1067 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
1068 | 0 |
|
1069 | 0 | /** |
1070 | 0 | * GXdpDocuments::handle-list: |
1071 | 0 | * @object: A #GXdpDocuments. |
1072 | 0 | * @invocation: A #GDBusMethodInvocation. |
1073 | 0 | * @arg_app_id: Argument passed by remote caller. |
1074 | 0 | * |
1075 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</link> D-Bus method. |
1076 | 0 | * |
1077 | 0 | * 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. |
1078 | 0 | * |
1079 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
1080 | 0 | */ |
1081 | 0 | g_signal_new ("handle-list", |
1082 | 0 | G_TYPE_FROM_INTERFACE (iface), |
1083 | 0 | G_SIGNAL_RUN_LAST, |
1084 | 0 | G_STRUCT_OFFSET (GXdpDocumentsIface, handle_list), |
1085 | 0 | g_signal_accumulator_true_handled, |
1086 | 0 | NULL, |
1087 | 0 | g_cclosure_marshal_generic, |
1088 | 0 | G_TYPE_BOOLEAN, |
1089 | 0 | 2, |
1090 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
1091 | 0 |
|
1092 | 0 | /* GObject properties for D-Bus properties: */ |
1093 | 0 | /** |
1094 | 0 | * GXdpDocuments:version: |
1095 | 0 | * |
1096 | 0 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link>. |
1097 | 0 | * |
1098 | 0 | * 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. |
1099 | 0 | */ |
1100 | 0 | g_object_interface_install_property (iface, |
1101 | 0 | g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1102 | 0 | } |
1103 | | |
1104 | | /** |
1105 | | * gxdp_documents_get_version: (skip) |
1106 | | * @object: A #GXdpDocuments. |
1107 | | * |
1108 | | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link> D-Bus property. |
1109 | | * |
1110 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1111 | | * |
1112 | | * Returns: The property value. |
1113 | | */ |
1114 | | guint |
1115 | | gxdp_documents_get_version (GXdpDocuments *object) |
1116 | 0 | { |
1117 | 0 | return GXDP_DOCUMENTS_GET_IFACE (object)->get_version (object); |
1118 | 0 | } |
1119 | | |
1120 | | /** |
1121 | | * gxdp_documents_set_version: (skip) |
1122 | | * @object: A #GXdpDocuments. |
1123 | | * @value: The value to set. |
1124 | | * |
1125 | | * Sets the <link linkend="gdbus-property-org-freedesktop-portal-Documents.version">"version"</link> D-Bus property to @value. |
1126 | | * |
1127 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1128 | | */ |
1129 | | void |
1130 | | gxdp_documents_set_version (GXdpDocuments *object, guint value) |
1131 | 0 | { |
1132 | 0 | g_object_set (G_OBJECT (object), "version", value, NULL); |
1133 | 0 | } |
1134 | | |
1135 | | /** |
1136 | | * gxdp_documents_call_get_mount_point: |
1137 | | * @proxy: A #GXdpDocumentsProxy. |
1138 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1139 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1140 | | * @user_data: User data to pass to @callback. |
1141 | | * |
1142 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GetMountPoint">GetMountPoint()</link> D-Bus method on @proxy. |
1143 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1144 | | * You can then call gxdp_documents_call_get_mount_point_finish() to get the result of the operation. |
1145 | | * |
1146 | | * See gxdp_documents_call_get_mount_point_sync() for the synchronous, blocking version of this method. |
1147 | | */ |
1148 | | void |
1149 | | gxdp_documents_call_get_mount_point ( |
1150 | | GXdpDocuments *proxy, |
1151 | | GCancellable *cancellable, |
1152 | | GAsyncReadyCallback callback, |
1153 | | gpointer user_data) |
1154 | 0 | { |
1155 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1156 | 0 | "GetMountPoint", |
1157 | 0 | g_variant_new ("()"), |
1158 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1159 | 0 | -1, |
1160 | 0 | cancellable, |
1161 | 0 | callback, |
1162 | 0 | user_data); |
1163 | 0 | } |
1164 | | |
1165 | | /** |
1166 | | * gxdp_documents_call_get_mount_point_finish: |
1167 | | * @proxy: A #GXdpDocumentsProxy. |
1168 | | * @out_path: (out): Return location for return parameter or %NULL to ignore. |
1169 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_get_mount_point(). |
1170 | | * @error: Return location for error or %NULL. |
1171 | | * |
1172 | | * Finishes an operation started with gxdp_documents_call_get_mount_point(). |
1173 | | * |
1174 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1175 | | */ |
1176 | | gboolean |
1177 | | gxdp_documents_call_get_mount_point_finish ( |
1178 | | GXdpDocuments *proxy, |
1179 | | gchar **out_path, |
1180 | | GAsyncResult *res, |
1181 | | GError **error) |
1182 | 0 | { |
1183 | 0 | GVariant *_ret; |
1184 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1185 | 0 | if (_ret == NULL) |
1186 | 0 | goto _out; |
1187 | 0 | g_variant_get (_ret, |
1188 | 0 | "(^ay)", |
1189 | 0 | out_path); |
1190 | 0 | g_variant_unref (_ret); |
1191 | 0 | _out: |
1192 | 0 | return _ret != NULL; |
1193 | 0 | } |
1194 | | |
1195 | | /** |
1196 | | * gxdp_documents_call_get_mount_point_sync: |
1197 | | * @proxy: A #GXdpDocumentsProxy. |
1198 | | * @out_path: (out): Return location for return parameter or %NULL to ignore. |
1199 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1200 | | * @error: Return location for error or %NULL. |
1201 | | * |
1202 | | * 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. |
1203 | | * |
1204 | | * See gxdp_documents_call_get_mount_point() for the asynchronous version of this method. |
1205 | | * |
1206 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1207 | | */ |
1208 | | gboolean |
1209 | | gxdp_documents_call_get_mount_point_sync ( |
1210 | | GXdpDocuments *proxy, |
1211 | | gchar **out_path, |
1212 | | GCancellable *cancellable, |
1213 | | GError **error) |
1214 | 0 | { |
1215 | 0 | GVariant *_ret; |
1216 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1217 | 0 | "GetMountPoint", |
1218 | 0 | g_variant_new ("()"), |
1219 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1220 | 0 | -1, |
1221 | 0 | cancellable, |
1222 | 0 | error); |
1223 | 0 | if (_ret == NULL) |
1224 | 0 | goto _out; |
1225 | 0 | g_variant_get (_ret, |
1226 | 0 | "(^ay)", |
1227 | 0 | out_path); |
1228 | 0 | g_variant_unref (_ret); |
1229 | 0 | _out: |
1230 | 0 | return _ret != NULL; |
1231 | 0 | } |
1232 | | |
1233 | | /** |
1234 | | * gxdp_documents_call_add: |
1235 | | * @proxy: A #GXdpDocumentsProxy. |
1236 | | * @arg_o_path_fd: Argument to pass with the method invocation. |
1237 | | * @arg_reuse_existing: Argument to pass with the method invocation. |
1238 | | * @arg_persistent: Argument to pass with the method invocation. |
1239 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1240 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1241 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1242 | | * @user_data: User data to pass to @callback. |
1243 | | * |
1244 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Add">Add()</link> D-Bus method on @proxy. |
1245 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1246 | | * You can then call gxdp_documents_call_add_finish() to get the result of the operation. |
1247 | | * |
1248 | | * See gxdp_documents_call_add_sync() for the synchronous, blocking version of this method. |
1249 | | */ |
1250 | | void |
1251 | | gxdp_documents_call_add ( |
1252 | | GXdpDocuments *proxy, |
1253 | | GVariant *arg_o_path_fd, |
1254 | | gboolean arg_reuse_existing, |
1255 | | gboolean arg_persistent, |
1256 | | GUnixFDList *fd_list, |
1257 | | GCancellable *cancellable, |
1258 | | GAsyncReadyCallback callback, |
1259 | | gpointer user_data) |
1260 | 0 | { |
1261 | 0 | g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy), |
1262 | 0 | "Add", |
1263 | 0 | g_variant_new ("(@hbb)", |
1264 | 0 | arg_o_path_fd, |
1265 | 0 | arg_reuse_existing, |
1266 | 0 | arg_persistent), |
1267 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1268 | 0 | -1, |
1269 | 0 | fd_list, |
1270 | 0 | cancellable, |
1271 | 0 | callback, |
1272 | 0 | user_data); |
1273 | 0 | } |
1274 | | |
1275 | | /** |
1276 | | * gxdp_documents_call_add_finish: |
1277 | | * @proxy: A #GXdpDocumentsProxy. |
1278 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
1279 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1280 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add(). |
1281 | | * @error: Return location for error or %NULL. |
1282 | | * |
1283 | | * Finishes an operation started with gxdp_documents_call_add(). |
1284 | | * |
1285 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1286 | | */ |
1287 | | gboolean |
1288 | | gxdp_documents_call_add_finish ( |
1289 | | GXdpDocuments *proxy, |
1290 | | gchar **out_doc_id, |
1291 | | GUnixFDList **out_fd_list, |
1292 | | GAsyncResult *res, |
1293 | | GError **error) |
1294 | 0 | { |
1295 | 0 | GVariant *_ret; |
1296 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error); |
1297 | 0 | if (_ret == NULL) |
1298 | 0 | goto _out; |
1299 | 0 | g_variant_get (_ret, |
1300 | 0 | "(s)", |
1301 | 0 | out_doc_id); |
1302 | 0 | g_variant_unref (_ret); |
1303 | 0 | _out: |
1304 | 0 | return _ret != NULL; |
1305 | 0 | } |
1306 | | |
1307 | | /** |
1308 | | * gxdp_documents_call_add_sync: |
1309 | | * @proxy: A #GXdpDocumentsProxy. |
1310 | | * @arg_o_path_fd: Argument to pass with the method invocation. |
1311 | | * @arg_reuse_existing: Argument to pass with the method invocation. |
1312 | | * @arg_persistent: Argument to pass with the method invocation. |
1313 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1314 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
1315 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1316 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1317 | | * @error: Return location for error or %NULL. |
1318 | | * |
1319 | | * 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. |
1320 | | * |
1321 | | * See gxdp_documents_call_add() for the asynchronous version of this method. |
1322 | | * |
1323 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1324 | | */ |
1325 | | gboolean |
1326 | | gxdp_documents_call_add_sync ( |
1327 | | GXdpDocuments *proxy, |
1328 | | GVariant *arg_o_path_fd, |
1329 | | gboolean arg_reuse_existing, |
1330 | | gboolean arg_persistent, |
1331 | | GUnixFDList *fd_list, |
1332 | | gchar **out_doc_id, |
1333 | | GUnixFDList **out_fd_list, |
1334 | | GCancellable *cancellable, |
1335 | | GError **error) |
1336 | 0 | { |
1337 | 0 | GVariant *_ret; |
1338 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy), |
1339 | 0 | "Add", |
1340 | 0 | g_variant_new ("(@hbb)", |
1341 | 0 | arg_o_path_fd, |
1342 | 0 | arg_reuse_existing, |
1343 | 0 | arg_persistent), |
1344 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1345 | 0 | -1, |
1346 | 0 | fd_list, |
1347 | 0 | out_fd_list, |
1348 | 0 | cancellable, |
1349 | 0 | error); |
1350 | 0 | if (_ret == NULL) |
1351 | 0 | goto _out; |
1352 | 0 | g_variant_get (_ret, |
1353 | 0 | "(s)", |
1354 | 0 | out_doc_id); |
1355 | 0 | g_variant_unref (_ret); |
1356 | 0 | _out: |
1357 | 0 | return _ret != NULL; |
1358 | 0 | } |
1359 | | |
1360 | | /** |
1361 | | * gxdp_documents_call_add_named: |
1362 | | * @proxy: A #GXdpDocumentsProxy. |
1363 | | * @arg_o_path_parent_fd: Argument to pass with the method invocation. |
1364 | | * @arg_filename: Argument to pass with the method invocation. |
1365 | | * @arg_reuse_existing: Argument to pass with the method invocation. |
1366 | | * @arg_persistent: Argument to pass with the method invocation. |
1367 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1368 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1369 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1370 | | * @user_data: User data to pass to @callback. |
1371 | | * |
1372 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddNamed">AddNamed()</link> D-Bus method on @proxy. |
1373 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1374 | | * You can then call gxdp_documents_call_add_named_finish() to get the result of the operation. |
1375 | | * |
1376 | | * See gxdp_documents_call_add_named_sync() for the synchronous, blocking version of this method. |
1377 | | */ |
1378 | | void |
1379 | | gxdp_documents_call_add_named ( |
1380 | | GXdpDocuments *proxy, |
1381 | | GVariant *arg_o_path_parent_fd, |
1382 | | const gchar *arg_filename, |
1383 | | gboolean arg_reuse_existing, |
1384 | | gboolean arg_persistent, |
1385 | | GUnixFDList *fd_list, |
1386 | | GCancellable *cancellable, |
1387 | | GAsyncReadyCallback callback, |
1388 | | gpointer user_data) |
1389 | 0 | { |
1390 | 0 | g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy), |
1391 | 0 | "AddNamed", |
1392 | 0 | g_variant_new ("(@h^aybb)", |
1393 | 0 | arg_o_path_parent_fd, |
1394 | 0 | arg_filename, |
1395 | 0 | arg_reuse_existing, |
1396 | 0 | arg_persistent), |
1397 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1398 | 0 | -1, |
1399 | 0 | fd_list, |
1400 | 0 | cancellable, |
1401 | 0 | callback, |
1402 | 0 | user_data); |
1403 | 0 | } |
1404 | | |
1405 | | /** |
1406 | | * gxdp_documents_call_add_named_finish: |
1407 | | * @proxy: A #GXdpDocumentsProxy. |
1408 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
1409 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1410 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add_named(). |
1411 | | * @error: Return location for error or %NULL. |
1412 | | * |
1413 | | * Finishes an operation started with gxdp_documents_call_add_named(). |
1414 | | * |
1415 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1416 | | */ |
1417 | | gboolean |
1418 | | gxdp_documents_call_add_named_finish ( |
1419 | | GXdpDocuments *proxy, |
1420 | | gchar **out_doc_id, |
1421 | | GUnixFDList **out_fd_list, |
1422 | | GAsyncResult *res, |
1423 | | GError **error) |
1424 | 0 | { |
1425 | 0 | GVariant *_ret; |
1426 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error); |
1427 | 0 | if (_ret == NULL) |
1428 | 0 | goto _out; |
1429 | 0 | g_variant_get (_ret, |
1430 | 0 | "(s)", |
1431 | 0 | out_doc_id); |
1432 | 0 | g_variant_unref (_ret); |
1433 | 0 | _out: |
1434 | 0 | return _ret != NULL; |
1435 | 0 | } |
1436 | | |
1437 | | /** |
1438 | | * gxdp_documents_call_add_named_sync: |
1439 | | * @proxy: A #GXdpDocumentsProxy. |
1440 | | * @arg_o_path_parent_fd: Argument to pass with the method invocation. |
1441 | | * @arg_filename: Argument to pass with the method invocation. |
1442 | | * @arg_reuse_existing: Argument to pass with the method invocation. |
1443 | | * @arg_persistent: Argument to pass with the method invocation. |
1444 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1445 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
1446 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1447 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1448 | | * @error: Return location for error or %NULL. |
1449 | | * |
1450 | | * 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. |
1451 | | * |
1452 | | * See gxdp_documents_call_add_named() for the asynchronous version of this method. |
1453 | | * |
1454 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1455 | | */ |
1456 | | gboolean |
1457 | | gxdp_documents_call_add_named_sync ( |
1458 | | GXdpDocuments *proxy, |
1459 | | GVariant *arg_o_path_parent_fd, |
1460 | | const gchar *arg_filename, |
1461 | | gboolean arg_reuse_existing, |
1462 | | gboolean arg_persistent, |
1463 | | GUnixFDList *fd_list, |
1464 | | gchar **out_doc_id, |
1465 | | GUnixFDList **out_fd_list, |
1466 | | GCancellable *cancellable, |
1467 | | GError **error) |
1468 | 0 | { |
1469 | 0 | GVariant *_ret; |
1470 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy), |
1471 | 0 | "AddNamed", |
1472 | 0 | g_variant_new ("(@h^aybb)", |
1473 | 0 | arg_o_path_parent_fd, |
1474 | 0 | arg_filename, |
1475 | 0 | arg_reuse_existing, |
1476 | 0 | arg_persistent), |
1477 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1478 | 0 | -1, |
1479 | 0 | fd_list, |
1480 | 0 | out_fd_list, |
1481 | 0 | cancellable, |
1482 | 0 | error); |
1483 | 0 | if (_ret == NULL) |
1484 | 0 | goto _out; |
1485 | 0 | g_variant_get (_ret, |
1486 | 0 | "(s)", |
1487 | 0 | out_doc_id); |
1488 | 0 | g_variant_unref (_ret); |
1489 | 0 | _out: |
1490 | 0 | return _ret != NULL; |
1491 | 0 | } |
1492 | | |
1493 | | /** |
1494 | | * gxdp_documents_call_add_full: |
1495 | | * @proxy: A #GXdpDocumentsProxy. |
1496 | | * @arg_o_path_fds: Argument to pass with the method invocation. |
1497 | | * @arg_flags: Argument to pass with the method invocation. |
1498 | | * @arg_app_id: Argument to pass with the method invocation. |
1499 | | * @arg_permissions: Argument to pass with the method invocation. |
1500 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1501 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1502 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1503 | | * @user_data: User data to pass to @callback. |
1504 | | * |
1505 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.AddFull">AddFull()</link> D-Bus method on @proxy. |
1506 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1507 | | * You can then call gxdp_documents_call_add_full_finish() to get the result of the operation. |
1508 | | * |
1509 | | * See gxdp_documents_call_add_full_sync() for the synchronous, blocking version of this method. |
1510 | | */ |
1511 | | void |
1512 | | gxdp_documents_call_add_full ( |
1513 | | GXdpDocuments *proxy, |
1514 | | GVariant *arg_o_path_fds, |
1515 | | guint arg_flags, |
1516 | | const gchar *arg_app_id, |
1517 | | const gchar *const *arg_permissions, |
1518 | | GUnixFDList *fd_list, |
1519 | | GCancellable *cancellable, |
1520 | | GAsyncReadyCallback callback, |
1521 | | gpointer user_data) |
1522 | 0 | { |
1523 | 0 | g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy), |
1524 | 0 | "AddFull", |
1525 | 0 | g_variant_new ("(@ahus^as)", |
1526 | 0 | arg_o_path_fds, |
1527 | 0 | arg_flags, |
1528 | 0 | arg_app_id, |
1529 | 0 | arg_permissions), |
1530 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1531 | 0 | -1, |
1532 | 0 | fd_list, |
1533 | 0 | cancellable, |
1534 | 0 | callback, |
1535 | 0 | user_data); |
1536 | 0 | } |
1537 | | |
1538 | | /** |
1539 | | * gxdp_documents_call_add_full_finish: |
1540 | | * @proxy: A #GXdpDocumentsProxy. |
1541 | | * @out_doc_ids: (out) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. |
1542 | | * @out_extra_out: (out): Return location for return parameter or %NULL to ignore. |
1543 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1544 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_add_full(). |
1545 | | * @error: Return location for error or %NULL. |
1546 | | * |
1547 | | * Finishes an operation started with gxdp_documents_call_add_full(). |
1548 | | * |
1549 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1550 | | */ |
1551 | | gboolean |
1552 | | gxdp_documents_call_add_full_finish ( |
1553 | | GXdpDocuments *proxy, |
1554 | | gchar ***out_doc_ids, |
1555 | | GVariant **out_extra_out, |
1556 | | GUnixFDList **out_fd_list, |
1557 | | GAsyncResult *res, |
1558 | | GError **error) |
1559 | 0 | { |
1560 | 0 | GVariant *_ret; |
1561 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error); |
1562 | 0 | if (_ret == NULL) |
1563 | 0 | goto _out; |
1564 | 0 | g_variant_get (_ret, |
1565 | 0 | "(^as@a{sv})", |
1566 | 0 | out_doc_ids, |
1567 | 0 | out_extra_out); |
1568 | 0 | g_variant_unref (_ret); |
1569 | 0 | _out: |
1570 | 0 | return _ret != NULL; |
1571 | 0 | } |
1572 | | |
1573 | | /** |
1574 | | * gxdp_documents_call_add_full_sync: |
1575 | | * @proxy: A #GXdpDocumentsProxy. |
1576 | | * @arg_o_path_fds: Argument to pass with the method invocation. |
1577 | | * @arg_flags: Argument to pass with the method invocation. |
1578 | | * @arg_app_id: Argument to pass with the method invocation. |
1579 | | * @arg_permissions: Argument to pass with the method invocation. |
1580 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
1581 | | * @out_doc_ids: (out) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. |
1582 | | * @out_extra_out: (out): Return location for return parameter or %NULL to ignore. |
1583 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
1584 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1585 | | * @error: Return location for error or %NULL. |
1586 | | * |
1587 | | * 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. |
1588 | | * |
1589 | | * See gxdp_documents_call_add_full() for the asynchronous version of this method. |
1590 | | * |
1591 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1592 | | */ |
1593 | | gboolean |
1594 | | gxdp_documents_call_add_full_sync ( |
1595 | | GXdpDocuments *proxy, |
1596 | | GVariant *arg_o_path_fds, |
1597 | | guint arg_flags, |
1598 | | const gchar *arg_app_id, |
1599 | | const gchar *const *arg_permissions, |
1600 | | GUnixFDList *fd_list, |
1601 | | gchar ***out_doc_ids, |
1602 | | GVariant **out_extra_out, |
1603 | | GUnixFDList **out_fd_list, |
1604 | | GCancellable *cancellable, |
1605 | | GError **error) |
1606 | 0 | { |
1607 | 0 | GVariant *_ret; |
1608 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy), |
1609 | 0 | "AddFull", |
1610 | 0 | g_variant_new ("(@ahus^as)", |
1611 | 0 | arg_o_path_fds, |
1612 | 0 | arg_flags, |
1613 | 0 | arg_app_id, |
1614 | 0 | arg_permissions), |
1615 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1616 | 0 | -1, |
1617 | 0 | fd_list, |
1618 | 0 | out_fd_list, |
1619 | 0 | cancellable, |
1620 | 0 | error); |
1621 | 0 | if (_ret == NULL) |
1622 | 0 | goto _out; |
1623 | 0 | g_variant_get (_ret, |
1624 | 0 | "(^as@a{sv})", |
1625 | 0 | out_doc_ids, |
1626 | 0 | out_extra_out); |
1627 | 0 | g_variant_unref (_ret); |
1628 | 0 | _out: |
1629 | 0 | return _ret != NULL; |
1630 | 0 | } |
1631 | | |
1632 | | /** |
1633 | | * gxdp_documents_call_grant_permissions: |
1634 | | * @proxy: A #GXdpDocumentsProxy. |
1635 | | * @arg_doc_id: Argument to pass with the method invocation. |
1636 | | * @arg_app_id: Argument to pass with the method invocation. |
1637 | | * @arg_permissions: Argument to pass with the method invocation. |
1638 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1639 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1640 | | * @user_data: User data to pass to @callback. |
1641 | | * |
1642 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.GrantPermissions">GrantPermissions()</link> D-Bus method on @proxy. |
1643 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1644 | | * You can then call gxdp_documents_call_grant_permissions_finish() to get the result of the operation. |
1645 | | * |
1646 | | * See gxdp_documents_call_grant_permissions_sync() for the synchronous, blocking version of this method. |
1647 | | */ |
1648 | | void |
1649 | | gxdp_documents_call_grant_permissions ( |
1650 | | GXdpDocuments *proxy, |
1651 | | const gchar *arg_doc_id, |
1652 | | const gchar *arg_app_id, |
1653 | | const gchar *const *arg_permissions, |
1654 | | GCancellable *cancellable, |
1655 | | GAsyncReadyCallback callback, |
1656 | | gpointer user_data) |
1657 | 0 | { |
1658 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1659 | 0 | "GrantPermissions", |
1660 | 0 | g_variant_new ("(ss^as)", |
1661 | 0 | arg_doc_id, |
1662 | 0 | arg_app_id, |
1663 | 0 | arg_permissions), |
1664 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1665 | 0 | -1, |
1666 | 0 | cancellable, |
1667 | 0 | callback, |
1668 | 0 | user_data); |
1669 | 0 | } |
1670 | | |
1671 | | /** |
1672 | | * gxdp_documents_call_grant_permissions_finish: |
1673 | | * @proxy: A #GXdpDocumentsProxy. |
1674 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_grant_permissions(). |
1675 | | * @error: Return location for error or %NULL. |
1676 | | * |
1677 | | * Finishes an operation started with gxdp_documents_call_grant_permissions(). |
1678 | | * |
1679 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1680 | | */ |
1681 | | gboolean |
1682 | | gxdp_documents_call_grant_permissions_finish ( |
1683 | | GXdpDocuments *proxy, |
1684 | | GAsyncResult *res, |
1685 | | GError **error) |
1686 | 0 | { |
1687 | 0 | GVariant *_ret; |
1688 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1689 | 0 | if (_ret == NULL) |
1690 | 0 | goto _out; |
1691 | 0 | g_variant_get (_ret, |
1692 | 0 | "()"); |
1693 | 0 | g_variant_unref (_ret); |
1694 | 0 | _out: |
1695 | 0 | return _ret != NULL; |
1696 | 0 | } |
1697 | | |
1698 | | /** |
1699 | | * gxdp_documents_call_grant_permissions_sync: |
1700 | | * @proxy: A #GXdpDocumentsProxy. |
1701 | | * @arg_doc_id: Argument to pass with the method invocation. |
1702 | | * @arg_app_id: Argument to pass with the method invocation. |
1703 | | * @arg_permissions: Argument to pass with the method invocation. |
1704 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1705 | | * @error: Return location for error or %NULL. |
1706 | | * |
1707 | | * 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. |
1708 | | * |
1709 | | * See gxdp_documents_call_grant_permissions() for the asynchronous version of this method. |
1710 | | * |
1711 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1712 | | */ |
1713 | | gboolean |
1714 | | gxdp_documents_call_grant_permissions_sync ( |
1715 | | GXdpDocuments *proxy, |
1716 | | const gchar *arg_doc_id, |
1717 | | const gchar *arg_app_id, |
1718 | | const gchar *const *arg_permissions, |
1719 | | GCancellable *cancellable, |
1720 | | GError **error) |
1721 | 0 | { |
1722 | 0 | GVariant *_ret; |
1723 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1724 | 0 | "GrantPermissions", |
1725 | 0 | g_variant_new ("(ss^as)", |
1726 | 0 | arg_doc_id, |
1727 | 0 | arg_app_id, |
1728 | 0 | arg_permissions), |
1729 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1730 | 0 | -1, |
1731 | 0 | cancellable, |
1732 | 0 | error); |
1733 | 0 | if (_ret == NULL) |
1734 | 0 | goto _out; |
1735 | 0 | g_variant_get (_ret, |
1736 | 0 | "()"); |
1737 | 0 | g_variant_unref (_ret); |
1738 | 0 | _out: |
1739 | 0 | return _ret != NULL; |
1740 | 0 | } |
1741 | | |
1742 | | /** |
1743 | | * gxdp_documents_call_revoke_permissions: |
1744 | | * @proxy: A #GXdpDocumentsProxy. |
1745 | | * @arg_doc_id: Argument to pass with the method invocation. |
1746 | | * @arg_app_id: Argument to pass with the method invocation. |
1747 | | * @arg_permissions: Argument to pass with the method invocation. |
1748 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1749 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1750 | | * @user_data: User data to pass to @callback. |
1751 | | * |
1752 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.RevokePermissions">RevokePermissions()</link> D-Bus method on @proxy. |
1753 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1754 | | * You can then call gxdp_documents_call_revoke_permissions_finish() to get the result of the operation. |
1755 | | * |
1756 | | * See gxdp_documents_call_revoke_permissions_sync() for the synchronous, blocking version of this method. |
1757 | | */ |
1758 | | void |
1759 | | gxdp_documents_call_revoke_permissions ( |
1760 | | GXdpDocuments *proxy, |
1761 | | const gchar *arg_doc_id, |
1762 | | const gchar *arg_app_id, |
1763 | | const gchar *const *arg_permissions, |
1764 | | GCancellable *cancellable, |
1765 | | GAsyncReadyCallback callback, |
1766 | | gpointer user_data) |
1767 | 0 | { |
1768 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1769 | 0 | "RevokePermissions", |
1770 | 0 | g_variant_new ("(ss^as)", |
1771 | 0 | arg_doc_id, |
1772 | 0 | arg_app_id, |
1773 | 0 | arg_permissions), |
1774 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1775 | 0 | -1, |
1776 | 0 | cancellable, |
1777 | 0 | callback, |
1778 | 0 | user_data); |
1779 | 0 | } |
1780 | | |
1781 | | /** |
1782 | | * gxdp_documents_call_revoke_permissions_finish: |
1783 | | * @proxy: A #GXdpDocumentsProxy. |
1784 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_revoke_permissions(). |
1785 | | * @error: Return location for error or %NULL. |
1786 | | * |
1787 | | * Finishes an operation started with gxdp_documents_call_revoke_permissions(). |
1788 | | * |
1789 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1790 | | */ |
1791 | | gboolean |
1792 | | gxdp_documents_call_revoke_permissions_finish ( |
1793 | | GXdpDocuments *proxy, |
1794 | | GAsyncResult *res, |
1795 | | GError **error) |
1796 | 0 | { |
1797 | 0 | GVariant *_ret; |
1798 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1799 | 0 | if (_ret == NULL) |
1800 | 0 | goto _out; |
1801 | 0 | g_variant_get (_ret, |
1802 | 0 | "()"); |
1803 | 0 | g_variant_unref (_ret); |
1804 | 0 | _out: |
1805 | 0 | return _ret != NULL; |
1806 | 0 | } |
1807 | | |
1808 | | /** |
1809 | | * gxdp_documents_call_revoke_permissions_sync: |
1810 | | * @proxy: A #GXdpDocumentsProxy. |
1811 | | * @arg_doc_id: Argument to pass with the method invocation. |
1812 | | * @arg_app_id: Argument to pass with the method invocation. |
1813 | | * @arg_permissions: Argument to pass with the method invocation. |
1814 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1815 | | * @error: Return location for error or %NULL. |
1816 | | * |
1817 | | * 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. |
1818 | | * |
1819 | | * See gxdp_documents_call_revoke_permissions() for the asynchronous version of this method. |
1820 | | * |
1821 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1822 | | */ |
1823 | | gboolean |
1824 | | gxdp_documents_call_revoke_permissions_sync ( |
1825 | | GXdpDocuments *proxy, |
1826 | | const gchar *arg_doc_id, |
1827 | | const gchar *arg_app_id, |
1828 | | const gchar *const *arg_permissions, |
1829 | | GCancellable *cancellable, |
1830 | | GError **error) |
1831 | 0 | { |
1832 | 0 | GVariant *_ret; |
1833 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1834 | 0 | "RevokePermissions", |
1835 | 0 | g_variant_new ("(ss^as)", |
1836 | 0 | arg_doc_id, |
1837 | 0 | arg_app_id, |
1838 | 0 | arg_permissions), |
1839 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1840 | 0 | -1, |
1841 | 0 | cancellable, |
1842 | 0 | error); |
1843 | 0 | if (_ret == NULL) |
1844 | 0 | goto _out; |
1845 | 0 | g_variant_get (_ret, |
1846 | 0 | "()"); |
1847 | 0 | g_variant_unref (_ret); |
1848 | 0 | _out: |
1849 | 0 | return _ret != NULL; |
1850 | 0 | } |
1851 | | |
1852 | | /** |
1853 | | * gxdp_documents_call_delete: |
1854 | | * @proxy: A #GXdpDocumentsProxy. |
1855 | | * @arg_doc_id: Argument to pass with the method invocation. |
1856 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1857 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1858 | | * @user_data: User data to pass to @callback. |
1859 | | * |
1860 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Delete">Delete()</link> D-Bus method on @proxy. |
1861 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1862 | | * You can then call gxdp_documents_call_delete_finish() to get the result of the operation. |
1863 | | * |
1864 | | * See gxdp_documents_call_delete_sync() for the synchronous, blocking version of this method. |
1865 | | */ |
1866 | | void |
1867 | | gxdp_documents_call_delete ( |
1868 | | GXdpDocuments *proxy, |
1869 | | const gchar *arg_doc_id, |
1870 | | GCancellable *cancellable, |
1871 | | GAsyncReadyCallback callback, |
1872 | | gpointer user_data) |
1873 | 0 | { |
1874 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1875 | 0 | "Delete", |
1876 | 0 | g_variant_new ("(s)", |
1877 | 0 | arg_doc_id), |
1878 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1879 | 0 | -1, |
1880 | 0 | cancellable, |
1881 | 0 | callback, |
1882 | 0 | user_data); |
1883 | 0 | } |
1884 | | |
1885 | | /** |
1886 | | * gxdp_documents_call_delete_finish: |
1887 | | * @proxy: A #GXdpDocumentsProxy. |
1888 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_delete(). |
1889 | | * @error: Return location for error or %NULL. |
1890 | | * |
1891 | | * Finishes an operation started with gxdp_documents_call_delete(). |
1892 | | * |
1893 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1894 | | */ |
1895 | | gboolean |
1896 | | gxdp_documents_call_delete_finish ( |
1897 | | GXdpDocuments *proxy, |
1898 | | GAsyncResult *res, |
1899 | | GError **error) |
1900 | 0 | { |
1901 | 0 | GVariant *_ret; |
1902 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1903 | 0 | if (_ret == NULL) |
1904 | 0 | goto _out; |
1905 | 0 | g_variant_get (_ret, |
1906 | 0 | "()"); |
1907 | 0 | g_variant_unref (_ret); |
1908 | 0 | _out: |
1909 | 0 | return _ret != NULL; |
1910 | 0 | } |
1911 | | |
1912 | | /** |
1913 | | * gxdp_documents_call_delete_sync: |
1914 | | * @proxy: A #GXdpDocumentsProxy. |
1915 | | * @arg_doc_id: Argument to pass with the method invocation. |
1916 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1917 | | * @error: Return location for error or %NULL. |
1918 | | * |
1919 | | * 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. |
1920 | | * |
1921 | | * See gxdp_documents_call_delete() for the asynchronous version of this method. |
1922 | | * |
1923 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1924 | | */ |
1925 | | gboolean |
1926 | | gxdp_documents_call_delete_sync ( |
1927 | | GXdpDocuments *proxy, |
1928 | | const gchar *arg_doc_id, |
1929 | | GCancellable *cancellable, |
1930 | | GError **error) |
1931 | 0 | { |
1932 | 0 | GVariant *_ret; |
1933 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1934 | 0 | "Delete", |
1935 | 0 | g_variant_new ("(s)", |
1936 | 0 | arg_doc_id), |
1937 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1938 | 0 | -1, |
1939 | 0 | cancellable, |
1940 | 0 | error); |
1941 | 0 | if (_ret == NULL) |
1942 | 0 | goto _out; |
1943 | 0 | g_variant_get (_ret, |
1944 | 0 | "()"); |
1945 | 0 | g_variant_unref (_ret); |
1946 | 0 | _out: |
1947 | 0 | return _ret != NULL; |
1948 | 0 | } |
1949 | | |
1950 | | /** |
1951 | | * gxdp_documents_call_lookup: |
1952 | | * @proxy: A #GXdpDocumentsProxy. |
1953 | | * @arg_filename: Argument to pass with the method invocation. |
1954 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
1955 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1956 | | * @user_data: User data to pass to @callback. |
1957 | | * |
1958 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Lookup">Lookup()</link> D-Bus method on @proxy. |
1959 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1960 | | * You can then call gxdp_documents_call_lookup_finish() to get the result of the operation. |
1961 | | * |
1962 | | * See gxdp_documents_call_lookup_sync() for the synchronous, blocking version of this method. |
1963 | | */ |
1964 | | void |
1965 | | gxdp_documents_call_lookup ( |
1966 | | GXdpDocuments *proxy, |
1967 | | const gchar *arg_filename, |
1968 | | GCancellable *cancellable, |
1969 | | GAsyncReadyCallback callback, |
1970 | | gpointer user_data) |
1971 | 0 | { |
1972 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1973 | 0 | "Lookup", |
1974 | 0 | g_variant_new ("(^ay)", |
1975 | 0 | arg_filename), |
1976 | 0 | G_DBUS_CALL_FLAGS_NONE, |
1977 | 0 | -1, |
1978 | 0 | cancellable, |
1979 | 0 | callback, |
1980 | 0 | user_data); |
1981 | 0 | } |
1982 | | |
1983 | | /** |
1984 | | * gxdp_documents_call_lookup_finish: |
1985 | | * @proxy: A #GXdpDocumentsProxy. |
1986 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
1987 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_lookup(). |
1988 | | * @error: Return location for error or %NULL. |
1989 | | * |
1990 | | * Finishes an operation started with gxdp_documents_call_lookup(). |
1991 | | * |
1992 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1993 | | */ |
1994 | | gboolean |
1995 | | gxdp_documents_call_lookup_finish ( |
1996 | | GXdpDocuments *proxy, |
1997 | | gchar **out_doc_id, |
1998 | | GAsyncResult *res, |
1999 | | GError **error) |
2000 | 0 | { |
2001 | 0 | GVariant *_ret; |
2002 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2003 | 0 | if (_ret == NULL) |
2004 | 0 | goto _out; |
2005 | 0 | g_variant_get (_ret, |
2006 | 0 | "(s)", |
2007 | 0 | out_doc_id); |
2008 | 0 | g_variant_unref (_ret); |
2009 | 0 | _out: |
2010 | 0 | return _ret != NULL; |
2011 | 0 | } |
2012 | | |
2013 | | /** |
2014 | | * gxdp_documents_call_lookup_sync: |
2015 | | * @proxy: A #GXdpDocumentsProxy. |
2016 | | * @arg_filename: Argument to pass with the method invocation. |
2017 | | * @out_doc_id: (out): Return location for return parameter or %NULL to ignore. |
2018 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2019 | | * @error: Return location for error or %NULL. |
2020 | | * |
2021 | | * 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. |
2022 | | * |
2023 | | * See gxdp_documents_call_lookup() for the asynchronous version of this method. |
2024 | | * |
2025 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2026 | | */ |
2027 | | gboolean |
2028 | | gxdp_documents_call_lookup_sync ( |
2029 | | GXdpDocuments *proxy, |
2030 | | const gchar *arg_filename, |
2031 | | gchar **out_doc_id, |
2032 | | GCancellable *cancellable, |
2033 | | GError **error) |
2034 | 0 | { |
2035 | 0 | GVariant *_ret; |
2036 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2037 | 0 | "Lookup", |
2038 | 0 | g_variant_new ("(^ay)", |
2039 | 0 | arg_filename), |
2040 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2041 | 0 | -1, |
2042 | 0 | cancellable, |
2043 | 0 | error); |
2044 | 0 | if (_ret == NULL) |
2045 | 0 | goto _out; |
2046 | 0 | g_variant_get (_ret, |
2047 | 0 | "(s)", |
2048 | 0 | out_doc_id); |
2049 | 0 | g_variant_unref (_ret); |
2050 | 0 | _out: |
2051 | 0 | return _ret != NULL; |
2052 | 0 | } |
2053 | | |
2054 | | /** |
2055 | | * gxdp_documents_call_info: |
2056 | | * @proxy: A #GXdpDocumentsProxy. |
2057 | | * @arg_doc_id: Argument to pass with the method invocation. |
2058 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2059 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2060 | | * @user_data: User data to pass to @callback. |
2061 | | * |
2062 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.Info">Info()</link> D-Bus method on @proxy. |
2063 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2064 | | * You can then call gxdp_documents_call_info_finish() to get the result of the operation. |
2065 | | * |
2066 | | * See gxdp_documents_call_info_sync() for the synchronous, blocking version of this method. |
2067 | | */ |
2068 | | void |
2069 | | gxdp_documents_call_info ( |
2070 | | GXdpDocuments *proxy, |
2071 | | const gchar *arg_doc_id, |
2072 | | GCancellable *cancellable, |
2073 | | GAsyncReadyCallback callback, |
2074 | | gpointer user_data) |
2075 | 0 | { |
2076 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2077 | 0 | "Info", |
2078 | 0 | g_variant_new ("(s)", |
2079 | 0 | arg_doc_id), |
2080 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2081 | 0 | -1, |
2082 | 0 | cancellable, |
2083 | 0 | callback, |
2084 | 0 | user_data); |
2085 | 0 | } |
2086 | | |
2087 | | /** |
2088 | | * gxdp_documents_call_info_finish: |
2089 | | * @proxy: A #GXdpDocumentsProxy. |
2090 | | * @out_path: (out): Return location for return parameter or %NULL to ignore. |
2091 | | * @out_apps: (out): Return location for return parameter or %NULL to ignore. |
2092 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_info(). |
2093 | | * @error: Return location for error or %NULL. |
2094 | | * |
2095 | | * Finishes an operation started with gxdp_documents_call_info(). |
2096 | | * |
2097 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2098 | | */ |
2099 | | gboolean |
2100 | | gxdp_documents_call_info_finish ( |
2101 | | GXdpDocuments *proxy, |
2102 | | gchar **out_path, |
2103 | | GVariant **out_apps, |
2104 | | GAsyncResult *res, |
2105 | | GError **error) |
2106 | 0 | { |
2107 | 0 | GVariant *_ret; |
2108 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2109 | 0 | if (_ret == NULL) |
2110 | 0 | goto _out; |
2111 | 0 | g_variant_get (_ret, |
2112 | 0 | "(^ay@a{sas})", |
2113 | 0 | out_path, |
2114 | 0 | out_apps); |
2115 | 0 | g_variant_unref (_ret); |
2116 | 0 | _out: |
2117 | 0 | return _ret != NULL; |
2118 | 0 | } |
2119 | | |
2120 | | /** |
2121 | | * gxdp_documents_call_info_sync: |
2122 | | * @proxy: A #GXdpDocumentsProxy. |
2123 | | * @arg_doc_id: Argument to pass with the method invocation. |
2124 | | * @out_path: (out): Return location for return parameter or %NULL to ignore. |
2125 | | * @out_apps: (out): Return location for return parameter or %NULL to ignore. |
2126 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2127 | | * @error: Return location for error or %NULL. |
2128 | | * |
2129 | | * 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. |
2130 | | * |
2131 | | * See gxdp_documents_call_info() for the asynchronous version of this method. |
2132 | | * |
2133 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2134 | | */ |
2135 | | gboolean |
2136 | | gxdp_documents_call_info_sync ( |
2137 | | GXdpDocuments *proxy, |
2138 | | const gchar *arg_doc_id, |
2139 | | gchar **out_path, |
2140 | | GVariant **out_apps, |
2141 | | GCancellable *cancellable, |
2142 | | GError **error) |
2143 | 0 | { |
2144 | 0 | GVariant *_ret; |
2145 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2146 | 0 | "Info", |
2147 | 0 | g_variant_new ("(s)", |
2148 | 0 | arg_doc_id), |
2149 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2150 | 0 | -1, |
2151 | 0 | cancellable, |
2152 | 0 | error); |
2153 | 0 | if (_ret == NULL) |
2154 | 0 | goto _out; |
2155 | 0 | g_variant_get (_ret, |
2156 | 0 | "(^ay@a{sas})", |
2157 | 0 | out_path, |
2158 | 0 | out_apps); |
2159 | 0 | g_variant_unref (_ret); |
2160 | 0 | _out: |
2161 | 0 | return _ret != NULL; |
2162 | 0 | } |
2163 | | |
2164 | | /** |
2165 | | * gxdp_documents_call_list: |
2166 | | * @proxy: A #GXdpDocumentsProxy. |
2167 | | * @arg_app_id: Argument to pass with the method invocation. |
2168 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2169 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
2170 | | * @user_data: User data to pass to @callback. |
2171 | | * |
2172 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-Documents.List">List()</link> D-Bus method on @proxy. |
2173 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2174 | | * You can then call gxdp_documents_call_list_finish() to get the result of the operation. |
2175 | | * |
2176 | | * See gxdp_documents_call_list_sync() for the synchronous, blocking version of this method. |
2177 | | */ |
2178 | | void |
2179 | | gxdp_documents_call_list ( |
2180 | | GXdpDocuments *proxy, |
2181 | | const gchar *arg_app_id, |
2182 | | GCancellable *cancellable, |
2183 | | GAsyncReadyCallback callback, |
2184 | | gpointer user_data) |
2185 | 0 | { |
2186 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
2187 | 0 | "List", |
2188 | 0 | g_variant_new ("(s)", |
2189 | 0 | arg_app_id), |
2190 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2191 | 0 | -1, |
2192 | 0 | cancellable, |
2193 | 0 | callback, |
2194 | 0 | user_data); |
2195 | 0 | } |
2196 | | |
2197 | | /** |
2198 | | * gxdp_documents_call_list_finish: |
2199 | | * @proxy: A #GXdpDocumentsProxy. |
2200 | | * @out_docs: (out): Return location for return parameter or %NULL to ignore. |
2201 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_call_list(). |
2202 | | * @error: Return location for error or %NULL. |
2203 | | * |
2204 | | * Finishes an operation started with gxdp_documents_call_list(). |
2205 | | * |
2206 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2207 | | */ |
2208 | | gboolean |
2209 | | gxdp_documents_call_list_finish ( |
2210 | | GXdpDocuments *proxy, |
2211 | | GVariant **out_docs, |
2212 | | GAsyncResult *res, |
2213 | | GError **error) |
2214 | 0 | { |
2215 | 0 | GVariant *_ret; |
2216 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
2217 | 0 | if (_ret == NULL) |
2218 | 0 | goto _out; |
2219 | 0 | g_variant_get (_ret, |
2220 | 0 | "(@a{say})", |
2221 | 0 | out_docs); |
2222 | 0 | g_variant_unref (_ret); |
2223 | 0 | _out: |
2224 | 0 | return _ret != NULL; |
2225 | 0 | } |
2226 | | |
2227 | | /** |
2228 | | * gxdp_documents_call_list_sync: |
2229 | | * @proxy: A #GXdpDocumentsProxy. |
2230 | | * @arg_app_id: Argument to pass with the method invocation. |
2231 | | * @out_docs: (out): Return location for return parameter or %NULL to ignore. |
2232 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2233 | | * @error: Return location for error or %NULL. |
2234 | | * |
2235 | | * 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. |
2236 | | * |
2237 | | * See gxdp_documents_call_list() for the asynchronous version of this method. |
2238 | | * |
2239 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
2240 | | */ |
2241 | | gboolean |
2242 | | gxdp_documents_call_list_sync ( |
2243 | | GXdpDocuments *proxy, |
2244 | | const gchar *arg_app_id, |
2245 | | GVariant **out_docs, |
2246 | | GCancellable *cancellable, |
2247 | | GError **error) |
2248 | 0 | { |
2249 | 0 | GVariant *_ret; |
2250 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
2251 | 0 | "List", |
2252 | 0 | g_variant_new ("(s)", |
2253 | 0 | arg_app_id), |
2254 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2255 | 0 | -1, |
2256 | 0 | cancellable, |
2257 | 0 | error); |
2258 | 0 | if (_ret == NULL) |
2259 | 0 | goto _out; |
2260 | 0 | g_variant_get (_ret, |
2261 | 0 | "(@a{say})", |
2262 | 0 | out_docs); |
2263 | 0 | g_variant_unref (_ret); |
2264 | 0 | _out: |
2265 | 0 | return _ret != NULL; |
2266 | 0 | } |
2267 | | |
2268 | | /** |
2269 | | * gxdp_documents_complete_get_mount_point: |
2270 | | * @object: A #GXdpDocuments. |
2271 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2272 | | * @path: Parameter to return. |
2273 | | * |
2274 | | * 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. |
2275 | | * |
2276 | | * This method will free @invocation, you cannot use it afterwards. |
2277 | | */ |
2278 | | void |
2279 | | gxdp_documents_complete_get_mount_point ( |
2280 | | GXdpDocuments *object, |
2281 | | GDBusMethodInvocation *invocation, |
2282 | | const gchar *path) |
2283 | 0 | { |
2284 | 0 | g_dbus_method_invocation_return_value (invocation, |
2285 | 0 | g_variant_new ("(^ay)", |
2286 | 0 | path)); |
2287 | 0 | } |
2288 | | |
2289 | | /** |
2290 | | * gxdp_documents_complete_add: |
2291 | | * @object: A #GXdpDocuments. |
2292 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2293 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
2294 | | * @doc_id: Parameter to return. |
2295 | | * |
2296 | | * 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. |
2297 | | * |
2298 | | * This method will free @invocation, you cannot use it afterwards. |
2299 | | */ |
2300 | | void |
2301 | | gxdp_documents_complete_add ( |
2302 | | GXdpDocuments *object, |
2303 | | GDBusMethodInvocation *invocation, |
2304 | | GUnixFDList *fd_list, |
2305 | | const gchar *doc_id) |
2306 | 0 | { |
2307 | 0 | g_dbus_method_invocation_return_value_with_unix_fd_list (invocation, |
2308 | 0 | g_variant_new ("(s)", |
2309 | 0 | doc_id), |
2310 | 0 | fd_list); |
2311 | 0 | } |
2312 | | |
2313 | | /** |
2314 | | * gxdp_documents_complete_add_named: |
2315 | | * @object: A #GXdpDocuments. |
2316 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2317 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
2318 | | * @doc_id: Parameter to return. |
2319 | | * |
2320 | | * 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. |
2321 | | * |
2322 | | * This method will free @invocation, you cannot use it afterwards. |
2323 | | */ |
2324 | | void |
2325 | | gxdp_documents_complete_add_named ( |
2326 | | GXdpDocuments *object, |
2327 | | GDBusMethodInvocation *invocation, |
2328 | | GUnixFDList *fd_list, |
2329 | | const gchar *doc_id) |
2330 | 0 | { |
2331 | 0 | g_dbus_method_invocation_return_value_with_unix_fd_list (invocation, |
2332 | 0 | g_variant_new ("(s)", |
2333 | 0 | doc_id), |
2334 | 0 | fd_list); |
2335 | 0 | } |
2336 | | |
2337 | | /** |
2338 | | * gxdp_documents_complete_add_full: |
2339 | | * @object: A #GXdpDocuments. |
2340 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2341 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
2342 | | * @doc_ids: Parameter to return. |
2343 | | * @extra_out: Parameter to return. |
2344 | | * |
2345 | | * 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. |
2346 | | * |
2347 | | * This method will free @invocation, you cannot use it afterwards. |
2348 | | */ |
2349 | | void |
2350 | | gxdp_documents_complete_add_full ( |
2351 | | GXdpDocuments *object, |
2352 | | GDBusMethodInvocation *invocation, |
2353 | | GUnixFDList *fd_list, |
2354 | | const gchar *const *doc_ids, |
2355 | | GVariant *extra_out) |
2356 | 0 | { |
2357 | 0 | g_dbus_method_invocation_return_value_with_unix_fd_list (invocation, |
2358 | 0 | g_variant_new ("(^as@a{sv})", |
2359 | 0 | doc_ids, |
2360 | 0 | extra_out), |
2361 | 0 | fd_list); |
2362 | 0 | } |
2363 | | |
2364 | | /** |
2365 | | * gxdp_documents_complete_grant_permissions: |
2366 | | * @object: A #GXdpDocuments. |
2367 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2368 | | * |
2369 | | * 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. |
2370 | | * |
2371 | | * This method will free @invocation, you cannot use it afterwards. |
2372 | | */ |
2373 | | void |
2374 | | gxdp_documents_complete_grant_permissions ( |
2375 | | GXdpDocuments *object, |
2376 | | GDBusMethodInvocation *invocation) |
2377 | 0 | { |
2378 | 0 | g_dbus_method_invocation_return_value (invocation, |
2379 | 0 | g_variant_new ("()")); |
2380 | 0 | } |
2381 | | |
2382 | | /** |
2383 | | * gxdp_documents_complete_revoke_permissions: |
2384 | | * @object: A #GXdpDocuments. |
2385 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2386 | | * |
2387 | | * 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. |
2388 | | * |
2389 | | * This method will free @invocation, you cannot use it afterwards. |
2390 | | */ |
2391 | | void |
2392 | | gxdp_documents_complete_revoke_permissions ( |
2393 | | GXdpDocuments *object, |
2394 | | GDBusMethodInvocation *invocation) |
2395 | 0 | { |
2396 | 0 | g_dbus_method_invocation_return_value (invocation, |
2397 | 0 | g_variant_new ("()")); |
2398 | 0 | } |
2399 | | |
2400 | | /** |
2401 | | * gxdp_documents_complete_delete: |
2402 | | * @object: A #GXdpDocuments. |
2403 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2404 | | * |
2405 | | * 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. |
2406 | | * |
2407 | | * This method will free @invocation, you cannot use it afterwards. |
2408 | | */ |
2409 | | void |
2410 | | gxdp_documents_complete_delete ( |
2411 | | GXdpDocuments *object, |
2412 | | GDBusMethodInvocation *invocation) |
2413 | 0 | { |
2414 | 0 | g_dbus_method_invocation_return_value (invocation, |
2415 | 0 | g_variant_new ("()")); |
2416 | 0 | } |
2417 | | |
2418 | | /** |
2419 | | * gxdp_documents_complete_lookup: |
2420 | | * @object: A #GXdpDocuments. |
2421 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2422 | | * @doc_id: Parameter to return. |
2423 | | * |
2424 | | * 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. |
2425 | | * |
2426 | | * This method will free @invocation, you cannot use it afterwards. |
2427 | | */ |
2428 | | void |
2429 | | gxdp_documents_complete_lookup ( |
2430 | | GXdpDocuments *object, |
2431 | | GDBusMethodInvocation *invocation, |
2432 | | const gchar *doc_id) |
2433 | 0 | { |
2434 | 0 | g_dbus_method_invocation_return_value (invocation, |
2435 | 0 | g_variant_new ("(s)", |
2436 | 0 | doc_id)); |
2437 | 0 | } |
2438 | | |
2439 | | /** |
2440 | | * gxdp_documents_complete_info: |
2441 | | * @object: A #GXdpDocuments. |
2442 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2443 | | * @path: Parameter to return. |
2444 | | * @apps: Parameter to return. |
2445 | | * |
2446 | | * 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. |
2447 | | * |
2448 | | * This method will free @invocation, you cannot use it afterwards. |
2449 | | */ |
2450 | | void |
2451 | | gxdp_documents_complete_info ( |
2452 | | GXdpDocuments *object, |
2453 | | GDBusMethodInvocation *invocation, |
2454 | | const gchar *path, |
2455 | | GVariant *apps) |
2456 | 0 | { |
2457 | 0 | g_dbus_method_invocation_return_value (invocation, |
2458 | 0 | g_variant_new ("(^ay@a{sas})", |
2459 | 0 | path, |
2460 | 0 | apps)); |
2461 | 0 | } |
2462 | | |
2463 | | /** |
2464 | | * gxdp_documents_complete_list: |
2465 | | * @object: A #GXdpDocuments. |
2466 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
2467 | | * @docs: Parameter to return. |
2468 | | * |
2469 | | * 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. |
2470 | | * |
2471 | | * This method will free @invocation, you cannot use it afterwards. |
2472 | | */ |
2473 | | void |
2474 | | gxdp_documents_complete_list ( |
2475 | | GXdpDocuments *object, |
2476 | | GDBusMethodInvocation *invocation, |
2477 | | GVariant *docs) |
2478 | 0 | { |
2479 | 0 | g_dbus_method_invocation_return_value (invocation, |
2480 | 0 | g_variant_new ("(@a{say})", |
2481 | 0 | docs)); |
2482 | 0 | } |
2483 | | |
2484 | | /* ------------------------------------------------------------------------ */ |
2485 | | |
2486 | | /** |
2487 | | * GXdpDocumentsProxy: |
2488 | | * |
2489 | | * The #GXdpDocumentsProxy structure contains only private data and should only be accessed using the provided API. |
2490 | | */ |
2491 | | |
2492 | | /** |
2493 | | * GXdpDocumentsProxyClass: |
2494 | | * @parent_class: The parent class. |
2495 | | * |
2496 | | * Class structure for #GXdpDocumentsProxy. |
2497 | | */ |
2498 | | |
2499 | | struct _GXdpDocumentsProxyPrivate |
2500 | | { |
2501 | | GData *qdata; |
2502 | | }; |
2503 | | |
2504 | | static void gxdp_documents_proxy_iface_init (GXdpDocumentsIface *iface); |
2505 | | |
2506 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2507 | | G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsProxy, gxdp_documents_proxy, G_TYPE_DBUS_PROXY, |
2508 | | G_ADD_PRIVATE (GXdpDocumentsProxy) |
2509 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_proxy_iface_init)) |
2510 | | |
2511 | | #else |
2512 | | G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsProxy, gxdp_documents_proxy, G_TYPE_DBUS_PROXY, |
2513 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_proxy_iface_init)) |
2514 | | |
2515 | | #endif |
2516 | | static void |
2517 | | gxdp_documents_proxy_finalize (GObject *object) |
2518 | 0 | { |
2519 | 0 | GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (object); |
2520 | 0 | g_datalist_clear (&proxy->priv->qdata); |
2521 | 0 | G_OBJECT_CLASS (gxdp_documents_proxy_parent_class)->finalize (object); |
2522 | 0 | } |
2523 | | |
2524 | | static void |
2525 | | gxdp_documents_proxy_get_property (GObject *object, |
2526 | | guint prop_id, |
2527 | | GValue *value, |
2528 | | GParamSpec *pspec G_GNUC_UNUSED) |
2529 | 0 | { |
2530 | 0 | const _ExtendedGDBusPropertyInfo *info; |
2531 | 0 | GVariant *variant; |
2532 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
2533 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1]; |
2534 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
2535 | 0 | if (info->use_gvariant) |
2536 | 0 | { |
2537 | 0 | g_value_set_variant (value, variant); |
2538 | 0 | } |
2539 | 0 | else |
2540 | 0 | { |
2541 | 0 | if (variant != NULL) |
2542 | 0 | g_dbus_gvariant_to_gvalue (variant, value); |
2543 | 0 | } |
2544 | 0 | if (variant != NULL) |
2545 | 0 | g_variant_unref (variant); |
2546 | 0 | } |
2547 | | |
2548 | | static void |
2549 | | gxdp_documents_proxy_set_property_cb (GDBusProxy *proxy, |
2550 | | GAsyncResult *res, |
2551 | | gpointer user_data) |
2552 | 0 | { |
2553 | 0 | const _ExtendedGDBusPropertyInfo *info = user_data; |
2554 | 0 | GError *error; |
2555 | 0 | GVariant *_ret; |
2556 | 0 | error = NULL; |
2557 | 0 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
2558 | 0 | if (!_ret) |
2559 | 0 | { |
2560 | 0 | g_warning ("Error setting property '%s' on interface org.freedesktop.portal.Documents: %s (%s, %d)", |
2561 | 0 | info->parent_struct.name, |
2562 | 0 | error->message, g_quark_to_string (error->domain), error->code); |
2563 | 0 | g_error_free (error); |
2564 | 0 | } |
2565 | 0 | else |
2566 | 0 | { |
2567 | 0 | g_variant_unref (_ret); |
2568 | 0 | } |
2569 | 0 | } |
2570 | | |
2571 | | static void |
2572 | | gxdp_documents_proxy_set_property (GObject *object, |
2573 | | guint prop_id, |
2574 | | const GValue *value, |
2575 | | GParamSpec *pspec G_GNUC_UNUSED) |
2576 | 0 | { |
2577 | 0 | const _ExtendedGDBusPropertyInfo *info; |
2578 | 0 | GVariant *variant; |
2579 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
2580 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1]; |
2581 | 0 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
2582 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
2583 | 0 | "org.freedesktop.DBus.Properties.Set", |
2584 | 0 | g_variant_new ("(ssv)", "org.freedesktop.portal.Documents", info->parent_struct.name, variant), |
2585 | 0 | G_DBUS_CALL_FLAGS_NONE, |
2586 | 0 | -1, |
2587 | 0 | NULL, (GAsyncReadyCallback) gxdp_documents_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
2588 | 0 | g_variant_unref (variant); |
2589 | 0 | } |
2590 | | |
2591 | | static void |
2592 | | gxdp_documents_proxy_g_signal (GDBusProxy *proxy, |
2593 | | const gchar *sender_name G_GNUC_UNUSED, |
2594 | | const gchar *signal_name, |
2595 | | GVariant *parameters) |
2596 | 0 | { |
2597 | 0 | _ExtendedGDBusSignalInfo *info; |
2598 | 0 | GVariantIter iter; |
2599 | 0 | GVariant *child; |
2600 | 0 | GValue *paramv; |
2601 | 0 | gsize num_params; |
2602 | 0 | gsize n; |
2603 | 0 | guint signal_id; |
2604 | 0 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, signal_name); |
2605 | 0 | if (info == NULL) |
2606 | 0 | return; |
2607 | 0 | num_params = g_variant_n_children (parameters); |
2608 | 0 | paramv = g_new0 (GValue, num_params + 1); |
2609 | 0 | g_value_init (¶mv[0], GXDP_TYPE_DOCUMENTS); |
2610 | 0 | g_value_set_object (¶mv[0], proxy); |
2611 | 0 | g_variant_iter_init (&iter, parameters); |
2612 | 0 | n = 1; |
2613 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
2614 | 0 | { |
2615 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
2616 | 0 | if (arg_info->use_gvariant) |
2617 | 0 | { |
2618 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
2619 | 0 | g_value_set_variant (¶mv[n], child); |
2620 | 0 | n++; |
2621 | 0 | } |
2622 | 0 | else |
2623 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
2624 | 0 | g_variant_unref (child); |
2625 | 0 | } |
2626 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_DOCUMENTS); |
2627 | 0 | g_signal_emitv (paramv, signal_id, 0, NULL); |
2628 | 0 | for (n = 0; n < num_params + 1; n++) |
2629 | 0 | g_value_unset (¶mv[n]); |
2630 | 0 | g_free (paramv); |
2631 | 0 | } |
2632 | | |
2633 | | static void |
2634 | | gxdp_documents_proxy_g_properties_changed (GDBusProxy *_proxy, |
2635 | | GVariant *changed_properties, |
2636 | | const gchar *const *invalidated_properties) |
2637 | 0 | { |
2638 | 0 | GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (_proxy); |
2639 | 0 | guint n; |
2640 | 0 | const gchar *key; |
2641 | 0 | GVariantIter *iter; |
2642 | 0 | _ExtendedGDBusPropertyInfo *info; |
2643 | 0 | g_variant_get (changed_properties, "a{sv}", &iter); |
2644 | 0 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
2645 | 0 | { |
2646 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, key); |
2647 | 0 | g_datalist_remove_data (&proxy->priv->qdata, key); |
2648 | 0 | if (info != NULL) |
2649 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
2650 | 0 | } |
2651 | 0 | g_variant_iter_free (iter); |
2652 | 0 | for (n = 0; invalidated_properties[n] != NULL; n++) |
2653 | 0 | { |
2654 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, invalidated_properties[n]); |
2655 | 0 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
2656 | 0 | if (info != NULL) |
2657 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
2658 | 0 | } |
2659 | 0 | } |
2660 | | |
2661 | | static guint |
2662 | | gxdp_documents_proxy_get_version (GXdpDocuments *object) |
2663 | 0 | { |
2664 | 0 | GXdpDocumentsProxy *proxy = GXDP_DOCUMENTS_PROXY (object); |
2665 | 0 | GVariant *variant; |
2666 | 0 | guint value = 0; |
2667 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version"); |
2668 | 0 | if (variant != NULL) |
2669 | 0 | { |
2670 | 0 | value = g_variant_get_uint32 (variant); |
2671 | 0 | g_variant_unref (variant); |
2672 | 0 | } |
2673 | 0 | return value; |
2674 | 0 | } |
2675 | | |
2676 | | static void |
2677 | | gxdp_documents_proxy_init (GXdpDocumentsProxy *proxy) |
2678 | 0 | { |
2679 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2680 | 0 | proxy->priv = gxdp_documents_proxy_get_instance_private (proxy); |
2681 | | #else |
2682 | | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_DOCUMENTS_PROXY, GXdpDocumentsProxyPrivate); |
2683 | | #endif |
2684 | |
|
2685 | 0 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_documents_interface_info ()); |
2686 | 0 | } |
2687 | | |
2688 | | static void |
2689 | | gxdp_documents_proxy_class_init (GXdpDocumentsProxyClass *klass) |
2690 | 0 | { |
2691 | 0 | GObjectClass *gobject_class; |
2692 | 0 | GDBusProxyClass *proxy_class; |
2693 | 0 |
|
2694 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
2695 | 0 | gobject_class->finalize = gxdp_documents_proxy_finalize; |
2696 | 0 | gobject_class->get_property = gxdp_documents_proxy_get_property; |
2697 | 0 | gobject_class->set_property = gxdp_documents_proxy_set_property; |
2698 | 0 |
|
2699 | 0 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
2700 | 0 | proxy_class->g_signal = gxdp_documents_proxy_g_signal; |
2701 | 0 | proxy_class->g_properties_changed = gxdp_documents_proxy_g_properties_changed; |
2702 | 0 |
|
2703 | 0 | gxdp_documents_override_properties (gobject_class, 1); |
2704 | 0 |
|
2705 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2706 | | g_type_class_add_private (klass, sizeof (GXdpDocumentsProxyPrivate)); |
2707 | | #endif |
2708 | | } |
2709 | | |
2710 | | static void |
2711 | | gxdp_documents_proxy_iface_init (GXdpDocumentsIface *iface) |
2712 | 0 | { |
2713 | 0 | iface->get_version = gxdp_documents_proxy_get_version; |
2714 | 0 | } |
2715 | | |
2716 | | /** |
2717 | | * gxdp_documents_proxy_new: |
2718 | | * @connection: A #GDBusConnection. |
2719 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2720 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
2721 | | * @object_path: An object path. |
2722 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2723 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
2724 | | * @user_data: User data to pass to @callback. |
2725 | | * |
2726 | | * 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. |
2727 | | * |
2728 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2729 | | * You can then call gxdp_documents_proxy_new_finish() to get the result of the operation. |
2730 | | * |
2731 | | * See gxdp_documents_proxy_new_sync() for the synchronous, blocking version of this constructor. |
2732 | | */ |
2733 | | void |
2734 | | gxdp_documents_proxy_new ( |
2735 | | GDBusConnection *connection, |
2736 | | GDBusProxyFlags flags, |
2737 | | const gchar *name, |
2738 | | const gchar *object_path, |
2739 | | GCancellable *cancellable, |
2740 | | GAsyncReadyCallback callback, |
2741 | | gpointer user_data) |
2742 | 0 | { |
2743 | 0 | 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); |
2744 | 0 | } |
2745 | | |
2746 | | /** |
2747 | | * gxdp_documents_proxy_new_finish: |
2748 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_proxy_new(). |
2749 | | * @error: Return location for error or %NULL |
2750 | | * |
2751 | | * Finishes an operation started with gxdp_documents_proxy_new(). |
2752 | | * |
2753 | | * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set. |
2754 | | */ |
2755 | | GXdpDocuments * |
2756 | | gxdp_documents_proxy_new_finish ( |
2757 | | GAsyncResult *res, |
2758 | | GError **error) |
2759 | 0 | { |
2760 | 0 | GObject *ret; |
2761 | 0 | GObject *source_object; |
2762 | 0 | source_object = g_async_result_get_source_object (res); |
2763 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
2764 | 0 | g_object_unref (source_object); |
2765 | 0 | if (ret != NULL) |
2766 | 0 | return GXDP_DOCUMENTS (ret); |
2767 | 0 | else |
2768 | 0 | return NULL; |
2769 | 0 | } |
2770 | | |
2771 | | /** |
2772 | | * gxdp_documents_proxy_new_sync: |
2773 | | * @connection: A #GDBusConnection. |
2774 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2775 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
2776 | | * @object_path: An object path. |
2777 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2778 | | * @error: Return location for error or %NULL |
2779 | | * |
2780 | | * 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. |
2781 | | * |
2782 | | * The calling thread is blocked until a reply is received. |
2783 | | * |
2784 | | * See gxdp_documents_proxy_new() for the asynchronous version of this constructor. |
2785 | | * |
2786 | | * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set. |
2787 | | */ |
2788 | | GXdpDocuments * |
2789 | | gxdp_documents_proxy_new_sync ( |
2790 | | GDBusConnection *connection, |
2791 | | GDBusProxyFlags flags, |
2792 | | const gchar *name, |
2793 | | const gchar *object_path, |
2794 | | GCancellable *cancellable, |
2795 | | GError **error) |
2796 | 0 | { |
2797 | 0 | GInitable *ret; |
2798 | 0 | 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); |
2799 | 0 | if (ret != NULL) |
2800 | 0 | return GXDP_DOCUMENTS (ret); |
2801 | 0 | else |
2802 | 0 | return NULL; |
2803 | 0 | } |
2804 | | |
2805 | | |
2806 | | /** |
2807 | | * gxdp_documents_proxy_new_for_bus: |
2808 | | * @bus_type: A #GBusType. |
2809 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2810 | | * @name: A bus name (well-known or unique). |
2811 | | * @object_path: An object path. |
2812 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2813 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
2814 | | * @user_data: User data to pass to @callback. |
2815 | | * |
2816 | | * Like gxdp_documents_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
2817 | | * |
2818 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
2819 | | * You can then call gxdp_documents_proxy_new_for_bus_finish() to get the result of the operation. |
2820 | | * |
2821 | | * See gxdp_documents_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
2822 | | */ |
2823 | | void |
2824 | | gxdp_documents_proxy_new_for_bus ( |
2825 | | GBusType bus_type, |
2826 | | GDBusProxyFlags flags, |
2827 | | const gchar *name, |
2828 | | const gchar *object_path, |
2829 | | GCancellable *cancellable, |
2830 | | GAsyncReadyCallback callback, |
2831 | | gpointer user_data) |
2832 | 0 | { |
2833 | 0 | 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); |
2834 | 0 | } |
2835 | | |
2836 | | /** |
2837 | | * gxdp_documents_proxy_new_for_bus_finish: |
2838 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_documents_proxy_new_for_bus(). |
2839 | | * @error: Return location for error or %NULL |
2840 | | * |
2841 | | * Finishes an operation started with gxdp_documents_proxy_new_for_bus(). |
2842 | | * |
2843 | | * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set. |
2844 | | */ |
2845 | | GXdpDocuments * |
2846 | | gxdp_documents_proxy_new_for_bus_finish ( |
2847 | | GAsyncResult *res, |
2848 | | GError **error) |
2849 | 0 | { |
2850 | 0 | GObject *ret; |
2851 | 0 | GObject *source_object; |
2852 | 0 | source_object = g_async_result_get_source_object (res); |
2853 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
2854 | 0 | g_object_unref (source_object); |
2855 | 0 | if (ret != NULL) |
2856 | 0 | return GXDP_DOCUMENTS (ret); |
2857 | 0 | else |
2858 | 0 | return NULL; |
2859 | 0 | } |
2860 | | |
2861 | | /** |
2862 | | * gxdp_documents_proxy_new_for_bus_sync: |
2863 | | * @bus_type: A #GBusType. |
2864 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
2865 | | * @name: A bus name (well-known or unique). |
2866 | | * @object_path: An object path. |
2867 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
2868 | | * @error: Return location for error or %NULL |
2869 | | * |
2870 | | * Like gxdp_documents_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
2871 | | * |
2872 | | * The calling thread is blocked until a reply is received. |
2873 | | * |
2874 | | * See gxdp_documents_proxy_new_for_bus() for the asynchronous version of this constructor. |
2875 | | * |
2876 | | * Returns: (transfer full) (type GXdpDocumentsProxy): The constructed proxy object or %NULL if @error is set. |
2877 | | */ |
2878 | | GXdpDocuments * |
2879 | | gxdp_documents_proxy_new_for_bus_sync ( |
2880 | | GBusType bus_type, |
2881 | | GDBusProxyFlags flags, |
2882 | | const gchar *name, |
2883 | | const gchar *object_path, |
2884 | | GCancellable *cancellable, |
2885 | | GError **error) |
2886 | 0 | { |
2887 | 0 | GInitable *ret; |
2888 | 0 | 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); |
2889 | 0 | if (ret != NULL) |
2890 | 0 | return GXDP_DOCUMENTS (ret); |
2891 | 0 | else |
2892 | 0 | return NULL; |
2893 | 0 | } |
2894 | | |
2895 | | |
2896 | | /* ------------------------------------------------------------------------ */ |
2897 | | |
2898 | | /** |
2899 | | * GXdpDocumentsSkeleton: |
2900 | | * |
2901 | | * The #GXdpDocumentsSkeleton structure contains only private data and should only be accessed using the provided API. |
2902 | | */ |
2903 | | |
2904 | | /** |
2905 | | * GXdpDocumentsSkeletonClass: |
2906 | | * @parent_class: The parent class. |
2907 | | * |
2908 | | * Class structure for #GXdpDocumentsSkeleton. |
2909 | | */ |
2910 | | |
2911 | | struct _GXdpDocumentsSkeletonPrivate |
2912 | | { |
2913 | | GValue *properties; |
2914 | | GList *changed_properties; |
2915 | | GSource *changed_properties_idle_source; |
2916 | | GMainContext *context; |
2917 | | GMutex lock; |
2918 | | }; |
2919 | | |
2920 | | static void |
2921 | | _gxdp_documents_skeleton_handle_method_call ( |
2922 | | GDBusConnection *connection G_GNUC_UNUSED, |
2923 | | const gchar *sender G_GNUC_UNUSED, |
2924 | | const gchar *object_path G_GNUC_UNUSED, |
2925 | | const gchar *interface_name, |
2926 | | const gchar *method_name, |
2927 | | GVariant *parameters, |
2928 | | GDBusMethodInvocation *invocation, |
2929 | | gpointer user_data) |
2930 | 0 | { |
2931 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data); |
2932 | 0 | _ExtendedGDBusMethodInfo *info; |
2933 | 0 | GVariantIter iter; |
2934 | 0 | GVariant *child; |
2935 | 0 | GValue *paramv; |
2936 | 0 | gsize num_params; |
2937 | 0 | guint num_extra; |
2938 | 0 | gsize n; |
2939 | 0 | guint signal_id; |
2940 | 0 | GValue return_value = G_VALUE_INIT; |
2941 | 0 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
2942 | 0 | g_assert (info != NULL); |
2943 | 0 | num_params = g_variant_n_children (parameters); |
2944 | 0 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
2945 | 0 | n = 0; |
2946 | 0 | g_value_init (¶mv[n], GXDP_TYPE_DOCUMENTS); |
2947 | 0 | g_value_set_object (¶mv[n++], skeleton); |
2948 | 0 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
2949 | 0 | g_value_set_object (¶mv[n++], invocation); |
2950 | 0 | if (info->pass_fdlist) |
2951 | 0 | { |
2952 | 0 | #ifdef G_OS_UNIX |
2953 | 0 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
2954 | 0 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
2955 | | #else |
2956 | | g_assert_not_reached (); |
2957 | | #endif |
2958 | | } |
2959 | 0 | g_variant_iter_init (&iter, parameters); |
2960 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
2961 | 0 | { |
2962 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
2963 | 0 | if (arg_info->use_gvariant) |
2964 | 0 | { |
2965 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
2966 | 0 | g_value_set_variant (¶mv[n], child); |
2967 | 0 | n++; |
2968 | 0 | } |
2969 | 0 | else |
2970 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
2971 | 0 | g_variant_unref (child); |
2972 | 0 | } |
2973 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_DOCUMENTS); |
2974 | 0 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
2975 | 0 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
2976 | 0 | if (!g_value_get_boolean (&return_value)) |
2977 | 0 | 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); |
2978 | 0 | g_value_unset (&return_value); |
2979 | 0 | for (n = 0; n < num_params + num_extra; n++) |
2980 | 0 | g_value_unset (¶mv[n]); |
2981 | 0 | g_free (paramv); |
2982 | 0 | } |
2983 | | |
2984 | | static GVariant * |
2985 | | _gxdp_documents_skeleton_handle_get_property ( |
2986 | | GDBusConnection *connection G_GNUC_UNUSED, |
2987 | | const gchar *sender G_GNUC_UNUSED, |
2988 | | const gchar *object_path G_GNUC_UNUSED, |
2989 | | const gchar *interface_name G_GNUC_UNUSED, |
2990 | | const gchar *property_name, |
2991 | | GError **error, |
2992 | | gpointer user_data) |
2993 | 0 | { |
2994 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data); |
2995 | 0 | GValue value = G_VALUE_INIT; |
2996 | 0 | GParamSpec *pspec; |
2997 | 0 | _ExtendedGDBusPropertyInfo *info; |
2998 | 0 | GVariant *ret; |
2999 | 0 | ret = NULL; |
3000 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, property_name); |
3001 | 0 | g_assert (info != NULL); |
3002 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3003 | 0 | if (pspec == NULL) |
3004 | 0 | { |
3005 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3006 | 0 | } |
3007 | 0 | else |
3008 | 0 | { |
3009 | 0 | g_value_init (&value, pspec->value_type); |
3010 | 0 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3011 | 0 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
3012 | 0 | g_value_unset (&value); |
3013 | 0 | } |
3014 | 0 | return ret; |
3015 | 0 | } |
3016 | | |
3017 | | static gboolean |
3018 | | _gxdp_documents_skeleton_handle_set_property ( |
3019 | | GDBusConnection *connection G_GNUC_UNUSED, |
3020 | | const gchar *sender G_GNUC_UNUSED, |
3021 | | const gchar *object_path G_GNUC_UNUSED, |
3022 | | const gchar *interface_name G_GNUC_UNUSED, |
3023 | | const gchar *property_name, |
3024 | | GVariant *variant, |
3025 | | GError **error, |
3026 | | gpointer user_data) |
3027 | 0 | { |
3028 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data); |
3029 | 0 | GValue value = G_VALUE_INIT; |
3030 | 0 | GParamSpec *pspec; |
3031 | 0 | _ExtendedGDBusPropertyInfo *info; |
3032 | 0 | gboolean ret; |
3033 | 0 | ret = FALSE; |
3034 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_documents_interface_info.parent_struct, property_name); |
3035 | 0 | g_assert (info != NULL); |
3036 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
3037 | 0 | if (pspec == NULL) |
3038 | 0 | { |
3039 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
3040 | 0 | } |
3041 | 0 | else |
3042 | 0 | { |
3043 | 0 | if (info->use_gvariant) |
3044 | 0 | g_value_set_variant (&value, variant); |
3045 | 0 | else |
3046 | 0 | g_dbus_gvariant_to_gvalue (variant, &value); |
3047 | 0 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
3048 | 0 | g_value_unset (&value); |
3049 | 0 | ret = TRUE; |
3050 | 0 | } |
3051 | 0 | return ret; |
3052 | 0 | } |
3053 | | |
3054 | | static const GDBusInterfaceVTable _gxdp_documents_skeleton_vtable = |
3055 | | { |
3056 | | _gxdp_documents_skeleton_handle_method_call, |
3057 | | _gxdp_documents_skeleton_handle_get_property, |
3058 | | _gxdp_documents_skeleton_handle_set_property, |
3059 | | {NULL} |
3060 | | }; |
3061 | | |
3062 | | static GDBusInterfaceInfo * |
3063 | | gxdp_documents_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3064 | 0 | { |
3065 | 0 | return gxdp_documents_interface_info (); |
3066 | 0 | } |
3067 | | |
3068 | | static GDBusInterfaceVTable * |
3069 | | gxdp_documents_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
3070 | 0 | { |
3071 | 0 | return (GDBusInterfaceVTable *) &_gxdp_documents_skeleton_vtable; |
3072 | 0 | } |
3073 | | |
3074 | | static GVariant * |
3075 | | gxdp_documents_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
3076 | 0 | { |
3077 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (_skeleton); |
3078 | 0 |
|
3079 | 0 | GVariantBuilder builder; |
3080 | 0 | guint n; |
3081 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
3082 | 0 | if (_gxdp_documents_interface_info.parent_struct.properties == NULL) |
3083 | 0 | goto out; |
3084 | 0 | for (n = 0; _gxdp_documents_interface_info.parent_struct.properties[n] != NULL; n++) |
3085 | 0 | { |
3086 | 0 | GDBusPropertyInfo *info = _gxdp_documents_interface_info.parent_struct.properties[n]; |
3087 | 0 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
3088 | 0 | { |
3089 | 0 | GVariant *value; |
3090 | 0 | 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); |
3091 | 0 | if (value != NULL) |
3092 | 0 | { |
3093 | 0 | g_variant_take_ref (value); |
3094 | 0 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
3095 | 0 | g_variant_unref (value); |
3096 | 0 | } |
3097 | 0 | } |
3098 | 0 | } |
3099 | 0 | out: |
3100 | 0 | return g_variant_builder_end (&builder); |
3101 | 0 | } |
3102 | | |
3103 | | static gboolean _gxdp_documents_emit_changed (gpointer user_data); |
3104 | | |
3105 | | static void |
3106 | | gxdp_documents_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
3107 | 0 | { |
3108 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (_skeleton); |
3109 | 0 | gboolean emit_changed = FALSE; |
3110 | 0 |
|
3111 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3112 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
3113 | 0 | { |
3114 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
3115 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
3116 | 0 | emit_changed = TRUE; |
3117 | 0 | } |
3118 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3119 | 0 |
|
3120 | 0 | if (emit_changed) |
3121 | 0 | _gxdp_documents_emit_changed (skeleton); |
3122 | 0 | } |
3123 | | |
3124 | | static void gxdp_documents_skeleton_iface_init (GXdpDocumentsIface *iface); |
3125 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3126 | | G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsSkeleton, gxdp_documents_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3127 | | G_ADD_PRIVATE (GXdpDocumentsSkeleton) |
3128 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_skeleton_iface_init)) |
3129 | | |
3130 | | #else |
3131 | | G_DEFINE_TYPE_WITH_CODE (GXdpDocumentsSkeleton, gxdp_documents_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
3132 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_DOCUMENTS, gxdp_documents_skeleton_iface_init)) |
3133 | | |
3134 | | #endif |
3135 | | static void |
3136 | | gxdp_documents_skeleton_finalize (GObject *object) |
3137 | 0 | { |
3138 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object); |
3139 | 0 | guint n; |
3140 | 0 | for (n = 0; n < 1; n++) |
3141 | 0 | g_value_unset (&skeleton->priv->properties[n]); |
3142 | 0 | g_free (skeleton->priv->properties); |
3143 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
3144 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
3145 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
3146 | 0 | g_main_context_unref (skeleton->priv->context); |
3147 | 0 | g_mutex_clear (&skeleton->priv->lock); |
3148 | 0 | G_OBJECT_CLASS (gxdp_documents_skeleton_parent_class)->finalize (object); |
3149 | 0 | } |
3150 | | |
3151 | | static void |
3152 | | gxdp_documents_skeleton_get_property (GObject *object, |
3153 | | guint prop_id, |
3154 | | GValue *value, |
3155 | | GParamSpec *pspec G_GNUC_UNUSED) |
3156 | 0 | { |
3157 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object); |
3158 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
3159 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3160 | 0 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
3161 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3162 | 0 | } |
3163 | | |
3164 | | static gboolean |
3165 | | _gxdp_documents_emit_changed (gpointer user_data) |
3166 | 0 | { |
3167 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (user_data); |
3168 | 0 | GList *l; |
3169 | 0 | GVariantBuilder builder; |
3170 | 0 | GVariantBuilder invalidated_builder; |
3171 | 0 | guint num_changes; |
3172 | 0 |
|
3173 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3174 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
3175 | 0 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
3176 | 0 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
3177 | 0 | { |
3178 | 0 | ChangedProperty *cp = l->data; |
3179 | 0 | GVariant *variant; |
3180 | 0 | const GValue *cur_value; |
3181 | 0 |
|
3182 | 0 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
3183 | 0 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
3184 | 0 | { |
3185 | 0 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
3186 | 0 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
3187 | 0 | g_variant_unref (variant); |
3188 | 0 | num_changes++; |
3189 | 0 | } |
3190 | 0 | } |
3191 | 0 | if (num_changes > 0) |
3192 | 0 | { |
3193 | 0 | GList *connections, *ll; |
3194 | 0 | GVariant *signal_variant; |
3195 | 0 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.Documents", |
3196 | 0 | &builder, &invalidated_builder)); |
3197 | 0 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
3198 | 0 | for (ll = connections; ll != NULL; ll = ll->next) |
3199 | 0 | { |
3200 | 0 | GDBusConnection *connection = ll->data; |
3201 | 0 |
|
3202 | 0 | g_dbus_connection_emit_signal (connection, |
3203 | 0 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
3204 | 0 | "org.freedesktop.DBus.Properties", |
3205 | 0 | "PropertiesChanged", |
3206 | 0 | signal_variant, |
3207 | 0 | NULL); |
3208 | 0 | } |
3209 | 0 | g_variant_unref (signal_variant); |
3210 | 0 | g_list_free_full (connections, g_object_unref); |
3211 | 0 | } |
3212 | 0 | else |
3213 | 0 | { |
3214 | 0 | g_variant_builder_clear (&builder); |
3215 | 0 | g_variant_builder_clear (&invalidated_builder); |
3216 | 0 | } |
3217 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
3218 | 0 | skeleton->priv->changed_properties = NULL; |
3219 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
3220 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3221 | 0 | return FALSE; |
3222 | 0 | } |
3223 | | |
3224 | | static void |
3225 | | _gxdp_documents_schedule_emit_changed (GXdpDocumentsSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
3226 | 0 | { |
3227 | 0 | ChangedProperty *cp; |
3228 | 0 | GList *l; |
3229 | 0 | cp = NULL; |
3230 | 0 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
3231 | 0 | { |
3232 | 0 | ChangedProperty *i_cp = l->data; |
3233 | 0 | if (i_cp->info == info) |
3234 | 0 | { |
3235 | 0 | cp = i_cp; |
3236 | 0 | break; |
3237 | 0 | } |
3238 | 0 | } |
3239 | 0 | if (cp == NULL) |
3240 | 0 | { |
3241 | 0 | cp = g_new0 (ChangedProperty, 1); |
3242 | 0 | cp->prop_id = prop_id; |
3243 | 0 | cp->info = info; |
3244 | 0 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
3245 | 0 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
3246 | 0 | g_value_copy (orig_value, &cp->orig_value); |
3247 | 0 | } |
3248 | 0 | } |
3249 | | |
3250 | | static void |
3251 | | gxdp_documents_skeleton_notify (GObject *object, |
3252 | | GParamSpec *pspec G_GNUC_UNUSED) |
3253 | 0 | { |
3254 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object); |
3255 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3256 | 0 | if (skeleton->priv->changed_properties != NULL && |
3257 | 0 | skeleton->priv->changed_properties_idle_source == NULL) |
3258 | 0 | { |
3259 | 0 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
3260 | 0 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
3261 | 0 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_documents_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
3262 | 0 | g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_documents_emit_changed"); |
3263 | 0 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
3264 | 0 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
3265 | 0 | } |
3266 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3267 | 0 | } |
3268 | | |
3269 | | static void |
3270 | | gxdp_documents_skeleton_set_property (GObject *object, |
3271 | | guint prop_id, |
3272 | | const GValue *value, |
3273 | | GParamSpec *pspec) |
3274 | 0 | { |
3275 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object); |
3276 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
3277 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3278 | 0 | g_object_freeze_notify (object); |
3279 | 0 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
3280 | 0 | { |
3281 | 0 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
3282 | 0 | _gxdp_documents_schedule_emit_changed (skeleton, (const _ExtendedGDBusPropertyInfo *) _gxdp_documents_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
3283 | 0 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
3284 | 0 | g_object_notify_by_pspec (object, pspec); |
3285 | 0 | } |
3286 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3287 | 0 | g_object_thaw_notify (object); |
3288 | 0 | } |
3289 | | |
3290 | | static void |
3291 | | gxdp_documents_skeleton_init (GXdpDocumentsSkeleton *skeleton) |
3292 | 0 | { |
3293 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
3294 | 0 | skeleton->priv = gxdp_documents_skeleton_get_instance_private (skeleton); |
3295 | | #else |
3296 | | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_DOCUMENTS_SKELETON, GXdpDocumentsSkeletonPrivate); |
3297 | | #endif |
3298 | |
|
3299 | 0 | g_mutex_init (&skeleton->priv->lock); |
3300 | 0 | skeleton->priv->context = g_main_context_ref_thread_default (); |
3301 | 0 | skeleton->priv->properties = g_new0 (GValue, 1); |
3302 | 0 | g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT); |
3303 | 0 | } |
3304 | | |
3305 | | static guint |
3306 | | gxdp_documents_skeleton_get_version (GXdpDocuments *object) |
3307 | 0 | { |
3308 | 0 | GXdpDocumentsSkeleton *skeleton = GXDP_DOCUMENTS_SKELETON (object); |
3309 | 0 | guint value; |
3310 | 0 | g_mutex_lock (&skeleton->priv->lock); |
3311 | 0 | value = g_value_get_uint (&(skeleton->priv->properties[0])); |
3312 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
3313 | 0 | return value; |
3314 | 0 | } |
3315 | | |
3316 | | static void |
3317 | | gxdp_documents_skeleton_class_init (GXdpDocumentsSkeletonClass *klass) |
3318 | 0 | { |
3319 | 0 | GObjectClass *gobject_class; |
3320 | 0 | GDBusInterfaceSkeletonClass *skeleton_class; |
3321 | 0 |
|
3322 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
3323 | 0 | gobject_class->finalize = gxdp_documents_skeleton_finalize; |
3324 | 0 | gobject_class->get_property = gxdp_documents_skeleton_get_property; |
3325 | 0 | gobject_class->set_property = gxdp_documents_skeleton_set_property; |
3326 | 0 | gobject_class->notify = gxdp_documents_skeleton_notify; |
3327 | 0 |
|
3328 | 0 |
|
3329 | 0 | gxdp_documents_override_properties (gobject_class, 1); |
3330 | 0 |
|
3331 | 0 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
3332 | 0 | skeleton_class->get_info = gxdp_documents_skeleton_dbus_interface_get_info; |
3333 | 0 | skeleton_class->get_properties = gxdp_documents_skeleton_dbus_interface_get_properties; |
3334 | 0 | skeleton_class->flush = gxdp_documents_skeleton_dbus_interface_flush; |
3335 | 0 | skeleton_class->get_vtable = gxdp_documents_skeleton_dbus_interface_get_vtable; |
3336 | 0 |
|
3337 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
3338 | | g_type_class_add_private (klass, sizeof (GXdpDocumentsSkeletonPrivate)); |
3339 | | #endif |
3340 | | } |
3341 | | |
3342 | | static void |
3343 | | gxdp_documents_skeleton_iface_init (GXdpDocumentsIface *iface) |
3344 | 0 | { |
3345 | 0 | iface->get_version = gxdp_documents_skeleton_get_version; |
3346 | 0 | } |
3347 | | |
3348 | | /** |
3349 | | * gxdp_documents_skeleton_new: |
3350 | | * |
3351 | | * 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>. |
3352 | | * |
3353 | | * Returns: (transfer full) (type GXdpDocumentsSkeleton): The skeleton object. |
3354 | | */ |
3355 | | GXdpDocuments * |
3356 | | gxdp_documents_skeleton_new (void) |
3357 | 0 | { |
3358 | 0 | return GXDP_DOCUMENTS (g_object_new (GXDP_TYPE_DOCUMENTS_SKELETON, NULL)); |
3359 | 0 | } |
3360 | | |
3361 | | /* ------------------------------------------------------------------------ |
3362 | | * Code for interface org.freedesktop.portal.OpenURI |
3363 | | * ------------------------------------------------------------------------ |
3364 | | */ |
3365 | | |
3366 | | /** |
3367 | | * SECTION:GXdpOpenURI |
3368 | | * @title: GXdpOpenURI |
3369 | | * @short_description: Generated C code for the org.freedesktop.portal.OpenURI D-Bus interface |
3370 | | * |
3371 | | * 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. |
3372 | | */ |
3373 | | |
3374 | | /* ---- Introspection data for org.freedesktop.portal.OpenURI ---- */ |
3375 | | |
3376 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_parent_window = |
3377 | | { |
3378 | | { |
3379 | | -1, |
3380 | | (gchar *) "parent_window", |
3381 | | (gchar *) "s", |
3382 | | NULL |
3383 | | }, |
3384 | | FALSE |
3385 | | }; |
3386 | | |
3387 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_uri = |
3388 | | { |
3389 | | { |
3390 | | -1, |
3391 | | (gchar *) "uri", |
3392 | | (gchar *) "s", |
3393 | | NULL |
3394 | | }, |
3395 | | FALSE |
3396 | | }; |
3397 | | |
3398 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_IN_ARG_options = |
3399 | | { |
3400 | | { |
3401 | | -1, |
3402 | | (gchar *) "options", |
3403 | | (gchar *) "a{sv}", |
3404 | | NULL |
3405 | | }, |
3406 | | FALSE |
3407 | | }; |
3408 | | |
3409 | | static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_uri_IN_ARG_pointers[] = |
3410 | | { |
3411 | | &_gxdp_open_uri_method_info_open_uri_IN_ARG_parent_window.parent_struct, |
3412 | | &_gxdp_open_uri_method_info_open_uri_IN_ARG_uri.parent_struct, |
3413 | | &_gxdp_open_uri_method_info_open_uri_IN_ARG_options.parent_struct, |
3414 | | NULL |
3415 | | }; |
3416 | | |
3417 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_uri_OUT_ARG_handle = |
3418 | | { |
3419 | | { |
3420 | | -1, |
3421 | | (gchar *) "handle", |
3422 | | (gchar *) "o", |
3423 | | NULL |
3424 | | }, |
3425 | | FALSE |
3426 | | }; |
3427 | | |
3428 | | static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_uri_OUT_ARG_pointers[] = |
3429 | | { |
3430 | | &_gxdp_open_uri_method_info_open_uri_OUT_ARG_handle.parent_struct, |
3431 | | NULL |
3432 | | }; |
3433 | | |
3434 | | static const _ExtendedGDBusMethodInfo _gxdp_open_uri_method_info_open_uri = |
3435 | | { |
3436 | | { |
3437 | | -1, |
3438 | | (gchar *) "OpenURI", |
3439 | | (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_uri_IN_ARG_pointers, |
3440 | | (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_uri_OUT_ARG_pointers, |
3441 | | NULL |
3442 | | }, |
3443 | | "handle-open-uri", |
3444 | | FALSE |
3445 | | }; |
3446 | | |
3447 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_parent_window = |
3448 | | { |
3449 | | { |
3450 | | -1, |
3451 | | (gchar *) "parent_window", |
3452 | | (gchar *) "s", |
3453 | | NULL |
3454 | | }, |
3455 | | FALSE |
3456 | | }; |
3457 | | |
3458 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_fd = |
3459 | | { |
3460 | | { |
3461 | | -1, |
3462 | | (gchar *) "fd", |
3463 | | (gchar *) "h", |
3464 | | NULL |
3465 | | }, |
3466 | | FALSE |
3467 | | }; |
3468 | | |
3469 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_IN_ARG_options = |
3470 | | { |
3471 | | { |
3472 | | -1, |
3473 | | (gchar *) "options", |
3474 | | (gchar *) "a{sv}", |
3475 | | NULL |
3476 | | }, |
3477 | | FALSE |
3478 | | }; |
3479 | | |
3480 | | static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_file_IN_ARG_pointers[] = |
3481 | | { |
3482 | | &_gxdp_open_uri_method_info_open_file_IN_ARG_parent_window.parent_struct, |
3483 | | &_gxdp_open_uri_method_info_open_file_IN_ARG_fd.parent_struct, |
3484 | | &_gxdp_open_uri_method_info_open_file_IN_ARG_options.parent_struct, |
3485 | | NULL |
3486 | | }; |
3487 | | |
3488 | | static const _ExtendedGDBusArgInfo _gxdp_open_uri_method_info_open_file_OUT_ARG_handle = |
3489 | | { |
3490 | | { |
3491 | | -1, |
3492 | | (gchar *) "handle", |
3493 | | (gchar *) "o", |
3494 | | NULL |
3495 | | }, |
3496 | | FALSE |
3497 | | }; |
3498 | | |
3499 | | static const GDBusArgInfo * const _gxdp_open_uri_method_info_open_file_OUT_ARG_pointers[] = |
3500 | | { |
3501 | | &_gxdp_open_uri_method_info_open_file_OUT_ARG_handle.parent_struct, |
3502 | | NULL |
3503 | | }; |
3504 | | |
3505 | | static const _ExtendedGDBusMethodInfo _gxdp_open_uri_method_info_open_file = |
3506 | | { |
3507 | | { |
3508 | | -1, |
3509 | | (gchar *) "OpenFile", |
3510 | | (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_file_IN_ARG_pointers, |
3511 | | (GDBusArgInfo **) &_gxdp_open_uri_method_info_open_file_OUT_ARG_pointers, |
3512 | | NULL |
3513 | | }, |
3514 | | "handle-open-file", |
3515 | | TRUE |
3516 | | }; |
3517 | | |
3518 | | static const GDBusMethodInfo * const _gxdp_open_uri_method_info_pointers[] = |
3519 | | { |
3520 | | &_gxdp_open_uri_method_info_open_uri.parent_struct, |
3521 | | &_gxdp_open_uri_method_info_open_file.parent_struct, |
3522 | | NULL |
3523 | | }; |
3524 | | |
3525 | | static const _ExtendedGDBusPropertyInfo _gxdp_open_uri_property_info_version = |
3526 | | { |
3527 | | { |
3528 | | -1, |
3529 | | (gchar *) "version", |
3530 | | (gchar *) "u", |
3531 | | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
3532 | | NULL |
3533 | | }, |
3534 | | "version", |
3535 | | FALSE |
3536 | | }; |
3537 | | |
3538 | | static const GDBusPropertyInfo * const _gxdp_open_uri_property_info_pointers[] = |
3539 | | { |
3540 | | &_gxdp_open_uri_property_info_version.parent_struct, |
3541 | | NULL |
3542 | | }; |
3543 | | |
3544 | | static const _ExtendedGDBusInterfaceInfo _gxdp_open_uri_interface_info = |
3545 | | { |
3546 | | { |
3547 | | -1, |
3548 | | (gchar *) "org.freedesktop.portal.OpenURI", |
3549 | | (GDBusMethodInfo **) &_gxdp_open_uri_method_info_pointers, |
3550 | | NULL, |
3551 | | (GDBusPropertyInfo **) &_gxdp_open_uri_property_info_pointers, |
3552 | | NULL |
3553 | | }, |
3554 | | "open-uri", |
3555 | | }; |
3556 | | |
3557 | | |
3558 | | /** |
3559 | | * gxdp_open_uri_interface_info: |
3560 | | * |
3561 | | * 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. |
3562 | | * |
3563 | | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
3564 | | */ |
3565 | | GDBusInterfaceInfo * |
3566 | | gxdp_open_uri_interface_info (void) |
3567 | 0 | { |
3568 | 0 | return (GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct; |
3569 | 0 | } |
3570 | | |
3571 | | /** |
3572 | | * gxdp_open_uri_override_properties: |
3573 | | * @klass: The class structure for a #GObject derived class. |
3574 | | * @property_id_begin: The property id to assign to the first overridden property. |
3575 | | * |
3576 | | * Overrides all #GObject properties in the #GXdpOpenURI interface for a concrete class. |
3577 | | * The properties are overridden in the order they are defined. |
3578 | | * |
3579 | | * Returns: The last property id. |
3580 | | */ |
3581 | | guint |
3582 | | gxdp_open_uri_override_properties (GObjectClass *klass, guint property_id_begin) |
3583 | 0 | { |
3584 | 0 | g_object_class_override_property (klass, property_id_begin++, "version"); |
3585 | 0 | return property_id_begin - 1; |
3586 | 0 | } |
3587 | | |
3588 | | |
3589 | | |
3590 | | /** |
3591 | | * GXdpOpenURI: |
3592 | | * |
3593 | | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>. |
3594 | | */ |
3595 | | |
3596 | | /** |
3597 | | * GXdpOpenURIIface: |
3598 | | * @parent_iface: The parent interface. |
3599 | | * @handle_open_file: Handler for the #GXdpOpenURI::handle-open-file signal. |
3600 | | * @handle_open_uri: Handler for the #GXdpOpenURI::handle-open-uri signal. |
3601 | | * @get_version: Getter for the #GXdpOpenURI:version property. |
3602 | | * |
3603 | | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-OpenURI.top_of_page">org.freedesktop.portal.OpenURI</link>. |
3604 | | */ |
3605 | | |
3606 | | typedef GXdpOpenURIIface GXdpOpenURIInterface; |
3607 | | G_DEFINE_INTERFACE (GXdpOpenURI, gxdp_open_uri, G_TYPE_OBJECT) |
3608 | | |
3609 | | static void |
3610 | | gxdp_open_uri_default_init (GXdpOpenURIIface *iface) |
3611 | 0 | { |
3612 | 0 | /* GObject signals for incoming D-Bus method calls: */ |
3613 | 0 | /** |
3614 | 0 | * GXdpOpenURI::handle-open-uri: |
3615 | 0 | * @object: A #GXdpOpenURI. |
3616 | 0 | * @invocation: A #GDBusMethodInvocation. |
3617 | 0 | * @arg_parent_window: Argument passed by remote caller. |
3618 | 0 | * @arg_uri: Argument passed by remote caller. |
3619 | 0 | * @arg_options: Argument passed by remote caller. |
3620 | 0 | * |
3621 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</link> D-Bus method. |
3622 | 0 | * |
3623 | 0 | * 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. |
3624 | 0 | * |
3625 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
3626 | 0 | */ |
3627 | 0 | g_signal_new ("handle-open-uri", |
3628 | 0 | G_TYPE_FROM_INTERFACE (iface), |
3629 | 0 | G_SIGNAL_RUN_LAST, |
3630 | 0 | G_STRUCT_OFFSET (GXdpOpenURIIface, handle_open_uri), |
3631 | 0 | g_signal_accumulator_true_handled, |
3632 | 0 | NULL, |
3633 | 0 | g_cclosure_marshal_generic, |
3634 | 0 | G_TYPE_BOOLEAN, |
3635 | 0 | 4, |
3636 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT); |
3637 | 0 |
|
3638 | 0 | /** |
3639 | 0 | * GXdpOpenURI::handle-open-file: |
3640 | 0 | * @object: A #GXdpOpenURI. |
3641 | 0 | * @invocation: A #GDBusMethodInvocation. |
3642 | 0 | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
3643 | 0 | * @arg_parent_window: Argument passed by remote caller. |
3644 | 0 | * @arg_fd: Argument passed by remote caller. |
3645 | 0 | * @arg_options: Argument passed by remote caller. |
3646 | 0 | * |
3647 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</link> D-Bus method. |
3648 | 0 | * |
3649 | 0 | * 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. |
3650 | 0 | * |
3651 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
3652 | 0 | */ |
3653 | 0 | g_signal_new ("handle-open-file", |
3654 | 0 | G_TYPE_FROM_INTERFACE (iface), |
3655 | 0 | G_SIGNAL_RUN_LAST, |
3656 | 0 | G_STRUCT_OFFSET (GXdpOpenURIIface, handle_open_file), |
3657 | 0 | g_signal_accumulator_true_handled, |
3658 | 0 | NULL, |
3659 | 0 | g_cclosure_marshal_generic, |
3660 | 0 | G_TYPE_BOOLEAN, |
3661 | 0 | 5, |
3662 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_VARIANT); |
3663 | 0 |
|
3664 | 0 | /* GObject properties for D-Bus properties: */ |
3665 | 0 | /** |
3666 | 0 | * GXdpOpenURI:version: |
3667 | 0 | * |
3668 | 0 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link>. |
3669 | 0 | * |
3670 | 0 | * 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. |
3671 | 0 | */ |
3672 | 0 | g_object_interface_install_property (iface, |
3673 | 0 | g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
3674 | 0 | } |
3675 | | |
3676 | | /** |
3677 | | * gxdp_open_uri_get_version: (skip) |
3678 | | * @object: A #GXdpOpenURI. |
3679 | | * |
3680 | | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link> D-Bus property. |
3681 | | * |
3682 | | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
3683 | | * |
3684 | | * Returns: The property value. |
3685 | | */ |
3686 | | guint |
3687 | | gxdp_open_uri_get_version (GXdpOpenURI *object) |
3688 | 0 | { |
3689 | 0 | return GXDP_OPEN_URI_GET_IFACE (object)->get_version (object); |
3690 | 0 | } |
3691 | | |
3692 | | /** |
3693 | | * gxdp_open_uri_set_version: (skip) |
3694 | | * @object: A #GXdpOpenURI. |
3695 | | * @value: The value to set. |
3696 | | * |
3697 | | * Sets the <link linkend="gdbus-property-org-freedesktop-portal-OpenURI.version">"version"</link> D-Bus property to @value. |
3698 | | * |
3699 | | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
3700 | | */ |
3701 | | void |
3702 | | gxdp_open_uri_set_version (GXdpOpenURI *object, guint value) |
3703 | 0 | { |
3704 | 0 | g_object_set (G_OBJECT (object), "version", value, NULL); |
3705 | 0 | } |
3706 | | |
3707 | | /** |
3708 | | * gxdp_open_uri_call_open_uri: |
3709 | | * @proxy: A #GXdpOpenURIProxy. |
3710 | | * @arg_parent_window: Argument to pass with the method invocation. |
3711 | | * @arg_uri: Argument to pass with the method invocation. |
3712 | | * @arg_options: Argument to pass with the method invocation. |
3713 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3714 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
3715 | | * @user_data: User data to pass to @callback. |
3716 | | * |
3717 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenURI">OpenURI()</link> D-Bus method on @proxy. |
3718 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
3719 | | * You can then call gxdp_open_uri_call_open_uri_finish() to get the result of the operation. |
3720 | | * |
3721 | | * See gxdp_open_uri_call_open_uri_sync() for the synchronous, blocking version of this method. |
3722 | | */ |
3723 | | void |
3724 | | gxdp_open_uri_call_open_uri ( |
3725 | | GXdpOpenURI *proxy, |
3726 | | const gchar *arg_parent_window, |
3727 | | const gchar *arg_uri, |
3728 | | GVariant *arg_options, |
3729 | | GCancellable *cancellable, |
3730 | | GAsyncReadyCallback callback, |
3731 | | gpointer user_data) |
3732 | 0 | { |
3733 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
3734 | 0 | "OpenURI", |
3735 | 0 | g_variant_new ("(ss@a{sv})", |
3736 | 0 | arg_parent_window, |
3737 | 0 | arg_uri, |
3738 | 0 | arg_options), |
3739 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3740 | 0 | -1, |
3741 | 0 | cancellable, |
3742 | 0 | callback, |
3743 | 0 | user_data); |
3744 | 0 | } |
3745 | | |
3746 | | /** |
3747 | | * gxdp_open_uri_call_open_uri_finish: |
3748 | | * @proxy: A #GXdpOpenURIProxy. |
3749 | | * @out_handle: (out): Return location for return parameter or %NULL to ignore. |
3750 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_call_open_uri(). |
3751 | | * @error: Return location for error or %NULL. |
3752 | | * |
3753 | | * Finishes an operation started with gxdp_open_uri_call_open_uri(). |
3754 | | * |
3755 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
3756 | | */ |
3757 | | gboolean |
3758 | | gxdp_open_uri_call_open_uri_finish ( |
3759 | | GXdpOpenURI *proxy, |
3760 | | gchar **out_handle, |
3761 | | GAsyncResult *res, |
3762 | | GError **error) |
3763 | 0 | { |
3764 | 0 | GVariant *_ret; |
3765 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
3766 | 0 | if (_ret == NULL) |
3767 | 0 | goto _out; |
3768 | 0 | g_variant_get (_ret, |
3769 | 0 | "(o)", |
3770 | 0 | out_handle); |
3771 | 0 | g_variant_unref (_ret); |
3772 | 0 | _out: |
3773 | 0 | return _ret != NULL; |
3774 | 0 | } |
3775 | | |
3776 | | /** |
3777 | | * gxdp_open_uri_call_open_uri_sync: |
3778 | | * @proxy: A #GXdpOpenURIProxy. |
3779 | | * @arg_parent_window: Argument to pass with the method invocation. |
3780 | | * @arg_uri: Argument to pass with the method invocation. |
3781 | | * @arg_options: Argument to pass with the method invocation. |
3782 | | * @out_handle: (out): Return location for return parameter or %NULL to ignore. |
3783 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3784 | | * @error: Return location for error or %NULL. |
3785 | | * |
3786 | | * 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. |
3787 | | * |
3788 | | * See gxdp_open_uri_call_open_uri() for the asynchronous version of this method. |
3789 | | * |
3790 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
3791 | | */ |
3792 | | gboolean |
3793 | | gxdp_open_uri_call_open_uri_sync ( |
3794 | | GXdpOpenURI *proxy, |
3795 | | const gchar *arg_parent_window, |
3796 | | const gchar *arg_uri, |
3797 | | GVariant *arg_options, |
3798 | | gchar **out_handle, |
3799 | | GCancellable *cancellable, |
3800 | | GError **error) |
3801 | 0 | { |
3802 | 0 | GVariant *_ret; |
3803 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
3804 | 0 | "OpenURI", |
3805 | 0 | g_variant_new ("(ss@a{sv})", |
3806 | 0 | arg_parent_window, |
3807 | 0 | arg_uri, |
3808 | 0 | arg_options), |
3809 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3810 | 0 | -1, |
3811 | 0 | cancellable, |
3812 | 0 | error); |
3813 | 0 | if (_ret == NULL) |
3814 | 0 | goto _out; |
3815 | 0 | g_variant_get (_ret, |
3816 | 0 | "(o)", |
3817 | 0 | out_handle); |
3818 | 0 | g_variant_unref (_ret); |
3819 | 0 | _out: |
3820 | 0 | return _ret != NULL; |
3821 | 0 | } |
3822 | | |
3823 | | /** |
3824 | | * gxdp_open_uri_call_open_file: |
3825 | | * @proxy: A #GXdpOpenURIProxy. |
3826 | | * @arg_parent_window: Argument to pass with the method invocation. |
3827 | | * @arg_fd: Argument to pass with the method invocation. |
3828 | | * @arg_options: Argument to pass with the method invocation. |
3829 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
3830 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3831 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
3832 | | * @user_data: User data to pass to @callback. |
3833 | | * |
3834 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-OpenURI.OpenFile">OpenFile()</link> D-Bus method on @proxy. |
3835 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
3836 | | * You can then call gxdp_open_uri_call_open_file_finish() to get the result of the operation. |
3837 | | * |
3838 | | * See gxdp_open_uri_call_open_file_sync() for the synchronous, blocking version of this method. |
3839 | | */ |
3840 | | void |
3841 | | gxdp_open_uri_call_open_file ( |
3842 | | GXdpOpenURI *proxy, |
3843 | | const gchar *arg_parent_window, |
3844 | | GVariant *arg_fd, |
3845 | | GVariant *arg_options, |
3846 | | GUnixFDList *fd_list, |
3847 | | GCancellable *cancellable, |
3848 | | GAsyncReadyCallback callback, |
3849 | | gpointer user_data) |
3850 | 0 | { |
3851 | 0 | g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy), |
3852 | 0 | "OpenFile", |
3853 | 0 | g_variant_new ("(s@h@a{sv})", |
3854 | 0 | arg_parent_window, |
3855 | 0 | arg_fd, |
3856 | 0 | arg_options), |
3857 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3858 | 0 | -1, |
3859 | 0 | fd_list, |
3860 | 0 | cancellable, |
3861 | 0 | callback, |
3862 | 0 | user_data); |
3863 | 0 | } |
3864 | | |
3865 | | /** |
3866 | | * gxdp_open_uri_call_open_file_finish: |
3867 | | * @proxy: A #GXdpOpenURIProxy. |
3868 | | * @out_handle: (out): Return location for return parameter or %NULL to ignore. |
3869 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
3870 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_call_open_file(). |
3871 | | * @error: Return location for error or %NULL. |
3872 | | * |
3873 | | * Finishes an operation started with gxdp_open_uri_call_open_file(). |
3874 | | * |
3875 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
3876 | | */ |
3877 | | gboolean |
3878 | | gxdp_open_uri_call_open_file_finish ( |
3879 | | GXdpOpenURI *proxy, |
3880 | | gchar **out_handle, |
3881 | | GUnixFDList **out_fd_list, |
3882 | | GAsyncResult *res, |
3883 | | GError **error) |
3884 | 0 | { |
3885 | 0 | GVariant *_ret; |
3886 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error); |
3887 | 0 | if (_ret == NULL) |
3888 | 0 | goto _out; |
3889 | 0 | g_variant_get (_ret, |
3890 | 0 | "(o)", |
3891 | 0 | out_handle); |
3892 | 0 | g_variant_unref (_ret); |
3893 | 0 | _out: |
3894 | 0 | return _ret != NULL; |
3895 | 0 | } |
3896 | | |
3897 | | /** |
3898 | | * gxdp_open_uri_call_open_file_sync: |
3899 | | * @proxy: A #GXdpOpenURIProxy. |
3900 | | * @arg_parent_window: Argument to pass with the method invocation. |
3901 | | * @arg_fd: Argument to pass with the method invocation. |
3902 | | * @arg_options: Argument to pass with the method invocation. |
3903 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
3904 | | * @out_handle: (out): Return location for return parameter or %NULL to ignore. |
3905 | | * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL. |
3906 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
3907 | | * @error: Return location for error or %NULL. |
3908 | | * |
3909 | | * 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. |
3910 | | * |
3911 | | * See gxdp_open_uri_call_open_file() for the asynchronous version of this method. |
3912 | | * |
3913 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
3914 | | */ |
3915 | | gboolean |
3916 | | gxdp_open_uri_call_open_file_sync ( |
3917 | | GXdpOpenURI *proxy, |
3918 | | const gchar *arg_parent_window, |
3919 | | GVariant *arg_fd, |
3920 | | GVariant *arg_options, |
3921 | | GUnixFDList *fd_list, |
3922 | | gchar **out_handle, |
3923 | | GUnixFDList **out_fd_list, |
3924 | | GCancellable *cancellable, |
3925 | | GError **error) |
3926 | 0 | { |
3927 | 0 | GVariant *_ret; |
3928 | 0 | _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy), |
3929 | 0 | "OpenFile", |
3930 | 0 | g_variant_new ("(s@h@a{sv})", |
3931 | 0 | arg_parent_window, |
3932 | 0 | arg_fd, |
3933 | 0 | arg_options), |
3934 | 0 | G_DBUS_CALL_FLAGS_NONE, |
3935 | 0 | -1, |
3936 | 0 | fd_list, |
3937 | 0 | out_fd_list, |
3938 | 0 | cancellable, |
3939 | 0 | error); |
3940 | 0 | if (_ret == NULL) |
3941 | 0 | goto _out; |
3942 | 0 | g_variant_get (_ret, |
3943 | 0 | "(o)", |
3944 | 0 | out_handle); |
3945 | 0 | g_variant_unref (_ret); |
3946 | 0 | _out: |
3947 | 0 | return _ret != NULL; |
3948 | 0 | } |
3949 | | |
3950 | | /** |
3951 | | * gxdp_open_uri_complete_open_uri: |
3952 | | * @object: A #GXdpOpenURI. |
3953 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
3954 | | * @handle: Parameter to return. |
3955 | | * |
3956 | | * 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. |
3957 | | * |
3958 | | * This method will free @invocation, you cannot use it afterwards. |
3959 | | */ |
3960 | | void |
3961 | | gxdp_open_uri_complete_open_uri ( |
3962 | | GXdpOpenURI *object, |
3963 | | GDBusMethodInvocation *invocation, |
3964 | | const gchar *handle) |
3965 | 0 | { |
3966 | 0 | g_dbus_method_invocation_return_value (invocation, |
3967 | 0 | g_variant_new ("(o)", |
3968 | 0 | handle)); |
3969 | 0 | } |
3970 | | |
3971 | | /** |
3972 | | * gxdp_open_uri_complete_open_file: |
3973 | | * @object: A #GXdpOpenURI. |
3974 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
3975 | | * @fd_list: (nullable): A #GUnixFDList or %NULL. |
3976 | | * @handle: Parameter to return. |
3977 | | * |
3978 | | * 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. |
3979 | | * |
3980 | | * This method will free @invocation, you cannot use it afterwards. |
3981 | | */ |
3982 | | void |
3983 | | gxdp_open_uri_complete_open_file ( |
3984 | | GXdpOpenURI *object, |
3985 | | GDBusMethodInvocation *invocation, |
3986 | | GUnixFDList *fd_list, |
3987 | | const gchar *handle) |
3988 | 0 | { |
3989 | 0 | g_dbus_method_invocation_return_value_with_unix_fd_list (invocation, |
3990 | 0 | g_variant_new ("(o)", |
3991 | 0 | handle), |
3992 | 0 | fd_list); |
3993 | 0 | } |
3994 | | |
3995 | | /* ------------------------------------------------------------------------ */ |
3996 | | |
3997 | | /** |
3998 | | * GXdpOpenURIProxy: |
3999 | | * |
4000 | | * The #GXdpOpenURIProxy structure contains only private data and should only be accessed using the provided API. |
4001 | | */ |
4002 | | |
4003 | | /** |
4004 | | * GXdpOpenURIProxyClass: |
4005 | | * @parent_class: The parent class. |
4006 | | * |
4007 | | * Class structure for #GXdpOpenURIProxy. |
4008 | | */ |
4009 | | |
4010 | | struct _GXdpOpenURIProxyPrivate |
4011 | | { |
4012 | | GData *qdata; |
4013 | | }; |
4014 | | |
4015 | | static void gxdp_open_uri_proxy_iface_init (GXdpOpenURIIface *iface); |
4016 | | |
4017 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4018 | | G_DEFINE_TYPE_WITH_CODE (GXdpOpenURIProxy, gxdp_open_uri_proxy, G_TYPE_DBUS_PROXY, |
4019 | | G_ADD_PRIVATE (GXdpOpenURIProxy) |
4020 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_proxy_iface_init)) |
4021 | | |
4022 | | #else |
4023 | | G_DEFINE_TYPE_WITH_CODE (GXdpOpenURIProxy, gxdp_open_uri_proxy, G_TYPE_DBUS_PROXY, |
4024 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_proxy_iface_init)) |
4025 | | |
4026 | | #endif |
4027 | | static void |
4028 | | gxdp_open_uri_proxy_finalize (GObject *object) |
4029 | 0 | { |
4030 | 0 | GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (object); |
4031 | 0 | g_datalist_clear (&proxy->priv->qdata); |
4032 | 0 | G_OBJECT_CLASS (gxdp_open_uri_proxy_parent_class)->finalize (object); |
4033 | 0 | } |
4034 | | |
4035 | | static void |
4036 | | gxdp_open_uri_proxy_get_property (GObject *object, |
4037 | | guint prop_id, |
4038 | | GValue *value, |
4039 | | GParamSpec *pspec G_GNUC_UNUSED) |
4040 | 0 | { |
4041 | 0 | const _ExtendedGDBusPropertyInfo *info; |
4042 | 0 | GVariant *variant; |
4043 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
4044 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1]; |
4045 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
4046 | 0 | if (info->use_gvariant) |
4047 | 0 | { |
4048 | 0 | g_value_set_variant (value, variant); |
4049 | 0 | } |
4050 | 0 | else |
4051 | 0 | { |
4052 | 0 | if (variant != NULL) |
4053 | 0 | g_dbus_gvariant_to_gvalue (variant, value); |
4054 | 0 | } |
4055 | 0 | if (variant != NULL) |
4056 | 0 | g_variant_unref (variant); |
4057 | 0 | } |
4058 | | |
4059 | | static void |
4060 | | gxdp_open_uri_proxy_set_property_cb (GDBusProxy *proxy, |
4061 | | GAsyncResult *res, |
4062 | | gpointer user_data) |
4063 | 0 | { |
4064 | 0 | const _ExtendedGDBusPropertyInfo *info = user_data; |
4065 | 0 | GError *error; |
4066 | 0 | GVariant *_ret; |
4067 | 0 | error = NULL; |
4068 | 0 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
4069 | 0 | if (!_ret) |
4070 | 0 | { |
4071 | 0 | g_warning ("Error setting property '%s' on interface org.freedesktop.portal.OpenURI: %s (%s, %d)", |
4072 | 0 | info->parent_struct.name, |
4073 | 0 | error->message, g_quark_to_string (error->domain), error->code); |
4074 | 0 | g_error_free (error); |
4075 | 0 | } |
4076 | 0 | else |
4077 | 0 | { |
4078 | 0 | g_variant_unref (_ret); |
4079 | 0 | } |
4080 | 0 | } |
4081 | | |
4082 | | static void |
4083 | | gxdp_open_uri_proxy_set_property (GObject *object, |
4084 | | guint prop_id, |
4085 | | const GValue *value, |
4086 | | GParamSpec *pspec G_GNUC_UNUSED) |
4087 | 0 | { |
4088 | 0 | const _ExtendedGDBusPropertyInfo *info; |
4089 | 0 | GVariant *variant; |
4090 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
4091 | 0 | info = (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1]; |
4092 | 0 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
4093 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
4094 | 0 | "org.freedesktop.DBus.Properties.Set", |
4095 | 0 | g_variant_new ("(ssv)", "org.freedesktop.portal.OpenURI", info->parent_struct.name, variant), |
4096 | 0 | G_DBUS_CALL_FLAGS_NONE, |
4097 | 0 | -1, |
4098 | 0 | NULL, (GAsyncReadyCallback) gxdp_open_uri_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
4099 | 0 | g_variant_unref (variant); |
4100 | 0 | } |
4101 | | |
4102 | | static void |
4103 | | gxdp_open_uri_proxy_g_signal (GDBusProxy *proxy, |
4104 | | const gchar *sender_name G_GNUC_UNUSED, |
4105 | | const gchar *signal_name, |
4106 | | GVariant *parameters) |
4107 | 0 | { |
4108 | 0 | _ExtendedGDBusSignalInfo *info; |
4109 | 0 | GVariantIter iter; |
4110 | 0 | GVariant *child; |
4111 | 0 | GValue *paramv; |
4112 | 0 | gsize num_params; |
4113 | 0 | gsize n; |
4114 | 0 | guint signal_id; |
4115 | 0 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, signal_name); |
4116 | 0 | if (info == NULL) |
4117 | 0 | return; |
4118 | 0 | num_params = g_variant_n_children (parameters); |
4119 | 0 | paramv = g_new0 (GValue, num_params + 1); |
4120 | 0 | g_value_init (¶mv[0], GXDP_TYPE_OPEN_URI); |
4121 | 0 | g_value_set_object (¶mv[0], proxy); |
4122 | 0 | g_variant_iter_init (&iter, parameters); |
4123 | 0 | n = 1; |
4124 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
4125 | 0 | { |
4126 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
4127 | 0 | if (arg_info->use_gvariant) |
4128 | 0 | { |
4129 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
4130 | 0 | g_value_set_variant (¶mv[n], child); |
4131 | 0 | n++; |
4132 | 0 | } |
4133 | 0 | else |
4134 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
4135 | 0 | g_variant_unref (child); |
4136 | 0 | } |
4137 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_OPEN_URI); |
4138 | 0 | g_signal_emitv (paramv, signal_id, 0, NULL); |
4139 | 0 | for (n = 0; n < num_params + 1; n++) |
4140 | 0 | g_value_unset (¶mv[n]); |
4141 | 0 | g_free (paramv); |
4142 | 0 | } |
4143 | | |
4144 | | static void |
4145 | | gxdp_open_uri_proxy_g_properties_changed (GDBusProxy *_proxy, |
4146 | | GVariant *changed_properties, |
4147 | | const gchar *const *invalidated_properties) |
4148 | 0 | { |
4149 | 0 | GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (_proxy); |
4150 | 0 | guint n; |
4151 | 0 | const gchar *key; |
4152 | 0 | GVariantIter *iter; |
4153 | 0 | _ExtendedGDBusPropertyInfo *info; |
4154 | 0 | g_variant_get (changed_properties, "a{sv}", &iter); |
4155 | 0 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
4156 | 0 | { |
4157 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, key); |
4158 | 0 | g_datalist_remove_data (&proxy->priv->qdata, key); |
4159 | 0 | if (info != NULL) |
4160 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
4161 | 0 | } |
4162 | 0 | g_variant_iter_free (iter); |
4163 | 0 | for (n = 0; invalidated_properties[n] != NULL; n++) |
4164 | 0 | { |
4165 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, invalidated_properties[n]); |
4166 | 0 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
4167 | 0 | if (info != NULL) |
4168 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
4169 | 0 | } |
4170 | 0 | } |
4171 | | |
4172 | | static guint |
4173 | | gxdp_open_uri_proxy_get_version (GXdpOpenURI *object) |
4174 | 0 | { |
4175 | 0 | GXdpOpenURIProxy *proxy = GXDP_OPEN_URI_PROXY (object); |
4176 | 0 | GVariant *variant; |
4177 | 0 | guint value = 0; |
4178 | 0 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version"); |
4179 | 0 | if (variant != NULL) |
4180 | 0 | { |
4181 | 0 | value = g_variant_get_uint32 (variant); |
4182 | 0 | g_variant_unref (variant); |
4183 | 0 | } |
4184 | 0 | return value; |
4185 | 0 | } |
4186 | | |
4187 | | static void |
4188 | | gxdp_open_uri_proxy_init (GXdpOpenURIProxy *proxy) |
4189 | 0 | { |
4190 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4191 | 0 | proxy->priv = gxdp_open_uri_proxy_get_instance_private (proxy); |
4192 | | #else |
4193 | | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_OPEN_URI_PROXY, GXdpOpenURIProxyPrivate); |
4194 | | #endif |
4195 | |
|
4196 | 0 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_open_uri_interface_info ()); |
4197 | 0 | } |
4198 | | |
4199 | | static void |
4200 | | gxdp_open_uri_proxy_class_init (GXdpOpenURIProxyClass *klass) |
4201 | 0 | { |
4202 | 0 | GObjectClass *gobject_class; |
4203 | 0 | GDBusProxyClass *proxy_class; |
4204 | 0 |
|
4205 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
4206 | 0 | gobject_class->finalize = gxdp_open_uri_proxy_finalize; |
4207 | 0 | gobject_class->get_property = gxdp_open_uri_proxy_get_property; |
4208 | 0 | gobject_class->set_property = gxdp_open_uri_proxy_set_property; |
4209 | 0 |
|
4210 | 0 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
4211 | 0 | proxy_class->g_signal = gxdp_open_uri_proxy_g_signal; |
4212 | 0 | proxy_class->g_properties_changed = gxdp_open_uri_proxy_g_properties_changed; |
4213 | 0 |
|
4214 | 0 | gxdp_open_uri_override_properties (gobject_class, 1); |
4215 | 0 |
|
4216 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
4217 | | g_type_class_add_private (klass, sizeof (GXdpOpenURIProxyPrivate)); |
4218 | | #endif |
4219 | | } |
4220 | | |
4221 | | static void |
4222 | | gxdp_open_uri_proxy_iface_init (GXdpOpenURIIface *iface) |
4223 | 0 | { |
4224 | 0 | iface->get_version = gxdp_open_uri_proxy_get_version; |
4225 | 0 | } |
4226 | | |
4227 | | /** |
4228 | | * gxdp_open_uri_proxy_new: |
4229 | | * @connection: A #GDBusConnection. |
4230 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4231 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
4232 | | * @object_path: An object path. |
4233 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4234 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
4235 | | * @user_data: User data to pass to @callback. |
4236 | | * |
4237 | | * 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. |
4238 | | * |
4239 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
4240 | | * You can then call gxdp_open_uri_proxy_new_finish() to get the result of the operation. |
4241 | | * |
4242 | | * See gxdp_open_uri_proxy_new_sync() for the synchronous, blocking version of this constructor. |
4243 | | */ |
4244 | | void |
4245 | | gxdp_open_uri_proxy_new ( |
4246 | | GDBusConnection *connection, |
4247 | | GDBusProxyFlags flags, |
4248 | | const gchar *name, |
4249 | | const gchar *object_path, |
4250 | | GCancellable *cancellable, |
4251 | | GAsyncReadyCallback callback, |
4252 | | gpointer user_data) |
4253 | 0 | { |
4254 | 0 | 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); |
4255 | 0 | } |
4256 | | |
4257 | | /** |
4258 | | * gxdp_open_uri_proxy_new_finish: |
4259 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_proxy_new(). |
4260 | | * @error: Return location for error or %NULL |
4261 | | * |
4262 | | * Finishes an operation started with gxdp_open_uri_proxy_new(). |
4263 | | * |
4264 | | * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set. |
4265 | | */ |
4266 | | GXdpOpenURI * |
4267 | | gxdp_open_uri_proxy_new_finish ( |
4268 | | GAsyncResult *res, |
4269 | | GError **error) |
4270 | 0 | { |
4271 | 0 | GObject *ret; |
4272 | 0 | GObject *source_object; |
4273 | 0 | source_object = g_async_result_get_source_object (res); |
4274 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
4275 | 0 | g_object_unref (source_object); |
4276 | 0 | if (ret != NULL) |
4277 | 0 | return GXDP_OPEN_URI (ret); |
4278 | 0 | else |
4279 | 0 | return NULL; |
4280 | 0 | } |
4281 | | |
4282 | | /** |
4283 | | * gxdp_open_uri_proxy_new_sync: |
4284 | | * @connection: A #GDBusConnection. |
4285 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4286 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
4287 | | * @object_path: An object path. |
4288 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4289 | | * @error: Return location for error or %NULL |
4290 | | * |
4291 | | * 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. |
4292 | | * |
4293 | | * The calling thread is blocked until a reply is received. |
4294 | | * |
4295 | | * See gxdp_open_uri_proxy_new() for the asynchronous version of this constructor. |
4296 | | * |
4297 | | * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set. |
4298 | | */ |
4299 | | GXdpOpenURI * |
4300 | | gxdp_open_uri_proxy_new_sync ( |
4301 | | GDBusConnection *connection, |
4302 | | GDBusProxyFlags flags, |
4303 | | const gchar *name, |
4304 | | const gchar *object_path, |
4305 | | GCancellable *cancellable, |
4306 | | GError **error) |
4307 | 0 | { |
4308 | 0 | GInitable *ret; |
4309 | 0 | 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); |
4310 | 0 | if (ret != NULL) |
4311 | 0 | return GXDP_OPEN_URI (ret); |
4312 | 0 | else |
4313 | 0 | return NULL; |
4314 | 0 | } |
4315 | | |
4316 | | |
4317 | | /** |
4318 | | * gxdp_open_uri_proxy_new_for_bus: |
4319 | | * @bus_type: A #GBusType. |
4320 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4321 | | * @name: A bus name (well-known or unique). |
4322 | | * @object_path: An object path. |
4323 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4324 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
4325 | | * @user_data: User data to pass to @callback. |
4326 | | * |
4327 | | * Like gxdp_open_uri_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
4328 | | * |
4329 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
4330 | | * You can then call gxdp_open_uri_proxy_new_for_bus_finish() to get the result of the operation. |
4331 | | * |
4332 | | * See gxdp_open_uri_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
4333 | | */ |
4334 | | void |
4335 | | gxdp_open_uri_proxy_new_for_bus ( |
4336 | | GBusType bus_type, |
4337 | | GDBusProxyFlags flags, |
4338 | | const gchar *name, |
4339 | | const gchar *object_path, |
4340 | | GCancellable *cancellable, |
4341 | | GAsyncReadyCallback callback, |
4342 | | gpointer user_data) |
4343 | 0 | { |
4344 | 0 | 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); |
4345 | 0 | } |
4346 | | |
4347 | | /** |
4348 | | * gxdp_open_uri_proxy_new_for_bus_finish: |
4349 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_open_uri_proxy_new_for_bus(). |
4350 | | * @error: Return location for error or %NULL |
4351 | | * |
4352 | | * Finishes an operation started with gxdp_open_uri_proxy_new_for_bus(). |
4353 | | * |
4354 | | * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set. |
4355 | | */ |
4356 | | GXdpOpenURI * |
4357 | | gxdp_open_uri_proxy_new_for_bus_finish ( |
4358 | | GAsyncResult *res, |
4359 | | GError **error) |
4360 | 0 | { |
4361 | 0 | GObject *ret; |
4362 | 0 | GObject *source_object; |
4363 | 0 | source_object = g_async_result_get_source_object (res); |
4364 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
4365 | 0 | g_object_unref (source_object); |
4366 | 0 | if (ret != NULL) |
4367 | 0 | return GXDP_OPEN_URI (ret); |
4368 | 0 | else |
4369 | 0 | return NULL; |
4370 | 0 | } |
4371 | | |
4372 | | /** |
4373 | | * gxdp_open_uri_proxy_new_for_bus_sync: |
4374 | | * @bus_type: A #GBusType. |
4375 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
4376 | | * @name: A bus name (well-known or unique). |
4377 | | * @object_path: An object path. |
4378 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
4379 | | * @error: Return location for error or %NULL |
4380 | | * |
4381 | | * Like gxdp_open_uri_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
4382 | | * |
4383 | | * The calling thread is blocked until a reply is received. |
4384 | | * |
4385 | | * See gxdp_open_uri_proxy_new_for_bus() for the asynchronous version of this constructor. |
4386 | | * |
4387 | | * Returns: (transfer full) (type GXdpOpenURIProxy): The constructed proxy object or %NULL if @error is set. |
4388 | | */ |
4389 | | GXdpOpenURI * |
4390 | | gxdp_open_uri_proxy_new_for_bus_sync ( |
4391 | | GBusType bus_type, |
4392 | | GDBusProxyFlags flags, |
4393 | | const gchar *name, |
4394 | | const gchar *object_path, |
4395 | | GCancellable *cancellable, |
4396 | | GError **error) |
4397 | 0 | { |
4398 | 0 | GInitable *ret; |
4399 | 0 | 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); |
4400 | 0 | if (ret != NULL) |
4401 | 0 | return GXDP_OPEN_URI (ret); |
4402 | 0 | else |
4403 | 0 | return NULL; |
4404 | 0 | } |
4405 | | |
4406 | | |
4407 | | /* ------------------------------------------------------------------------ */ |
4408 | | |
4409 | | /** |
4410 | | * GXdpOpenURISkeleton: |
4411 | | * |
4412 | | * The #GXdpOpenURISkeleton structure contains only private data and should only be accessed using the provided API. |
4413 | | */ |
4414 | | |
4415 | | /** |
4416 | | * GXdpOpenURISkeletonClass: |
4417 | | * @parent_class: The parent class. |
4418 | | * |
4419 | | * Class structure for #GXdpOpenURISkeleton. |
4420 | | */ |
4421 | | |
4422 | | struct _GXdpOpenURISkeletonPrivate |
4423 | | { |
4424 | | GValue *properties; |
4425 | | GList *changed_properties; |
4426 | | GSource *changed_properties_idle_source; |
4427 | | GMainContext *context; |
4428 | | GMutex lock; |
4429 | | }; |
4430 | | |
4431 | | static void |
4432 | | _gxdp_open_uri_skeleton_handle_method_call ( |
4433 | | GDBusConnection *connection G_GNUC_UNUSED, |
4434 | | const gchar *sender G_GNUC_UNUSED, |
4435 | | const gchar *object_path G_GNUC_UNUSED, |
4436 | | const gchar *interface_name, |
4437 | | const gchar *method_name, |
4438 | | GVariant *parameters, |
4439 | | GDBusMethodInvocation *invocation, |
4440 | | gpointer user_data) |
4441 | 0 | { |
4442 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data); |
4443 | 0 | _ExtendedGDBusMethodInfo *info; |
4444 | 0 | GVariantIter iter; |
4445 | 0 | GVariant *child; |
4446 | 0 | GValue *paramv; |
4447 | 0 | gsize num_params; |
4448 | 0 | guint num_extra; |
4449 | 0 | gsize n; |
4450 | 0 | guint signal_id; |
4451 | 0 | GValue return_value = G_VALUE_INIT; |
4452 | 0 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
4453 | 0 | g_assert (info != NULL); |
4454 | 0 | num_params = g_variant_n_children (parameters); |
4455 | 0 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
4456 | 0 | n = 0; |
4457 | 0 | g_value_init (¶mv[n], GXDP_TYPE_OPEN_URI); |
4458 | 0 | g_value_set_object (¶mv[n++], skeleton); |
4459 | 0 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
4460 | 0 | g_value_set_object (¶mv[n++], invocation); |
4461 | 0 | if (info->pass_fdlist) |
4462 | 0 | { |
4463 | 0 | #ifdef G_OS_UNIX |
4464 | 0 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
4465 | 0 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
4466 | | #else |
4467 | | g_assert_not_reached (); |
4468 | | #endif |
4469 | | } |
4470 | 0 | g_variant_iter_init (&iter, parameters); |
4471 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
4472 | 0 | { |
4473 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
4474 | 0 | if (arg_info->use_gvariant) |
4475 | 0 | { |
4476 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
4477 | 0 | g_value_set_variant (¶mv[n], child); |
4478 | 0 | n++; |
4479 | 0 | } |
4480 | 0 | else |
4481 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
4482 | 0 | g_variant_unref (child); |
4483 | 0 | } |
4484 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_OPEN_URI); |
4485 | 0 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
4486 | 0 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
4487 | 0 | if (!g_value_get_boolean (&return_value)) |
4488 | 0 | 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); |
4489 | 0 | g_value_unset (&return_value); |
4490 | 0 | for (n = 0; n < num_params + num_extra; n++) |
4491 | 0 | g_value_unset (¶mv[n]); |
4492 | 0 | g_free (paramv); |
4493 | 0 | } |
4494 | | |
4495 | | static GVariant * |
4496 | | _gxdp_open_uri_skeleton_handle_get_property ( |
4497 | | GDBusConnection *connection G_GNUC_UNUSED, |
4498 | | const gchar *sender G_GNUC_UNUSED, |
4499 | | const gchar *object_path G_GNUC_UNUSED, |
4500 | | const gchar *interface_name G_GNUC_UNUSED, |
4501 | | const gchar *property_name, |
4502 | | GError **error, |
4503 | | gpointer user_data) |
4504 | 0 | { |
4505 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data); |
4506 | 0 | GValue value = G_VALUE_INIT; |
4507 | 0 | GParamSpec *pspec; |
4508 | 0 | _ExtendedGDBusPropertyInfo *info; |
4509 | 0 | GVariant *ret; |
4510 | 0 | ret = NULL; |
4511 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, property_name); |
4512 | 0 | g_assert (info != NULL); |
4513 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
4514 | 0 | if (pspec == NULL) |
4515 | 0 | { |
4516 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
4517 | 0 | } |
4518 | 0 | else |
4519 | 0 | { |
4520 | 0 | g_value_init (&value, pspec->value_type); |
4521 | 0 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
4522 | 0 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
4523 | 0 | g_value_unset (&value); |
4524 | 0 | } |
4525 | 0 | return ret; |
4526 | 0 | } |
4527 | | |
4528 | | static gboolean |
4529 | | _gxdp_open_uri_skeleton_handle_set_property ( |
4530 | | GDBusConnection *connection G_GNUC_UNUSED, |
4531 | | const gchar *sender G_GNUC_UNUSED, |
4532 | | const gchar *object_path G_GNUC_UNUSED, |
4533 | | const gchar *interface_name G_GNUC_UNUSED, |
4534 | | const gchar *property_name, |
4535 | | GVariant *variant, |
4536 | | GError **error, |
4537 | | gpointer user_data) |
4538 | 0 | { |
4539 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data); |
4540 | 0 | GValue value = G_VALUE_INIT; |
4541 | 0 | GParamSpec *pspec; |
4542 | 0 | _ExtendedGDBusPropertyInfo *info; |
4543 | 0 | gboolean ret; |
4544 | 0 | ret = FALSE; |
4545 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_open_uri_interface_info.parent_struct, property_name); |
4546 | 0 | g_assert (info != NULL); |
4547 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
4548 | 0 | if (pspec == NULL) |
4549 | 0 | { |
4550 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
4551 | 0 | } |
4552 | 0 | else |
4553 | 0 | { |
4554 | 0 | if (info->use_gvariant) |
4555 | 0 | g_value_set_variant (&value, variant); |
4556 | 0 | else |
4557 | 0 | g_dbus_gvariant_to_gvalue (variant, &value); |
4558 | 0 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
4559 | 0 | g_value_unset (&value); |
4560 | 0 | ret = TRUE; |
4561 | 0 | } |
4562 | 0 | return ret; |
4563 | 0 | } |
4564 | | |
4565 | | static const GDBusInterfaceVTable _gxdp_open_uri_skeleton_vtable = |
4566 | | { |
4567 | | _gxdp_open_uri_skeleton_handle_method_call, |
4568 | | _gxdp_open_uri_skeleton_handle_get_property, |
4569 | | _gxdp_open_uri_skeleton_handle_set_property, |
4570 | | {NULL} |
4571 | | }; |
4572 | | |
4573 | | static GDBusInterfaceInfo * |
4574 | | gxdp_open_uri_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
4575 | 0 | { |
4576 | 0 | return gxdp_open_uri_interface_info (); |
4577 | 0 | } |
4578 | | |
4579 | | static GDBusInterfaceVTable * |
4580 | | gxdp_open_uri_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
4581 | 0 | { |
4582 | 0 | return (GDBusInterfaceVTable *) &_gxdp_open_uri_skeleton_vtable; |
4583 | 0 | } |
4584 | | |
4585 | | static GVariant * |
4586 | | gxdp_open_uri_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
4587 | 0 | { |
4588 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (_skeleton); |
4589 | 0 |
|
4590 | 0 | GVariantBuilder builder; |
4591 | 0 | guint n; |
4592 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
4593 | 0 | if (_gxdp_open_uri_interface_info.parent_struct.properties == NULL) |
4594 | 0 | goto out; |
4595 | 0 | for (n = 0; _gxdp_open_uri_interface_info.parent_struct.properties[n] != NULL; n++) |
4596 | 0 | { |
4597 | 0 | GDBusPropertyInfo *info = _gxdp_open_uri_interface_info.parent_struct.properties[n]; |
4598 | 0 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
4599 | 0 | { |
4600 | 0 | GVariant *value; |
4601 | 0 | 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); |
4602 | 0 | if (value != NULL) |
4603 | 0 | { |
4604 | 0 | g_variant_take_ref (value); |
4605 | 0 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
4606 | 0 | g_variant_unref (value); |
4607 | 0 | } |
4608 | 0 | } |
4609 | 0 | } |
4610 | 0 | out: |
4611 | 0 | return g_variant_builder_end (&builder); |
4612 | 0 | } |
4613 | | |
4614 | | static gboolean _gxdp_open_uri_emit_changed (gpointer user_data); |
4615 | | |
4616 | | static void |
4617 | | gxdp_open_uri_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
4618 | 0 | { |
4619 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (_skeleton); |
4620 | 0 | gboolean emit_changed = FALSE; |
4621 | 0 |
|
4622 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4623 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
4624 | 0 | { |
4625 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
4626 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
4627 | 0 | emit_changed = TRUE; |
4628 | 0 | } |
4629 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4630 | 0 |
|
4631 | 0 | if (emit_changed) |
4632 | 0 | _gxdp_open_uri_emit_changed (skeleton); |
4633 | 0 | } |
4634 | | |
4635 | | static void gxdp_open_uri_skeleton_iface_init (GXdpOpenURIIface *iface); |
4636 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4637 | | G_DEFINE_TYPE_WITH_CODE (GXdpOpenURISkeleton, gxdp_open_uri_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
4638 | | G_ADD_PRIVATE (GXdpOpenURISkeleton) |
4639 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_skeleton_iface_init)) |
4640 | | |
4641 | | #else |
4642 | | G_DEFINE_TYPE_WITH_CODE (GXdpOpenURISkeleton, gxdp_open_uri_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
4643 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_OPEN_URI, gxdp_open_uri_skeleton_iface_init)) |
4644 | | |
4645 | | #endif |
4646 | | static void |
4647 | | gxdp_open_uri_skeleton_finalize (GObject *object) |
4648 | 0 | { |
4649 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object); |
4650 | 0 | guint n; |
4651 | 0 | for (n = 0; n < 1; n++) |
4652 | 0 | g_value_unset (&skeleton->priv->properties[n]); |
4653 | 0 | g_free (skeleton->priv->properties); |
4654 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
4655 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
4656 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
4657 | 0 | g_main_context_unref (skeleton->priv->context); |
4658 | 0 | g_mutex_clear (&skeleton->priv->lock); |
4659 | 0 | G_OBJECT_CLASS (gxdp_open_uri_skeleton_parent_class)->finalize (object); |
4660 | 0 | } |
4661 | | |
4662 | | static void |
4663 | | gxdp_open_uri_skeleton_get_property (GObject *object, |
4664 | | guint prop_id, |
4665 | | GValue *value, |
4666 | | GParamSpec *pspec G_GNUC_UNUSED) |
4667 | 0 | { |
4668 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object); |
4669 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
4670 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4671 | 0 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
4672 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4673 | 0 | } |
4674 | | |
4675 | | static gboolean |
4676 | | _gxdp_open_uri_emit_changed (gpointer user_data) |
4677 | 0 | { |
4678 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (user_data); |
4679 | 0 | GList *l; |
4680 | 0 | GVariantBuilder builder; |
4681 | 0 | GVariantBuilder invalidated_builder; |
4682 | 0 | guint num_changes; |
4683 | 0 |
|
4684 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4685 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
4686 | 0 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
4687 | 0 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
4688 | 0 | { |
4689 | 0 | ChangedProperty *cp = l->data; |
4690 | 0 | GVariant *variant; |
4691 | 0 | const GValue *cur_value; |
4692 | 0 |
|
4693 | 0 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
4694 | 0 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
4695 | 0 | { |
4696 | 0 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
4697 | 0 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
4698 | 0 | g_variant_unref (variant); |
4699 | 0 | num_changes++; |
4700 | 0 | } |
4701 | 0 | } |
4702 | 0 | if (num_changes > 0) |
4703 | 0 | { |
4704 | 0 | GList *connections, *ll; |
4705 | 0 | GVariant *signal_variant; |
4706 | 0 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.portal.OpenURI", |
4707 | 0 | &builder, &invalidated_builder)); |
4708 | 0 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
4709 | 0 | for (ll = connections; ll != NULL; ll = ll->next) |
4710 | 0 | { |
4711 | 0 | GDBusConnection *connection = ll->data; |
4712 | 0 |
|
4713 | 0 | g_dbus_connection_emit_signal (connection, |
4714 | 0 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
4715 | 0 | "org.freedesktop.DBus.Properties", |
4716 | 0 | "PropertiesChanged", |
4717 | 0 | signal_variant, |
4718 | 0 | NULL); |
4719 | 0 | } |
4720 | 0 | g_variant_unref (signal_variant); |
4721 | 0 | g_list_free_full (connections, g_object_unref); |
4722 | 0 | } |
4723 | 0 | else |
4724 | 0 | { |
4725 | 0 | g_variant_builder_clear (&builder); |
4726 | 0 | g_variant_builder_clear (&invalidated_builder); |
4727 | 0 | } |
4728 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
4729 | 0 | skeleton->priv->changed_properties = NULL; |
4730 | 0 | skeleton->priv->changed_properties_idle_source = NULL; |
4731 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4732 | 0 | return FALSE; |
4733 | 0 | } |
4734 | | |
4735 | | static void |
4736 | | _gxdp_open_uri_schedule_emit_changed (GXdpOpenURISkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
4737 | 0 | { |
4738 | 0 | ChangedProperty *cp; |
4739 | 0 | GList *l; |
4740 | 0 | cp = NULL; |
4741 | 0 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
4742 | 0 | { |
4743 | 0 | ChangedProperty *i_cp = l->data; |
4744 | 0 | if (i_cp->info == info) |
4745 | 0 | { |
4746 | 0 | cp = i_cp; |
4747 | 0 | break; |
4748 | 0 | } |
4749 | 0 | } |
4750 | 0 | if (cp == NULL) |
4751 | 0 | { |
4752 | 0 | cp = g_new0 (ChangedProperty, 1); |
4753 | 0 | cp->prop_id = prop_id; |
4754 | 0 | cp->info = info; |
4755 | 0 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
4756 | 0 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
4757 | 0 | g_value_copy (orig_value, &cp->orig_value); |
4758 | 0 | } |
4759 | 0 | } |
4760 | | |
4761 | | static void |
4762 | | gxdp_open_uri_skeleton_notify (GObject *object, |
4763 | | GParamSpec *pspec G_GNUC_UNUSED) |
4764 | 0 | { |
4765 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object); |
4766 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4767 | 0 | if (skeleton->priv->changed_properties != NULL && |
4768 | 0 | skeleton->priv->changed_properties_idle_source == NULL) |
4769 | 0 | { |
4770 | 0 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
4771 | 0 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
4772 | 0 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gxdp_open_uri_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
4773 | 0 | g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gxdp_open_uri_emit_changed"); |
4774 | 0 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
4775 | 0 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
4776 | 0 | } |
4777 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4778 | 0 | } |
4779 | | |
4780 | | static void |
4781 | | gxdp_open_uri_skeleton_set_property (GObject *object, |
4782 | | guint prop_id, |
4783 | | const GValue *value, |
4784 | | GParamSpec *pspec) |
4785 | 0 | { |
4786 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object); |
4787 | 0 | g_assert (prop_id != 0 && prop_id - 1 < 1); |
4788 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4789 | 0 | g_object_freeze_notify (object); |
4790 | 0 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
4791 | 0 | { |
4792 | 0 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
4793 | 0 | _gxdp_open_uri_schedule_emit_changed (skeleton, (const _ExtendedGDBusPropertyInfo *) _gxdp_open_uri_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
4794 | 0 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
4795 | 0 | g_object_notify_by_pspec (object, pspec); |
4796 | 0 | } |
4797 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4798 | 0 | g_object_thaw_notify (object); |
4799 | 0 | } |
4800 | | |
4801 | | static void |
4802 | | gxdp_open_uri_skeleton_init (GXdpOpenURISkeleton *skeleton) |
4803 | 0 | { |
4804 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
4805 | 0 | skeleton->priv = gxdp_open_uri_skeleton_get_instance_private (skeleton); |
4806 | | #else |
4807 | | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_OPEN_URI_SKELETON, GXdpOpenURISkeletonPrivate); |
4808 | | #endif |
4809 | |
|
4810 | 0 | g_mutex_init (&skeleton->priv->lock); |
4811 | 0 | skeleton->priv->context = g_main_context_ref_thread_default (); |
4812 | 0 | skeleton->priv->properties = g_new0 (GValue, 1); |
4813 | 0 | g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT); |
4814 | 0 | } |
4815 | | |
4816 | | static guint |
4817 | | gxdp_open_uri_skeleton_get_version (GXdpOpenURI *object) |
4818 | 0 | { |
4819 | 0 | GXdpOpenURISkeleton *skeleton = GXDP_OPEN_URI_SKELETON (object); |
4820 | 0 | guint value; |
4821 | 0 | g_mutex_lock (&skeleton->priv->lock); |
4822 | 0 | value = g_value_get_uint (&(skeleton->priv->properties[0])); |
4823 | 0 | g_mutex_unlock (&skeleton->priv->lock); |
4824 | 0 | return value; |
4825 | 0 | } |
4826 | | |
4827 | | static void |
4828 | | gxdp_open_uri_skeleton_class_init (GXdpOpenURISkeletonClass *klass) |
4829 | 0 | { |
4830 | 0 | GObjectClass *gobject_class; |
4831 | 0 | GDBusInterfaceSkeletonClass *skeleton_class; |
4832 | 0 |
|
4833 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
4834 | 0 | gobject_class->finalize = gxdp_open_uri_skeleton_finalize; |
4835 | 0 | gobject_class->get_property = gxdp_open_uri_skeleton_get_property; |
4836 | 0 | gobject_class->set_property = gxdp_open_uri_skeleton_set_property; |
4837 | 0 | gobject_class->notify = gxdp_open_uri_skeleton_notify; |
4838 | 0 |
|
4839 | 0 |
|
4840 | 0 | gxdp_open_uri_override_properties (gobject_class, 1); |
4841 | 0 |
|
4842 | 0 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
4843 | 0 | skeleton_class->get_info = gxdp_open_uri_skeleton_dbus_interface_get_info; |
4844 | 0 | skeleton_class->get_properties = gxdp_open_uri_skeleton_dbus_interface_get_properties; |
4845 | 0 | skeleton_class->flush = gxdp_open_uri_skeleton_dbus_interface_flush; |
4846 | 0 | skeleton_class->get_vtable = gxdp_open_uri_skeleton_dbus_interface_get_vtable; |
4847 | 0 |
|
4848 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
4849 | | g_type_class_add_private (klass, sizeof (GXdpOpenURISkeletonPrivate)); |
4850 | | #endif |
4851 | | } |
4852 | | |
4853 | | static void |
4854 | | gxdp_open_uri_skeleton_iface_init (GXdpOpenURIIface *iface) |
4855 | 0 | { |
4856 | 0 | iface->get_version = gxdp_open_uri_skeleton_get_version; |
4857 | 0 | } |
4858 | | |
4859 | | /** |
4860 | | * gxdp_open_uri_skeleton_new: |
4861 | | * |
4862 | | * 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>. |
4863 | | * |
4864 | | * Returns: (transfer full) (type GXdpOpenURISkeleton): The skeleton object. |
4865 | | */ |
4866 | | GXdpOpenURI * |
4867 | | gxdp_open_uri_skeleton_new (void) |
4868 | 0 | { |
4869 | 0 | return GXDP_OPEN_URI (g_object_new (GXDP_TYPE_OPEN_URI_SKELETON, NULL)); |
4870 | 0 | } |
4871 | | |
4872 | | /* ------------------------------------------------------------------------ |
4873 | | * Code for interface org.freedesktop.portal.ProxyResolver |
4874 | | * ------------------------------------------------------------------------ |
4875 | | */ |
4876 | | |
4877 | | /** |
4878 | | * SECTION:GXdpProxyResolver |
4879 | | * @title: GXdpProxyResolver |
4880 | | * @short_description: Generated C code for the org.freedesktop.portal.ProxyResolver D-Bus interface |
4881 | | * |
4882 | | * 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. |
4883 | | */ |
4884 | | |
4885 | | /* ---- Introspection data for org.freedesktop.portal.ProxyResolver ---- */ |
4886 | | |
4887 | | static const _ExtendedGDBusArgInfo _gxdp_proxy_resolver_method_info_lookup_IN_ARG_uri = |
4888 | | { |
4889 | | { |
4890 | | -1, |
4891 | | (gchar *) "uri", |
4892 | | (gchar *) "s", |
4893 | | NULL |
4894 | | }, |
4895 | | FALSE |
4896 | | }; |
4897 | | |
4898 | | static const GDBusArgInfo * const _gxdp_proxy_resolver_method_info_lookup_IN_ARG_pointers[] = |
4899 | | { |
4900 | | &_gxdp_proxy_resolver_method_info_lookup_IN_ARG_uri.parent_struct, |
4901 | | NULL |
4902 | | }; |
4903 | | |
4904 | | static const _ExtendedGDBusArgInfo _gxdp_proxy_resolver_method_info_lookup_OUT_ARG_proxies = |
4905 | | { |
4906 | | { |
4907 | | -1, |
4908 | | (gchar *) "proxies", |
4909 | | (gchar *) "as", |
4910 | | NULL |
4911 | | }, |
4912 | | FALSE |
4913 | | }; |
4914 | | |
4915 | | static const GDBusArgInfo * const _gxdp_proxy_resolver_method_info_lookup_OUT_ARG_pointers[] = |
4916 | | { |
4917 | | &_gxdp_proxy_resolver_method_info_lookup_OUT_ARG_proxies.parent_struct, |
4918 | | NULL |
4919 | | }; |
4920 | | |
4921 | | static const _ExtendedGDBusMethodInfo _gxdp_proxy_resolver_method_info_lookup = |
4922 | | { |
4923 | | { |
4924 | | -1, |
4925 | | (gchar *) "Lookup", |
4926 | | (GDBusArgInfo **) &_gxdp_proxy_resolver_method_info_lookup_IN_ARG_pointers, |
4927 | | (GDBusArgInfo **) &_gxdp_proxy_resolver_method_info_lookup_OUT_ARG_pointers, |
4928 | | NULL |
4929 | | }, |
4930 | | "handle-lookup", |
4931 | | FALSE |
4932 | | }; |
4933 | | |
4934 | | static const GDBusMethodInfo * const _gxdp_proxy_resolver_method_info_pointers[] = |
4935 | | { |
4936 | | &_gxdp_proxy_resolver_method_info_lookup.parent_struct, |
4937 | | NULL |
4938 | | }; |
4939 | | |
4940 | | static const _ExtendedGDBusInterfaceInfo _gxdp_proxy_resolver_interface_info = |
4941 | | { |
4942 | | { |
4943 | | -1, |
4944 | | (gchar *) "org.freedesktop.portal.ProxyResolver", |
4945 | | (GDBusMethodInfo **) &_gxdp_proxy_resolver_method_info_pointers, |
4946 | | NULL, |
4947 | | NULL, |
4948 | | NULL |
4949 | | }, |
4950 | | "proxy-resolver", |
4951 | | }; |
4952 | | |
4953 | | |
4954 | | /** |
4955 | | * gxdp_proxy_resolver_interface_info: |
4956 | | * |
4957 | | * 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. |
4958 | | * |
4959 | | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
4960 | | */ |
4961 | | GDBusInterfaceInfo * |
4962 | | gxdp_proxy_resolver_interface_info (void) |
4963 | 0 | { |
4964 | 0 | return (GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct; |
4965 | 0 | } |
4966 | | |
4967 | | /** |
4968 | | * gxdp_proxy_resolver_override_properties: |
4969 | | * @klass: The class structure for a #GObject derived class. |
4970 | | * @property_id_begin: The property id to assign to the first overridden property. |
4971 | | * |
4972 | | * Overrides all #GObject properties in the #GXdpProxyResolver interface for a concrete class. |
4973 | | * The properties are overridden in the order they are defined. |
4974 | | * |
4975 | | * Returns: The last property id. |
4976 | | */ |
4977 | | guint |
4978 | | gxdp_proxy_resolver_override_properties (GObjectClass *klass, guint property_id_begin) |
4979 | 0 | { |
4980 | 0 | return property_id_begin - 1; |
4981 | 0 | } |
4982 | | |
4983 | | |
4984 | | |
4985 | | /** |
4986 | | * GXdpProxyResolver: |
4987 | | * |
4988 | | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>. |
4989 | | */ |
4990 | | |
4991 | | /** |
4992 | | * GXdpProxyResolverIface: |
4993 | | * @parent_iface: The parent interface. |
4994 | | * @handle_lookup: Handler for the #GXdpProxyResolver::handle-lookup signal. |
4995 | | * |
4996 | | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-portal-ProxyResolver.top_of_page">org.freedesktop.portal.ProxyResolver</link>. |
4997 | | */ |
4998 | | |
4999 | | typedef GXdpProxyResolverIface GXdpProxyResolverInterface; |
5000 | | G_DEFINE_INTERFACE (GXdpProxyResolver, gxdp_proxy_resolver, G_TYPE_OBJECT) |
5001 | | |
5002 | | static void |
5003 | | gxdp_proxy_resolver_default_init (GXdpProxyResolverIface *iface) |
5004 | 0 | { |
5005 | 0 | /* GObject signals for incoming D-Bus method calls: */ |
5006 | 0 | /** |
5007 | 0 | * GXdpProxyResolver::handle-lookup: |
5008 | 0 | * @object: A #GXdpProxyResolver. |
5009 | 0 | * @invocation: A #GDBusMethodInvocation. |
5010 | 0 | * @arg_uri: Argument passed by remote caller. |
5011 | 0 | * |
5012 | 0 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</link> D-Bus method. |
5013 | 0 | * |
5014 | 0 | * 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. |
5015 | 0 | * |
5016 | 0 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
5017 | 0 | */ |
5018 | 0 | g_signal_new ("handle-lookup", |
5019 | 0 | G_TYPE_FROM_INTERFACE (iface), |
5020 | 0 | G_SIGNAL_RUN_LAST, |
5021 | 0 | G_STRUCT_OFFSET (GXdpProxyResolverIface, handle_lookup), |
5022 | 0 | g_signal_accumulator_true_handled, |
5023 | 0 | NULL, |
5024 | 0 | g_cclosure_marshal_generic, |
5025 | 0 | G_TYPE_BOOLEAN, |
5026 | 0 | 2, |
5027 | 0 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); |
5028 | 0 |
|
5029 | 0 | } |
5030 | | |
5031 | | /** |
5032 | | * gxdp_proxy_resolver_call_lookup: |
5033 | | * @proxy: A #GXdpProxyResolverProxy. |
5034 | | * @arg_uri: Argument to pass with the method invocation. |
5035 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5036 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
5037 | | * @user_data: User data to pass to @callback. |
5038 | | * |
5039 | | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-portal-ProxyResolver.Lookup">Lookup()</link> D-Bus method on @proxy. |
5040 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5041 | | * You can then call gxdp_proxy_resolver_call_lookup_finish() to get the result of the operation. |
5042 | | * |
5043 | | * See gxdp_proxy_resolver_call_lookup_sync() for the synchronous, blocking version of this method. |
5044 | | */ |
5045 | | void |
5046 | | gxdp_proxy_resolver_call_lookup ( |
5047 | | GXdpProxyResolver *proxy, |
5048 | | const gchar *arg_uri, |
5049 | | GCancellable *cancellable, |
5050 | | GAsyncReadyCallback callback, |
5051 | | gpointer user_data) |
5052 | 0 | { |
5053 | 0 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
5054 | 0 | "Lookup", |
5055 | 0 | g_variant_new ("(s)", |
5056 | 0 | arg_uri), |
5057 | 0 | G_DBUS_CALL_FLAGS_NONE, |
5058 | 0 | -1, |
5059 | 0 | cancellable, |
5060 | 0 | callback, |
5061 | 0 | user_data); |
5062 | 0 | } |
5063 | | |
5064 | | /** |
5065 | | * gxdp_proxy_resolver_call_lookup_finish: |
5066 | | * @proxy: A #GXdpProxyResolverProxy. |
5067 | | * @out_proxies: (out) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. |
5068 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_call_lookup(). |
5069 | | * @error: Return location for error or %NULL. |
5070 | | * |
5071 | | * Finishes an operation started with gxdp_proxy_resolver_call_lookup(). |
5072 | | * |
5073 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5074 | | */ |
5075 | | gboolean |
5076 | | gxdp_proxy_resolver_call_lookup_finish ( |
5077 | | GXdpProxyResolver *proxy, |
5078 | | gchar ***out_proxies, |
5079 | | GAsyncResult *res, |
5080 | | GError **error) |
5081 | 0 | { |
5082 | 0 | GVariant *_ret; |
5083 | 0 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
5084 | 0 | if (_ret == NULL) |
5085 | 0 | goto _out; |
5086 | 0 | g_variant_get (_ret, |
5087 | 0 | "(^as)", |
5088 | 0 | out_proxies); |
5089 | 0 | g_variant_unref (_ret); |
5090 | 0 | _out: |
5091 | 0 | return _ret != NULL; |
5092 | 0 | } |
5093 | | |
5094 | | /** |
5095 | | * gxdp_proxy_resolver_call_lookup_sync: |
5096 | | * @proxy: A #GXdpProxyResolverProxy. |
5097 | | * @arg_uri: Argument to pass with the method invocation. |
5098 | | * @out_proxies: (out) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. |
5099 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5100 | | * @error: Return location for error or %NULL. |
5101 | | * |
5102 | | * 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. |
5103 | | * |
5104 | | * See gxdp_proxy_resolver_call_lookup() for the asynchronous version of this method. |
5105 | | * |
5106 | | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
5107 | | */ |
5108 | | gboolean |
5109 | | gxdp_proxy_resolver_call_lookup_sync ( |
5110 | | GXdpProxyResolver *proxy, |
5111 | | const gchar *arg_uri, |
5112 | | gchar ***out_proxies, |
5113 | | GCancellable *cancellable, |
5114 | | GError **error) |
5115 | 0 | { |
5116 | 0 | GVariant *_ret; |
5117 | 0 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
5118 | 0 | "Lookup", |
5119 | 0 | g_variant_new ("(s)", |
5120 | 0 | arg_uri), |
5121 | 0 | G_DBUS_CALL_FLAGS_NONE, |
5122 | 0 | -1, |
5123 | 0 | cancellable, |
5124 | 0 | error); |
5125 | 0 | if (_ret == NULL) |
5126 | 0 | goto _out; |
5127 | 0 | g_variant_get (_ret, |
5128 | 0 | "(^as)", |
5129 | 0 | out_proxies); |
5130 | 0 | g_variant_unref (_ret); |
5131 | 0 | _out: |
5132 | 0 | return _ret != NULL; |
5133 | 0 | } |
5134 | | |
5135 | | /** |
5136 | | * gxdp_proxy_resolver_complete_lookup: |
5137 | | * @object: A #GXdpProxyResolver. |
5138 | | * @invocation: (transfer full): A #GDBusMethodInvocation. |
5139 | | * @proxies: Parameter to return. |
5140 | | * |
5141 | | * 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. |
5142 | | * |
5143 | | * This method will free @invocation, you cannot use it afterwards. |
5144 | | */ |
5145 | | void |
5146 | | gxdp_proxy_resolver_complete_lookup ( |
5147 | | GXdpProxyResolver *object, |
5148 | | GDBusMethodInvocation *invocation, |
5149 | | const gchar *const *proxies) |
5150 | 0 | { |
5151 | 0 | g_dbus_method_invocation_return_value (invocation, |
5152 | 0 | g_variant_new ("(^as)", |
5153 | 0 | proxies)); |
5154 | 0 | } |
5155 | | |
5156 | | /* ------------------------------------------------------------------------ */ |
5157 | | |
5158 | | /** |
5159 | | * GXdpProxyResolverProxy: |
5160 | | * |
5161 | | * The #GXdpProxyResolverProxy structure contains only private data and should only be accessed using the provided API. |
5162 | | */ |
5163 | | |
5164 | | /** |
5165 | | * GXdpProxyResolverProxyClass: |
5166 | | * @parent_class: The parent class. |
5167 | | * |
5168 | | * Class structure for #GXdpProxyResolverProxy. |
5169 | | */ |
5170 | | |
5171 | | struct _GXdpProxyResolverProxyPrivate |
5172 | | { |
5173 | | GData *qdata; |
5174 | | }; |
5175 | | |
5176 | | static void gxdp_proxy_resolver_proxy_iface_init (GXdpProxyResolverIface *iface); |
5177 | | |
5178 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5179 | | G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverProxy, gxdp_proxy_resolver_proxy, G_TYPE_DBUS_PROXY, |
5180 | | G_ADD_PRIVATE (GXdpProxyResolverProxy) |
5181 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_proxy_iface_init)) |
5182 | | |
5183 | | #else |
5184 | | G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverProxy, gxdp_proxy_resolver_proxy, G_TYPE_DBUS_PROXY, |
5185 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_proxy_iface_init)) |
5186 | | |
5187 | | #endif |
5188 | | static void |
5189 | | gxdp_proxy_resolver_proxy_finalize (GObject *object) |
5190 | 0 | { |
5191 | 0 | GXdpProxyResolverProxy *proxy = GXDP_PROXY_RESOLVER_PROXY (object); |
5192 | 0 | g_datalist_clear (&proxy->priv->qdata); |
5193 | 0 | G_OBJECT_CLASS (gxdp_proxy_resolver_proxy_parent_class)->finalize (object); |
5194 | 0 | } |
5195 | | |
5196 | | static void |
5197 | | gxdp_proxy_resolver_proxy_get_property (GObject *object, |
5198 | | guint prop_id, |
5199 | | GValue *value, |
5200 | | GParamSpec *pspec G_GNUC_UNUSED) |
5201 | 0 | { |
5202 | 0 | } |
5203 | | |
5204 | | static void |
5205 | | gxdp_proxy_resolver_proxy_set_property (GObject *object, |
5206 | | guint prop_id, |
5207 | | const GValue *value, |
5208 | | GParamSpec *pspec G_GNUC_UNUSED) |
5209 | 0 | { |
5210 | 0 | } |
5211 | | |
5212 | | static void |
5213 | | gxdp_proxy_resolver_proxy_g_signal (GDBusProxy *proxy, |
5214 | | const gchar *sender_name G_GNUC_UNUSED, |
5215 | | const gchar *signal_name, |
5216 | | GVariant *parameters) |
5217 | 0 | { |
5218 | 0 | _ExtendedGDBusSignalInfo *info; |
5219 | 0 | GVariantIter iter; |
5220 | 0 | GVariant *child; |
5221 | 0 | GValue *paramv; |
5222 | 0 | gsize num_params; |
5223 | 0 | gsize n; |
5224 | 0 | guint signal_id; |
5225 | 0 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, signal_name); |
5226 | 0 | if (info == NULL) |
5227 | 0 | return; |
5228 | 0 | num_params = g_variant_n_children (parameters); |
5229 | 0 | paramv = g_new0 (GValue, num_params + 1); |
5230 | 0 | g_value_init (¶mv[0], GXDP_TYPE_PROXY_RESOLVER); |
5231 | 0 | g_value_set_object (¶mv[0], proxy); |
5232 | 0 | g_variant_iter_init (&iter, parameters); |
5233 | 0 | n = 1; |
5234 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
5235 | 0 | { |
5236 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
5237 | 0 | if (arg_info->use_gvariant) |
5238 | 0 | { |
5239 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
5240 | 0 | g_value_set_variant (¶mv[n], child); |
5241 | 0 | n++; |
5242 | 0 | } |
5243 | 0 | else |
5244 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
5245 | 0 | g_variant_unref (child); |
5246 | 0 | } |
5247 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_PROXY_RESOLVER); |
5248 | 0 | g_signal_emitv (paramv, signal_id, 0, NULL); |
5249 | 0 | for (n = 0; n < num_params + 1; n++) |
5250 | 0 | g_value_unset (¶mv[n]); |
5251 | 0 | g_free (paramv); |
5252 | 0 | } |
5253 | | |
5254 | | static void |
5255 | | gxdp_proxy_resolver_proxy_g_properties_changed (GDBusProxy *_proxy, |
5256 | | GVariant *changed_properties, |
5257 | | const gchar *const *invalidated_properties) |
5258 | 0 | { |
5259 | 0 | GXdpProxyResolverProxy *proxy = GXDP_PROXY_RESOLVER_PROXY (_proxy); |
5260 | 0 | guint n; |
5261 | 0 | const gchar *key; |
5262 | 0 | GVariantIter *iter; |
5263 | 0 | _ExtendedGDBusPropertyInfo *info; |
5264 | 0 | g_variant_get (changed_properties, "a{sv}", &iter); |
5265 | 0 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
5266 | 0 | { |
5267 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, key); |
5268 | 0 | g_datalist_remove_data (&proxy->priv->qdata, key); |
5269 | 0 | if (info != NULL) |
5270 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
5271 | 0 | } |
5272 | 0 | g_variant_iter_free (iter); |
5273 | 0 | for (n = 0; invalidated_properties[n] != NULL; n++) |
5274 | 0 | { |
5275 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, invalidated_properties[n]); |
5276 | 0 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
5277 | 0 | if (info != NULL) |
5278 | 0 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
5279 | 0 | } |
5280 | 0 | } |
5281 | | |
5282 | | static void |
5283 | | gxdp_proxy_resolver_proxy_init (GXdpProxyResolverProxy *proxy) |
5284 | 0 | { |
5285 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5286 | 0 | proxy->priv = gxdp_proxy_resolver_proxy_get_instance_private (proxy); |
5287 | | #else |
5288 | | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GXDP_TYPE_PROXY_RESOLVER_PROXY, GXdpProxyResolverProxyPrivate); |
5289 | | #endif |
5290 | |
|
5291 | 0 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gxdp_proxy_resolver_interface_info ()); |
5292 | 0 | } |
5293 | | |
5294 | | static void |
5295 | | gxdp_proxy_resolver_proxy_class_init (GXdpProxyResolverProxyClass *klass) |
5296 | 0 | { |
5297 | 0 | GObjectClass *gobject_class; |
5298 | 0 | GDBusProxyClass *proxy_class; |
5299 | 0 |
|
5300 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
5301 | 0 | gobject_class->finalize = gxdp_proxy_resolver_proxy_finalize; |
5302 | 0 | gobject_class->get_property = gxdp_proxy_resolver_proxy_get_property; |
5303 | 0 | gobject_class->set_property = gxdp_proxy_resolver_proxy_set_property; |
5304 | 0 |
|
5305 | 0 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
5306 | 0 | proxy_class->g_signal = gxdp_proxy_resolver_proxy_g_signal; |
5307 | 0 | proxy_class->g_properties_changed = gxdp_proxy_resolver_proxy_g_properties_changed; |
5308 | 0 |
|
5309 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
5310 | | g_type_class_add_private (klass, sizeof (GXdpProxyResolverProxyPrivate)); |
5311 | | #endif |
5312 | | } |
5313 | | |
5314 | | static void |
5315 | | gxdp_proxy_resolver_proxy_iface_init (GXdpProxyResolverIface *iface) |
5316 | 0 | { |
5317 | 0 | } |
5318 | | |
5319 | | /** |
5320 | | * gxdp_proxy_resolver_proxy_new: |
5321 | | * @connection: A #GDBusConnection. |
5322 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5323 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
5324 | | * @object_path: An object path. |
5325 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5326 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
5327 | | * @user_data: User data to pass to @callback. |
5328 | | * |
5329 | | * 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. |
5330 | | * |
5331 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5332 | | * You can then call gxdp_proxy_resolver_proxy_new_finish() to get the result of the operation. |
5333 | | * |
5334 | | * See gxdp_proxy_resolver_proxy_new_sync() for the synchronous, blocking version of this constructor. |
5335 | | */ |
5336 | | void |
5337 | | gxdp_proxy_resolver_proxy_new ( |
5338 | | GDBusConnection *connection, |
5339 | | GDBusProxyFlags flags, |
5340 | | const gchar *name, |
5341 | | const gchar *object_path, |
5342 | | GCancellable *cancellable, |
5343 | | GAsyncReadyCallback callback, |
5344 | | gpointer user_data) |
5345 | 0 | { |
5346 | 0 | 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); |
5347 | 0 | } |
5348 | | |
5349 | | /** |
5350 | | * gxdp_proxy_resolver_proxy_new_finish: |
5351 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_proxy_new(). |
5352 | | * @error: Return location for error or %NULL |
5353 | | * |
5354 | | * Finishes an operation started with gxdp_proxy_resolver_proxy_new(). |
5355 | | * |
5356 | | * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set. |
5357 | | */ |
5358 | | GXdpProxyResolver * |
5359 | | gxdp_proxy_resolver_proxy_new_finish ( |
5360 | | GAsyncResult *res, |
5361 | | GError **error) |
5362 | 0 | { |
5363 | 0 | GObject *ret; |
5364 | 0 | GObject *source_object; |
5365 | 0 | source_object = g_async_result_get_source_object (res); |
5366 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
5367 | 0 | g_object_unref (source_object); |
5368 | 0 | if (ret != NULL) |
5369 | 0 | return GXDP_PROXY_RESOLVER (ret); |
5370 | 0 | else |
5371 | 0 | return NULL; |
5372 | 0 | } |
5373 | | |
5374 | | /** |
5375 | | * gxdp_proxy_resolver_proxy_new_sync: |
5376 | | * @connection: A #GDBusConnection. |
5377 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5378 | | * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
5379 | | * @object_path: An object path. |
5380 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5381 | | * @error: Return location for error or %NULL |
5382 | | * |
5383 | | * 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. |
5384 | | * |
5385 | | * The calling thread is blocked until a reply is received. |
5386 | | * |
5387 | | * See gxdp_proxy_resolver_proxy_new() for the asynchronous version of this constructor. |
5388 | | * |
5389 | | * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set. |
5390 | | */ |
5391 | | GXdpProxyResolver * |
5392 | | gxdp_proxy_resolver_proxy_new_sync ( |
5393 | | GDBusConnection *connection, |
5394 | | GDBusProxyFlags flags, |
5395 | | const gchar *name, |
5396 | | const gchar *object_path, |
5397 | | GCancellable *cancellable, |
5398 | | GError **error) |
5399 | 0 | { |
5400 | 0 | GInitable *ret; |
5401 | 0 | 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); |
5402 | 0 | if (ret != NULL) |
5403 | 0 | return GXDP_PROXY_RESOLVER (ret); |
5404 | 0 | else |
5405 | 0 | return NULL; |
5406 | 0 | } |
5407 | | |
5408 | | |
5409 | | /** |
5410 | | * gxdp_proxy_resolver_proxy_new_for_bus: |
5411 | | * @bus_type: A #GBusType. |
5412 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5413 | | * @name: A bus name (well-known or unique). |
5414 | | * @object_path: An object path. |
5415 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5416 | | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
5417 | | * @user_data: User data to pass to @callback. |
5418 | | * |
5419 | | * Like gxdp_proxy_resolver_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
5420 | | * |
5421 | | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
5422 | | * You can then call gxdp_proxy_resolver_proxy_new_for_bus_finish() to get the result of the operation. |
5423 | | * |
5424 | | * See gxdp_proxy_resolver_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
5425 | | */ |
5426 | | void |
5427 | | gxdp_proxy_resolver_proxy_new_for_bus ( |
5428 | | GBusType bus_type, |
5429 | | GDBusProxyFlags flags, |
5430 | | const gchar *name, |
5431 | | const gchar *object_path, |
5432 | | GCancellable *cancellable, |
5433 | | GAsyncReadyCallback callback, |
5434 | | gpointer user_data) |
5435 | 0 | { |
5436 | 0 | 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); |
5437 | 0 | } |
5438 | | |
5439 | | /** |
5440 | | * gxdp_proxy_resolver_proxy_new_for_bus_finish: |
5441 | | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gxdp_proxy_resolver_proxy_new_for_bus(). |
5442 | | * @error: Return location for error or %NULL |
5443 | | * |
5444 | | * Finishes an operation started with gxdp_proxy_resolver_proxy_new_for_bus(). |
5445 | | * |
5446 | | * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set. |
5447 | | */ |
5448 | | GXdpProxyResolver * |
5449 | | gxdp_proxy_resolver_proxy_new_for_bus_finish ( |
5450 | | GAsyncResult *res, |
5451 | | GError **error) |
5452 | 0 | { |
5453 | 0 | GObject *ret; |
5454 | 0 | GObject *source_object; |
5455 | 0 | source_object = g_async_result_get_source_object (res); |
5456 | 0 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
5457 | 0 | g_object_unref (source_object); |
5458 | 0 | if (ret != NULL) |
5459 | 0 | return GXDP_PROXY_RESOLVER (ret); |
5460 | 0 | else |
5461 | 0 | return NULL; |
5462 | 0 | } |
5463 | | |
5464 | | /** |
5465 | | * gxdp_proxy_resolver_proxy_new_for_bus_sync: |
5466 | | * @bus_type: A #GBusType. |
5467 | | * @flags: Flags from the #GDBusProxyFlags enumeration. |
5468 | | * @name: A bus name (well-known or unique). |
5469 | | * @object_path: An object path. |
5470 | | * @cancellable: (nullable): A #GCancellable or %NULL. |
5471 | | * @error: Return location for error or %NULL |
5472 | | * |
5473 | | * Like gxdp_proxy_resolver_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
5474 | | * |
5475 | | * The calling thread is blocked until a reply is received. |
5476 | | * |
5477 | | * See gxdp_proxy_resolver_proxy_new_for_bus() for the asynchronous version of this constructor. |
5478 | | * |
5479 | | * Returns: (transfer full) (type GXdpProxyResolverProxy): The constructed proxy object or %NULL if @error is set. |
5480 | | */ |
5481 | | GXdpProxyResolver * |
5482 | | gxdp_proxy_resolver_proxy_new_for_bus_sync ( |
5483 | | GBusType bus_type, |
5484 | | GDBusProxyFlags flags, |
5485 | | const gchar *name, |
5486 | | const gchar *object_path, |
5487 | | GCancellable *cancellable, |
5488 | | GError **error) |
5489 | 0 | { |
5490 | 0 | GInitable *ret; |
5491 | 0 | 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); |
5492 | 0 | if (ret != NULL) |
5493 | 0 | return GXDP_PROXY_RESOLVER (ret); |
5494 | 0 | else |
5495 | 0 | return NULL; |
5496 | 0 | } |
5497 | | |
5498 | | |
5499 | | /* ------------------------------------------------------------------------ */ |
5500 | | |
5501 | | /** |
5502 | | * GXdpProxyResolverSkeleton: |
5503 | | * |
5504 | | * The #GXdpProxyResolverSkeleton structure contains only private data and should only be accessed using the provided API. |
5505 | | */ |
5506 | | |
5507 | | /** |
5508 | | * GXdpProxyResolverSkeletonClass: |
5509 | | * @parent_class: The parent class. |
5510 | | * |
5511 | | * Class structure for #GXdpProxyResolverSkeleton. |
5512 | | */ |
5513 | | |
5514 | | struct _GXdpProxyResolverSkeletonPrivate |
5515 | | { |
5516 | | GValue *properties; |
5517 | | GList *changed_properties; |
5518 | | GSource *changed_properties_idle_source; |
5519 | | GMainContext *context; |
5520 | | GMutex lock; |
5521 | | }; |
5522 | | |
5523 | | static void |
5524 | | _gxdp_proxy_resolver_skeleton_handle_method_call ( |
5525 | | GDBusConnection *connection G_GNUC_UNUSED, |
5526 | | const gchar *sender G_GNUC_UNUSED, |
5527 | | const gchar *object_path G_GNUC_UNUSED, |
5528 | | const gchar *interface_name, |
5529 | | const gchar *method_name, |
5530 | | GVariant *parameters, |
5531 | | GDBusMethodInvocation *invocation, |
5532 | | gpointer user_data) |
5533 | 0 | { |
5534 | 0 | GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data); |
5535 | 0 | _ExtendedGDBusMethodInfo *info; |
5536 | 0 | GVariantIter iter; |
5537 | 0 | GVariant *child; |
5538 | 0 | GValue *paramv; |
5539 | 0 | gsize num_params; |
5540 | 0 | guint num_extra; |
5541 | 0 | gsize n; |
5542 | 0 | guint signal_id; |
5543 | 0 | GValue return_value = G_VALUE_INIT; |
5544 | 0 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
5545 | 0 | g_assert (info != NULL); |
5546 | 0 | num_params = g_variant_n_children (parameters); |
5547 | 0 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
5548 | 0 | n = 0; |
5549 | 0 | g_value_init (¶mv[n], GXDP_TYPE_PROXY_RESOLVER); |
5550 | 0 | g_value_set_object (¶mv[n++], skeleton); |
5551 | 0 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
5552 | 0 | g_value_set_object (¶mv[n++], invocation); |
5553 | 0 | if (info->pass_fdlist) |
5554 | 0 | { |
5555 | 0 | #ifdef G_OS_UNIX |
5556 | 0 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
5557 | 0 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
5558 | | #else |
5559 | | g_assert_not_reached (); |
5560 | | #endif |
5561 | | } |
5562 | 0 | g_variant_iter_init (&iter, parameters); |
5563 | 0 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
5564 | 0 | { |
5565 | 0 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
5566 | 0 | if (arg_info->use_gvariant) |
5567 | 0 | { |
5568 | 0 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
5569 | 0 | g_value_set_variant (¶mv[n], child); |
5570 | 0 | n++; |
5571 | 0 | } |
5572 | 0 | else |
5573 | 0 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
5574 | 0 | g_variant_unref (child); |
5575 | 0 | } |
5576 | 0 | signal_id = g_signal_lookup (info->signal_name, GXDP_TYPE_PROXY_RESOLVER); |
5577 | 0 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
5578 | 0 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
5579 | 0 | if (!g_value_get_boolean (&return_value)) |
5580 | 0 | 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); |
5581 | 0 | g_value_unset (&return_value); |
5582 | 0 | for (n = 0; n < num_params + num_extra; n++) |
5583 | 0 | g_value_unset (¶mv[n]); |
5584 | 0 | g_free (paramv); |
5585 | 0 | } |
5586 | | |
5587 | | static GVariant * |
5588 | | _gxdp_proxy_resolver_skeleton_handle_get_property ( |
5589 | | GDBusConnection *connection G_GNUC_UNUSED, |
5590 | | const gchar *sender G_GNUC_UNUSED, |
5591 | | const gchar *object_path G_GNUC_UNUSED, |
5592 | | const gchar *interface_name G_GNUC_UNUSED, |
5593 | | const gchar *property_name, |
5594 | | GError **error, |
5595 | | gpointer user_data) |
5596 | 0 | { |
5597 | 0 | GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data); |
5598 | 0 | GValue value = G_VALUE_INIT; |
5599 | 0 | GParamSpec *pspec; |
5600 | 0 | _ExtendedGDBusPropertyInfo *info; |
5601 | 0 | GVariant *ret; |
5602 | 0 | ret = NULL; |
5603 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, property_name); |
5604 | 0 | g_assert (info != NULL); |
5605 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
5606 | 0 | if (pspec == NULL) |
5607 | 0 | { |
5608 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
5609 | 0 | } |
5610 | 0 | else |
5611 | 0 | { |
5612 | 0 | g_value_init (&value, pspec->value_type); |
5613 | 0 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
5614 | 0 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
5615 | 0 | g_value_unset (&value); |
5616 | 0 | } |
5617 | 0 | return ret; |
5618 | 0 | } |
5619 | | |
5620 | | static gboolean |
5621 | | _gxdp_proxy_resolver_skeleton_handle_set_property ( |
5622 | | GDBusConnection *connection G_GNUC_UNUSED, |
5623 | | const gchar *sender G_GNUC_UNUSED, |
5624 | | const gchar *object_path G_GNUC_UNUSED, |
5625 | | const gchar *interface_name G_GNUC_UNUSED, |
5626 | | const gchar *property_name, |
5627 | | GVariant *variant, |
5628 | | GError **error, |
5629 | | gpointer user_data) |
5630 | 0 | { |
5631 | 0 | GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (user_data); |
5632 | 0 | GValue value = G_VALUE_INIT; |
5633 | 0 | GParamSpec *pspec; |
5634 | 0 | _ExtendedGDBusPropertyInfo *info; |
5635 | 0 | gboolean ret; |
5636 | 0 | ret = FALSE; |
5637 | 0 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gxdp_proxy_resolver_interface_info.parent_struct, property_name); |
5638 | 0 | g_assert (info != NULL); |
5639 | 0 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
5640 | 0 | if (pspec == NULL) |
5641 | 0 | { |
5642 | 0 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
5643 | 0 | } |
5644 | 0 | else |
5645 | 0 | { |
5646 | 0 | if (info->use_gvariant) |
5647 | 0 | g_value_set_variant (&value, variant); |
5648 | 0 | else |
5649 | 0 | g_dbus_gvariant_to_gvalue (variant, &value); |
5650 | 0 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
5651 | 0 | g_value_unset (&value); |
5652 | 0 | ret = TRUE; |
5653 | 0 | } |
5654 | 0 | return ret; |
5655 | 0 | } |
5656 | | |
5657 | | static const GDBusInterfaceVTable _gxdp_proxy_resolver_skeleton_vtable = |
5658 | | { |
5659 | | _gxdp_proxy_resolver_skeleton_handle_method_call, |
5660 | | _gxdp_proxy_resolver_skeleton_handle_get_property, |
5661 | | _gxdp_proxy_resolver_skeleton_handle_set_property, |
5662 | | {NULL} |
5663 | | }; |
5664 | | |
5665 | | static GDBusInterfaceInfo * |
5666 | | gxdp_proxy_resolver_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
5667 | 0 | { |
5668 | 0 | return gxdp_proxy_resolver_interface_info (); |
5669 | 0 | } |
5670 | | |
5671 | | static GDBusInterfaceVTable * |
5672 | | gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
5673 | 0 | { |
5674 | 0 | return (GDBusInterfaceVTable *) &_gxdp_proxy_resolver_skeleton_vtable; |
5675 | 0 | } |
5676 | | |
5677 | | static GVariant * |
5678 | | gxdp_proxy_resolver_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
5679 | 0 | { |
5680 | 0 | GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (_skeleton); |
5681 | 0 |
|
5682 | 0 | GVariantBuilder builder; |
5683 | 0 | guint n; |
5684 | 0 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
5685 | 0 | if (_gxdp_proxy_resolver_interface_info.parent_struct.properties == NULL) |
5686 | 0 | goto out; |
5687 | 0 | for (n = 0; _gxdp_proxy_resolver_interface_info.parent_struct.properties[n] != NULL; n++) |
5688 | 0 | { |
5689 | 0 | GDBusPropertyInfo *info = _gxdp_proxy_resolver_interface_info.parent_struct.properties[n]; |
5690 | 0 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
5691 | 0 | { |
5692 | 0 | GVariant *value; |
5693 | 0 | 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); |
5694 | 0 | if (value != NULL) |
5695 | 0 | { |
5696 | 0 | g_variant_take_ref (value); |
5697 | 0 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
5698 | 0 | g_variant_unref (value); |
5699 | 0 | } |
5700 | 0 | } |
5701 | 0 | } |
5702 | 0 | out: |
5703 | 0 | return g_variant_builder_end (&builder); |
5704 | 0 | } |
5705 | | |
5706 | | static void |
5707 | | gxdp_proxy_resolver_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
5708 | 0 | { |
5709 | 0 | } |
5710 | | |
5711 | | static void gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface); |
5712 | | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5713 | | G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
5714 | | G_ADD_PRIVATE (GXdpProxyResolverSkeleton) |
5715 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init)) |
5716 | | |
5717 | | #else |
5718 | | G_DEFINE_TYPE_WITH_CODE (GXdpProxyResolverSkeleton, gxdp_proxy_resolver_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
5719 | | G_IMPLEMENT_INTERFACE (GXDP_TYPE_PROXY_RESOLVER, gxdp_proxy_resolver_skeleton_iface_init)) |
5720 | | |
5721 | | #endif |
5722 | | static void |
5723 | | gxdp_proxy_resolver_skeleton_finalize (GObject *object) |
5724 | 0 | { |
5725 | 0 | GXdpProxyResolverSkeleton *skeleton = GXDP_PROXY_RESOLVER_SKELETON (object); |
5726 | 0 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
5727 | 0 | if (skeleton->priv->changed_properties_idle_source != NULL) |
5728 | 0 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
5729 | 0 | g_main_context_unref (skeleton->priv->context); |
5730 | 0 | g_mutex_clear (&skeleton->priv->lock); |
5731 | 0 | G_OBJECT_CLASS (gxdp_proxy_resolver_skeleton_parent_class)->finalize (object); |
5732 | 0 | } |
5733 | | |
5734 | | static void |
5735 | | gxdp_proxy_resolver_skeleton_init (GXdpProxyResolverSkeleton *skeleton) |
5736 | 0 | { |
5737 | 0 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
5738 | 0 | skeleton->priv = gxdp_proxy_resolver_skeleton_get_instance_private (skeleton); |
5739 | | #else |
5740 | | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GXDP_TYPE_PROXY_RESOLVER_SKELETON, GXdpProxyResolverSkeletonPrivate); |
5741 | | #endif |
5742 | |
|
5743 | 0 | g_mutex_init (&skeleton->priv->lock); |
5744 | 0 | skeleton->priv->context = g_main_context_ref_thread_default (); |
5745 | 0 | } |
5746 | | |
5747 | | static void |
5748 | | gxdp_proxy_resolver_skeleton_class_init (GXdpProxyResolverSkeletonClass *klass) |
5749 | 0 | { |
5750 | 0 | GObjectClass *gobject_class; |
5751 | 0 | GDBusInterfaceSkeletonClass *skeleton_class; |
5752 | 0 |
|
5753 | 0 | gobject_class = G_OBJECT_CLASS (klass); |
5754 | 0 | gobject_class->finalize = gxdp_proxy_resolver_skeleton_finalize; |
5755 | 0 |
|
5756 | 0 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
5757 | 0 | skeleton_class->get_info = gxdp_proxy_resolver_skeleton_dbus_interface_get_info; |
5758 | 0 | skeleton_class->get_properties = gxdp_proxy_resolver_skeleton_dbus_interface_get_properties; |
5759 | 0 | skeleton_class->flush = gxdp_proxy_resolver_skeleton_dbus_interface_flush; |
5760 | 0 | skeleton_class->get_vtable = gxdp_proxy_resolver_skeleton_dbus_interface_get_vtable; |
5761 | 0 |
|
5762 | | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
5763 | | g_type_class_add_private (klass, sizeof (GXdpProxyResolverSkeletonPrivate)); |
5764 | | #endif |
5765 | | } |
5766 | | |
5767 | | static void |
5768 | | gxdp_proxy_resolver_skeleton_iface_init (GXdpProxyResolverIface *iface) |
5769 | 0 | { |
5770 | 0 | } |
5771 | | |
5772 | | /** |
5773 | | * gxdp_proxy_resolver_skeleton_new: |
5774 | | * |
5775 | | * 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>. |
5776 | | * |
5777 | | * Returns: (transfer full) (type GXdpProxyResolverSkeleton): The skeleton object. |
5778 | | */ |
5779 | | GXdpProxyResolver * |
5780 | | gxdp_proxy_resolver_skeleton_new (void) |
5781 | 0 | { |
5782 | 0 | return GXDP_PROXY_RESOLVER (g_object_new (GXDP_TYPE_PROXY_RESOLVER_SKELETON, NULL)); |
5783 | 0 | } |
5784 | | |