Line data Source code
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 "../daemon/dbus/gkd-portal-generated.h"
14 :
15 : #include <string.h>
16 : #ifdef G_OS_UNIX
17 : # include <gio/gunixfdlist.h>
18 : #endif
19 :
20 : #ifdef G_ENABLE_DEBUG
21 : #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
22 : #define g_marshal_value_peek_char(v) g_value_get_schar (v)
23 : #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
24 : #define g_marshal_value_peek_int(v) g_value_get_int (v)
25 : #define g_marshal_value_peek_uint(v) g_value_get_uint (v)
26 : #define g_marshal_value_peek_long(v) g_value_get_long (v)
27 : #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
28 : #define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
29 : #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
30 : #define g_marshal_value_peek_enum(v) g_value_get_enum (v)
31 : #define g_marshal_value_peek_flags(v) g_value_get_flags (v)
32 : #define g_marshal_value_peek_float(v) g_value_get_float (v)
33 : #define g_marshal_value_peek_double(v) g_value_get_double (v)
34 : #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
35 : #define g_marshal_value_peek_param(v) g_value_get_param (v)
36 : #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
37 : #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
38 : #define g_marshal_value_peek_object(v) g_value_get_object (v)
39 : #define g_marshal_value_peek_variant(v) g_value_get_variant (v)
40 : #else /* !G_ENABLE_DEBUG */
41 : /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
42 : * Do not access GValues directly in your code. Instead, use the
43 : * g_value_get_*() functions
44 : */
45 : #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
46 : #define g_marshal_value_peek_char(v) (v)->data[0].v_int
47 : #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
48 : #define g_marshal_value_peek_int(v) (v)->data[0].v_int
49 : #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
50 : #define g_marshal_value_peek_long(v) (v)->data[0].v_long
51 : #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
52 : #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
53 : #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
54 : #define g_marshal_value_peek_enum(v) (v)->data[0].v_long
55 : #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
56 : #define g_marshal_value_peek_float(v) (v)->data[0].v_float
57 : #define g_marshal_value_peek_double(v) (v)->data[0].v_double
58 : #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
59 : #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
60 : #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
61 : #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
62 : #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
63 : #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
64 : #endif /* !G_ENABLE_DEBUG */
65 :
66 : typedef struct
67 : {
68 : GDBusArgInfo parent_struct;
69 : gboolean use_gvariant;
70 : } _ExtendedGDBusArgInfo;
71 :
72 : typedef struct
73 : {
74 : GDBusMethodInfo parent_struct;
75 : const gchar *signal_name;
76 : gboolean pass_fdlist;
77 : } _ExtendedGDBusMethodInfo;
78 :
79 : typedef struct
80 : {
81 : GDBusSignalInfo parent_struct;
82 : const gchar *signal_name;
83 : } _ExtendedGDBusSignalInfo;
84 :
85 : typedef struct
86 : {
87 : GDBusPropertyInfo parent_struct;
88 : const gchar *hyphen_name;
89 : guint use_gvariant : 1;
90 : guint emits_changed_signal : 1;
91 : } _ExtendedGDBusPropertyInfo;
92 :
93 : typedef struct
94 : {
95 : GDBusInterfaceInfo parent_struct;
96 : const gchar *hyphen_name;
97 : } _ExtendedGDBusInterfaceInfo;
98 :
99 : typedef struct
100 : {
101 : const _ExtendedGDBusPropertyInfo *info;
102 : guint prop_id;
103 : GValue orig_value; /* the value before the change */
104 : } ChangedProperty;
105 :
106 : static void
107 0 : _changed_property_free (ChangedProperty *data)
108 : {
109 0 : g_value_unset (&data->orig_value);
110 0 : g_free (data);
111 0 : }
112 :
113 : static gboolean
114 0 : _g_strv_equal0 (gchar **a, gchar **b)
115 : {
116 0 : gboolean ret = FALSE;
117 : guint n;
118 0 : if (a == NULL && b == NULL)
119 : {
120 0 : ret = TRUE;
121 0 : goto out;
122 : }
123 0 : if (a == NULL || b == NULL)
124 0 : goto out;
125 0 : if (g_strv_length (a) != g_strv_length (b))
126 0 : goto out;
127 0 : for (n = 0; a[n] != NULL; n++)
128 0 : if (g_strcmp0 (a[n], b[n]) != 0)
129 0 : goto out;
130 0 : ret = TRUE;
131 0 : out:
132 0 : return ret;
133 : }
134 :
135 : static gboolean
136 0 : _g_variant_equal0 (GVariant *a, GVariant *b)
137 : {
138 0 : gboolean ret = FALSE;
139 0 : if (a == NULL && b == NULL)
140 : {
141 0 : ret = TRUE;
142 0 : goto out;
143 : }
144 0 : if (a == NULL || b == NULL)
145 0 : goto out;
146 0 : ret = g_variant_equal (a, b);
147 0 : out:
148 0 : return ret;
149 : }
150 :
151 : G_GNUC_UNUSED static gboolean
152 0 : _g_value_equal (const GValue *a, const GValue *b)
153 : {
154 0 : gboolean ret = FALSE;
155 0 : g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
156 0 : switch (G_VALUE_TYPE (a))
157 : {
158 0 : case G_TYPE_BOOLEAN:
159 0 : ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
160 0 : break;
161 0 : case G_TYPE_UCHAR:
162 0 : ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
163 0 : break;
164 0 : case G_TYPE_INT:
165 0 : ret = (g_value_get_int (a) == g_value_get_int (b));
166 0 : break;
167 0 : case G_TYPE_UINT:
168 0 : ret = (g_value_get_uint (a) == g_value_get_uint (b));
169 0 : break;
170 0 : case G_TYPE_INT64:
171 0 : ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
172 0 : break;
173 0 : case G_TYPE_UINT64:
174 0 : ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
175 0 : break;
176 0 : case G_TYPE_DOUBLE:
177 : {
178 : /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
179 0 : gdouble da = g_value_get_double (a);
180 0 : gdouble db = g_value_get_double (b);
181 0 : ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
182 : }
183 0 : break;
184 0 : case G_TYPE_STRING:
185 0 : ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
186 0 : break;
187 0 : case G_TYPE_VARIANT:
188 0 : ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
189 0 : break;
190 0 : default:
191 0 : if (G_VALUE_TYPE (a) == G_TYPE_STRV)
192 0 : ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
193 : else
194 0 : g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
195 0 : break;
196 : }
197 0 : return ret;
198 : }
199 :
200 : static void
201 4 : _g_dbus_codegen_marshal_BOOLEAN__OBJECT_OBJECT_STRING_STRING_VARIANT_VARIANT (
202 : GClosure *closure,
203 : GValue *return_value,
204 : unsigned int n_param_values,
205 : const GValue *param_values,
206 : void *invocation_hint G_GNUC_UNUSED,
207 : void *marshal_data)
208 : {
209 : typedef gboolean (*_GDbusCodegenMarshalBoolean_ObjectObjectStringStringVariantVariantFunc)
210 : (void *data1,
211 : GUnixFDList *arg_fd_list,
212 : GDBusMethodInvocation *arg_method_invocation,
213 : const gchar *arg_handle,
214 : const gchar *arg_app_id,
215 : GVariant *arg_fd,
216 : GVariant *arg_options,
217 : void *data2);
218 : _GDbusCodegenMarshalBoolean_ObjectObjectStringStringVariantVariantFunc callback;
219 4 : GCClosure *cc = (GCClosure*) closure;
220 : void *data1, *data2;
221 : gboolean v_return;
222 :
223 4 : g_return_if_fail (return_value != NULL);
224 4 : g_return_if_fail (n_param_values == 7);
225 :
226 4 : if (G_CCLOSURE_SWAP_DATA (closure))
227 : {
228 0 : data1 = closure->data;
229 0 : data2 = g_value_peek_pointer (param_values + 0);
230 : }
231 : else
232 : {
233 4 : data1 = g_value_peek_pointer (param_values + 0);
234 4 : data2 = closure->data;
235 : }
236 :
237 4 : callback = (_GDbusCodegenMarshalBoolean_ObjectObjectStringStringVariantVariantFunc)
238 4 : (marshal_data ? marshal_data : cc->callback);
239 :
240 : v_return =
241 4 : callback (data1,
242 4 : g_marshal_value_peek_object (param_values + 1),
243 4 : g_marshal_value_peek_object (param_values + 2),
244 4 : g_marshal_value_peek_string (param_values + 3),
245 4 : g_marshal_value_peek_string (param_values + 4),
246 4 : g_marshal_value_peek_variant (param_values + 5),
247 4 : g_marshal_value_peek_variant (param_values + 6),
248 : data2);
249 :
250 4 : g_value_set_boolean (return_value, v_return);
251 : }
252 :
253 : /* ------------------------------------------------------------------------
254 : * Code for interface org.freedesktop.impl.portal.Secret
255 : * ------------------------------------------------------------------------
256 : */
257 :
258 : /**
259 : * SECTION:GkdExportedPortal
260 : * @title: GkdExportedPortal
261 : * @short_description: Generated C code for the org.freedesktop.impl.portal.Secret D-Bus interface
262 : *
263 : * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link> D-Bus interface in C.
264 : */
265 :
266 : /* ---- Introspection data for org.freedesktop.impl.portal.Secret ---- */
267 :
268 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_IN_ARG_handle =
269 : {
270 : {
271 : -1,
272 : (gchar *) "handle",
273 : (gchar *) "o",
274 : NULL
275 : },
276 : FALSE
277 : };
278 :
279 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_IN_ARG_app_id =
280 : {
281 : {
282 : -1,
283 : (gchar *) "app_id",
284 : (gchar *) "s",
285 : NULL
286 : },
287 : FALSE
288 : };
289 :
290 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_IN_ARG_fd =
291 : {
292 : {
293 : -1,
294 : (gchar *) "fd",
295 : (gchar *) "h",
296 : NULL
297 : },
298 : FALSE
299 : };
300 :
301 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_IN_ARG_options =
302 : {
303 : {
304 : -1,
305 : (gchar *) "options",
306 : (gchar *) "a{sv}",
307 : NULL
308 : },
309 : FALSE
310 : };
311 :
312 : static const GDBusArgInfo * const _gkd_exported_portal_method_info_retrieve_secret_IN_ARG_pointers[] =
313 : {
314 : &_gkd_exported_portal_method_info_retrieve_secret_IN_ARG_handle.parent_struct,
315 : &_gkd_exported_portal_method_info_retrieve_secret_IN_ARG_app_id.parent_struct,
316 : &_gkd_exported_portal_method_info_retrieve_secret_IN_ARG_fd.parent_struct,
317 : &_gkd_exported_portal_method_info_retrieve_secret_IN_ARG_options.parent_struct,
318 : NULL
319 : };
320 :
321 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_response =
322 : {
323 : {
324 : -1,
325 : (gchar *) "response",
326 : (gchar *) "u",
327 : NULL
328 : },
329 : FALSE
330 : };
331 :
332 : static const _ExtendedGDBusArgInfo _gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_results =
333 : {
334 : {
335 : -1,
336 : (gchar *) "results",
337 : (gchar *) "a{sv}",
338 : NULL
339 : },
340 : FALSE
341 : };
342 :
343 : static const GDBusArgInfo * const _gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_pointers[] =
344 : {
345 : &_gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_response.parent_struct,
346 : &_gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_results.parent_struct,
347 : NULL
348 : };
349 :
350 : static const GDBusAnnotationInfo _gkd_exported_portal_method_retrieve_secret_annotation_info_0 =
351 : {
352 : -1,
353 : (gchar *) "org.qtproject.QtDBus.QtTypeName.In3",
354 : (gchar *) "QVariantMap",
355 : NULL
356 : };
357 :
358 : static const GDBusAnnotationInfo _gkd_exported_portal_method_retrieve_secret_annotation_info_1 =
359 : {
360 : -1,
361 : (gchar *) "org.qtproject.QtDBus.QtTypeName.Out1",
362 : (gchar *) "QVariantMap",
363 : NULL
364 : };
365 :
366 : static const GDBusAnnotationInfo * const _gkd_exported_portal_method_retrieve_secret_annotation_info_pointers[] =
367 : {
368 : &_gkd_exported_portal_method_retrieve_secret_annotation_info_0,
369 : &_gkd_exported_portal_method_retrieve_secret_annotation_info_1,
370 : NULL
371 : };
372 :
373 : static const _ExtendedGDBusMethodInfo _gkd_exported_portal_method_info_retrieve_secret =
374 : {
375 : {
376 : -1,
377 : (gchar *) "RetrieveSecret",
378 : (GDBusArgInfo **) &_gkd_exported_portal_method_info_retrieve_secret_IN_ARG_pointers,
379 : (GDBusArgInfo **) &_gkd_exported_portal_method_info_retrieve_secret_OUT_ARG_pointers,
380 : (GDBusAnnotationInfo **) &_gkd_exported_portal_method_retrieve_secret_annotation_info_pointers
381 : },
382 : "handle-retrieve-secret",
383 : TRUE
384 : };
385 :
386 : static const GDBusMethodInfo * const _gkd_exported_portal_method_info_pointers[] =
387 : {
388 : &_gkd_exported_portal_method_info_retrieve_secret.parent_struct,
389 : NULL
390 : };
391 :
392 : static const _ExtendedGDBusPropertyInfo _gkd_exported_portal_property_info_version =
393 : {
394 : {
395 : -1,
396 : (gchar *) "version",
397 : (gchar *) "u",
398 : G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
399 : NULL
400 : },
401 : "version",
402 : FALSE,
403 : TRUE
404 : };
405 :
406 : static const GDBusPropertyInfo * const _gkd_exported_portal_property_info_pointers[] =
407 : {
408 : &_gkd_exported_portal_property_info_version.parent_struct,
409 : NULL
410 : };
411 :
412 : static const _ExtendedGDBusInterfaceInfo _gkd_exported_portal_interface_info =
413 : {
414 : {
415 : -1,
416 : (gchar *) "org.freedesktop.impl.portal.Secret",
417 : (GDBusMethodInfo **) &_gkd_exported_portal_method_info_pointers,
418 : NULL,
419 : (GDBusPropertyInfo **) &_gkd_exported_portal_property_info_pointers,
420 : NULL
421 : },
422 : "exported-portal",
423 : };
424 :
425 :
426 : /**
427 : * gkd_exported_portal_interface_info:
428 : *
429 : * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link> D-Bus interface.
430 : *
431 : * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
432 : */
433 : GDBusInterfaceInfo *
434 25 : gkd_exported_portal_interface_info (void)
435 : {
436 25 : return (GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct;
437 : }
438 :
439 : /**
440 : * gkd_exported_portal_override_properties:
441 : * @klass: The class structure for a #GObject derived class.
442 : * @property_id_begin: The property id to assign to the first overridden property.
443 : *
444 : * Overrides all #GObject properties in the #GkdExportedPortal interface for a concrete class.
445 : * The properties are overridden in the order they are defined.
446 : *
447 : * Returns: The last property id.
448 : */
449 : guint
450 25 : gkd_exported_portal_override_properties (GObjectClass *klass, guint property_id_begin)
451 : {
452 25 : g_object_class_override_property (klass, property_id_begin++, "version");
453 25 : return property_id_begin - 1;
454 : }
455 :
456 :
457 : inline static void
458 4 : gkd_exported_portal_method_marshal_retrieve_secret (
459 : GClosure *closure,
460 : GValue *return_value,
461 : unsigned int n_param_values,
462 : const GValue *param_values,
463 : void *invocation_hint,
464 : void *marshal_data)
465 : {
466 4 : _g_dbus_codegen_marshal_BOOLEAN__OBJECT_OBJECT_STRING_STRING_VARIANT_VARIANT (closure,
467 : return_value, n_param_values, param_values, invocation_hint, marshal_data);
468 4 : }
469 :
470 :
471 : /**
472 : * GkdExportedPortal:
473 : *
474 : * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link>.
475 : */
476 :
477 : /**
478 : * GkdExportedPortalIface:
479 : * @parent_iface: The parent interface.
480 : * @handle_retrieve_secret: Handler for the #GkdExportedPortal::handle-retrieve-secret signal.
481 : * @get_version: Getter for the #GkdExportedPortal:version property.
482 : *
483 : * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link>.
484 : */
485 :
486 : typedef GkdExportedPortalIface GkdExportedPortalInterface;
487 58 : G_DEFINE_INTERFACE (GkdExportedPortal, gkd_exported_portal, G_TYPE_OBJECT)
488 :
489 : static void
490 25 : gkd_exported_portal_default_init (GkdExportedPortalIface *iface)
491 : {
492 : /* GObject signals for incoming D-Bus method calls: */
493 : /**
494 : * GkdExportedPortal::handle-retrieve-secret:
495 : * @object: A #GkdExportedPortal.
496 : * @invocation: A #GDBusMethodInvocation.
497 : * @fd_list: (nullable): A #GUnixFDList or %NULL.
498 : * @arg_handle: Argument passed by remote caller.
499 : * @arg_app_id: Argument passed by remote caller.
500 : * @arg_fd: Argument passed by remote caller.
501 : * @arg_options: Argument passed by remote caller.
502 : *
503 : * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-impl-portal-Secret.RetrieveSecret">RetrieveSecret()</link> D-Bus method.
504 : *
505 : * 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 gkd_exported_portal_complete_retrieve_secret() or e.g. g_dbus_method_invocation_return_error() on it) and no other signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
506 : *
507 : * 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.
508 : */
509 25 : g_signal_new ("handle-retrieve-secret",
510 : G_TYPE_FROM_INTERFACE (iface),
511 : G_SIGNAL_RUN_LAST,
512 : G_STRUCT_OFFSET (GkdExportedPortalIface, handle_retrieve_secret),
513 : g_signal_accumulator_true_handled,
514 : NULL,
515 : gkd_exported_portal_method_marshal_retrieve_secret,
516 : G_TYPE_BOOLEAN,
517 : 6,
518 : G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UNIX_FD_LIST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_VARIANT);
519 :
520 : /* GObject properties for D-Bus properties: */
521 : /**
522 : * GkdExportedPortal:version:
523 : *
524 : * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-impl-portal-Secret.version">"version"</link>.
525 : *
526 : * 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.
527 : */
528 25 : g_object_interface_install_property (iface,
529 : g_param_spec_uint ("version", "version", "version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
530 25 : }
531 :
532 : /**
533 : * gkd_exported_portal_get_version: (skip)
534 : * @object: A #GkdExportedPortal.
535 : *
536 : * Gets the value of the <link linkend="gdbus-property-org-freedesktop-impl-portal-Secret.version">"version"</link> D-Bus property.
537 : *
538 : * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
539 : *
540 : * Returns: The property value.
541 : */
542 : guint
543 0 : gkd_exported_portal_get_version (GkdExportedPortal *object)
544 : {
545 0 : g_return_val_if_fail (GKD_IS_EXPORTED_PORTAL (object), 0);
546 :
547 0 : return GKD_EXPORTED_PORTAL_GET_IFACE (object)->get_version (object);
548 : }
549 :
550 : /**
551 : * gkd_exported_portal_set_version: (skip)
552 : * @object: A #GkdExportedPortal.
553 : * @value: The value to set.
554 : *
555 : * Sets the <link linkend="gdbus-property-org-freedesktop-impl-portal-Secret.version">"version"</link> D-Bus property to @value.
556 : *
557 : * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
558 : */
559 : void
560 0 : gkd_exported_portal_set_version (GkdExportedPortal *object, guint value)
561 : {
562 0 : g_object_set (G_OBJECT (object), "version", value, NULL);
563 0 : }
564 :
565 : /**
566 : * gkd_exported_portal_call_retrieve_secret:
567 : * @proxy: A #GkdExportedPortalProxy.
568 : * @arg_handle: Argument to pass with the method invocation.
569 : * @arg_app_id: Argument to pass with the method invocation.
570 : * @arg_fd: Argument to pass with the method invocation.
571 : * @arg_options: Argument to pass with the method invocation.
572 : * @fd_list: (nullable): A #GUnixFDList or %NULL.
573 : * @cancellable: (nullable): A #GCancellable or %NULL.
574 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
575 : * @user_data: User data to pass to @callback.
576 : *
577 : * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-impl-portal-Secret.RetrieveSecret">RetrieveSecret()</link> D-Bus method on @proxy.
578 : * 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()).
579 : * You can then call gkd_exported_portal_call_retrieve_secret_finish() to get the result of the operation.
580 : *
581 : * See gkd_exported_portal_call_retrieve_secret_sync() for the synchronous, blocking version of this method.
582 : */
583 : void
584 0 : gkd_exported_portal_call_retrieve_secret (
585 : GkdExportedPortal *proxy,
586 : const gchar *arg_handle,
587 : const gchar *arg_app_id,
588 : GVariant *arg_fd,
589 : GVariant *arg_options,
590 : GUnixFDList *fd_list,
591 : GCancellable *cancellable,
592 : GAsyncReadyCallback callback,
593 : gpointer user_data)
594 : {
595 0 : g_dbus_proxy_call_with_unix_fd_list (G_DBUS_PROXY (proxy),
596 : "RetrieveSecret",
597 : g_variant_new ("(os@h@a{sv})",
598 : arg_handle,
599 : arg_app_id,
600 : arg_fd,
601 : arg_options),
602 : G_DBUS_CALL_FLAGS_NONE,
603 : -1,
604 : fd_list,
605 : cancellable,
606 : callback,
607 : user_data);
608 0 : }
609 :
610 : /**
611 : * gkd_exported_portal_call_retrieve_secret_finish:
612 : * @proxy: A #GkdExportedPortalProxy.
613 : * @out_response: (out) (optional): Return location for return parameter or %NULL to ignore.
614 : * @out_results: (out) (optional): Return location for return parameter or %NULL to ignore.
615 : * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or %NULL to ignore.
616 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_portal_call_retrieve_secret().
617 : * @error: Return location for error or %NULL.
618 : *
619 : * Finishes an operation started with gkd_exported_portal_call_retrieve_secret().
620 : *
621 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
622 : */
623 : gboolean
624 0 : gkd_exported_portal_call_retrieve_secret_finish (
625 : GkdExportedPortal *proxy,
626 : guint *out_response,
627 : GVariant **out_results,
628 : GUnixFDList **out_fd_list,
629 : GAsyncResult *res,
630 : GError **error)
631 : {
632 : GVariant *_ret;
633 0 : _ret = g_dbus_proxy_call_with_unix_fd_list_finish (G_DBUS_PROXY (proxy), out_fd_list, res, error);
634 0 : if (_ret == NULL)
635 0 : goto _out;
636 0 : g_variant_get (_ret,
637 : "(u@a{sv})",
638 : out_response,
639 : out_results);
640 0 : g_variant_unref (_ret);
641 0 : _out:
642 0 : return _ret != NULL;
643 : }
644 :
645 : /**
646 : * gkd_exported_portal_call_retrieve_secret_sync:
647 : * @proxy: A #GkdExportedPortalProxy.
648 : * @arg_handle: Argument to pass with the method invocation.
649 : * @arg_app_id: Argument to pass with the method invocation.
650 : * @arg_fd: Argument to pass with the method invocation.
651 : * @arg_options: Argument to pass with the method invocation.
652 : * @fd_list: (nullable): A #GUnixFDList or %NULL.
653 : * @out_response: (out) (optional): Return location for return parameter or %NULL to ignore.
654 : * @out_results: (out) (optional): Return location for return parameter or %NULL to ignore.
655 : * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.
656 : * @cancellable: (nullable): A #GCancellable or %NULL.
657 : * @error: Return location for error or %NULL.
658 : *
659 : * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-impl-portal-Secret.RetrieveSecret">RetrieveSecret()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
660 : *
661 : * See gkd_exported_portal_call_retrieve_secret() for the asynchronous version of this method.
662 : *
663 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
664 : */
665 : gboolean
666 0 : gkd_exported_portal_call_retrieve_secret_sync (
667 : GkdExportedPortal *proxy,
668 : const gchar *arg_handle,
669 : const gchar *arg_app_id,
670 : GVariant *arg_fd,
671 : GVariant *arg_options,
672 : GUnixFDList *fd_list,
673 : guint *out_response,
674 : GVariant **out_results,
675 : GUnixFDList **out_fd_list,
676 : GCancellable *cancellable,
677 : GError **error)
678 : {
679 : GVariant *_ret;
680 0 : _ret = g_dbus_proxy_call_with_unix_fd_list_sync (G_DBUS_PROXY (proxy),
681 : "RetrieveSecret",
682 : g_variant_new ("(os@h@a{sv})",
683 : arg_handle,
684 : arg_app_id,
685 : arg_fd,
686 : arg_options),
687 : G_DBUS_CALL_FLAGS_NONE,
688 : -1,
689 : fd_list,
690 : out_fd_list,
691 : cancellable,
692 : error);
693 0 : if (_ret == NULL)
694 0 : goto _out;
695 0 : g_variant_get (_ret,
696 : "(u@a{sv})",
697 : out_response,
698 : out_results);
699 0 : g_variant_unref (_ret);
700 0 : _out:
701 0 : return _ret != NULL;
702 : }
703 :
704 : /**
705 : * gkd_exported_portal_complete_retrieve_secret:
706 : * @object: A #GkdExportedPortal.
707 : * @invocation: (transfer full): A #GDBusMethodInvocation.
708 : * @fd_list: (nullable): A #GUnixFDList or %NULL.
709 : * @response: Parameter to return.
710 : * @results: Parameter to return.
711 : *
712 : * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-impl-portal-Secret.RetrieveSecret">RetrieveSecret()</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.
713 : *
714 : * This method will free @invocation, you cannot use it afterwards.
715 : */
716 : void
717 4 : gkd_exported_portal_complete_retrieve_secret (
718 : GkdExportedPortal *object G_GNUC_UNUSED,
719 : GDBusMethodInvocation *invocation,
720 : GUnixFDList *fd_list,
721 : guint response,
722 : GVariant *results)
723 : {
724 4 : g_dbus_method_invocation_return_value_with_unix_fd_list (invocation,
725 : g_variant_new ("(u@a{sv})",
726 : response,
727 : results),
728 : fd_list);
729 4 : }
730 :
731 : /* ------------------------------------------------------------------------ */
732 :
733 : /**
734 : * GkdExportedPortalProxy:
735 : *
736 : * The #GkdExportedPortalProxy structure contains only private data and should only be accessed using the provided API.
737 : */
738 :
739 : /**
740 : * GkdExportedPortalProxyClass:
741 : * @parent_class: The parent class.
742 : *
743 : * Class structure for #GkdExportedPortalProxy.
744 : */
745 :
746 : struct _GkdExportedPortalProxyPrivate
747 : {
748 : GData *qdata;
749 : };
750 :
751 : static void gkd_exported_portal_proxy_iface_init (GkdExportedPortalIface *iface);
752 :
753 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
754 0 : G_DEFINE_TYPE_WITH_CODE (GkdExportedPortalProxy, gkd_exported_portal_proxy, G_TYPE_DBUS_PROXY,
755 : G_ADD_PRIVATE (GkdExportedPortalProxy)
756 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_PORTAL, gkd_exported_portal_proxy_iface_init))
757 :
758 : #else
759 : G_DEFINE_TYPE_WITH_CODE (GkdExportedPortalProxy, gkd_exported_portal_proxy, G_TYPE_DBUS_PROXY,
760 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_PORTAL, gkd_exported_portal_proxy_iface_init))
761 :
762 : #endif
763 : static void
764 0 : gkd_exported_portal_proxy_finalize (GObject *object)
765 : {
766 0 : GkdExportedPortalProxy *proxy = GKD_EXPORTED_PORTAL_PROXY (object);
767 0 : g_datalist_clear (&proxy->priv->qdata);
768 0 : G_OBJECT_CLASS (gkd_exported_portal_proxy_parent_class)->finalize (object);
769 0 : }
770 :
771 : static void
772 0 : gkd_exported_portal_proxy_get_property (GObject *object,
773 : guint prop_id,
774 : GValue *value,
775 : GParamSpec *pspec G_GNUC_UNUSED)
776 : {
777 : const _ExtendedGDBusPropertyInfo *info;
778 : GVariant *variant;
779 0 : g_assert (prop_id != 0 && prop_id - 1 < 1);
780 0 : info = (const _ExtendedGDBusPropertyInfo *) _gkd_exported_portal_property_info_pointers[prop_id - 1];
781 0 : variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
782 0 : if (info->use_gvariant)
783 : {
784 0 : g_value_set_variant (value, variant);
785 : }
786 : else
787 : {
788 0 : if (variant != NULL)
789 0 : g_dbus_gvariant_to_gvalue (variant, value);
790 : }
791 0 : if (variant != NULL)
792 0 : g_variant_unref (variant);
793 0 : }
794 :
795 : static void
796 0 : gkd_exported_portal_proxy_set_property_cb (GDBusProxy *proxy,
797 : GAsyncResult *res,
798 : gpointer user_data)
799 : {
800 0 : const _ExtendedGDBusPropertyInfo *info = user_data;
801 : GError *error;
802 : GVariant *_ret;
803 0 : error = NULL;
804 0 : _ret = g_dbus_proxy_call_finish (proxy, res, &error);
805 0 : if (!_ret)
806 : {
807 0 : g_warning ("Error setting property '%s' on interface org.freedesktop.impl.portal.Secret: %s (%s, %d)",
808 : info->parent_struct.name,
809 : error->message, g_quark_to_string (error->domain), error->code);
810 0 : g_error_free (error);
811 : }
812 : else
813 : {
814 0 : g_variant_unref (_ret);
815 : }
816 0 : }
817 :
818 : static void
819 0 : gkd_exported_portal_proxy_set_property (GObject *object,
820 : guint prop_id,
821 : const GValue *value,
822 : GParamSpec *pspec G_GNUC_UNUSED)
823 : {
824 : const _ExtendedGDBusPropertyInfo *info;
825 : GVariant *variant;
826 0 : g_assert (prop_id != 0 && prop_id - 1 < 1);
827 0 : info = (const _ExtendedGDBusPropertyInfo *) _gkd_exported_portal_property_info_pointers[prop_id - 1];
828 0 : variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
829 0 : g_dbus_proxy_call (G_DBUS_PROXY (object),
830 : "org.freedesktop.DBus.Properties.Set",
831 0 : g_variant_new ("(ssv)", "org.freedesktop.impl.portal.Secret", info->parent_struct.name, variant),
832 : G_DBUS_CALL_FLAGS_NONE,
833 : -1,
834 0 : NULL, (GAsyncReadyCallback) gkd_exported_portal_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
835 0 : g_variant_unref (variant);
836 0 : }
837 :
838 : static void
839 0 : gkd_exported_portal_proxy_g_signal (GDBusProxy *proxy,
840 : const gchar *sender_name G_GNUC_UNUSED,
841 : const gchar *signal_name,
842 : GVariant *parameters)
843 : {
844 : _ExtendedGDBusSignalInfo *info;
845 : GVariantIter iter;
846 : GVariant *child;
847 : GValue *paramv;
848 : gsize num_params;
849 : gsize n;
850 : guint signal_id;
851 0 : info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct, signal_name);
852 0 : if (info == NULL)
853 0 : return;
854 0 : num_params = g_variant_n_children (parameters);
855 0 : paramv = g_new0 (GValue, num_params + 1);
856 0 : g_value_init (¶mv[0], GKD_TYPE_EXPORTED_PORTAL);
857 0 : g_value_set_object (¶mv[0], proxy);
858 0 : g_variant_iter_init (&iter, parameters);
859 0 : n = 1;
860 0 : while ((child = g_variant_iter_next_value (&iter)) != NULL)
861 : {
862 0 : _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
863 0 : if (arg_info->use_gvariant)
864 : {
865 0 : g_value_init (¶mv[n], G_TYPE_VARIANT);
866 0 : g_value_set_variant (¶mv[n], child);
867 0 : n++;
868 : }
869 : else
870 0 : g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
871 0 : g_variant_unref (child);
872 : }
873 0 : signal_id = g_signal_lookup (info->signal_name, GKD_TYPE_EXPORTED_PORTAL);
874 0 : g_signal_emitv (paramv, signal_id, 0, NULL);
875 0 : for (n = 0; n < num_params + 1; n++)
876 0 : g_value_unset (¶mv[n]);
877 0 : g_free (paramv);
878 : }
879 :
880 : static void
881 0 : gkd_exported_portal_proxy_g_properties_changed (GDBusProxy *_proxy,
882 : GVariant *changed_properties,
883 : const gchar *const *invalidated_properties)
884 : {
885 0 : GkdExportedPortalProxy *proxy = GKD_EXPORTED_PORTAL_PROXY (_proxy);
886 : guint n;
887 : const gchar *key;
888 : GVariantIter *iter;
889 : _ExtendedGDBusPropertyInfo *info;
890 0 : g_variant_get (changed_properties, "a{sv}", &iter);
891 0 : while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
892 : {
893 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct, key);
894 0 : g_datalist_remove_data (&proxy->priv->qdata, key);
895 0 : if (info != NULL)
896 0 : g_object_notify (G_OBJECT (proxy), info->hyphen_name);
897 : }
898 0 : g_variant_iter_free (iter);
899 0 : for (n = 0; invalidated_properties[n] != NULL; n++)
900 : {
901 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct, invalidated_properties[n]);
902 0 : g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
903 0 : if (info != NULL)
904 0 : g_object_notify (G_OBJECT (proxy), info->hyphen_name);
905 : }
906 0 : }
907 :
908 : static guint
909 0 : gkd_exported_portal_proxy_get_version (GkdExportedPortal *object)
910 : {
911 0 : GkdExportedPortalProxy *proxy = GKD_EXPORTED_PORTAL_PROXY (object);
912 : GVariant *variant;
913 0 : guint value = 0;
914 0 : variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "version");
915 0 : if (variant != NULL)
916 : {
917 0 : value = g_variant_get_uint32 (variant);
918 0 : g_variant_unref (variant);
919 : }
920 0 : return value;
921 : }
922 :
923 : static void
924 0 : gkd_exported_portal_proxy_init (GkdExportedPortalProxy *proxy)
925 : {
926 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
927 0 : proxy->priv = gkd_exported_portal_proxy_get_instance_private (proxy);
928 : #else
929 : proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GKD_TYPE_EXPORTED_PORTAL_PROXY, GkdExportedPortalProxyPrivate);
930 : #endif
931 :
932 0 : g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gkd_exported_portal_interface_info ());
933 0 : }
934 :
935 : static void
936 0 : gkd_exported_portal_proxy_class_init (GkdExportedPortalProxyClass *klass)
937 : {
938 : GObjectClass *gobject_class;
939 : GDBusProxyClass *proxy_class;
940 :
941 0 : gobject_class = G_OBJECT_CLASS (klass);
942 0 : gobject_class->finalize = gkd_exported_portal_proxy_finalize;
943 0 : gobject_class->get_property = gkd_exported_portal_proxy_get_property;
944 0 : gobject_class->set_property = gkd_exported_portal_proxy_set_property;
945 :
946 0 : proxy_class = G_DBUS_PROXY_CLASS (klass);
947 0 : proxy_class->g_signal = gkd_exported_portal_proxy_g_signal;
948 0 : proxy_class->g_properties_changed = gkd_exported_portal_proxy_g_properties_changed;
949 :
950 0 : gkd_exported_portal_override_properties (gobject_class, 1);
951 :
952 : #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
953 : g_type_class_add_private (klass, sizeof (GkdExportedPortalProxyPrivate));
954 : #endif
955 0 : }
956 :
957 : static void
958 0 : gkd_exported_portal_proxy_iface_init (GkdExportedPortalIface *iface)
959 : {
960 0 : iface->get_version = gkd_exported_portal_proxy_get_version;
961 0 : }
962 :
963 : /**
964 : * gkd_exported_portal_proxy_new:
965 : * @connection: A #GDBusConnection.
966 : * @flags: Flags from the #GDBusProxyFlags enumeration.
967 : * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
968 : * @object_path: An object path.
969 : * @cancellable: (nullable): A #GCancellable or %NULL.
970 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
971 : * @user_data: User data to pass to @callback.
972 : *
973 : * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link>. See g_dbus_proxy_new() for more details.
974 : *
975 : * 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()).
976 : * You can then call gkd_exported_portal_proxy_new_finish() to get the result of the operation.
977 : *
978 : * See gkd_exported_portal_proxy_new_sync() for the synchronous, blocking version of this constructor.
979 : */
980 : void
981 0 : gkd_exported_portal_proxy_new (
982 : GDBusConnection *connection,
983 : GDBusProxyFlags flags,
984 : const gchar *name,
985 : const gchar *object_path,
986 : GCancellable *cancellable,
987 : GAsyncReadyCallback callback,
988 : gpointer user_data)
989 : {
990 0 : g_async_initable_new_async (GKD_TYPE_EXPORTED_PORTAL_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.impl.portal.Secret", NULL);
991 0 : }
992 :
993 : /**
994 : * gkd_exported_portal_proxy_new_finish:
995 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_portal_proxy_new().
996 : * @error: Return location for error or %NULL
997 : *
998 : * Finishes an operation started with gkd_exported_portal_proxy_new().
999 : *
1000 : * Returns: (transfer full) (type GkdExportedPortalProxy): The constructed proxy object or %NULL if @error is set.
1001 : */
1002 : GkdExportedPortal *
1003 0 : gkd_exported_portal_proxy_new_finish (
1004 : GAsyncResult *res,
1005 : GError **error)
1006 : {
1007 : GObject *ret;
1008 : GObject *source_object;
1009 0 : source_object = g_async_result_get_source_object (res);
1010 0 : ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1011 0 : g_object_unref (source_object);
1012 0 : if (ret != NULL)
1013 0 : return GKD_EXPORTED_PORTAL (ret);
1014 : else
1015 0 : return NULL;
1016 : }
1017 :
1018 : /**
1019 : * gkd_exported_portal_proxy_new_sync:
1020 : * @connection: A #GDBusConnection.
1021 : * @flags: Flags from the #GDBusProxyFlags enumeration.
1022 : * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1023 : * @object_path: An object path.
1024 : * @cancellable: (nullable): A #GCancellable or %NULL.
1025 : * @error: Return location for error or %NULL
1026 : *
1027 : * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link>. See g_dbus_proxy_new_sync() for more details.
1028 : *
1029 : * The calling thread is blocked until a reply is received.
1030 : *
1031 : * See gkd_exported_portal_proxy_new() for the asynchronous version of this constructor.
1032 : *
1033 : * Returns: (transfer full) (type GkdExportedPortalProxy): The constructed proxy object or %NULL if @error is set.
1034 : */
1035 : GkdExportedPortal *
1036 0 : gkd_exported_portal_proxy_new_sync (
1037 : GDBusConnection *connection,
1038 : GDBusProxyFlags flags,
1039 : const gchar *name,
1040 : const gchar *object_path,
1041 : GCancellable *cancellable,
1042 : GError **error)
1043 : {
1044 : GInitable *ret;
1045 0 : ret = g_initable_new (GKD_TYPE_EXPORTED_PORTAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.impl.portal.Secret", NULL);
1046 0 : if (ret != NULL)
1047 0 : return GKD_EXPORTED_PORTAL (ret);
1048 : else
1049 0 : return NULL;
1050 : }
1051 :
1052 :
1053 : /**
1054 : * gkd_exported_portal_proxy_new_for_bus:
1055 : * @bus_type: A #GBusType.
1056 : * @flags: Flags from the #GDBusProxyFlags enumeration.
1057 : * @name: A bus name (well-known or unique).
1058 : * @object_path: An object path.
1059 : * @cancellable: (nullable): A #GCancellable or %NULL.
1060 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1061 : * @user_data: User data to pass to @callback.
1062 : *
1063 : * Like gkd_exported_portal_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1064 : *
1065 : * 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()).
1066 : * You can then call gkd_exported_portal_proxy_new_for_bus_finish() to get the result of the operation.
1067 : *
1068 : * See gkd_exported_portal_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1069 : */
1070 : void
1071 0 : gkd_exported_portal_proxy_new_for_bus (
1072 : GBusType bus_type,
1073 : GDBusProxyFlags flags,
1074 : const gchar *name,
1075 : const gchar *object_path,
1076 : GCancellable *cancellable,
1077 : GAsyncReadyCallback callback,
1078 : gpointer user_data)
1079 : {
1080 0 : g_async_initable_new_async (GKD_TYPE_EXPORTED_PORTAL_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.impl.portal.Secret", NULL);
1081 0 : }
1082 :
1083 : /**
1084 : * gkd_exported_portal_proxy_new_for_bus_finish:
1085 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_portal_proxy_new_for_bus().
1086 : * @error: Return location for error or %NULL
1087 : *
1088 : * Finishes an operation started with gkd_exported_portal_proxy_new_for_bus().
1089 : *
1090 : * Returns: (transfer full) (type GkdExportedPortalProxy): The constructed proxy object or %NULL if @error is set.
1091 : */
1092 : GkdExportedPortal *
1093 0 : gkd_exported_portal_proxy_new_for_bus_finish (
1094 : GAsyncResult *res,
1095 : GError **error)
1096 : {
1097 : GObject *ret;
1098 : GObject *source_object;
1099 0 : source_object = g_async_result_get_source_object (res);
1100 0 : ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1101 0 : g_object_unref (source_object);
1102 0 : if (ret != NULL)
1103 0 : return GKD_EXPORTED_PORTAL (ret);
1104 : else
1105 0 : return NULL;
1106 : }
1107 :
1108 : /**
1109 : * gkd_exported_portal_proxy_new_for_bus_sync:
1110 : * @bus_type: A #GBusType.
1111 : * @flags: Flags from the #GDBusProxyFlags enumeration.
1112 : * @name: A bus name (well-known or unique).
1113 : * @object_path: An object path.
1114 : * @cancellable: (nullable): A #GCancellable or %NULL.
1115 : * @error: Return location for error or %NULL
1116 : *
1117 : * Like gkd_exported_portal_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1118 : *
1119 : * The calling thread is blocked until a reply is received.
1120 : *
1121 : * See gkd_exported_portal_proxy_new_for_bus() for the asynchronous version of this constructor.
1122 : *
1123 : * Returns: (transfer full) (type GkdExportedPortalProxy): The constructed proxy object or %NULL if @error is set.
1124 : */
1125 : GkdExportedPortal *
1126 0 : gkd_exported_portal_proxy_new_for_bus_sync (
1127 : GBusType bus_type,
1128 : GDBusProxyFlags flags,
1129 : const gchar *name,
1130 : const gchar *object_path,
1131 : GCancellable *cancellable,
1132 : GError **error)
1133 : {
1134 : GInitable *ret;
1135 0 : ret = g_initable_new (GKD_TYPE_EXPORTED_PORTAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.impl.portal.Secret", NULL);
1136 0 : if (ret != NULL)
1137 0 : return GKD_EXPORTED_PORTAL (ret);
1138 : else
1139 0 : return NULL;
1140 : }
1141 :
1142 :
1143 : /* ------------------------------------------------------------------------ */
1144 :
1145 : /**
1146 : * GkdExportedPortalSkeleton:
1147 : *
1148 : * The #GkdExportedPortalSkeleton structure contains only private data and should only be accessed using the provided API.
1149 : */
1150 :
1151 : /**
1152 : * GkdExportedPortalSkeletonClass:
1153 : * @parent_class: The parent class.
1154 : *
1155 : * Class structure for #GkdExportedPortalSkeleton.
1156 : */
1157 :
1158 : struct _GkdExportedPortalSkeletonPrivate
1159 : {
1160 : GValue *properties;
1161 : GList *changed_properties;
1162 : GSource *changed_properties_idle_source;
1163 : GMainContext *context;
1164 : GMutex lock;
1165 : };
1166 :
1167 : static void
1168 4 : _gkd_exported_portal_skeleton_handle_method_call (
1169 : GDBusConnection *connection G_GNUC_UNUSED,
1170 : const gchar *sender G_GNUC_UNUSED,
1171 : const gchar *object_path G_GNUC_UNUSED,
1172 : const gchar *interface_name,
1173 : const gchar *method_name,
1174 : GVariant *parameters,
1175 : GDBusMethodInvocation *invocation,
1176 : gpointer user_data)
1177 : {
1178 4 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (user_data);
1179 : _ExtendedGDBusMethodInfo *info;
1180 : GVariantIter iter;
1181 : GVariant *child;
1182 : GValue *paramv;
1183 : gsize num_params;
1184 : guint num_extra;
1185 : gsize n;
1186 : guint signal_id;
1187 4 : GValue return_value = G_VALUE_INIT;
1188 4 : info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1189 4 : g_assert (info != NULL);
1190 4 : num_params = g_variant_n_children (parameters);
1191 4 : num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1192 4 : n = 0;
1193 4 : g_value_init (¶mv[n], GKD_TYPE_EXPORTED_PORTAL);
1194 4 : g_value_set_object (¶mv[n++], skeleton);
1195 4 : g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1196 4 : g_value_set_object (¶mv[n++], invocation);
1197 4 : if (info->pass_fdlist)
1198 : {
1199 : #ifdef G_OS_UNIX
1200 4 : g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1201 4 : g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1202 : #else
1203 : g_assert_not_reached ();
1204 : #endif
1205 : }
1206 4 : g_variant_iter_init (&iter, parameters);
1207 20 : while ((child = g_variant_iter_next_value (&iter)) != NULL)
1208 : {
1209 16 : _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1210 16 : if (arg_info->use_gvariant)
1211 : {
1212 0 : g_value_init (¶mv[n], G_TYPE_VARIANT);
1213 0 : g_value_set_variant (¶mv[n], child);
1214 0 : n++;
1215 : }
1216 : else
1217 16 : g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1218 16 : g_variant_unref (child);
1219 : }
1220 4 : signal_id = g_signal_lookup (info->signal_name, GKD_TYPE_EXPORTED_PORTAL);
1221 4 : g_value_init (&return_value, G_TYPE_BOOLEAN);
1222 4 : g_signal_emitv (paramv, signal_id, 0, &return_value);
1223 4 : if (!g_value_get_boolean (&return_value))
1224 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);
1225 4 : g_value_unset (&return_value);
1226 32 : for (n = 0; n < num_params + num_extra; n++)
1227 28 : g_value_unset (¶mv[n]);
1228 4 : g_free (paramv);
1229 4 : }
1230 :
1231 : static GVariant *
1232 0 : _gkd_exported_portal_skeleton_handle_get_property (
1233 : GDBusConnection *connection G_GNUC_UNUSED,
1234 : const gchar *sender G_GNUC_UNUSED,
1235 : const gchar *object_path G_GNUC_UNUSED,
1236 : const gchar *interface_name G_GNUC_UNUSED,
1237 : const gchar *property_name,
1238 : GError **error,
1239 : gpointer user_data)
1240 : {
1241 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (user_data);
1242 0 : GValue value = G_VALUE_INIT;
1243 : GParamSpec *pspec;
1244 : _ExtendedGDBusPropertyInfo *info;
1245 : GVariant *ret;
1246 0 : ret = NULL;
1247 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct, property_name);
1248 0 : g_assert (info != NULL);
1249 0 : pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1250 0 : if (pspec == NULL)
1251 : {
1252 0 : g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1253 : }
1254 : else
1255 : {
1256 0 : g_value_init (&value, pspec->value_type);
1257 0 : g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1258 0 : ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1259 0 : g_value_unset (&value);
1260 : }
1261 0 : return ret;
1262 : }
1263 :
1264 : static gboolean
1265 0 : _gkd_exported_portal_skeleton_handle_set_property (
1266 : GDBusConnection *connection G_GNUC_UNUSED,
1267 : const gchar *sender G_GNUC_UNUSED,
1268 : const gchar *object_path G_GNUC_UNUSED,
1269 : const gchar *interface_name G_GNUC_UNUSED,
1270 : const gchar *property_name,
1271 : GVariant *variant,
1272 : GError **error,
1273 : gpointer user_data)
1274 : {
1275 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (user_data);
1276 0 : GValue value = G_VALUE_INIT;
1277 : GParamSpec *pspec;
1278 : _ExtendedGDBusPropertyInfo *info;
1279 : gboolean ret;
1280 0 : ret = FALSE;
1281 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_portal_interface_info.parent_struct, property_name);
1282 0 : g_assert (info != NULL);
1283 0 : pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1284 0 : if (pspec == NULL)
1285 : {
1286 0 : g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1287 : }
1288 : else
1289 : {
1290 0 : if (info->use_gvariant)
1291 0 : g_value_set_variant (&value, variant);
1292 : else
1293 0 : g_dbus_gvariant_to_gvalue (variant, &value);
1294 0 : g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1295 0 : g_value_unset (&value);
1296 0 : ret = TRUE;
1297 : }
1298 0 : return ret;
1299 : }
1300 :
1301 : static const GDBusInterfaceVTable _gkd_exported_portal_skeleton_vtable =
1302 : {
1303 : _gkd_exported_portal_skeleton_handle_method_call,
1304 : _gkd_exported_portal_skeleton_handle_get_property,
1305 : _gkd_exported_portal_skeleton_handle_set_property,
1306 : {NULL}
1307 : };
1308 :
1309 : static GDBusInterfaceInfo *
1310 25 : gkd_exported_portal_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1311 : {
1312 25 : return gkd_exported_portal_interface_info ();
1313 : }
1314 :
1315 : static GDBusInterfaceVTable *
1316 29 : gkd_exported_portal_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1317 : {
1318 29 : return (GDBusInterfaceVTable *) &_gkd_exported_portal_skeleton_vtable;
1319 : }
1320 :
1321 : static GVariant *
1322 0 : gkd_exported_portal_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1323 : {
1324 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (_skeleton);
1325 :
1326 : GVariantBuilder builder;
1327 : guint n;
1328 0 : g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1329 0 : if (_gkd_exported_portal_interface_info.parent_struct.properties == NULL)
1330 0 : goto out;
1331 0 : for (n = 0; _gkd_exported_portal_interface_info.parent_struct.properties[n] != NULL; n++)
1332 : {
1333 0 : GDBusPropertyInfo *info = _gkd_exported_portal_interface_info.parent_struct.properties[n];
1334 0 : if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1335 : {
1336 : GVariant *value;
1337 0 : value = _gkd_exported_portal_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.impl.portal.Secret", info->name, NULL, skeleton);
1338 0 : if (value != NULL)
1339 : {
1340 0 : g_variant_take_ref (value);
1341 0 : g_variant_builder_add (&builder, "{sv}", info->name, value);
1342 0 : g_variant_unref (value);
1343 : }
1344 : }
1345 : }
1346 0 : out:
1347 0 : return g_variant_builder_end (&builder);
1348 : }
1349 :
1350 : static gboolean _gkd_exported_portal_emit_changed (gpointer user_data);
1351 :
1352 : static void
1353 0 : gkd_exported_portal_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1354 : {
1355 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (_skeleton);
1356 0 : gboolean emit_changed = FALSE;
1357 :
1358 0 : g_mutex_lock (&skeleton->priv->lock);
1359 0 : if (skeleton->priv->changed_properties_idle_source != NULL)
1360 : {
1361 0 : g_source_destroy (skeleton->priv->changed_properties_idle_source);
1362 0 : skeleton->priv->changed_properties_idle_source = NULL;
1363 0 : emit_changed = TRUE;
1364 : }
1365 0 : g_mutex_unlock (&skeleton->priv->lock);
1366 :
1367 0 : if (emit_changed)
1368 0 : _gkd_exported_portal_emit_changed (skeleton);
1369 0 : }
1370 :
1371 : static void gkd_exported_portal_skeleton_iface_init (GkdExportedPortalIface *iface);
1372 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1373 129 : G_DEFINE_TYPE_WITH_CODE (GkdExportedPortalSkeleton, gkd_exported_portal_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1374 : G_ADD_PRIVATE (GkdExportedPortalSkeleton)
1375 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_PORTAL, gkd_exported_portal_skeleton_iface_init))
1376 :
1377 : #else
1378 : G_DEFINE_TYPE_WITH_CODE (GkdExportedPortalSkeleton, gkd_exported_portal_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1379 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_PORTAL, gkd_exported_portal_skeleton_iface_init))
1380 :
1381 : #endif
1382 : static void
1383 25 : gkd_exported_portal_skeleton_finalize (GObject *object)
1384 : {
1385 25 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (object);
1386 : guint n;
1387 50 : for (n = 0; n < 1; n++)
1388 25 : g_value_unset (&skeleton->priv->properties[n]);
1389 25 : g_free (skeleton->priv->properties);
1390 25 : g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1391 25 : if (skeleton->priv->changed_properties_idle_source != NULL)
1392 0 : g_source_destroy (skeleton->priv->changed_properties_idle_source);
1393 25 : g_main_context_unref (skeleton->priv->context);
1394 25 : g_mutex_clear (&skeleton->priv->lock);
1395 25 : G_OBJECT_CLASS (gkd_exported_portal_skeleton_parent_class)->finalize (object);
1396 25 : }
1397 :
1398 : static void
1399 0 : gkd_exported_portal_skeleton_get_property (GObject *object,
1400 : guint prop_id,
1401 : GValue *value,
1402 : GParamSpec *pspec G_GNUC_UNUSED)
1403 : {
1404 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (object);
1405 0 : g_assert (prop_id != 0 && prop_id - 1 < 1);
1406 0 : g_mutex_lock (&skeleton->priv->lock);
1407 0 : g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1408 0 : g_mutex_unlock (&skeleton->priv->lock);
1409 0 : }
1410 :
1411 : static gboolean
1412 0 : _gkd_exported_portal_emit_changed (gpointer user_data)
1413 : {
1414 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (user_data);
1415 : GList *l;
1416 : GVariantBuilder builder;
1417 : GVariantBuilder invalidated_builder;
1418 : guint num_changes;
1419 :
1420 0 : g_mutex_lock (&skeleton->priv->lock);
1421 0 : g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1422 0 : g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1423 0 : for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1424 : {
1425 0 : ChangedProperty *cp = l->data;
1426 : GVariant *variant;
1427 : const GValue *cur_value;
1428 :
1429 0 : cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1430 0 : if (!_g_value_equal (cur_value, &cp->orig_value))
1431 : {
1432 0 : variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1433 0 : g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1434 0 : g_variant_unref (variant);
1435 0 : num_changes++;
1436 : }
1437 : }
1438 0 : if (num_changes > 0)
1439 : {
1440 : GList *connections, *ll;
1441 : GVariant *signal_variant;
1442 0 : signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.impl.portal.Secret",
1443 : &builder, &invalidated_builder));
1444 0 : connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1445 0 : for (ll = connections; ll != NULL; ll = ll->next)
1446 : {
1447 0 : GDBusConnection *connection = ll->data;
1448 :
1449 0 : g_dbus_connection_emit_signal (connection,
1450 0 : NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1451 : "org.freedesktop.DBus.Properties",
1452 : "PropertiesChanged",
1453 : signal_variant,
1454 : NULL);
1455 : }
1456 0 : g_variant_unref (signal_variant);
1457 0 : g_list_free_full (connections, g_object_unref);
1458 : }
1459 : else
1460 : {
1461 0 : g_variant_builder_clear (&builder);
1462 0 : g_variant_builder_clear (&invalidated_builder);
1463 : }
1464 0 : g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1465 0 : skeleton->priv->changed_properties = NULL;
1466 0 : skeleton->priv->changed_properties_idle_source = NULL;
1467 0 : g_mutex_unlock (&skeleton->priv->lock);
1468 0 : return FALSE;
1469 : }
1470 :
1471 : static void
1472 0 : _gkd_exported_portal_schedule_emit_changed (GkdExportedPortalSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1473 : {
1474 : ChangedProperty *cp;
1475 : GList *l;
1476 0 : cp = NULL;
1477 0 : for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1478 : {
1479 0 : ChangedProperty *i_cp = l->data;
1480 0 : if (i_cp->info == info)
1481 : {
1482 0 : cp = i_cp;
1483 0 : break;
1484 : }
1485 : }
1486 0 : if (cp == NULL)
1487 : {
1488 0 : cp = g_new0 (ChangedProperty, 1);
1489 0 : cp->prop_id = prop_id;
1490 0 : cp->info = info;
1491 0 : skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1492 0 : g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1493 0 : g_value_copy (orig_value, &cp->orig_value);
1494 : }
1495 0 : }
1496 :
1497 : static void
1498 0 : gkd_exported_portal_skeleton_notify (GObject *object,
1499 : GParamSpec *pspec G_GNUC_UNUSED)
1500 : {
1501 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (object);
1502 0 : g_mutex_lock (&skeleton->priv->lock);
1503 0 : if (skeleton->priv->changed_properties != NULL &&
1504 0 : skeleton->priv->changed_properties_idle_source == NULL)
1505 : {
1506 0 : skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1507 0 : g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1508 0 : g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gkd_exported_portal_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1509 0 : g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gkd_exported_portal_emit_changed");
1510 0 : g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1511 0 : g_source_unref (skeleton->priv->changed_properties_idle_source);
1512 : }
1513 0 : g_mutex_unlock (&skeleton->priv->lock);
1514 0 : }
1515 :
1516 : static void
1517 0 : gkd_exported_portal_skeleton_set_property (GObject *object,
1518 : guint prop_id,
1519 : const GValue *value,
1520 : GParamSpec *pspec)
1521 : {
1522 : const _ExtendedGDBusPropertyInfo *info;
1523 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (object);
1524 0 : g_assert (prop_id != 0 && prop_id - 1 < 1);
1525 0 : info = (const _ExtendedGDBusPropertyInfo *) _gkd_exported_portal_property_info_pointers[prop_id - 1];
1526 0 : g_mutex_lock (&skeleton->priv->lock);
1527 0 : g_object_freeze_notify (object);
1528 0 : if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1529 : {
1530 0 : if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
1531 : info->emits_changed_signal)
1532 0 : _gkd_exported_portal_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
1533 0 : g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1534 0 : g_object_notify_by_pspec (object, pspec);
1535 : }
1536 0 : g_mutex_unlock (&skeleton->priv->lock);
1537 0 : g_object_thaw_notify (object);
1538 0 : }
1539 :
1540 : static void
1541 25 : gkd_exported_portal_skeleton_init (GkdExportedPortalSkeleton *skeleton)
1542 : {
1543 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1544 25 : skeleton->priv = gkd_exported_portal_skeleton_get_instance_private (skeleton);
1545 : #else
1546 : skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GKD_TYPE_EXPORTED_PORTAL_SKELETON, GkdExportedPortalSkeletonPrivate);
1547 : #endif
1548 :
1549 25 : g_mutex_init (&skeleton->priv->lock);
1550 25 : skeleton->priv->context = g_main_context_ref_thread_default ();
1551 25 : skeleton->priv->properties = g_new0 (GValue, 1);
1552 25 : g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
1553 25 : }
1554 :
1555 : static guint
1556 0 : gkd_exported_portal_skeleton_get_version (GkdExportedPortal *object)
1557 : {
1558 0 : GkdExportedPortalSkeleton *skeleton = GKD_EXPORTED_PORTAL_SKELETON (object);
1559 : guint value;
1560 0 : g_mutex_lock (&skeleton->priv->lock);
1561 0 : value = g_marshal_value_peek_uint (&(skeleton->priv->properties[0]));
1562 0 : g_mutex_unlock (&skeleton->priv->lock);
1563 0 : return value;
1564 : }
1565 :
1566 : static void
1567 25 : gkd_exported_portal_skeleton_class_init (GkdExportedPortalSkeletonClass *klass)
1568 : {
1569 : GObjectClass *gobject_class;
1570 : GDBusInterfaceSkeletonClass *skeleton_class;
1571 :
1572 25 : gobject_class = G_OBJECT_CLASS (klass);
1573 25 : gobject_class->finalize = gkd_exported_portal_skeleton_finalize;
1574 25 : gobject_class->get_property = gkd_exported_portal_skeleton_get_property;
1575 25 : gobject_class->set_property = gkd_exported_portal_skeleton_set_property;
1576 25 : gobject_class->notify = gkd_exported_portal_skeleton_notify;
1577 :
1578 :
1579 25 : gkd_exported_portal_override_properties (gobject_class, 1);
1580 :
1581 25 : skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1582 25 : skeleton_class->get_info = gkd_exported_portal_skeleton_dbus_interface_get_info;
1583 25 : skeleton_class->get_properties = gkd_exported_portal_skeleton_dbus_interface_get_properties;
1584 25 : skeleton_class->flush = gkd_exported_portal_skeleton_dbus_interface_flush;
1585 25 : skeleton_class->get_vtable = gkd_exported_portal_skeleton_dbus_interface_get_vtable;
1586 :
1587 : #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1588 : g_type_class_add_private (klass, sizeof (GkdExportedPortalSkeletonPrivate));
1589 : #endif
1590 25 : }
1591 :
1592 : static void
1593 25 : gkd_exported_portal_skeleton_iface_init (GkdExportedPortalIface *iface)
1594 : {
1595 25 : iface->get_version = gkd_exported_portal_skeleton_get_version;
1596 25 : }
1597 :
1598 : /**
1599 : * gkd_exported_portal_skeleton_new:
1600 : *
1601 : * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-impl-portal-Secret.top_of_page">org.freedesktop.impl.portal.Secret</link>.
1602 : *
1603 : * Returns: (transfer full) (type GkdExportedPortalSkeleton): The skeleton object.
1604 : */
1605 : GkdExportedPortal *
1606 25 : gkd_exported_portal_skeleton_new (void)
1607 : {
1608 25 : return GKD_EXPORTED_PORTAL (g_object_new (GKD_TYPE_EXPORTED_PORTAL_SKELETON, NULL));
1609 : }
1610 :
|