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-daemon-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 0 : _g_dbus_codegen_marshal_BOOLEAN__OBJECT (
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_ObjectFunc)
210 : (void *data1,
211 : GDBusMethodInvocation *arg_method_invocation,
212 : void *data2);
213 : _GDbusCodegenMarshalBoolean_ObjectFunc callback;
214 0 : GCClosure *cc = (GCClosure*) closure;
215 : void *data1, *data2;
216 : gboolean v_return;
217 :
218 0 : g_return_if_fail (return_value != NULL);
219 0 : g_return_if_fail (n_param_values == 2);
220 :
221 0 : if (G_CCLOSURE_SWAP_DATA (closure))
222 : {
223 0 : data1 = closure->data;
224 0 : data2 = g_value_peek_pointer (param_values + 0);
225 : }
226 : else
227 : {
228 0 : data1 = g_value_peek_pointer (param_values + 0);
229 0 : data2 = closure->data;
230 : }
231 :
232 0 : callback = (_GDbusCodegenMarshalBoolean_ObjectFunc)
233 0 : (marshal_data ? marshal_data : cc->callback);
234 :
235 : v_return =
236 0 : callback (data1,
237 0 : g_marshal_value_peek_object (param_values + 1),
238 : data2);
239 :
240 0 : g_value_set_boolean (return_value, v_return);
241 : }
242 :
243 : /* ------------------------------------------------------------------------
244 : * Code for interface org.gnome.keyring.Daemon
245 : * ------------------------------------------------------------------------
246 : */
247 :
248 : /**
249 : * SECTION:GkdExportedDaemon
250 : * @title: GkdExportedDaemon
251 : * @short_description: Generated C code for the org.gnome.keyring.Daemon D-Bus interface
252 : *
253 : * This section contains code for working with the <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link> D-Bus interface in C.
254 : */
255 :
256 : /* ---- Introspection data for org.gnome.keyring.Daemon ---- */
257 :
258 : static const _ExtendedGDBusArgInfo _gkd_exported_daemon_method_info_get_environment_OUT_ARG_Environment =
259 : {
260 : {
261 : -1,
262 : (gchar *) "Environment",
263 : (gchar *) "a{ss}",
264 : NULL
265 : },
266 : FALSE
267 : };
268 :
269 : static const GDBusArgInfo * const _gkd_exported_daemon_method_info_get_environment_OUT_ARG_pointers[] =
270 : {
271 : &_gkd_exported_daemon_method_info_get_environment_OUT_ARG_Environment.parent_struct,
272 : NULL
273 : };
274 :
275 : static const _ExtendedGDBusMethodInfo _gkd_exported_daemon_method_info_get_environment =
276 : {
277 : {
278 : -1,
279 : (gchar *) "GetEnvironment",
280 : NULL,
281 : (GDBusArgInfo **) &_gkd_exported_daemon_method_info_get_environment_OUT_ARG_pointers,
282 : NULL
283 : },
284 : "handle-get-environment",
285 : FALSE
286 : };
287 :
288 : static const _ExtendedGDBusArgInfo _gkd_exported_daemon_method_info_get_control_directory_OUT_ARG_ControlDirectory =
289 : {
290 : {
291 : -1,
292 : (gchar *) "ControlDirectory",
293 : (gchar *) "s",
294 : NULL
295 : },
296 : FALSE
297 : };
298 :
299 : static const GDBusArgInfo * const _gkd_exported_daemon_method_info_get_control_directory_OUT_ARG_pointers[] =
300 : {
301 : &_gkd_exported_daemon_method_info_get_control_directory_OUT_ARG_ControlDirectory.parent_struct,
302 : NULL
303 : };
304 :
305 : static const _ExtendedGDBusMethodInfo _gkd_exported_daemon_method_info_get_control_directory =
306 : {
307 : {
308 : -1,
309 : (gchar *) "GetControlDirectory",
310 : NULL,
311 : (GDBusArgInfo **) &_gkd_exported_daemon_method_info_get_control_directory_OUT_ARG_pointers,
312 : NULL
313 : },
314 : "handle-get-control-directory",
315 : FALSE
316 : };
317 :
318 : static const GDBusMethodInfo * const _gkd_exported_daemon_method_info_pointers[] =
319 : {
320 : &_gkd_exported_daemon_method_info_get_environment.parent_struct,
321 : &_gkd_exported_daemon_method_info_get_control_directory.parent_struct,
322 : NULL
323 : };
324 :
325 : static const _ExtendedGDBusInterfaceInfo _gkd_exported_daemon_interface_info =
326 : {
327 : {
328 : -1,
329 : (gchar *) "org.gnome.keyring.Daemon",
330 : (GDBusMethodInfo **) &_gkd_exported_daemon_method_info_pointers,
331 : NULL,
332 : NULL,
333 : NULL
334 : },
335 : "exported-daemon",
336 : };
337 :
338 :
339 : /**
340 : * gkd_exported_daemon_interface_info:
341 : *
342 : * Gets a machine-readable description of the <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link> D-Bus interface.
343 : *
344 : * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
345 : */
346 : GDBusInterfaceInfo *
347 27 : gkd_exported_daemon_interface_info (void)
348 : {
349 27 : return (GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct;
350 : }
351 :
352 : /**
353 : * gkd_exported_daemon_override_properties:
354 : * @klass: The class structure for a #GObject derived class.
355 : * @property_id_begin: The property id to assign to the first overridden property.
356 : *
357 : * Overrides all #GObject properties in the #GkdExportedDaemon interface for a concrete class.
358 : * The properties are overridden in the order they are defined.
359 : *
360 : * Returns: The last property id.
361 : */
362 : guint
363 0 : gkd_exported_daemon_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
364 : {
365 0 : return property_id_begin - 1;
366 : }
367 :
368 :
369 : inline static void
370 0 : gkd_exported_daemon_method_marshal_get_environment (
371 : GClosure *closure,
372 : GValue *return_value,
373 : unsigned int n_param_values,
374 : const GValue *param_values,
375 : void *invocation_hint,
376 : void *marshal_data)
377 : {
378 0 : _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
379 : return_value, n_param_values, param_values, invocation_hint, marshal_data);
380 0 : }
381 :
382 : inline static void
383 0 : gkd_exported_daemon_method_marshal_get_control_directory (
384 : GClosure *closure,
385 : GValue *return_value,
386 : unsigned int n_param_values,
387 : const GValue *param_values,
388 : void *invocation_hint,
389 : void *marshal_data)
390 : {
391 0 : _g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure,
392 : return_value, n_param_values, param_values, invocation_hint, marshal_data);
393 0 : }
394 :
395 :
396 : /**
397 : * GkdExportedDaemon:
398 : *
399 : * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link>.
400 : */
401 :
402 : /**
403 : * GkdExportedDaemonIface:
404 : * @parent_iface: The parent interface.
405 : * @handle_get_control_directory: Handler for the #GkdExportedDaemon::handle-get-control-directory signal.
406 : * @handle_get_environment: Handler for the #GkdExportedDaemon::handle-get-environment signal.
407 : *
408 : * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link>.
409 : */
410 :
411 : typedef GkdExportedDaemonIface GkdExportedDaemonInterface;
412 54 : G_DEFINE_INTERFACE (GkdExportedDaemon, gkd_exported_daemon, G_TYPE_OBJECT)
413 :
414 : static void
415 27 : gkd_exported_daemon_default_init (GkdExportedDaemonIface *iface)
416 : {
417 : /* GObject signals for incoming D-Bus method calls: */
418 : /**
419 : * GkdExportedDaemon::handle-get-environment:
420 : * @object: A #GkdExportedDaemon.
421 : * @invocation: A #GDBusMethodInvocation.
422 : *
423 : * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetEnvironment">GetEnvironment()</link> D-Bus method.
424 : *
425 : * 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_daemon_complete_get_environment() 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.
426 : *
427 : * 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.
428 : */
429 27 : g_signal_new ("handle-get-environment",
430 : G_TYPE_FROM_INTERFACE (iface),
431 : G_SIGNAL_RUN_LAST,
432 : G_STRUCT_OFFSET (GkdExportedDaemonIface, handle_get_environment),
433 : g_signal_accumulator_true_handled,
434 : NULL,
435 : gkd_exported_daemon_method_marshal_get_environment,
436 : G_TYPE_BOOLEAN,
437 : 1,
438 : G_TYPE_DBUS_METHOD_INVOCATION);
439 :
440 : /**
441 : * GkdExportedDaemon::handle-get-control-directory:
442 : * @object: A #GkdExportedDaemon.
443 : * @invocation: A #GDBusMethodInvocation.
444 : *
445 : * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetControlDirectory">GetControlDirectory()</link> D-Bus method.
446 : *
447 : * 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_daemon_complete_get_control_directory() 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.
448 : *
449 : * 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.
450 : */
451 27 : g_signal_new ("handle-get-control-directory",
452 : G_TYPE_FROM_INTERFACE (iface),
453 : G_SIGNAL_RUN_LAST,
454 : G_STRUCT_OFFSET (GkdExportedDaemonIface, handle_get_control_directory),
455 : g_signal_accumulator_true_handled,
456 : NULL,
457 : gkd_exported_daemon_method_marshal_get_control_directory,
458 : G_TYPE_BOOLEAN,
459 : 1,
460 : G_TYPE_DBUS_METHOD_INVOCATION);
461 :
462 27 : }
463 :
464 : /**
465 : * gkd_exported_daemon_call_get_environment:
466 : * @proxy: A #GkdExportedDaemonProxy.
467 : * @cancellable: (nullable): A #GCancellable or %NULL.
468 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
469 : * @user_data: User data to pass to @callback.
470 : *
471 : * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetEnvironment">GetEnvironment()</link> D-Bus method on @proxy.
472 : * 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()).
473 : * You can then call gkd_exported_daemon_call_get_environment_finish() to get the result of the operation.
474 : *
475 : * See gkd_exported_daemon_call_get_environment_sync() for the synchronous, blocking version of this method.
476 : */
477 : void
478 0 : gkd_exported_daemon_call_get_environment (
479 : GkdExportedDaemon *proxy,
480 : GCancellable *cancellable,
481 : GAsyncReadyCallback callback,
482 : gpointer user_data)
483 : {
484 0 : g_dbus_proxy_call (G_DBUS_PROXY (proxy),
485 : "GetEnvironment",
486 : g_variant_new ("()"),
487 : G_DBUS_CALL_FLAGS_NONE,
488 : -1,
489 : cancellable,
490 : callback,
491 : user_data);
492 0 : }
493 :
494 : /**
495 : * gkd_exported_daemon_call_get_environment_finish:
496 : * @proxy: A #GkdExportedDaemonProxy.
497 : * @out_Environment: (out) (optional): Return location for return parameter or %NULL to ignore.
498 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_daemon_call_get_environment().
499 : * @error: Return location for error or %NULL.
500 : *
501 : * Finishes an operation started with gkd_exported_daemon_call_get_environment().
502 : *
503 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
504 : */
505 : gboolean
506 0 : gkd_exported_daemon_call_get_environment_finish (
507 : GkdExportedDaemon *proxy,
508 : GVariant **out_Environment,
509 : GAsyncResult *res,
510 : GError **error)
511 : {
512 : GVariant *_ret;
513 0 : _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
514 0 : if (_ret == NULL)
515 0 : goto _out;
516 0 : g_variant_get (_ret,
517 : "(@a{ss})",
518 : out_Environment);
519 0 : g_variant_unref (_ret);
520 0 : _out:
521 0 : return _ret != NULL;
522 : }
523 :
524 : /**
525 : * gkd_exported_daemon_call_get_environment_sync:
526 : * @proxy: A #GkdExportedDaemonProxy.
527 : * @out_Environment: (out) (optional): Return location for return parameter or %NULL to ignore.
528 : * @cancellable: (nullable): A #GCancellable or %NULL.
529 : * @error: Return location for error or %NULL.
530 : *
531 : * Synchronously invokes the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetEnvironment">GetEnvironment()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
532 : *
533 : * See gkd_exported_daemon_call_get_environment() for the asynchronous version of this method.
534 : *
535 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
536 : */
537 : gboolean
538 0 : gkd_exported_daemon_call_get_environment_sync (
539 : GkdExportedDaemon *proxy,
540 : GVariant **out_Environment,
541 : GCancellable *cancellable,
542 : GError **error)
543 : {
544 : GVariant *_ret;
545 0 : _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
546 : "GetEnvironment",
547 : g_variant_new ("()"),
548 : G_DBUS_CALL_FLAGS_NONE,
549 : -1,
550 : cancellable,
551 : error);
552 0 : if (_ret == NULL)
553 0 : goto _out;
554 0 : g_variant_get (_ret,
555 : "(@a{ss})",
556 : out_Environment);
557 0 : g_variant_unref (_ret);
558 0 : _out:
559 0 : return _ret != NULL;
560 : }
561 :
562 : /**
563 : * gkd_exported_daemon_call_get_control_directory:
564 : * @proxy: A #GkdExportedDaemonProxy.
565 : * @cancellable: (nullable): A #GCancellable or %NULL.
566 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
567 : * @user_data: User data to pass to @callback.
568 : *
569 : * Asynchronously invokes the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetControlDirectory">GetControlDirectory()</link> D-Bus method on @proxy.
570 : * 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()).
571 : * You can then call gkd_exported_daemon_call_get_control_directory_finish() to get the result of the operation.
572 : *
573 : * See gkd_exported_daemon_call_get_control_directory_sync() for the synchronous, blocking version of this method.
574 : */
575 : void
576 0 : gkd_exported_daemon_call_get_control_directory (
577 : GkdExportedDaemon *proxy,
578 : GCancellable *cancellable,
579 : GAsyncReadyCallback callback,
580 : gpointer user_data)
581 : {
582 0 : g_dbus_proxy_call (G_DBUS_PROXY (proxy),
583 : "GetControlDirectory",
584 : g_variant_new ("()"),
585 : G_DBUS_CALL_FLAGS_NONE,
586 : -1,
587 : cancellable,
588 : callback,
589 : user_data);
590 0 : }
591 :
592 : /**
593 : * gkd_exported_daemon_call_get_control_directory_finish:
594 : * @proxy: A #GkdExportedDaemonProxy.
595 : * @out_ControlDirectory: (out) (optional): Return location for return parameter or %NULL to ignore.
596 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_daemon_call_get_control_directory().
597 : * @error: Return location for error or %NULL.
598 : *
599 : * Finishes an operation started with gkd_exported_daemon_call_get_control_directory().
600 : *
601 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
602 : */
603 : gboolean
604 0 : gkd_exported_daemon_call_get_control_directory_finish (
605 : GkdExportedDaemon *proxy,
606 : gchar **out_ControlDirectory,
607 : GAsyncResult *res,
608 : GError **error)
609 : {
610 : GVariant *_ret;
611 0 : _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
612 0 : if (_ret == NULL)
613 0 : goto _out;
614 0 : g_variant_get (_ret,
615 : "(s)",
616 : out_ControlDirectory);
617 0 : g_variant_unref (_ret);
618 0 : _out:
619 0 : return _ret != NULL;
620 : }
621 :
622 : /**
623 : * gkd_exported_daemon_call_get_control_directory_sync:
624 : * @proxy: A #GkdExportedDaemonProxy.
625 : * @out_ControlDirectory: (out) (optional): Return location for return parameter or %NULL to ignore.
626 : * @cancellable: (nullable): A #GCancellable or %NULL.
627 : * @error: Return location for error or %NULL.
628 : *
629 : * Synchronously invokes the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetControlDirectory">GetControlDirectory()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
630 : *
631 : * See gkd_exported_daemon_call_get_control_directory() for the asynchronous version of this method.
632 : *
633 : * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
634 : */
635 : gboolean
636 0 : gkd_exported_daemon_call_get_control_directory_sync (
637 : GkdExportedDaemon *proxy,
638 : gchar **out_ControlDirectory,
639 : GCancellable *cancellable,
640 : GError **error)
641 : {
642 : GVariant *_ret;
643 0 : _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
644 : "GetControlDirectory",
645 : g_variant_new ("()"),
646 : G_DBUS_CALL_FLAGS_NONE,
647 : -1,
648 : cancellable,
649 : error);
650 0 : if (_ret == NULL)
651 0 : goto _out;
652 0 : g_variant_get (_ret,
653 : "(s)",
654 : out_ControlDirectory);
655 0 : g_variant_unref (_ret);
656 0 : _out:
657 0 : return _ret != NULL;
658 : }
659 :
660 : /**
661 : * gkd_exported_daemon_complete_get_environment:
662 : * @object: A #GkdExportedDaemon.
663 : * @invocation: (transfer full): A #GDBusMethodInvocation.
664 : * @Environment: Parameter to return.
665 : *
666 : * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetEnvironment">GetEnvironment()</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.
667 : *
668 : * This method will free @invocation, you cannot use it afterwards.
669 : */
670 : void
671 0 : gkd_exported_daemon_complete_get_environment (
672 : GkdExportedDaemon *object G_GNUC_UNUSED,
673 : GDBusMethodInvocation *invocation,
674 : GVariant *Environment)
675 : {
676 0 : g_dbus_method_invocation_return_value (invocation,
677 : g_variant_new ("(@a{ss})",
678 : Environment));
679 0 : }
680 :
681 : /**
682 : * gkd_exported_daemon_complete_get_control_directory:
683 : * @object: A #GkdExportedDaemon.
684 : * @invocation: (transfer full): A #GDBusMethodInvocation.
685 : * @ControlDirectory: Parameter to return.
686 : *
687 : * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gnome-keyring-Daemon.GetControlDirectory">GetControlDirectory()</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.
688 : *
689 : * This method will free @invocation, you cannot use it afterwards.
690 : */
691 : void
692 0 : gkd_exported_daemon_complete_get_control_directory (
693 : GkdExportedDaemon *object G_GNUC_UNUSED,
694 : GDBusMethodInvocation *invocation,
695 : const gchar *ControlDirectory)
696 : {
697 0 : g_dbus_method_invocation_return_value (invocation,
698 : g_variant_new ("(s)",
699 : ControlDirectory));
700 0 : }
701 :
702 : /* ------------------------------------------------------------------------ */
703 :
704 : /**
705 : * GkdExportedDaemonProxy:
706 : *
707 : * The #GkdExportedDaemonProxy structure contains only private data and should only be accessed using the provided API.
708 : */
709 :
710 : /**
711 : * GkdExportedDaemonProxyClass:
712 : * @parent_class: The parent class.
713 : *
714 : * Class structure for #GkdExportedDaemonProxy.
715 : */
716 :
717 : struct _GkdExportedDaemonProxyPrivate
718 : {
719 : GData *qdata;
720 : };
721 :
722 : static void gkd_exported_daemon_proxy_iface_init (GkdExportedDaemonIface *iface);
723 :
724 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
725 0 : G_DEFINE_TYPE_WITH_CODE (GkdExportedDaemonProxy, gkd_exported_daemon_proxy, G_TYPE_DBUS_PROXY,
726 : G_ADD_PRIVATE (GkdExportedDaemonProxy)
727 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_DAEMON, gkd_exported_daemon_proxy_iface_init))
728 :
729 : #else
730 : G_DEFINE_TYPE_WITH_CODE (GkdExportedDaemonProxy, gkd_exported_daemon_proxy, G_TYPE_DBUS_PROXY,
731 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_DAEMON, gkd_exported_daemon_proxy_iface_init))
732 :
733 : #endif
734 : static void
735 0 : gkd_exported_daemon_proxy_finalize (GObject *object)
736 : {
737 0 : GkdExportedDaemonProxy *proxy = GKD_EXPORTED_DAEMON_PROXY (object);
738 0 : g_datalist_clear (&proxy->priv->qdata);
739 0 : G_OBJECT_CLASS (gkd_exported_daemon_proxy_parent_class)->finalize (object);
740 0 : }
741 :
742 : static void
743 0 : gkd_exported_daemon_proxy_get_property (GObject *object G_GNUC_UNUSED,
744 : guint prop_id G_GNUC_UNUSED,
745 : GValue *value G_GNUC_UNUSED,
746 : GParamSpec *pspec G_GNUC_UNUSED)
747 : {
748 0 : }
749 :
750 : static void
751 0 : gkd_exported_daemon_proxy_set_property (GObject *object G_GNUC_UNUSED,
752 : guint prop_id G_GNUC_UNUSED,
753 : const GValue *value G_GNUC_UNUSED,
754 : GParamSpec *pspec G_GNUC_UNUSED)
755 : {
756 0 : }
757 :
758 : static void
759 0 : gkd_exported_daemon_proxy_g_signal (GDBusProxy *proxy,
760 : const gchar *sender_name G_GNUC_UNUSED,
761 : const gchar *signal_name,
762 : GVariant *parameters)
763 : {
764 : _ExtendedGDBusSignalInfo *info;
765 : GVariantIter iter;
766 : GVariant *child;
767 : GValue *paramv;
768 : gsize num_params;
769 : gsize n;
770 : guint signal_id;
771 0 : info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct, signal_name);
772 0 : if (info == NULL)
773 0 : return;
774 0 : num_params = g_variant_n_children (parameters);
775 0 : paramv = g_new0 (GValue, num_params + 1);
776 0 : g_value_init (¶mv[0], GKD_TYPE_EXPORTED_DAEMON);
777 0 : g_value_set_object (¶mv[0], proxy);
778 0 : g_variant_iter_init (&iter, parameters);
779 0 : n = 1;
780 0 : while ((child = g_variant_iter_next_value (&iter)) != NULL)
781 : {
782 0 : _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
783 0 : if (arg_info->use_gvariant)
784 : {
785 0 : g_value_init (¶mv[n], G_TYPE_VARIANT);
786 0 : g_value_set_variant (¶mv[n], child);
787 0 : n++;
788 : }
789 : else
790 0 : g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
791 0 : g_variant_unref (child);
792 : }
793 0 : signal_id = g_signal_lookup (info->signal_name, GKD_TYPE_EXPORTED_DAEMON);
794 0 : g_signal_emitv (paramv, signal_id, 0, NULL);
795 0 : for (n = 0; n < num_params + 1; n++)
796 0 : g_value_unset (¶mv[n]);
797 0 : g_free (paramv);
798 : }
799 :
800 : static void
801 0 : gkd_exported_daemon_proxy_g_properties_changed (GDBusProxy *_proxy,
802 : GVariant *changed_properties,
803 : const gchar *const *invalidated_properties)
804 : {
805 0 : GkdExportedDaemonProxy *proxy = GKD_EXPORTED_DAEMON_PROXY (_proxy);
806 : guint n;
807 : const gchar *key;
808 : GVariantIter *iter;
809 : _ExtendedGDBusPropertyInfo *info;
810 0 : g_variant_get (changed_properties, "a{sv}", &iter);
811 0 : while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
812 : {
813 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct, key);
814 0 : g_datalist_remove_data (&proxy->priv->qdata, key);
815 0 : if (info != NULL)
816 0 : g_object_notify (G_OBJECT (proxy), info->hyphen_name);
817 : }
818 0 : g_variant_iter_free (iter);
819 0 : for (n = 0; invalidated_properties[n] != NULL; n++)
820 : {
821 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct, invalidated_properties[n]);
822 0 : g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
823 0 : if (info != NULL)
824 0 : g_object_notify (G_OBJECT (proxy), info->hyphen_name);
825 : }
826 0 : }
827 :
828 : static void
829 0 : gkd_exported_daemon_proxy_init (GkdExportedDaemonProxy *proxy)
830 : {
831 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
832 0 : proxy->priv = gkd_exported_daemon_proxy_get_instance_private (proxy);
833 : #else
834 : proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, GKD_TYPE_EXPORTED_DAEMON_PROXY, GkdExportedDaemonProxyPrivate);
835 : #endif
836 :
837 0 : g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gkd_exported_daemon_interface_info ());
838 0 : }
839 :
840 : static void
841 0 : gkd_exported_daemon_proxy_class_init (GkdExportedDaemonProxyClass *klass)
842 : {
843 : GObjectClass *gobject_class;
844 : GDBusProxyClass *proxy_class;
845 :
846 0 : gobject_class = G_OBJECT_CLASS (klass);
847 0 : gobject_class->finalize = gkd_exported_daemon_proxy_finalize;
848 0 : gobject_class->get_property = gkd_exported_daemon_proxy_get_property;
849 0 : gobject_class->set_property = gkd_exported_daemon_proxy_set_property;
850 :
851 0 : proxy_class = G_DBUS_PROXY_CLASS (klass);
852 0 : proxy_class->g_signal = gkd_exported_daemon_proxy_g_signal;
853 0 : proxy_class->g_properties_changed = gkd_exported_daemon_proxy_g_properties_changed;
854 :
855 : #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
856 : g_type_class_add_private (klass, sizeof (GkdExportedDaemonProxyPrivate));
857 : #endif
858 0 : }
859 :
860 : static void
861 0 : gkd_exported_daemon_proxy_iface_init (GkdExportedDaemonIface *iface G_GNUC_UNUSED)
862 : {
863 0 : }
864 :
865 : /**
866 : * gkd_exported_daemon_proxy_new:
867 : * @connection: A #GDBusConnection.
868 : * @flags: Flags from the #GDBusProxyFlags enumeration.
869 : * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
870 : * @object_path: An object path.
871 : * @cancellable: (nullable): A #GCancellable or %NULL.
872 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
873 : * @user_data: User data to pass to @callback.
874 : *
875 : * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link>. See g_dbus_proxy_new() for more details.
876 : *
877 : * 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()).
878 : * You can then call gkd_exported_daemon_proxy_new_finish() to get the result of the operation.
879 : *
880 : * See gkd_exported_daemon_proxy_new_sync() for the synchronous, blocking version of this constructor.
881 : */
882 : void
883 0 : gkd_exported_daemon_proxy_new (
884 : GDBusConnection *connection,
885 : GDBusProxyFlags flags,
886 : const gchar *name,
887 : const gchar *object_path,
888 : GCancellable *cancellable,
889 : GAsyncReadyCallback callback,
890 : gpointer user_data)
891 : {
892 0 : g_async_initable_new_async (GKD_TYPE_EXPORTED_DAEMON_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.gnome.keyring.Daemon", NULL);
893 0 : }
894 :
895 : /**
896 : * gkd_exported_daemon_proxy_new_finish:
897 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_daemon_proxy_new().
898 : * @error: Return location for error or %NULL
899 : *
900 : * Finishes an operation started with gkd_exported_daemon_proxy_new().
901 : *
902 : * Returns: (transfer full) (type GkdExportedDaemonProxy): The constructed proxy object or %NULL if @error is set.
903 : */
904 : GkdExportedDaemon *
905 0 : gkd_exported_daemon_proxy_new_finish (
906 : GAsyncResult *res,
907 : GError **error)
908 : {
909 : GObject *ret;
910 : GObject *source_object;
911 0 : source_object = g_async_result_get_source_object (res);
912 0 : ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
913 0 : g_object_unref (source_object);
914 0 : if (ret != NULL)
915 0 : return GKD_EXPORTED_DAEMON (ret);
916 : else
917 0 : return NULL;
918 : }
919 :
920 : /**
921 : * gkd_exported_daemon_proxy_new_sync:
922 : * @connection: A #GDBusConnection.
923 : * @flags: Flags from the #GDBusProxyFlags enumeration.
924 : * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
925 : * @object_path: An object path.
926 : * @cancellable: (nullable): A #GCancellable or %NULL.
927 : * @error: Return location for error or %NULL
928 : *
929 : * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link>. See g_dbus_proxy_new_sync() for more details.
930 : *
931 : * The calling thread is blocked until a reply is received.
932 : *
933 : * See gkd_exported_daemon_proxy_new() for the asynchronous version of this constructor.
934 : *
935 : * Returns: (transfer full) (type GkdExportedDaemonProxy): The constructed proxy object or %NULL if @error is set.
936 : */
937 : GkdExportedDaemon *
938 0 : gkd_exported_daemon_proxy_new_sync (
939 : GDBusConnection *connection,
940 : GDBusProxyFlags flags,
941 : const gchar *name,
942 : const gchar *object_path,
943 : GCancellable *cancellable,
944 : GError **error)
945 : {
946 : GInitable *ret;
947 0 : ret = g_initable_new (GKD_TYPE_EXPORTED_DAEMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gnome.keyring.Daemon", NULL);
948 0 : if (ret != NULL)
949 0 : return GKD_EXPORTED_DAEMON (ret);
950 : else
951 0 : return NULL;
952 : }
953 :
954 :
955 : /**
956 : * gkd_exported_daemon_proxy_new_for_bus:
957 : * @bus_type: A #GBusType.
958 : * @flags: Flags from the #GDBusProxyFlags enumeration.
959 : * @name: A bus name (well-known or unique).
960 : * @object_path: An object path.
961 : * @cancellable: (nullable): A #GCancellable or %NULL.
962 : * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
963 : * @user_data: User data to pass to @callback.
964 : *
965 : * Like gkd_exported_daemon_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
966 : *
967 : * 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()).
968 : * You can then call gkd_exported_daemon_proxy_new_for_bus_finish() to get the result of the operation.
969 : *
970 : * See gkd_exported_daemon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
971 : */
972 : void
973 0 : gkd_exported_daemon_proxy_new_for_bus (
974 : GBusType bus_type,
975 : GDBusProxyFlags flags,
976 : const gchar *name,
977 : const gchar *object_path,
978 : GCancellable *cancellable,
979 : GAsyncReadyCallback callback,
980 : gpointer user_data)
981 : {
982 0 : g_async_initable_new_async (GKD_TYPE_EXPORTED_DAEMON_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.gnome.keyring.Daemon", NULL);
983 0 : }
984 :
985 : /**
986 : * gkd_exported_daemon_proxy_new_for_bus_finish:
987 : * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gkd_exported_daemon_proxy_new_for_bus().
988 : * @error: Return location for error or %NULL
989 : *
990 : * Finishes an operation started with gkd_exported_daemon_proxy_new_for_bus().
991 : *
992 : * Returns: (transfer full) (type GkdExportedDaemonProxy): The constructed proxy object or %NULL if @error is set.
993 : */
994 : GkdExportedDaemon *
995 0 : gkd_exported_daemon_proxy_new_for_bus_finish (
996 : GAsyncResult *res,
997 : GError **error)
998 : {
999 : GObject *ret;
1000 : GObject *source_object;
1001 0 : source_object = g_async_result_get_source_object (res);
1002 0 : ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1003 0 : g_object_unref (source_object);
1004 0 : if (ret != NULL)
1005 0 : return GKD_EXPORTED_DAEMON (ret);
1006 : else
1007 0 : return NULL;
1008 : }
1009 :
1010 : /**
1011 : * gkd_exported_daemon_proxy_new_for_bus_sync:
1012 : * @bus_type: A #GBusType.
1013 : * @flags: Flags from the #GDBusProxyFlags enumeration.
1014 : * @name: A bus name (well-known or unique).
1015 : * @object_path: An object path.
1016 : * @cancellable: (nullable): A #GCancellable or %NULL.
1017 : * @error: Return location for error or %NULL
1018 : *
1019 : * Like gkd_exported_daemon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1020 : *
1021 : * The calling thread is blocked until a reply is received.
1022 : *
1023 : * See gkd_exported_daemon_proxy_new_for_bus() for the asynchronous version of this constructor.
1024 : *
1025 : * Returns: (transfer full) (type GkdExportedDaemonProxy): The constructed proxy object or %NULL if @error is set.
1026 : */
1027 : GkdExportedDaemon *
1028 0 : gkd_exported_daemon_proxy_new_for_bus_sync (
1029 : GBusType bus_type,
1030 : GDBusProxyFlags flags,
1031 : const gchar *name,
1032 : const gchar *object_path,
1033 : GCancellable *cancellable,
1034 : GError **error)
1035 : {
1036 : GInitable *ret;
1037 0 : ret = g_initable_new (GKD_TYPE_EXPORTED_DAEMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gnome.keyring.Daemon", NULL);
1038 0 : if (ret != NULL)
1039 0 : return GKD_EXPORTED_DAEMON (ret);
1040 : else
1041 0 : return NULL;
1042 : }
1043 :
1044 :
1045 : /* ------------------------------------------------------------------------ */
1046 :
1047 : /**
1048 : * GkdExportedDaemonSkeleton:
1049 : *
1050 : * The #GkdExportedDaemonSkeleton structure contains only private data and should only be accessed using the provided API.
1051 : */
1052 :
1053 : /**
1054 : * GkdExportedDaemonSkeletonClass:
1055 : * @parent_class: The parent class.
1056 : *
1057 : * Class structure for #GkdExportedDaemonSkeleton.
1058 : */
1059 :
1060 : struct _GkdExportedDaemonSkeletonPrivate
1061 : {
1062 : GValue *properties;
1063 : GList *changed_properties;
1064 : GSource *changed_properties_idle_source;
1065 : GMainContext *context;
1066 : GMutex lock;
1067 : };
1068 :
1069 : static void
1070 0 : _gkd_exported_daemon_skeleton_handle_method_call (
1071 : GDBusConnection *connection G_GNUC_UNUSED,
1072 : const gchar *sender G_GNUC_UNUSED,
1073 : const gchar *object_path G_GNUC_UNUSED,
1074 : const gchar *interface_name,
1075 : const gchar *method_name,
1076 : GVariant *parameters,
1077 : GDBusMethodInvocation *invocation,
1078 : gpointer user_data)
1079 : {
1080 0 : GkdExportedDaemonSkeleton *skeleton = GKD_EXPORTED_DAEMON_SKELETON (user_data);
1081 : _ExtendedGDBusMethodInfo *info;
1082 : GVariantIter iter;
1083 : GVariant *child;
1084 : GValue *paramv;
1085 : gsize num_params;
1086 : guint num_extra;
1087 : gsize n;
1088 : guint signal_id;
1089 0 : GValue return_value = G_VALUE_INIT;
1090 0 : info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1091 0 : g_assert (info != NULL);
1092 0 : num_params = g_variant_n_children (parameters);
1093 0 : num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1094 0 : n = 0;
1095 0 : g_value_init (¶mv[n], GKD_TYPE_EXPORTED_DAEMON);
1096 0 : g_value_set_object (¶mv[n++], skeleton);
1097 0 : g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1098 0 : g_value_set_object (¶mv[n++], invocation);
1099 0 : if (info->pass_fdlist)
1100 : {
1101 : #ifdef G_OS_UNIX
1102 0 : g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1103 0 : g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1104 : #else
1105 : g_assert_not_reached ();
1106 : #endif
1107 : }
1108 0 : g_variant_iter_init (&iter, parameters);
1109 0 : while ((child = g_variant_iter_next_value (&iter)) != NULL)
1110 : {
1111 0 : _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1112 0 : if (arg_info->use_gvariant)
1113 : {
1114 0 : g_value_init (¶mv[n], G_TYPE_VARIANT);
1115 0 : g_value_set_variant (¶mv[n], child);
1116 0 : n++;
1117 : }
1118 : else
1119 0 : g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1120 0 : g_variant_unref (child);
1121 : }
1122 0 : signal_id = g_signal_lookup (info->signal_name, GKD_TYPE_EXPORTED_DAEMON);
1123 0 : g_value_init (&return_value, G_TYPE_BOOLEAN);
1124 0 : g_signal_emitv (paramv, signal_id, 0, &return_value);
1125 0 : if (!g_value_get_boolean (&return_value))
1126 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);
1127 0 : g_value_unset (&return_value);
1128 0 : for (n = 0; n < num_params + num_extra; n++)
1129 0 : g_value_unset (¶mv[n]);
1130 0 : g_free (paramv);
1131 0 : }
1132 :
1133 : static GVariant *
1134 0 : _gkd_exported_daemon_skeleton_handle_get_property (
1135 : GDBusConnection *connection G_GNUC_UNUSED,
1136 : const gchar *sender G_GNUC_UNUSED,
1137 : const gchar *object_path G_GNUC_UNUSED,
1138 : const gchar *interface_name G_GNUC_UNUSED,
1139 : const gchar *property_name,
1140 : GError **error,
1141 : gpointer user_data)
1142 : {
1143 0 : GkdExportedDaemonSkeleton *skeleton = GKD_EXPORTED_DAEMON_SKELETON (user_data);
1144 0 : GValue value = G_VALUE_INIT;
1145 : GParamSpec *pspec;
1146 : _ExtendedGDBusPropertyInfo *info;
1147 : GVariant *ret;
1148 0 : ret = NULL;
1149 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct, property_name);
1150 0 : g_assert (info != NULL);
1151 0 : pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1152 0 : if (pspec == NULL)
1153 : {
1154 0 : g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1155 : }
1156 : else
1157 : {
1158 0 : g_value_init (&value, pspec->value_type);
1159 0 : g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1160 0 : ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1161 0 : g_value_unset (&value);
1162 : }
1163 0 : return ret;
1164 : }
1165 :
1166 : static gboolean
1167 0 : _gkd_exported_daemon_skeleton_handle_set_property (
1168 : GDBusConnection *connection G_GNUC_UNUSED,
1169 : const gchar *sender G_GNUC_UNUSED,
1170 : const gchar *object_path G_GNUC_UNUSED,
1171 : const gchar *interface_name G_GNUC_UNUSED,
1172 : const gchar *property_name,
1173 : GVariant *variant,
1174 : GError **error,
1175 : gpointer user_data)
1176 : {
1177 0 : GkdExportedDaemonSkeleton *skeleton = GKD_EXPORTED_DAEMON_SKELETON (user_data);
1178 0 : GValue value = G_VALUE_INIT;
1179 : GParamSpec *pspec;
1180 : _ExtendedGDBusPropertyInfo *info;
1181 : gboolean ret;
1182 0 : ret = FALSE;
1183 0 : info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gkd_exported_daemon_interface_info.parent_struct, property_name);
1184 0 : g_assert (info != NULL);
1185 0 : pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1186 0 : if (pspec == NULL)
1187 : {
1188 0 : g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1189 : }
1190 : else
1191 : {
1192 0 : if (info->use_gvariant)
1193 0 : g_value_set_variant (&value, variant);
1194 : else
1195 0 : g_dbus_gvariant_to_gvalue (variant, &value);
1196 0 : g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1197 0 : g_value_unset (&value);
1198 0 : ret = TRUE;
1199 : }
1200 0 : return ret;
1201 : }
1202 :
1203 : static const GDBusInterfaceVTable _gkd_exported_daemon_skeleton_vtable =
1204 : {
1205 : _gkd_exported_daemon_skeleton_handle_method_call,
1206 : _gkd_exported_daemon_skeleton_handle_get_property,
1207 : _gkd_exported_daemon_skeleton_handle_set_property,
1208 : {NULL}
1209 : };
1210 :
1211 : static GDBusInterfaceInfo *
1212 27 : gkd_exported_daemon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1213 : {
1214 27 : return gkd_exported_daemon_interface_info ();
1215 : }
1216 :
1217 : static GDBusInterfaceVTable *
1218 27 : gkd_exported_daemon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1219 : {
1220 27 : return (GDBusInterfaceVTable *) &_gkd_exported_daemon_skeleton_vtable;
1221 : }
1222 :
1223 : static GVariant *
1224 0 : gkd_exported_daemon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1225 : {
1226 0 : GkdExportedDaemonSkeleton *skeleton = GKD_EXPORTED_DAEMON_SKELETON (_skeleton);
1227 :
1228 : GVariantBuilder builder;
1229 : guint n;
1230 0 : g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1231 0 : if (_gkd_exported_daemon_interface_info.parent_struct.properties == NULL)
1232 0 : goto out;
1233 0 : for (n = 0; _gkd_exported_daemon_interface_info.parent_struct.properties[n] != NULL; n++)
1234 : {
1235 0 : GDBusPropertyInfo *info = _gkd_exported_daemon_interface_info.parent_struct.properties[n];
1236 0 : if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1237 : {
1238 : GVariant *value;
1239 0 : value = _gkd_exported_daemon_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.gnome.keyring.Daemon", info->name, NULL, skeleton);
1240 0 : if (value != NULL)
1241 : {
1242 0 : g_variant_take_ref (value);
1243 0 : g_variant_builder_add (&builder, "{sv}", info->name, value);
1244 0 : g_variant_unref (value);
1245 : }
1246 : }
1247 : }
1248 0 : out:
1249 0 : return g_variant_builder_end (&builder);
1250 : }
1251 :
1252 : static void
1253 0 : gkd_exported_daemon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
1254 : {
1255 0 : }
1256 :
1257 : static void gkd_exported_daemon_skeleton_iface_init (GkdExportedDaemonIface *iface);
1258 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1259 135 : G_DEFINE_TYPE_WITH_CODE (GkdExportedDaemonSkeleton, gkd_exported_daemon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1260 : G_ADD_PRIVATE (GkdExportedDaemonSkeleton)
1261 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_DAEMON, gkd_exported_daemon_skeleton_iface_init))
1262 :
1263 : #else
1264 : G_DEFINE_TYPE_WITH_CODE (GkdExportedDaemonSkeleton, gkd_exported_daemon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1265 : G_IMPLEMENT_INTERFACE (GKD_TYPE_EXPORTED_DAEMON, gkd_exported_daemon_skeleton_iface_init))
1266 :
1267 : #endif
1268 : static void
1269 27 : gkd_exported_daemon_skeleton_finalize (GObject *object)
1270 : {
1271 27 : GkdExportedDaemonSkeleton *skeleton = GKD_EXPORTED_DAEMON_SKELETON (object);
1272 27 : g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1273 27 : if (skeleton->priv->changed_properties_idle_source != NULL)
1274 0 : g_source_destroy (skeleton->priv->changed_properties_idle_source);
1275 27 : g_main_context_unref (skeleton->priv->context);
1276 27 : g_mutex_clear (&skeleton->priv->lock);
1277 27 : G_OBJECT_CLASS (gkd_exported_daemon_skeleton_parent_class)->finalize (object);
1278 27 : }
1279 :
1280 : static void
1281 27 : gkd_exported_daemon_skeleton_init (GkdExportedDaemonSkeleton *skeleton)
1282 : {
1283 : #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1284 27 : skeleton->priv = gkd_exported_daemon_skeleton_get_instance_private (skeleton);
1285 : #else
1286 : skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, GKD_TYPE_EXPORTED_DAEMON_SKELETON, GkdExportedDaemonSkeletonPrivate);
1287 : #endif
1288 :
1289 27 : g_mutex_init (&skeleton->priv->lock);
1290 27 : skeleton->priv->context = g_main_context_ref_thread_default ();
1291 27 : }
1292 :
1293 : static void
1294 27 : gkd_exported_daemon_skeleton_class_init (GkdExportedDaemonSkeletonClass *klass)
1295 : {
1296 : GObjectClass *gobject_class;
1297 : GDBusInterfaceSkeletonClass *skeleton_class;
1298 :
1299 27 : gobject_class = G_OBJECT_CLASS (klass);
1300 27 : gobject_class->finalize = gkd_exported_daemon_skeleton_finalize;
1301 :
1302 27 : skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1303 27 : skeleton_class->get_info = gkd_exported_daemon_skeleton_dbus_interface_get_info;
1304 27 : skeleton_class->get_properties = gkd_exported_daemon_skeleton_dbus_interface_get_properties;
1305 27 : skeleton_class->flush = gkd_exported_daemon_skeleton_dbus_interface_flush;
1306 27 : skeleton_class->get_vtable = gkd_exported_daemon_skeleton_dbus_interface_get_vtable;
1307 :
1308 : #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1309 : g_type_class_add_private (klass, sizeof (GkdExportedDaemonSkeletonPrivate));
1310 : #endif
1311 27 : }
1312 :
1313 : static void
1314 27 : gkd_exported_daemon_skeleton_iface_init (GkdExportedDaemonIface *iface G_GNUC_UNUSED)
1315 : {
1316 27 : }
1317 :
1318 : /**
1319 : * gkd_exported_daemon_skeleton_new:
1320 : *
1321 : * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gnome-keyring-Daemon.top_of_page">org.gnome.keyring.Daemon</link>.
1322 : *
1323 : * Returns: (transfer full) (type GkdExportedDaemonSkeleton): The skeleton object.
1324 : */
1325 : GkdExportedDaemon *
1326 27 : gkd_exported_daemon_skeleton_new (void)
1327 : {
1328 27 : return GKD_EXPORTED_DAEMON (g_object_new (GKD_TYPE_EXPORTED_DAEMON_SKELETON, NULL));
1329 : }
1330 :
|