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