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 "mnd-dbus-generated.h"
14
15 #include <string.h>
16 #ifdef G_OS_UNIX
17 # include <gio/gunixfdlist.h>
18 #endif
19
20 typedef struct
21 {
22 GDBusArgInfo parent_struct;
23 gboolean use_gvariant;
24 } _ExtendedGDBusArgInfo;
25
26 typedef struct
27 {
28 GDBusMethodInfo parent_struct;
29 const gchar *signal_name;
30 gboolean pass_fdlist;
31 } _ExtendedGDBusMethodInfo;
32
33 typedef struct
34 {
35 GDBusSignalInfo parent_struct;
36 const gchar *signal_name;
37 } _ExtendedGDBusSignalInfo;
38
39 typedef struct
40 {
41 GDBusPropertyInfo parent_struct;
42 const gchar *hyphen_name;
43 guint use_gvariant : 1;
44 guint emits_changed_signal : 1;
45 } _ExtendedGDBusPropertyInfo;
46
47 typedef struct
48 {
49 GDBusInterfaceInfo parent_struct;
50 const gchar *hyphen_name;
51 } _ExtendedGDBusInterfaceInfo;
52
53 typedef struct
54 {
55 const _ExtendedGDBusPropertyInfo *info;
56 guint prop_id;
57 GValue orig_value; /* the value before the change */
58 } ChangedProperty;
59
60 static void
_changed_property_free(ChangedProperty * data)61 _changed_property_free (ChangedProperty *data)
62 {
63 g_value_unset (&data->orig_value);
64 g_free (data);
65 }
66
67 static gboolean
_g_strv_equal0(gchar ** a,gchar ** b)68 _g_strv_equal0 (gchar **a, gchar **b)
69 {
70 gboolean ret = FALSE;
71 guint n;
72 if (a == NULL && b == NULL)
73 {
74 ret = TRUE;
75 goto out;
76 }
77 if (a == NULL || b == NULL)
78 goto out;
79 if (g_strv_length (a) != g_strv_length (b))
80 goto out;
81 for (n = 0; a[n] != NULL; n++)
82 if (g_strcmp0 (a[n], b[n]) != 0)
83 goto out;
84 ret = TRUE;
85 out:
86 return ret;
87 }
88
89 static gboolean
_g_variant_equal0(GVariant * a,GVariant * b)90 _g_variant_equal0 (GVariant *a, GVariant *b)
91 {
92 gboolean ret = FALSE;
93 if (a == NULL && b == NULL)
94 {
95 ret = TRUE;
96 goto out;
97 }
98 if (a == NULL || b == NULL)
99 goto out;
100 ret = g_variant_equal (a, b);
101 out:
102 return ret;
103 }
104
105 G_GNUC_UNUSED static gboolean
_g_value_equal(const GValue * a,const GValue * b)106 _g_value_equal (const GValue *a, const GValue *b)
107 {
108 gboolean ret = FALSE;
109 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
110 switch (G_VALUE_TYPE (a))
111 {
112 case G_TYPE_BOOLEAN:
113 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
114 break;
115 case G_TYPE_UCHAR:
116 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
117 break;
118 case G_TYPE_INT:
119 ret = (g_value_get_int (a) == g_value_get_int (b));
120 break;
121 case G_TYPE_UINT:
122 ret = (g_value_get_uint (a) == g_value_get_uint (b));
123 break;
124 case G_TYPE_INT64:
125 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
126 break;
127 case G_TYPE_UINT64:
128 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
129 break;
130 case G_TYPE_DOUBLE:
131 {
132 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
133 gdouble da = g_value_get_double (a);
134 gdouble db = g_value_get_double (b);
135 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
136 }
137 break;
138 case G_TYPE_STRING:
139 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
140 break;
141 case G_TYPE_VARIANT:
142 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
143 break;
144 default:
145 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
146 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
147 else
148 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
149 break;
150 }
151 return ret;
152 }
153
154 /* ------------------------------------------------------------------------
155 * Code for interface org.freedesktop.Notifications
156 * ------------------------------------------------------------------------
157 */
158
159 /**
160 * SECTION:NotifyDaemonNotifications
161 * @title: NotifyDaemonNotifications
162 * @short_description: Generated C code for the org.freedesktop.Notifications D-Bus interface
163 *
164 * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link> D-Bus interface in C.
165 */
166
167 /* ---- Introspection data for org.freedesktop.Notifications ---- */
168
169 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_app_name =
170 {
171 {
172 -1,
173 (gchar *) "app_name",
174 (gchar *) "s",
175 NULL
176 },
177 FALSE
178 };
179
180 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_id =
181 {
182 {
183 -1,
184 (gchar *) "id",
185 (gchar *) "u",
186 NULL
187 },
188 FALSE
189 };
190
191 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_icon =
192 {
193 {
194 -1,
195 (gchar *) "icon",
196 (gchar *) "s",
197 NULL
198 },
199 FALSE
200 };
201
202 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_summary =
203 {
204 {
205 -1,
206 (gchar *) "summary",
207 (gchar *) "s",
208 NULL
209 },
210 FALSE
211 };
212
213 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_body =
214 {
215 {
216 -1,
217 (gchar *) "body",
218 (gchar *) "s",
219 NULL
220 },
221 FALSE
222 };
223
224 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_actions =
225 {
226 {
227 -1,
228 (gchar *) "actions",
229 (gchar *) "as",
230 NULL
231 },
232 FALSE
233 };
234
235 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_hints =
236 {
237 {
238 -1,
239 (gchar *) "hints",
240 (gchar *) "a{sv}",
241 NULL
242 },
243 FALSE
244 };
245
246 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_IN_ARG_timeout =
247 {
248 {
249 -1,
250 (gchar *) "timeout",
251 (gchar *) "i",
252 NULL
253 },
254 FALSE
255 };
256
257 static const GDBusArgInfo * const _notify_daemon_notifications_method_info_notify_IN_ARG_pointers[] =
258 {
259 &_notify_daemon_notifications_method_info_notify_IN_ARG_app_name.parent_struct,
260 &_notify_daemon_notifications_method_info_notify_IN_ARG_id.parent_struct,
261 &_notify_daemon_notifications_method_info_notify_IN_ARG_icon.parent_struct,
262 &_notify_daemon_notifications_method_info_notify_IN_ARG_summary.parent_struct,
263 &_notify_daemon_notifications_method_info_notify_IN_ARG_body.parent_struct,
264 &_notify_daemon_notifications_method_info_notify_IN_ARG_actions.parent_struct,
265 &_notify_daemon_notifications_method_info_notify_IN_ARG_hints.parent_struct,
266 &_notify_daemon_notifications_method_info_notify_IN_ARG_timeout.parent_struct,
267 NULL
268 };
269
270 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_notify_OUT_ARG_return_id =
271 {
272 {
273 -1,
274 (gchar *) "return_id",
275 (gchar *) "u",
276 NULL
277 },
278 FALSE
279 };
280
281 static const GDBusArgInfo * const _notify_daemon_notifications_method_info_notify_OUT_ARG_pointers[] =
282 {
283 &_notify_daemon_notifications_method_info_notify_OUT_ARG_return_id.parent_struct,
284 NULL
285 };
286
287 static const _ExtendedGDBusMethodInfo _notify_daemon_notifications_method_info_notify =
288 {
289 {
290 -1,
291 (gchar *) "Notify",
292 (GDBusArgInfo **) &_notify_daemon_notifications_method_info_notify_IN_ARG_pointers,
293 (GDBusArgInfo **) &_notify_daemon_notifications_method_info_notify_OUT_ARG_pointers,
294 NULL
295 },
296 "handle-notify",
297 FALSE
298 };
299
300 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_close_notification_IN_ARG_id =
301 {
302 {
303 -1,
304 (gchar *) "id",
305 (gchar *) "u",
306 NULL
307 },
308 FALSE
309 };
310
311 static const GDBusArgInfo * const _notify_daemon_notifications_method_info_close_notification_IN_ARG_pointers[] =
312 {
313 &_notify_daemon_notifications_method_info_close_notification_IN_ARG_id.parent_struct,
314 NULL
315 };
316
317 static const _ExtendedGDBusMethodInfo _notify_daemon_notifications_method_info_close_notification =
318 {
319 {
320 -1,
321 (gchar *) "CloseNotification",
322 (GDBusArgInfo **) &_notify_daemon_notifications_method_info_close_notification_IN_ARG_pointers,
323 NULL,
324 NULL
325 },
326 "handle-close-notification",
327 FALSE
328 };
329
330 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_get_capabilities_OUT_ARG_return_caps =
331 {
332 {
333 -1,
334 (gchar *) "return_caps",
335 (gchar *) "as",
336 NULL
337 },
338 FALSE
339 };
340
341 static const GDBusArgInfo * const _notify_daemon_notifications_method_info_get_capabilities_OUT_ARG_pointers[] =
342 {
343 &_notify_daemon_notifications_method_info_get_capabilities_OUT_ARG_return_caps.parent_struct,
344 NULL
345 };
346
347 static const _ExtendedGDBusMethodInfo _notify_daemon_notifications_method_info_get_capabilities =
348 {
349 {
350 -1,
351 (gchar *) "GetCapabilities",
352 NULL,
353 (GDBusArgInfo **) &_notify_daemon_notifications_method_info_get_capabilities_OUT_ARG_pointers,
354 NULL
355 },
356 "handle-get-capabilities",
357 FALSE
358 };
359
360 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_name =
361 {
362 {
363 -1,
364 (gchar *) "return_name",
365 (gchar *) "s",
366 NULL
367 },
368 FALSE
369 };
370
371 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_vendor =
372 {
373 {
374 -1,
375 (gchar *) "return_vendor",
376 (gchar *) "s",
377 NULL
378 },
379 FALSE
380 };
381
382 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_version =
383 {
384 {
385 -1,
386 (gchar *) "return_version",
387 (gchar *) "s",
388 NULL
389 },
390 FALSE
391 };
392
393 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_spec_version =
394 {
395 {
396 -1,
397 (gchar *) "return_spec_version",
398 (gchar *) "s",
399 NULL
400 },
401 FALSE
402 };
403
404 static const GDBusArgInfo * const _notify_daemon_notifications_method_info_get_server_information_OUT_ARG_pointers[] =
405 {
406 &_notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_name.parent_struct,
407 &_notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_vendor.parent_struct,
408 &_notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_version.parent_struct,
409 &_notify_daemon_notifications_method_info_get_server_information_OUT_ARG_return_spec_version.parent_struct,
410 NULL
411 };
412
413 static const _ExtendedGDBusMethodInfo _notify_daemon_notifications_method_info_get_server_information =
414 {
415 {
416 -1,
417 (gchar *) "GetServerInformation",
418 NULL,
419 (GDBusArgInfo **) &_notify_daemon_notifications_method_info_get_server_information_OUT_ARG_pointers,
420 NULL
421 },
422 "handle-get-server-information",
423 FALSE
424 };
425
426 static const GDBusMethodInfo * const _notify_daemon_notifications_method_info_pointers[] =
427 {
428 &_notify_daemon_notifications_method_info_notify.parent_struct,
429 &_notify_daemon_notifications_method_info_close_notification.parent_struct,
430 &_notify_daemon_notifications_method_info_get_capabilities.parent_struct,
431 &_notify_daemon_notifications_method_info_get_server_information.parent_struct,
432 NULL
433 };
434
435 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_signal_info_action_invoked_ARG_id =
436 {
437 {
438 -1,
439 (gchar *) "id",
440 (gchar *) "u",
441 NULL
442 },
443 FALSE
444 };
445
446 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_signal_info_action_invoked_ARG_action_key =
447 {
448 {
449 -1,
450 (gchar *) "action_key",
451 (gchar *) "s",
452 NULL
453 },
454 FALSE
455 };
456
457 static const GDBusArgInfo * const _notify_daemon_notifications_signal_info_action_invoked_ARG_pointers[] =
458 {
459 &_notify_daemon_notifications_signal_info_action_invoked_ARG_id.parent_struct,
460 &_notify_daemon_notifications_signal_info_action_invoked_ARG_action_key.parent_struct,
461 NULL
462 };
463
464 static const _ExtendedGDBusSignalInfo _notify_daemon_notifications_signal_info_action_invoked =
465 {
466 {
467 -1,
468 (gchar *) "ActionInvoked",
469 (GDBusArgInfo **) &_notify_daemon_notifications_signal_info_action_invoked_ARG_pointers,
470 NULL
471 },
472 "action-invoked"
473 };
474
475 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_signal_info_notification_closed_ARG_id =
476 {
477 {
478 -1,
479 (gchar *) "id",
480 (gchar *) "u",
481 NULL
482 },
483 FALSE
484 };
485
486 static const _ExtendedGDBusArgInfo _notify_daemon_notifications_signal_info_notification_closed_ARG_reason =
487 {
488 {
489 -1,
490 (gchar *) "reason",
491 (gchar *) "u",
492 NULL
493 },
494 FALSE
495 };
496
497 static const GDBusArgInfo * const _notify_daemon_notifications_signal_info_notification_closed_ARG_pointers[] =
498 {
499 &_notify_daemon_notifications_signal_info_notification_closed_ARG_id.parent_struct,
500 &_notify_daemon_notifications_signal_info_notification_closed_ARG_reason.parent_struct,
501 NULL
502 };
503
504 static const _ExtendedGDBusSignalInfo _notify_daemon_notifications_signal_info_notification_closed =
505 {
506 {
507 -1,
508 (gchar *) "NotificationClosed",
509 (GDBusArgInfo **) &_notify_daemon_notifications_signal_info_notification_closed_ARG_pointers,
510 NULL
511 },
512 "notification-closed"
513 };
514
515 static const GDBusSignalInfo * const _notify_daemon_notifications_signal_info_pointers[] =
516 {
517 &_notify_daemon_notifications_signal_info_action_invoked.parent_struct,
518 &_notify_daemon_notifications_signal_info_notification_closed.parent_struct,
519 NULL
520 };
521
522 static const _ExtendedGDBusInterfaceInfo _notify_daemon_notifications_interface_info =
523 {
524 {
525 -1,
526 (gchar *) "org.freedesktop.Notifications",
527 (GDBusMethodInfo **) &_notify_daemon_notifications_method_info_pointers,
528 (GDBusSignalInfo **) &_notify_daemon_notifications_signal_info_pointers,
529 NULL,
530 NULL
531 },
532 "notifications",
533 };
534
535
536 /**
537 * notify_daemon_notifications_interface_info:
538 *
539 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link> D-Bus interface.
540 *
541 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
542 */
543 GDBusInterfaceInfo *
notify_daemon_notifications_interface_info(void)544 notify_daemon_notifications_interface_info (void)
545 {
546 return (GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct;
547 }
548
549 /**
550 * notify_daemon_notifications_override_properties:
551 * @klass: The class structure for a #GObject derived class.
552 * @property_id_begin: The property id to assign to the first overridden property.
553 *
554 * Overrides all #GObject properties in the #NotifyDaemonNotifications interface for a concrete class.
555 * The properties are overridden in the order they are defined.
556 *
557 * Returns: The last property id.
558 */
559 guint
notify_daemon_notifications_override_properties(GObjectClass * klass G_GNUC_UNUSED,guint property_id_begin)560 notify_daemon_notifications_override_properties (GObjectClass *klass G_GNUC_UNUSED, guint property_id_begin)
561 {
562 return property_id_begin - 1;
563 }
564
565
566
567 /**
568 * NotifyDaemonNotifications:
569 *
570 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link>.
571 */
572
573 /**
574 * NotifyDaemonNotificationsIface:
575 * @parent_iface: The parent interface.
576 * @handle_close_notification: Handler for the #NotifyDaemonNotifications::handle-close-notification signal.
577 * @handle_get_capabilities: Handler for the #NotifyDaemonNotifications::handle-get-capabilities signal.
578 * @handle_get_server_information: Handler for the #NotifyDaemonNotifications::handle-get-server-information signal.
579 * @handle_notify: Handler for the #NotifyDaemonNotifications::handle-notify signal.
580 * @action_invoked: Handler for the #NotifyDaemonNotifications::action-invoked signal.
581 * @notification_closed: Handler for the #NotifyDaemonNotifications::notification-closed signal.
582 *
583 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link>.
584 */
585
586 typedef NotifyDaemonNotificationsIface NotifyDaemonNotificationsInterface;
G_DEFINE_INTERFACE(NotifyDaemonNotifications,notify_daemon_notifications,G_TYPE_OBJECT)587 G_DEFINE_INTERFACE (NotifyDaemonNotifications, notify_daemon_notifications, G_TYPE_OBJECT)
588
589 static void
590 notify_daemon_notifications_default_init (NotifyDaemonNotificationsIface *iface)
591 {
592 /* GObject signals for incoming D-Bus method calls: */
593 /**
594 * NotifyDaemonNotifications::handle-notify:
595 * @object: A #NotifyDaemonNotifications.
596 * @invocation: A #GDBusMethodInvocation.
597 * @arg_app_name: Argument passed by remote caller.
598 * @arg_id: Argument passed by remote caller.
599 * @arg_icon: Argument passed by remote caller.
600 * @arg_summary: Argument passed by remote caller.
601 * @arg_body: Argument passed by remote caller.
602 * @arg_actions: Argument passed by remote caller.
603 * @arg_hints: Argument passed by remote caller.
604 * @arg_timeout: Argument passed by remote caller.
605 *
606 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Notifications.Notify">Notify()</link> D-Bus method.
607 *
608 * 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 notify_daemon_notifications_complete_notify() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
609 *
610 * 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.
611 */
612 g_signal_new ("handle-notify",
613 G_TYPE_FROM_INTERFACE (iface),
614 G_SIGNAL_RUN_LAST,
615 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, handle_notify),
616 g_signal_accumulator_true_handled,
617 NULL,
618 g_cclosure_marshal_generic,
619 G_TYPE_BOOLEAN,
620 9,
621 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRV, G_TYPE_VARIANT, G_TYPE_INT);
622
623 /**
624 * NotifyDaemonNotifications::handle-close-notification:
625 * @object: A #NotifyDaemonNotifications.
626 * @invocation: A #GDBusMethodInvocation.
627 * @arg_id: Argument passed by remote caller.
628 *
629 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Notifications.CloseNotification">CloseNotification()</link> D-Bus method.
630 *
631 * 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 notify_daemon_notifications_complete_close_notification() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
632 *
633 * 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.
634 */
635 g_signal_new ("handle-close-notification",
636 G_TYPE_FROM_INTERFACE (iface),
637 G_SIGNAL_RUN_LAST,
638 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, handle_close_notification),
639 g_signal_accumulator_true_handled,
640 NULL,
641 g_cclosure_marshal_generic,
642 G_TYPE_BOOLEAN,
643 2,
644 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UINT);
645
646 /**
647 * NotifyDaemonNotifications::handle-get-capabilities:
648 * @object: A #NotifyDaemonNotifications.
649 * @invocation: A #GDBusMethodInvocation.
650 *
651 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Notifications.GetCapabilities">GetCapabilities()</link> D-Bus method.
652 *
653 * 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 notify_daemon_notifications_complete_get_capabilities() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
654 *
655 * 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.
656 */
657 g_signal_new ("handle-get-capabilities",
658 G_TYPE_FROM_INTERFACE (iface),
659 G_SIGNAL_RUN_LAST,
660 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, handle_get_capabilities),
661 g_signal_accumulator_true_handled,
662 NULL,
663 g_cclosure_marshal_generic,
664 G_TYPE_BOOLEAN,
665 1,
666 G_TYPE_DBUS_METHOD_INVOCATION);
667
668 /**
669 * NotifyDaemonNotifications::handle-get-server-information:
670 * @object: A #NotifyDaemonNotifications.
671 * @invocation: A #GDBusMethodInvocation.
672 *
673 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Notifications.GetServerInformation">GetServerInformation()</link> D-Bus method.
674 *
675 * 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 notify_daemon_notifications_complete_get_server_information() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
676 *
677 * 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.
678 */
679 g_signal_new ("handle-get-server-information",
680 G_TYPE_FROM_INTERFACE (iface),
681 G_SIGNAL_RUN_LAST,
682 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, handle_get_server_information),
683 g_signal_accumulator_true_handled,
684 NULL,
685 g_cclosure_marshal_generic,
686 G_TYPE_BOOLEAN,
687 1,
688 G_TYPE_DBUS_METHOD_INVOCATION);
689
690 /* GObject signals for received D-Bus signals: */
691 /**
692 * NotifyDaemonNotifications::action-invoked:
693 * @object: A #NotifyDaemonNotifications.
694 * @arg_id: Argument.
695 * @arg_action_key: Argument.
696 *
697 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Notifications.ActionInvoked">"ActionInvoked"</link> is received.
698 *
699 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
700 */
701 g_signal_new ("action-invoked",
702 G_TYPE_FROM_INTERFACE (iface),
703 G_SIGNAL_RUN_LAST,
704 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, action_invoked),
705 NULL,
706 NULL,
707 g_cclosure_marshal_generic,
708 G_TYPE_NONE,
709 2, G_TYPE_UINT, G_TYPE_STRING);
710
711 /**
712 * NotifyDaemonNotifications::notification-closed:
713 * @object: A #NotifyDaemonNotifications.
714 * @arg_id: Argument.
715 * @arg_reason: Argument.
716 *
717 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-freedesktop-Notifications.NotificationClosed">"NotificationClosed"</link> is received.
718 *
719 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
720 */
721 g_signal_new ("notification-closed",
722 G_TYPE_FROM_INTERFACE (iface),
723 G_SIGNAL_RUN_LAST,
724 G_STRUCT_OFFSET (NotifyDaemonNotificationsIface, notification_closed),
725 NULL,
726 NULL,
727 g_cclosure_marshal_generic,
728 G_TYPE_NONE,
729 2, G_TYPE_UINT, G_TYPE_UINT);
730
731 }
732
733 /**
734 * notify_daemon_notifications_emit_action_invoked:
735 * @object: A #NotifyDaemonNotifications.
736 * @arg_id: Argument to pass with the signal.
737 * @arg_action_key: Argument to pass with the signal.
738 *
739 * Emits the <link linkend="gdbus-signal-org-freedesktop-Notifications.ActionInvoked">"ActionInvoked"</link> D-Bus signal.
740 */
741 void
notify_daemon_notifications_emit_action_invoked(NotifyDaemonNotifications * object,guint arg_id,const gchar * arg_action_key)742 notify_daemon_notifications_emit_action_invoked (
743 NotifyDaemonNotifications *object,
744 guint arg_id,
745 const gchar *arg_action_key)
746 {
747 g_signal_emit_by_name (object, "action-invoked", arg_id, arg_action_key);
748 }
749
750 /**
751 * notify_daemon_notifications_emit_notification_closed:
752 * @object: A #NotifyDaemonNotifications.
753 * @arg_id: Argument to pass with the signal.
754 * @arg_reason: Argument to pass with the signal.
755 *
756 * Emits the <link linkend="gdbus-signal-org-freedesktop-Notifications.NotificationClosed">"NotificationClosed"</link> D-Bus signal.
757 */
758 void
notify_daemon_notifications_emit_notification_closed(NotifyDaemonNotifications * object,guint arg_id,guint arg_reason)759 notify_daemon_notifications_emit_notification_closed (
760 NotifyDaemonNotifications *object,
761 guint arg_id,
762 guint arg_reason)
763 {
764 g_signal_emit_by_name (object, "notification-closed", arg_id, arg_reason);
765 }
766
767 /**
768 * notify_daemon_notifications_call_notify:
769 * @proxy: A #NotifyDaemonNotificationsProxy.
770 * @arg_app_name: Argument to pass with the method invocation.
771 * @arg_id: Argument to pass with the method invocation.
772 * @arg_icon: Argument to pass with the method invocation.
773 * @arg_summary: Argument to pass with the method invocation.
774 * @arg_body: Argument to pass with the method invocation.
775 * @arg_actions: Argument to pass with the method invocation.
776 * @arg_hints: Argument to pass with the method invocation.
777 * @arg_timeout: Argument to pass with the method invocation.
778 * @cancellable: (nullable): A #GCancellable or %NULL.
779 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
780 * @user_data: User data to pass to @callback.
781 *
782 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.Notify">Notify()</link> D-Bus method on @proxy.
783 * 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()).
784 * You can then call notify_daemon_notifications_call_notify_finish() to get the result of the operation.
785 *
786 * See notify_daemon_notifications_call_notify_sync() for the synchronous, blocking version of this method.
787 */
788 void
notify_daemon_notifications_call_notify(NotifyDaemonNotifications * proxy,const gchar * arg_app_name,guint arg_id,const gchar * arg_icon,const gchar * arg_summary,const gchar * arg_body,const gchar * const * arg_actions,GVariant * arg_hints,gint arg_timeout,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)789 notify_daemon_notifications_call_notify (
790 NotifyDaemonNotifications *proxy,
791 const gchar *arg_app_name,
792 guint arg_id,
793 const gchar *arg_icon,
794 const gchar *arg_summary,
795 const gchar *arg_body,
796 const gchar *const *arg_actions,
797 GVariant *arg_hints,
798 gint arg_timeout,
799 GCancellable *cancellable,
800 GAsyncReadyCallback callback,
801 gpointer user_data)
802 {
803 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
804 "Notify",
805 g_variant_new ("(susss^as@a{sv}i)",
806 arg_app_name,
807 arg_id,
808 arg_icon,
809 arg_summary,
810 arg_body,
811 arg_actions,
812 arg_hints,
813 arg_timeout),
814 G_DBUS_CALL_FLAGS_NONE,
815 -1,
816 cancellable,
817 callback,
818 user_data);
819 }
820
821 /**
822 * notify_daemon_notifications_call_notify_finish:
823 * @proxy: A #NotifyDaemonNotificationsProxy.
824 * @out_return_id: (out) (optional): Return location for return parameter or %NULL to ignore.
825 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_call_notify().
826 * @error: Return location for error or %NULL.
827 *
828 * Finishes an operation started with notify_daemon_notifications_call_notify().
829 *
830 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
831 */
832 gboolean
notify_daemon_notifications_call_notify_finish(NotifyDaemonNotifications * proxy,guint * out_return_id,GAsyncResult * res,GError ** error)833 notify_daemon_notifications_call_notify_finish (
834 NotifyDaemonNotifications *proxy,
835 guint *out_return_id,
836 GAsyncResult *res,
837 GError **error)
838 {
839 GVariant *_ret;
840 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
841 if (_ret == NULL)
842 goto _out;
843 g_variant_get (_ret,
844 "(u)",
845 out_return_id);
846 g_variant_unref (_ret);
847 _out:
848 return _ret != NULL;
849 }
850
851 /**
852 * notify_daemon_notifications_call_notify_sync:
853 * @proxy: A #NotifyDaemonNotificationsProxy.
854 * @arg_app_name: Argument to pass with the method invocation.
855 * @arg_id: Argument to pass with the method invocation.
856 * @arg_icon: Argument to pass with the method invocation.
857 * @arg_summary: Argument to pass with the method invocation.
858 * @arg_body: Argument to pass with the method invocation.
859 * @arg_actions: Argument to pass with the method invocation.
860 * @arg_hints: Argument to pass with the method invocation.
861 * @arg_timeout: Argument to pass with the method invocation.
862 * @out_return_id: (out) (optional): Return location for return parameter or %NULL to ignore.
863 * @cancellable: (nullable): A #GCancellable or %NULL.
864 * @error: Return location for error or %NULL.
865 *
866 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.Notify">Notify()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
867 *
868 * See notify_daemon_notifications_call_notify() for the asynchronous version of this method.
869 *
870 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
871 */
872 gboolean
notify_daemon_notifications_call_notify_sync(NotifyDaemonNotifications * proxy,const gchar * arg_app_name,guint arg_id,const gchar * arg_icon,const gchar * arg_summary,const gchar * arg_body,const gchar * const * arg_actions,GVariant * arg_hints,gint arg_timeout,guint * out_return_id,GCancellable * cancellable,GError ** error)873 notify_daemon_notifications_call_notify_sync (
874 NotifyDaemonNotifications *proxy,
875 const gchar *arg_app_name,
876 guint arg_id,
877 const gchar *arg_icon,
878 const gchar *arg_summary,
879 const gchar *arg_body,
880 const gchar *const *arg_actions,
881 GVariant *arg_hints,
882 gint arg_timeout,
883 guint *out_return_id,
884 GCancellable *cancellable,
885 GError **error)
886 {
887 GVariant *_ret;
888 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
889 "Notify",
890 g_variant_new ("(susss^as@a{sv}i)",
891 arg_app_name,
892 arg_id,
893 arg_icon,
894 arg_summary,
895 arg_body,
896 arg_actions,
897 arg_hints,
898 arg_timeout),
899 G_DBUS_CALL_FLAGS_NONE,
900 -1,
901 cancellable,
902 error);
903 if (_ret == NULL)
904 goto _out;
905 g_variant_get (_ret,
906 "(u)",
907 out_return_id);
908 g_variant_unref (_ret);
909 _out:
910 return _ret != NULL;
911 }
912
913 /**
914 * notify_daemon_notifications_call_close_notification:
915 * @proxy: A #NotifyDaemonNotificationsProxy.
916 * @arg_id: Argument to pass with the method invocation.
917 * @cancellable: (nullable): A #GCancellable or %NULL.
918 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
919 * @user_data: User data to pass to @callback.
920 *
921 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.CloseNotification">CloseNotification()</link> D-Bus method on @proxy.
922 * 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()).
923 * You can then call notify_daemon_notifications_call_close_notification_finish() to get the result of the operation.
924 *
925 * See notify_daemon_notifications_call_close_notification_sync() for the synchronous, blocking version of this method.
926 */
927 void
notify_daemon_notifications_call_close_notification(NotifyDaemonNotifications * proxy,guint arg_id,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)928 notify_daemon_notifications_call_close_notification (
929 NotifyDaemonNotifications *proxy,
930 guint arg_id,
931 GCancellable *cancellable,
932 GAsyncReadyCallback callback,
933 gpointer user_data)
934 {
935 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
936 "CloseNotification",
937 g_variant_new ("(u)",
938 arg_id),
939 G_DBUS_CALL_FLAGS_NONE,
940 -1,
941 cancellable,
942 callback,
943 user_data);
944 }
945
946 /**
947 * notify_daemon_notifications_call_close_notification_finish:
948 * @proxy: A #NotifyDaemonNotificationsProxy.
949 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_call_close_notification().
950 * @error: Return location for error or %NULL.
951 *
952 * Finishes an operation started with notify_daemon_notifications_call_close_notification().
953 *
954 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
955 */
956 gboolean
notify_daemon_notifications_call_close_notification_finish(NotifyDaemonNotifications * proxy,GAsyncResult * res,GError ** error)957 notify_daemon_notifications_call_close_notification_finish (
958 NotifyDaemonNotifications *proxy,
959 GAsyncResult *res,
960 GError **error)
961 {
962 GVariant *_ret;
963 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
964 if (_ret == NULL)
965 goto _out;
966 g_variant_get (_ret,
967 "()");
968 g_variant_unref (_ret);
969 _out:
970 return _ret != NULL;
971 }
972
973 /**
974 * notify_daemon_notifications_call_close_notification_sync:
975 * @proxy: A #NotifyDaemonNotificationsProxy.
976 * @arg_id: Argument to pass with the method invocation.
977 * @cancellable: (nullable): A #GCancellable or %NULL.
978 * @error: Return location for error or %NULL.
979 *
980 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.CloseNotification">CloseNotification()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
981 *
982 * See notify_daemon_notifications_call_close_notification() for the asynchronous version of this method.
983 *
984 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
985 */
986 gboolean
notify_daemon_notifications_call_close_notification_sync(NotifyDaemonNotifications * proxy,guint arg_id,GCancellable * cancellable,GError ** error)987 notify_daemon_notifications_call_close_notification_sync (
988 NotifyDaemonNotifications *proxy,
989 guint arg_id,
990 GCancellable *cancellable,
991 GError **error)
992 {
993 GVariant *_ret;
994 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
995 "CloseNotification",
996 g_variant_new ("(u)",
997 arg_id),
998 G_DBUS_CALL_FLAGS_NONE,
999 -1,
1000 cancellable,
1001 error);
1002 if (_ret == NULL)
1003 goto _out;
1004 g_variant_get (_ret,
1005 "()");
1006 g_variant_unref (_ret);
1007 _out:
1008 return _ret != NULL;
1009 }
1010
1011 /**
1012 * notify_daemon_notifications_call_get_capabilities:
1013 * @proxy: A #NotifyDaemonNotificationsProxy.
1014 * @cancellable: (nullable): A #GCancellable or %NULL.
1015 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1016 * @user_data: User data to pass to @callback.
1017 *
1018 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.GetCapabilities">GetCapabilities()</link> D-Bus method on @proxy.
1019 * 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()).
1020 * You can then call notify_daemon_notifications_call_get_capabilities_finish() to get the result of the operation.
1021 *
1022 * See notify_daemon_notifications_call_get_capabilities_sync() for the synchronous, blocking version of this method.
1023 */
1024 void
notify_daemon_notifications_call_get_capabilities(NotifyDaemonNotifications * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1025 notify_daemon_notifications_call_get_capabilities (
1026 NotifyDaemonNotifications *proxy,
1027 GCancellable *cancellable,
1028 GAsyncReadyCallback callback,
1029 gpointer user_data)
1030 {
1031 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1032 "GetCapabilities",
1033 g_variant_new ("()"),
1034 G_DBUS_CALL_FLAGS_NONE,
1035 -1,
1036 cancellable,
1037 callback,
1038 user_data);
1039 }
1040
1041 /**
1042 * notify_daemon_notifications_call_get_capabilities_finish:
1043 * @proxy: A #NotifyDaemonNotificationsProxy.
1044 * @out_return_caps: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
1045 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_call_get_capabilities().
1046 * @error: Return location for error or %NULL.
1047 *
1048 * Finishes an operation started with notify_daemon_notifications_call_get_capabilities().
1049 *
1050 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1051 */
1052 gboolean
notify_daemon_notifications_call_get_capabilities_finish(NotifyDaemonNotifications * proxy,gchar *** out_return_caps,GAsyncResult * res,GError ** error)1053 notify_daemon_notifications_call_get_capabilities_finish (
1054 NotifyDaemonNotifications *proxy,
1055 gchar ***out_return_caps,
1056 GAsyncResult *res,
1057 GError **error)
1058 {
1059 GVariant *_ret;
1060 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1061 if (_ret == NULL)
1062 goto _out;
1063 g_variant_get (_ret,
1064 "(^as)",
1065 out_return_caps);
1066 g_variant_unref (_ret);
1067 _out:
1068 return _ret != NULL;
1069 }
1070
1071 /**
1072 * notify_daemon_notifications_call_get_capabilities_sync:
1073 * @proxy: A #NotifyDaemonNotificationsProxy.
1074 * @out_return_caps: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore.
1075 * @cancellable: (nullable): A #GCancellable or %NULL.
1076 * @error: Return location for error or %NULL.
1077 *
1078 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.GetCapabilities">GetCapabilities()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1079 *
1080 * See notify_daemon_notifications_call_get_capabilities() for the asynchronous version of this method.
1081 *
1082 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1083 */
1084 gboolean
notify_daemon_notifications_call_get_capabilities_sync(NotifyDaemonNotifications * proxy,gchar *** out_return_caps,GCancellable * cancellable,GError ** error)1085 notify_daemon_notifications_call_get_capabilities_sync (
1086 NotifyDaemonNotifications *proxy,
1087 gchar ***out_return_caps,
1088 GCancellable *cancellable,
1089 GError **error)
1090 {
1091 GVariant *_ret;
1092 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1093 "GetCapabilities",
1094 g_variant_new ("()"),
1095 G_DBUS_CALL_FLAGS_NONE,
1096 -1,
1097 cancellable,
1098 error);
1099 if (_ret == NULL)
1100 goto _out;
1101 g_variant_get (_ret,
1102 "(^as)",
1103 out_return_caps);
1104 g_variant_unref (_ret);
1105 _out:
1106 return _ret != NULL;
1107 }
1108
1109 /**
1110 * notify_daemon_notifications_call_get_server_information:
1111 * @proxy: A #NotifyDaemonNotificationsProxy.
1112 * @cancellable: (nullable): A #GCancellable or %NULL.
1113 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1114 * @user_data: User data to pass to @callback.
1115 *
1116 * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.GetServerInformation">GetServerInformation()</link> D-Bus method on @proxy.
1117 * 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()).
1118 * You can then call notify_daemon_notifications_call_get_server_information_finish() to get the result of the operation.
1119 *
1120 * See notify_daemon_notifications_call_get_server_information_sync() for the synchronous, blocking version of this method.
1121 */
1122 void
notify_daemon_notifications_call_get_server_information(NotifyDaemonNotifications * proxy,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1123 notify_daemon_notifications_call_get_server_information (
1124 NotifyDaemonNotifications *proxy,
1125 GCancellable *cancellable,
1126 GAsyncReadyCallback callback,
1127 gpointer user_data)
1128 {
1129 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1130 "GetServerInformation",
1131 g_variant_new ("()"),
1132 G_DBUS_CALL_FLAGS_NONE,
1133 -1,
1134 cancellable,
1135 callback,
1136 user_data);
1137 }
1138
1139 /**
1140 * notify_daemon_notifications_call_get_server_information_finish:
1141 * @proxy: A #NotifyDaemonNotificationsProxy.
1142 * @out_return_name: (out) (optional): Return location for return parameter or %NULL to ignore.
1143 * @out_return_vendor: (out) (optional): Return location for return parameter or %NULL to ignore.
1144 * @out_return_version: (out) (optional): Return location for return parameter or %NULL to ignore.
1145 * @out_return_spec_version: (out) (optional): Return location for return parameter or %NULL to ignore.
1146 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_call_get_server_information().
1147 * @error: Return location for error or %NULL.
1148 *
1149 * Finishes an operation started with notify_daemon_notifications_call_get_server_information().
1150 *
1151 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1152 */
1153 gboolean
notify_daemon_notifications_call_get_server_information_finish(NotifyDaemonNotifications * proxy,gchar ** out_return_name,gchar ** out_return_vendor,gchar ** out_return_version,gchar ** out_return_spec_version,GAsyncResult * res,GError ** error)1154 notify_daemon_notifications_call_get_server_information_finish (
1155 NotifyDaemonNotifications *proxy,
1156 gchar **out_return_name,
1157 gchar **out_return_vendor,
1158 gchar **out_return_version,
1159 gchar **out_return_spec_version,
1160 GAsyncResult *res,
1161 GError **error)
1162 {
1163 GVariant *_ret;
1164 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1165 if (_ret == NULL)
1166 goto _out;
1167 g_variant_get (_ret,
1168 "(ssss)",
1169 out_return_name,
1170 out_return_vendor,
1171 out_return_version,
1172 out_return_spec_version);
1173 g_variant_unref (_ret);
1174 _out:
1175 return _ret != NULL;
1176 }
1177
1178 /**
1179 * notify_daemon_notifications_call_get_server_information_sync:
1180 * @proxy: A #NotifyDaemonNotificationsProxy.
1181 * @out_return_name: (out) (optional): Return location for return parameter or %NULL to ignore.
1182 * @out_return_vendor: (out) (optional): Return location for return parameter or %NULL to ignore.
1183 * @out_return_version: (out) (optional): Return location for return parameter or %NULL to ignore.
1184 * @out_return_spec_version: (out) (optional): Return location for return parameter or %NULL to ignore.
1185 * @cancellable: (nullable): A #GCancellable or %NULL.
1186 * @error: Return location for error or %NULL.
1187 *
1188 * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-Notifications.GetServerInformation">GetServerInformation()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1189 *
1190 * See notify_daemon_notifications_call_get_server_information() for the asynchronous version of this method.
1191 *
1192 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1193 */
1194 gboolean
notify_daemon_notifications_call_get_server_information_sync(NotifyDaemonNotifications * proxy,gchar ** out_return_name,gchar ** out_return_vendor,gchar ** out_return_version,gchar ** out_return_spec_version,GCancellable * cancellable,GError ** error)1195 notify_daemon_notifications_call_get_server_information_sync (
1196 NotifyDaemonNotifications *proxy,
1197 gchar **out_return_name,
1198 gchar **out_return_vendor,
1199 gchar **out_return_version,
1200 gchar **out_return_spec_version,
1201 GCancellable *cancellable,
1202 GError **error)
1203 {
1204 GVariant *_ret;
1205 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1206 "GetServerInformation",
1207 g_variant_new ("()"),
1208 G_DBUS_CALL_FLAGS_NONE,
1209 -1,
1210 cancellable,
1211 error);
1212 if (_ret == NULL)
1213 goto _out;
1214 g_variant_get (_ret,
1215 "(ssss)",
1216 out_return_name,
1217 out_return_vendor,
1218 out_return_version,
1219 out_return_spec_version);
1220 g_variant_unref (_ret);
1221 _out:
1222 return _ret != NULL;
1223 }
1224
1225 /**
1226 * notify_daemon_notifications_complete_notify:
1227 * @object: A #NotifyDaemonNotifications.
1228 * @invocation: (transfer full): A #GDBusMethodInvocation.
1229 * @return_id: Parameter to return.
1230 *
1231 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Notifications.Notify">Notify()</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.
1232 *
1233 * This method will free @invocation, you cannot use it afterwards.
1234 */
1235 void
notify_daemon_notifications_complete_notify(NotifyDaemonNotifications * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,guint return_id)1236 notify_daemon_notifications_complete_notify (
1237 NotifyDaemonNotifications *object G_GNUC_UNUSED,
1238 GDBusMethodInvocation *invocation,
1239 guint return_id)
1240 {
1241 g_dbus_method_invocation_return_value (invocation,
1242 g_variant_new ("(u)",
1243 return_id));
1244 }
1245
1246 /**
1247 * notify_daemon_notifications_complete_close_notification:
1248 * @object: A #NotifyDaemonNotifications.
1249 * @invocation: (transfer full): A #GDBusMethodInvocation.
1250 *
1251 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Notifications.CloseNotification">CloseNotification()</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.
1252 *
1253 * This method will free @invocation, you cannot use it afterwards.
1254 */
1255 void
notify_daemon_notifications_complete_close_notification(NotifyDaemonNotifications * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)1256 notify_daemon_notifications_complete_close_notification (
1257 NotifyDaemonNotifications *object G_GNUC_UNUSED,
1258 GDBusMethodInvocation *invocation)
1259 {
1260 g_dbus_method_invocation_return_value (invocation,
1261 g_variant_new ("()"));
1262 }
1263
1264 /**
1265 * notify_daemon_notifications_complete_get_capabilities:
1266 * @object: A #NotifyDaemonNotifications.
1267 * @invocation: (transfer full): A #GDBusMethodInvocation.
1268 * @return_caps: Parameter to return.
1269 *
1270 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Notifications.GetCapabilities">GetCapabilities()</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.
1271 *
1272 * This method will free @invocation, you cannot use it afterwards.
1273 */
1274 void
notify_daemon_notifications_complete_get_capabilities(NotifyDaemonNotifications * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * const * return_caps)1275 notify_daemon_notifications_complete_get_capabilities (
1276 NotifyDaemonNotifications *object G_GNUC_UNUSED,
1277 GDBusMethodInvocation *invocation,
1278 const gchar *const *return_caps)
1279 {
1280 g_dbus_method_invocation_return_value (invocation,
1281 g_variant_new ("(^as)",
1282 return_caps));
1283 }
1284
1285 /**
1286 * notify_daemon_notifications_complete_get_server_information:
1287 * @object: A #NotifyDaemonNotifications.
1288 * @invocation: (transfer full): A #GDBusMethodInvocation.
1289 * @return_name: Parameter to return.
1290 * @return_vendor: Parameter to return.
1291 * @return_version: Parameter to return.
1292 * @return_spec_version: Parameter to return.
1293 *
1294 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-Notifications.GetServerInformation">GetServerInformation()</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.
1295 *
1296 * This method will free @invocation, you cannot use it afterwards.
1297 */
1298 void
notify_daemon_notifications_complete_get_server_information(NotifyDaemonNotifications * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,const gchar * return_name,const gchar * return_vendor,const gchar * return_version,const gchar * return_spec_version)1299 notify_daemon_notifications_complete_get_server_information (
1300 NotifyDaemonNotifications *object G_GNUC_UNUSED,
1301 GDBusMethodInvocation *invocation,
1302 const gchar *return_name,
1303 const gchar *return_vendor,
1304 const gchar *return_version,
1305 const gchar *return_spec_version)
1306 {
1307 g_dbus_method_invocation_return_value (invocation,
1308 g_variant_new ("(ssss)",
1309 return_name,
1310 return_vendor,
1311 return_version,
1312 return_spec_version));
1313 }
1314
1315 /* ------------------------------------------------------------------------ */
1316
1317 /**
1318 * NotifyDaemonNotificationsProxy:
1319 *
1320 * The #NotifyDaemonNotificationsProxy structure contains only private data and should only be accessed using the provided API.
1321 */
1322
1323 /**
1324 * NotifyDaemonNotificationsProxyClass:
1325 * @parent_class: The parent class.
1326 *
1327 * Class structure for #NotifyDaemonNotificationsProxy.
1328 */
1329
1330 struct _NotifyDaemonNotificationsProxyPrivate
1331 {
1332 GData *qdata;
1333 };
1334
1335 static void notify_daemon_notifications_proxy_iface_init (NotifyDaemonNotificationsIface *iface);
1336
1337 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(NotifyDaemonNotificationsProxy,notify_daemon_notifications_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (NotifyDaemonNotificationsProxy)G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS,notify_daemon_notifications_proxy_iface_init))1338 G_DEFINE_TYPE_WITH_CODE (NotifyDaemonNotificationsProxy, notify_daemon_notifications_proxy, G_TYPE_DBUS_PROXY,
1339 G_ADD_PRIVATE (NotifyDaemonNotificationsProxy)
1340 G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS, notify_daemon_notifications_proxy_iface_init))
1341
1342 #else
1343 G_DEFINE_TYPE_WITH_CODE (NotifyDaemonNotificationsProxy, notify_daemon_notifications_proxy, G_TYPE_DBUS_PROXY,
1344 G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS, notify_daemon_notifications_proxy_iface_init))
1345
1346 #endif
1347 static void
1348 notify_daemon_notifications_proxy_finalize (GObject *object)
1349 {
1350 NotifyDaemonNotificationsProxy *proxy = NOTIFY_DAEMON_NOTIFICATIONS_PROXY (object);
1351 g_datalist_clear (&proxy->priv->qdata);
1352 G_OBJECT_CLASS (notify_daemon_notifications_proxy_parent_class)->finalize (object);
1353 }
1354
1355 static void
notify_daemon_notifications_proxy_get_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)1356 notify_daemon_notifications_proxy_get_property (GObject *object G_GNUC_UNUSED,
1357 guint prop_id G_GNUC_UNUSED,
1358 GValue *value G_GNUC_UNUSED,
1359 GParamSpec *pspec G_GNUC_UNUSED)
1360 {
1361 }
1362
1363 static void
notify_daemon_notifications_proxy_set_property(GObject * object G_GNUC_UNUSED,guint prop_id G_GNUC_UNUSED,const GValue * value G_GNUC_UNUSED,GParamSpec * pspec G_GNUC_UNUSED)1364 notify_daemon_notifications_proxy_set_property (GObject *object G_GNUC_UNUSED,
1365 guint prop_id G_GNUC_UNUSED,
1366 const GValue *value G_GNUC_UNUSED,
1367 GParamSpec *pspec G_GNUC_UNUSED)
1368 {
1369 }
1370
1371 static void
notify_daemon_notifications_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)1372 notify_daemon_notifications_proxy_g_signal (GDBusProxy *proxy,
1373 const gchar *sender_name G_GNUC_UNUSED,
1374 const gchar *signal_name,
1375 GVariant *parameters)
1376 {
1377 _ExtendedGDBusSignalInfo *info;
1378 GVariantIter iter;
1379 GVariant *child;
1380 GValue *paramv;
1381 gsize num_params;
1382 gsize n;
1383 guint signal_id;
1384 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct, signal_name);
1385 if (info == NULL)
1386 return;
1387 num_params = g_variant_n_children (parameters);
1388 paramv = g_new0 (GValue, num_params + 1);
1389 g_value_init (¶mv[0], NOTIFY_DAEMON_TYPE_NOTIFICATIONS);
1390 g_value_set_object (¶mv[0], proxy);
1391 g_variant_iter_init (&iter, parameters);
1392 n = 1;
1393 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1394 {
1395 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1396 if (arg_info->use_gvariant)
1397 {
1398 g_value_init (¶mv[n], G_TYPE_VARIANT);
1399 g_value_set_variant (¶mv[n], child);
1400 n++;
1401 }
1402 else
1403 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1404 g_variant_unref (child);
1405 }
1406 signal_id = g_signal_lookup (info->signal_name, NOTIFY_DAEMON_TYPE_NOTIFICATIONS);
1407 g_signal_emitv (paramv, signal_id, 0, NULL);
1408 for (n = 0; n < num_params + 1; n++)
1409 g_value_unset (¶mv[n]);
1410 g_free (paramv);
1411 }
1412
1413 static void
notify_daemon_notifications_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)1414 notify_daemon_notifications_proxy_g_properties_changed (GDBusProxy *_proxy,
1415 GVariant *changed_properties,
1416 const gchar *const *invalidated_properties)
1417 {
1418 NotifyDaemonNotificationsProxy *proxy = NOTIFY_DAEMON_NOTIFICATIONS_PROXY (_proxy);
1419 guint n;
1420 const gchar *key;
1421 GVariantIter *iter;
1422 _ExtendedGDBusPropertyInfo *info;
1423 g_variant_get (changed_properties, "a{sv}", &iter);
1424 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1425 {
1426 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct, key);
1427 g_datalist_remove_data (&proxy->priv->qdata, key);
1428 if (info != NULL)
1429 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1430 }
1431 g_variant_iter_free (iter);
1432 for (n = 0; invalidated_properties[n] != NULL; n++)
1433 {
1434 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct, invalidated_properties[n]);
1435 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1436 if (info != NULL)
1437 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1438 }
1439 }
1440
1441 static void
notify_daemon_notifications_proxy_init(NotifyDaemonNotificationsProxy * proxy)1442 notify_daemon_notifications_proxy_init (NotifyDaemonNotificationsProxy *proxy)
1443 {
1444 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1445 proxy->priv = notify_daemon_notifications_proxy_get_instance_private (proxy);
1446 #else
1447 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, NOTIFY_DAEMON_TYPE_NOTIFICATIONS_PROXY, NotifyDaemonNotificationsProxyPrivate);
1448 #endif
1449
1450 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), notify_daemon_notifications_interface_info ());
1451 }
1452
1453 static void
notify_daemon_notifications_proxy_class_init(NotifyDaemonNotificationsProxyClass * klass)1454 notify_daemon_notifications_proxy_class_init (NotifyDaemonNotificationsProxyClass *klass)
1455 {
1456 GObjectClass *gobject_class;
1457 GDBusProxyClass *proxy_class;
1458
1459 gobject_class = G_OBJECT_CLASS (klass);
1460 gobject_class->finalize = notify_daemon_notifications_proxy_finalize;
1461 gobject_class->get_property = notify_daemon_notifications_proxy_get_property;
1462 gobject_class->set_property = notify_daemon_notifications_proxy_set_property;
1463
1464 proxy_class = G_DBUS_PROXY_CLASS (klass);
1465 proxy_class->g_signal = notify_daemon_notifications_proxy_g_signal;
1466 proxy_class->g_properties_changed = notify_daemon_notifications_proxy_g_properties_changed;
1467
1468 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1469 g_type_class_add_private (klass, sizeof (NotifyDaemonNotificationsProxyPrivate));
1470 #endif
1471 }
1472
1473 static void
notify_daemon_notifications_proxy_iface_init(NotifyDaemonNotificationsIface * iface G_GNUC_UNUSED)1474 notify_daemon_notifications_proxy_iface_init (NotifyDaemonNotificationsIface *iface G_GNUC_UNUSED)
1475 {
1476 }
1477
1478 /**
1479 * notify_daemon_notifications_proxy_new:
1480 * @connection: A #GDBusConnection.
1481 * @flags: Flags from the #GDBusProxyFlags enumeration.
1482 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1483 * @object_path: An object path.
1484 * @cancellable: (nullable): A #GCancellable or %NULL.
1485 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1486 * @user_data: User data to pass to @callback.
1487 *
1488 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link>. See g_dbus_proxy_new() for more details.
1489 *
1490 * 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()).
1491 * You can then call notify_daemon_notifications_proxy_new_finish() to get the result of the operation.
1492 *
1493 * See notify_daemon_notifications_proxy_new_sync() for the synchronous, blocking version of this constructor.
1494 */
1495 void
notify_daemon_notifications_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1496 notify_daemon_notifications_proxy_new (
1497 GDBusConnection *connection,
1498 GDBusProxyFlags flags,
1499 const gchar *name,
1500 const gchar *object_path,
1501 GCancellable *cancellable,
1502 GAsyncReadyCallback callback,
1503 gpointer user_data)
1504 {
1505 g_async_initable_new_async (NOTIFY_DAEMON_TYPE_NOTIFICATIONS_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.Notifications", NULL);
1506 }
1507
1508 /**
1509 * notify_daemon_notifications_proxy_new_finish:
1510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_proxy_new().
1511 * @error: Return location for error or %NULL
1512 *
1513 * Finishes an operation started with notify_daemon_notifications_proxy_new().
1514 *
1515 * Returns: (transfer full) (type NotifyDaemonNotificationsProxy): The constructed proxy object or %NULL if @error is set.
1516 */
1517 NotifyDaemonNotifications *
notify_daemon_notifications_proxy_new_finish(GAsyncResult * res,GError ** error)1518 notify_daemon_notifications_proxy_new_finish (
1519 GAsyncResult *res,
1520 GError **error)
1521 {
1522 GObject *ret;
1523 GObject *source_object;
1524 source_object = g_async_result_get_source_object (res);
1525 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1526 g_object_unref (source_object);
1527 if (ret != NULL)
1528 return NOTIFY_DAEMON_NOTIFICATIONS (ret);
1529 else
1530 return NULL;
1531 }
1532
1533 /**
1534 * notify_daemon_notifications_proxy_new_sync:
1535 * @connection: A #GDBusConnection.
1536 * @flags: Flags from the #GDBusProxyFlags enumeration.
1537 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1538 * @object_path: An object path.
1539 * @cancellable: (nullable): A #GCancellable or %NULL.
1540 * @error: Return location for error or %NULL
1541 *
1542 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link>. See g_dbus_proxy_new_sync() for more details.
1543 *
1544 * The calling thread is blocked until a reply is received.
1545 *
1546 * See notify_daemon_notifications_proxy_new() for the asynchronous version of this constructor.
1547 *
1548 * Returns: (transfer full) (type NotifyDaemonNotificationsProxy): The constructed proxy object or %NULL if @error is set.
1549 */
1550 NotifyDaemonNotifications *
notify_daemon_notifications_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)1551 notify_daemon_notifications_proxy_new_sync (
1552 GDBusConnection *connection,
1553 GDBusProxyFlags flags,
1554 const gchar *name,
1555 const gchar *object_path,
1556 GCancellable *cancellable,
1557 GError **error)
1558 {
1559 GInitable *ret;
1560 ret = g_initable_new (NOTIFY_DAEMON_TYPE_NOTIFICATIONS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Notifications", NULL);
1561 if (ret != NULL)
1562 return NOTIFY_DAEMON_NOTIFICATIONS (ret);
1563 else
1564 return NULL;
1565 }
1566
1567
1568 /**
1569 * notify_daemon_notifications_proxy_new_for_bus:
1570 * @bus_type: A #GBusType.
1571 * @flags: Flags from the #GDBusProxyFlags enumeration.
1572 * @name: A bus name (well-known or unique).
1573 * @object_path: An object path.
1574 * @cancellable: (nullable): A #GCancellable or %NULL.
1575 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1576 * @user_data: User data to pass to @callback.
1577 *
1578 * Like notify_daemon_notifications_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1579 *
1580 * 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()).
1581 * You can then call notify_daemon_notifications_proxy_new_for_bus_finish() to get the result of the operation.
1582 *
1583 * See notify_daemon_notifications_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1584 */
1585 void
notify_daemon_notifications_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1586 notify_daemon_notifications_proxy_new_for_bus (
1587 GBusType bus_type,
1588 GDBusProxyFlags flags,
1589 const gchar *name,
1590 const gchar *object_path,
1591 GCancellable *cancellable,
1592 GAsyncReadyCallback callback,
1593 gpointer user_data)
1594 {
1595 g_async_initable_new_async (NOTIFY_DAEMON_TYPE_NOTIFICATIONS_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.Notifications", NULL);
1596 }
1597
1598 /**
1599 * notify_daemon_notifications_proxy_new_for_bus_finish:
1600 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to notify_daemon_notifications_proxy_new_for_bus().
1601 * @error: Return location for error or %NULL
1602 *
1603 * Finishes an operation started with notify_daemon_notifications_proxy_new_for_bus().
1604 *
1605 * Returns: (transfer full) (type NotifyDaemonNotificationsProxy): The constructed proxy object or %NULL if @error is set.
1606 */
1607 NotifyDaemonNotifications *
notify_daemon_notifications_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)1608 notify_daemon_notifications_proxy_new_for_bus_finish (
1609 GAsyncResult *res,
1610 GError **error)
1611 {
1612 GObject *ret;
1613 GObject *source_object;
1614 source_object = g_async_result_get_source_object (res);
1615 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1616 g_object_unref (source_object);
1617 if (ret != NULL)
1618 return NOTIFY_DAEMON_NOTIFICATIONS (ret);
1619 else
1620 return NULL;
1621 }
1622
1623 /**
1624 * notify_daemon_notifications_proxy_new_for_bus_sync:
1625 * @bus_type: A #GBusType.
1626 * @flags: Flags from the #GDBusProxyFlags enumeration.
1627 * @name: A bus name (well-known or unique).
1628 * @object_path: An object path.
1629 * @cancellable: (nullable): A #GCancellable or %NULL.
1630 * @error: Return location for error or %NULL
1631 *
1632 * Like notify_daemon_notifications_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1633 *
1634 * The calling thread is blocked until a reply is received.
1635 *
1636 * See notify_daemon_notifications_proxy_new_for_bus() for the asynchronous version of this constructor.
1637 *
1638 * Returns: (transfer full) (type NotifyDaemonNotificationsProxy): The constructed proxy object or %NULL if @error is set.
1639 */
1640 NotifyDaemonNotifications *
notify_daemon_notifications_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)1641 notify_daemon_notifications_proxy_new_for_bus_sync (
1642 GBusType bus_type,
1643 GDBusProxyFlags flags,
1644 const gchar *name,
1645 const gchar *object_path,
1646 GCancellable *cancellable,
1647 GError **error)
1648 {
1649 GInitable *ret;
1650 ret = g_initable_new (NOTIFY_DAEMON_TYPE_NOTIFICATIONS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.Notifications", NULL);
1651 if (ret != NULL)
1652 return NOTIFY_DAEMON_NOTIFICATIONS (ret);
1653 else
1654 return NULL;
1655 }
1656
1657
1658 /* ------------------------------------------------------------------------ */
1659
1660 /**
1661 * NotifyDaemonNotificationsSkeleton:
1662 *
1663 * The #NotifyDaemonNotificationsSkeleton structure contains only private data and should only be accessed using the provided API.
1664 */
1665
1666 /**
1667 * NotifyDaemonNotificationsSkeletonClass:
1668 * @parent_class: The parent class.
1669 *
1670 * Class structure for #NotifyDaemonNotificationsSkeleton.
1671 */
1672
1673 struct _NotifyDaemonNotificationsSkeletonPrivate
1674 {
1675 GValue *properties;
1676 GList *changed_properties;
1677 GSource *changed_properties_idle_source;
1678 GMainContext *context;
1679 GMutex lock;
1680 };
1681
1682 static void
_notify_daemon_notifications_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)1683 _notify_daemon_notifications_skeleton_handle_method_call (
1684 GDBusConnection *connection G_GNUC_UNUSED,
1685 const gchar *sender G_GNUC_UNUSED,
1686 const gchar *object_path G_GNUC_UNUSED,
1687 const gchar *interface_name,
1688 const gchar *method_name,
1689 GVariant *parameters,
1690 GDBusMethodInvocation *invocation,
1691 gpointer user_data)
1692 {
1693 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (user_data);
1694 _ExtendedGDBusMethodInfo *info;
1695 GVariantIter iter;
1696 GVariant *child;
1697 GValue *paramv;
1698 gsize num_params;
1699 guint num_extra;
1700 gsize n;
1701 guint signal_id;
1702 GValue return_value = G_VALUE_INIT;
1703 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1704 g_assert (info != NULL);
1705 num_params = g_variant_n_children (parameters);
1706 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1707 n = 0;
1708 g_value_init (¶mv[n], NOTIFY_DAEMON_TYPE_NOTIFICATIONS);
1709 g_value_set_object (¶mv[n++], skeleton);
1710 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1711 g_value_set_object (¶mv[n++], invocation);
1712 if (info->pass_fdlist)
1713 {
1714 #ifdef G_OS_UNIX
1715 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
1716 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1717 #else
1718 g_assert_not_reached ();
1719 #endif
1720 }
1721 g_variant_iter_init (&iter, parameters);
1722 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1723 {
1724 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1725 if (arg_info->use_gvariant)
1726 {
1727 g_value_init (¶mv[n], G_TYPE_VARIANT);
1728 g_value_set_variant (¶mv[n], child);
1729 n++;
1730 }
1731 else
1732 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
1733 g_variant_unref (child);
1734 }
1735 signal_id = g_signal_lookup (info->signal_name, NOTIFY_DAEMON_TYPE_NOTIFICATIONS);
1736 g_value_init (&return_value, G_TYPE_BOOLEAN);
1737 g_signal_emitv (paramv, signal_id, 0, &return_value);
1738 if (!g_value_get_boolean (&return_value))
1739 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);
1740 g_value_unset (&return_value);
1741 for (n = 0; n < num_params + num_extra; n++)
1742 g_value_unset (¶mv[n]);
1743 g_free (paramv);
1744 }
1745
1746 static GVariant *
_notify_daemon_notifications_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GError ** error,gpointer user_data)1747 _notify_daemon_notifications_skeleton_handle_get_property (
1748 GDBusConnection *connection G_GNUC_UNUSED,
1749 const gchar *sender G_GNUC_UNUSED,
1750 const gchar *object_path G_GNUC_UNUSED,
1751 const gchar *interface_name G_GNUC_UNUSED,
1752 const gchar *property_name,
1753 GError **error,
1754 gpointer user_data)
1755 {
1756 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (user_data);
1757 GValue value = G_VALUE_INIT;
1758 GParamSpec *pspec;
1759 _ExtendedGDBusPropertyInfo *info;
1760 GVariant *ret;
1761 ret = NULL;
1762 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct, property_name);
1763 g_assert (info != NULL);
1764 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1765 if (pspec == NULL)
1766 {
1767 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1768 }
1769 else
1770 {
1771 g_value_init (&value, pspec->value_type);
1772 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1773 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1774 g_value_unset (&value);
1775 }
1776 return ret;
1777 }
1778
1779 static gboolean
_notify_daemon_notifications_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED,const gchar * sender G_GNUC_UNUSED,const gchar * object_path G_GNUC_UNUSED,const gchar * interface_name G_GNUC_UNUSED,const gchar * property_name,GVariant * variant,GError ** error,gpointer user_data)1780 _notify_daemon_notifications_skeleton_handle_set_property (
1781 GDBusConnection *connection G_GNUC_UNUSED,
1782 const gchar *sender G_GNUC_UNUSED,
1783 const gchar *object_path G_GNUC_UNUSED,
1784 const gchar *interface_name G_GNUC_UNUSED,
1785 const gchar *property_name,
1786 GVariant *variant,
1787 GError **error,
1788 gpointer user_data)
1789 {
1790 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (user_data);
1791 GValue value = G_VALUE_INIT;
1792 GParamSpec *pspec;
1793 _ExtendedGDBusPropertyInfo *info;
1794 gboolean ret;
1795 ret = FALSE;
1796 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_notify_daemon_notifications_interface_info.parent_struct, property_name);
1797 g_assert (info != NULL);
1798 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1799 if (pspec == NULL)
1800 {
1801 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1802 }
1803 else
1804 {
1805 if (info->use_gvariant)
1806 g_value_set_variant (&value, variant);
1807 else
1808 g_dbus_gvariant_to_gvalue (variant, &value);
1809 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1810 g_value_unset (&value);
1811 ret = TRUE;
1812 }
1813 return ret;
1814 }
1815
1816 static const GDBusInterfaceVTable _notify_daemon_notifications_skeleton_vtable =
1817 {
1818 _notify_daemon_notifications_skeleton_handle_method_call,
1819 _notify_daemon_notifications_skeleton_handle_get_property,
1820 _notify_daemon_notifications_skeleton_handle_set_property,
1821 {NULL}
1822 };
1823
1824 static GDBusInterfaceInfo *
notify_daemon_notifications_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1825 notify_daemon_notifications_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1826 {
1827 return notify_daemon_notifications_interface_info ();
1828 }
1829
1830 static GDBusInterfaceVTable *
notify_daemon_notifications_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)1831 notify_daemon_notifications_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1832 {
1833 return (GDBusInterfaceVTable *) &_notify_daemon_notifications_skeleton_vtable;
1834 }
1835
1836 static GVariant *
notify_daemon_notifications_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)1837 notify_daemon_notifications_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1838 {
1839 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (_skeleton);
1840
1841 GVariantBuilder builder;
1842 guint n;
1843 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1844 if (_notify_daemon_notifications_interface_info.parent_struct.properties == NULL)
1845 goto out;
1846 for (n = 0; _notify_daemon_notifications_interface_info.parent_struct.properties[n] != NULL; n++)
1847 {
1848 GDBusPropertyInfo *info = _notify_daemon_notifications_interface_info.parent_struct.properties[n];
1849 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1850 {
1851 GVariant *value;
1852 value = _notify_daemon_notifications_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.Notifications", info->name, NULL, skeleton);
1853 if (value != NULL)
1854 {
1855 g_variant_take_ref (value);
1856 g_variant_builder_add (&builder, "{sv}", info->name, value);
1857 g_variant_unref (value);
1858 }
1859 }
1860 }
1861 out:
1862 return g_variant_builder_end (&builder);
1863 }
1864
1865 static void
notify_daemon_notifications_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton G_GNUC_UNUSED)1866 notify_daemon_notifications_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton G_GNUC_UNUSED)
1867 {
1868 }
1869
1870 static void
_notify_daemon_notifications_on_signal_action_invoked(NotifyDaemonNotifications * object,guint arg_id,const gchar * arg_action_key)1871 _notify_daemon_notifications_on_signal_action_invoked (
1872 NotifyDaemonNotifications *object,
1873 guint arg_id,
1874 const gchar *arg_action_key)
1875 {
1876 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (object);
1877
1878 GList *connections, *l;
1879 GVariant *signal_variant;
1880 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1881
1882 signal_variant = g_variant_ref_sink (g_variant_new ("(us)",
1883 arg_id,
1884 arg_action_key));
1885 for (l = connections; l != NULL; l = l->next)
1886 {
1887 GDBusConnection *connection = l->data;
1888 g_dbus_connection_emit_signal (connection,
1889 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Notifications", "ActionInvoked",
1890 signal_variant, NULL);
1891 }
1892 g_variant_unref (signal_variant);
1893 g_list_free_full (connections, g_object_unref);
1894 }
1895
1896 static void
_notify_daemon_notifications_on_signal_notification_closed(NotifyDaemonNotifications * object,guint arg_id,guint arg_reason)1897 _notify_daemon_notifications_on_signal_notification_closed (
1898 NotifyDaemonNotifications *object,
1899 guint arg_id,
1900 guint arg_reason)
1901 {
1902 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (object);
1903
1904 GList *connections, *l;
1905 GVariant *signal_variant;
1906 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1907
1908 signal_variant = g_variant_ref_sink (g_variant_new ("(uu)",
1909 arg_id,
1910 arg_reason));
1911 for (l = connections; l != NULL; l = l->next)
1912 {
1913 GDBusConnection *connection = l->data;
1914 g_dbus_connection_emit_signal (connection,
1915 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.Notifications", "NotificationClosed",
1916 signal_variant, NULL);
1917 }
1918 g_variant_unref (signal_variant);
1919 g_list_free_full (connections, g_object_unref);
1920 }
1921
1922 static void notify_daemon_notifications_skeleton_iface_init (NotifyDaemonNotificationsIface *iface);
1923 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(NotifyDaemonNotificationsSkeleton,notify_daemon_notifications_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (NotifyDaemonNotificationsSkeleton)G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS,notify_daemon_notifications_skeleton_iface_init))1924 G_DEFINE_TYPE_WITH_CODE (NotifyDaemonNotificationsSkeleton, notify_daemon_notifications_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1925 G_ADD_PRIVATE (NotifyDaemonNotificationsSkeleton)
1926 G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS, notify_daemon_notifications_skeleton_iface_init))
1927
1928 #else
1929 G_DEFINE_TYPE_WITH_CODE (NotifyDaemonNotificationsSkeleton, notify_daemon_notifications_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1930 G_IMPLEMENT_INTERFACE (NOTIFY_DAEMON_TYPE_NOTIFICATIONS, notify_daemon_notifications_skeleton_iface_init))
1931
1932 #endif
1933 static void
1934 notify_daemon_notifications_skeleton_finalize (GObject *object)
1935 {
1936 NotifyDaemonNotificationsSkeleton *skeleton = NOTIFY_DAEMON_NOTIFICATIONS_SKELETON (object);
1937 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1938 if (skeleton->priv->changed_properties_idle_source != NULL)
1939 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1940 g_main_context_unref (skeleton->priv->context);
1941 g_mutex_clear (&skeleton->priv->lock);
1942 G_OBJECT_CLASS (notify_daemon_notifications_skeleton_parent_class)->finalize (object);
1943 }
1944
1945 static void
notify_daemon_notifications_skeleton_init(NotifyDaemonNotificationsSkeleton * skeleton)1946 notify_daemon_notifications_skeleton_init (NotifyDaemonNotificationsSkeleton *skeleton)
1947 {
1948 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1949 skeleton->priv = notify_daemon_notifications_skeleton_get_instance_private (skeleton);
1950 #else
1951 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, NOTIFY_DAEMON_TYPE_NOTIFICATIONS_SKELETON, NotifyDaemonNotificationsSkeletonPrivate);
1952 #endif
1953
1954 g_mutex_init (&skeleton->priv->lock);
1955 skeleton->priv->context = g_main_context_ref_thread_default ();
1956 }
1957
1958 static void
notify_daemon_notifications_skeleton_class_init(NotifyDaemonNotificationsSkeletonClass * klass)1959 notify_daemon_notifications_skeleton_class_init (NotifyDaemonNotificationsSkeletonClass *klass)
1960 {
1961 GObjectClass *gobject_class;
1962 GDBusInterfaceSkeletonClass *skeleton_class;
1963
1964 gobject_class = G_OBJECT_CLASS (klass);
1965 gobject_class->finalize = notify_daemon_notifications_skeleton_finalize;
1966
1967 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1968 skeleton_class->get_info = notify_daemon_notifications_skeleton_dbus_interface_get_info;
1969 skeleton_class->get_properties = notify_daemon_notifications_skeleton_dbus_interface_get_properties;
1970 skeleton_class->flush = notify_daemon_notifications_skeleton_dbus_interface_flush;
1971 skeleton_class->get_vtable = notify_daemon_notifications_skeleton_dbus_interface_get_vtable;
1972
1973 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1974 g_type_class_add_private (klass, sizeof (NotifyDaemonNotificationsSkeletonPrivate));
1975 #endif
1976 }
1977
1978 static void
notify_daemon_notifications_skeleton_iface_init(NotifyDaemonNotificationsIface * iface)1979 notify_daemon_notifications_skeleton_iface_init (NotifyDaemonNotificationsIface *iface)
1980 {
1981 iface->action_invoked = _notify_daemon_notifications_on_signal_action_invoked;
1982 iface->notification_closed = _notify_daemon_notifications_on_signal_notification_closed;
1983 }
1984
1985 /**
1986 * notify_daemon_notifications_skeleton_new:
1987 *
1988 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-Notifications.top_of_page">org.freedesktop.Notifications</link>.
1989 *
1990 * Returns: (transfer full) (type NotifyDaemonNotificationsSkeleton): The skeleton object.
1991 */
1992 NotifyDaemonNotifications *
notify_daemon_notifications_skeleton_new(void)1993 notify_daemon_notifications_skeleton_new (void)
1994 {
1995 return NOTIFY_DAEMON_NOTIFICATIONS (g_object_new (NOTIFY_DAEMON_TYPE_NOTIFICATIONS_SKELETON, NULL));
1996 }
1997
1998