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 "sn-dbus-menu-gen.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 com.canonical.dbusmenu
156 * ------------------------------------------------------------------------
157 */
158
159 /**
160 * SECTION:SnDBusMenuGen
161 * @title: SnDBusMenuGen
162 * @short_description: Generated C code for the com.canonical.dbusmenu D-Bus interface
163 *
164 * This section contains code for working with the <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link> D-Bus interface in C.
165 */
166
167 /* ---- Introspection data for com.canonical.dbusmenu ---- */
168
169 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_layout_IN_ARG_parentId =
170 {
171 {
172 -1,
173 (gchar *) "parentId",
174 (gchar *) "i",
175 NULL
176 },
177 FALSE
178 };
179
180 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_layout_IN_ARG_recursionDepth =
181 {
182 {
183 -1,
184 (gchar *) "recursionDepth",
185 (gchar *) "i",
186 NULL
187 },
188 FALSE
189 };
190
191 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_layout_IN_ARG_propertyNames =
192 {
193 {
194 -1,
195 (gchar *) "propertyNames",
196 (gchar *) "as",
197 NULL
198 },
199 FALSE
200 };
201
202 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_layout_IN_ARG_pointers[] =
203 {
204 &_sn_dbus_menu_gen_method_info_get_layout_IN_ARG_parentId.parent_struct,
205 &_sn_dbus_menu_gen_method_info_get_layout_IN_ARG_recursionDepth.parent_struct,
206 &_sn_dbus_menu_gen_method_info_get_layout_IN_ARG_propertyNames.parent_struct,
207 NULL
208 };
209
210 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_revision =
211 {
212 {
213 -1,
214 (gchar *) "revision",
215 (gchar *) "u",
216 NULL
217 },
218 FALSE
219 };
220
221 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_layout =
222 {
223 {
224 -1,
225 (gchar *) "layout",
226 (gchar *) "(ia{sv}av)",
227 NULL
228 },
229 FALSE
230 };
231
232 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_pointers[] =
233 {
234 &_sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_revision.parent_struct,
235 &_sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_layout.parent_struct,
236 NULL
237 };
238
239 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_get_layout =
240 {
241 {
242 -1,
243 (gchar *) "GetLayout",
244 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_layout_IN_ARG_pointers,
245 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_layout_OUT_ARG_pointers,
246 NULL
247 },
248 "handle-get-layout",
249 FALSE
250 };
251
252 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_ids =
253 {
254 {
255 -1,
256 (gchar *) "ids",
257 (gchar *) "ai",
258 NULL
259 },
260 FALSE
261 };
262
263 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_propertyNames =
264 {
265 {
266 -1,
267 (gchar *) "propertyNames",
268 (gchar *) "as",
269 NULL
270 },
271 FALSE
272 };
273
274 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_pointers[] =
275 {
276 &_sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_ids.parent_struct,
277 &_sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_propertyNames.parent_struct,
278 NULL
279 };
280
281 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_group_properties_OUT_ARG_properties =
282 {
283 {
284 -1,
285 (gchar *) "properties",
286 (gchar *) "a(ia{sv})",
287 NULL
288 },
289 FALSE
290 };
291
292 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_group_properties_OUT_ARG_pointers[] =
293 {
294 &_sn_dbus_menu_gen_method_info_get_group_properties_OUT_ARG_properties.parent_struct,
295 NULL
296 };
297
298 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_get_group_properties =
299 {
300 {
301 -1,
302 (gchar *) "GetGroupProperties",
303 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_group_properties_IN_ARG_pointers,
304 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_group_properties_OUT_ARG_pointers,
305 NULL
306 },
307 "handle-get-group-properties",
308 FALSE
309 };
310
311 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_property_IN_ARG_id =
312 {
313 {
314 -1,
315 (gchar *) "id",
316 (gchar *) "i",
317 NULL
318 },
319 FALSE
320 };
321
322 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_property_IN_ARG_name =
323 {
324 {
325 -1,
326 (gchar *) "name",
327 (gchar *) "s",
328 NULL
329 },
330 FALSE
331 };
332
333 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_property_IN_ARG_pointers[] =
334 {
335 &_sn_dbus_menu_gen_method_info_get_property_IN_ARG_id.parent_struct,
336 &_sn_dbus_menu_gen_method_info_get_property_IN_ARG_name.parent_struct,
337 NULL
338 };
339
340 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_get_property_OUT_ARG_value =
341 {
342 {
343 -1,
344 (gchar *) "value",
345 (gchar *) "v",
346 NULL
347 },
348 FALSE
349 };
350
351 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_get_property_OUT_ARG_pointers[] =
352 {
353 &_sn_dbus_menu_gen_method_info_get_property_OUT_ARG_value.parent_struct,
354 NULL
355 };
356
357 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_get_property =
358 {
359 {
360 -1,
361 (gchar *) "GetProperty",
362 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_property_IN_ARG_pointers,
363 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_get_property_OUT_ARG_pointers,
364 NULL
365 },
366 "handle-get-property",
367 FALSE
368 };
369
370 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_IN_ARG_id =
371 {
372 {
373 -1,
374 (gchar *) "id",
375 (gchar *) "i",
376 NULL
377 },
378 FALSE
379 };
380
381 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_IN_ARG_eventId =
382 {
383 {
384 -1,
385 (gchar *) "eventId",
386 (gchar *) "s",
387 NULL
388 },
389 FALSE
390 };
391
392 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_IN_ARG_data =
393 {
394 {
395 -1,
396 (gchar *) "data",
397 (gchar *) "v",
398 NULL
399 },
400 FALSE
401 };
402
403 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_IN_ARG_timestamp =
404 {
405 {
406 -1,
407 (gchar *) "timestamp",
408 (gchar *) "u",
409 NULL
410 },
411 FALSE
412 };
413
414 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_event_IN_ARG_pointers[] =
415 {
416 &_sn_dbus_menu_gen_method_info_event_IN_ARG_id.parent_struct,
417 &_sn_dbus_menu_gen_method_info_event_IN_ARG_eventId.parent_struct,
418 &_sn_dbus_menu_gen_method_info_event_IN_ARG_data.parent_struct,
419 &_sn_dbus_menu_gen_method_info_event_IN_ARG_timestamp.parent_struct,
420 NULL
421 };
422
423 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_event =
424 {
425 {
426 -1,
427 (gchar *) "Event",
428 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_event_IN_ARG_pointers,
429 NULL,
430 NULL
431 },
432 "handle-event",
433 FALSE
434 };
435
436 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_group_IN_ARG_events =
437 {
438 {
439 -1,
440 (gchar *) "events",
441 (gchar *) "a(isvu)",
442 NULL
443 },
444 FALSE
445 };
446
447 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_event_group_IN_ARG_pointers[] =
448 {
449 &_sn_dbus_menu_gen_method_info_event_group_IN_ARG_events.parent_struct,
450 NULL
451 };
452
453 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_event_group_OUT_ARG_idErrors =
454 {
455 {
456 -1,
457 (gchar *) "idErrors",
458 (gchar *) "ai",
459 NULL
460 },
461 FALSE
462 };
463
464 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_event_group_OUT_ARG_pointers[] =
465 {
466 &_sn_dbus_menu_gen_method_info_event_group_OUT_ARG_idErrors.parent_struct,
467 NULL
468 };
469
470 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_event_group =
471 {
472 {
473 -1,
474 (gchar *) "EventGroup",
475 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_event_group_IN_ARG_pointers,
476 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_event_group_OUT_ARG_pointers,
477 NULL
478 },
479 "handle-event-group",
480 FALSE
481 };
482
483 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_about_to_show_IN_ARG_id =
484 {
485 {
486 -1,
487 (gchar *) "id",
488 (gchar *) "i",
489 NULL
490 },
491 FALSE
492 };
493
494 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_about_to_show_IN_ARG_pointers[] =
495 {
496 &_sn_dbus_menu_gen_method_info_about_to_show_IN_ARG_id.parent_struct,
497 NULL
498 };
499
500 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_about_to_show_OUT_ARG_needUpdate =
501 {
502 {
503 -1,
504 (gchar *) "needUpdate",
505 (gchar *) "b",
506 NULL
507 },
508 FALSE
509 };
510
511 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_about_to_show_OUT_ARG_pointers[] =
512 {
513 &_sn_dbus_menu_gen_method_info_about_to_show_OUT_ARG_needUpdate.parent_struct,
514 NULL
515 };
516
517 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_about_to_show =
518 {
519 {
520 -1,
521 (gchar *) "AboutToShow",
522 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_about_to_show_IN_ARG_pointers,
523 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_about_to_show_OUT_ARG_pointers,
524 NULL
525 },
526 "handle-about-to-show",
527 FALSE
528 };
529
530 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_about_to_show_group_IN_ARG_ids =
531 {
532 {
533 -1,
534 (gchar *) "ids",
535 (gchar *) "ai",
536 NULL
537 },
538 FALSE
539 };
540
541 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_about_to_show_group_IN_ARG_pointers[] =
542 {
543 &_sn_dbus_menu_gen_method_info_about_to_show_group_IN_ARG_ids.parent_struct,
544 NULL
545 };
546
547 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_updatesNeeded =
548 {
549 {
550 -1,
551 (gchar *) "updatesNeeded",
552 (gchar *) "ai",
553 NULL
554 },
555 FALSE
556 };
557
558 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_idErrors =
559 {
560 {
561 -1,
562 (gchar *) "idErrors",
563 (gchar *) "ai",
564 NULL
565 },
566 FALSE
567 };
568
569 static const GDBusArgInfo * const _sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_pointers[] =
570 {
571 &_sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_updatesNeeded.parent_struct,
572 &_sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_idErrors.parent_struct,
573 NULL
574 };
575
576 static const _ExtendedGDBusMethodInfo _sn_dbus_menu_gen_method_info_about_to_show_group =
577 {
578 {
579 -1,
580 (gchar *) "AboutToShowGroup",
581 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_about_to_show_group_IN_ARG_pointers,
582 (GDBusArgInfo **) &_sn_dbus_menu_gen_method_info_about_to_show_group_OUT_ARG_pointers,
583 NULL
584 },
585 "handle-about-to-show-group",
586 FALSE
587 };
588
589 static const GDBusMethodInfo * const _sn_dbus_menu_gen_method_info_pointers[] =
590 {
591 &_sn_dbus_menu_gen_method_info_get_layout.parent_struct,
592 &_sn_dbus_menu_gen_method_info_get_group_properties.parent_struct,
593 &_sn_dbus_menu_gen_method_info_get_property.parent_struct,
594 &_sn_dbus_menu_gen_method_info_event.parent_struct,
595 &_sn_dbus_menu_gen_method_info_event_group.parent_struct,
596 &_sn_dbus_menu_gen_method_info_about_to_show.parent_struct,
597 &_sn_dbus_menu_gen_method_info_about_to_show_group.parent_struct,
598 NULL
599 };
600
601 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_updatedProps =
602 {
603 {
604 -1,
605 (gchar *) "updatedProps",
606 (gchar *) "a(ia{sv})",
607 NULL
608 },
609 FALSE
610 };
611
612 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_removedProps =
613 {
614 {
615 -1,
616 (gchar *) "removedProps",
617 (gchar *) "a(ias)",
618 NULL
619 },
620 FALSE
621 };
622
623 static const GDBusArgInfo * const _sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_pointers[] =
624 {
625 &_sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_updatedProps.parent_struct,
626 &_sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_removedProps.parent_struct,
627 NULL
628 };
629
630 static const _ExtendedGDBusSignalInfo _sn_dbus_menu_gen_signal_info_items_properties_updated =
631 {
632 {
633 -1,
634 (gchar *) "ItemsPropertiesUpdated",
635 (GDBusArgInfo **) &_sn_dbus_menu_gen_signal_info_items_properties_updated_ARG_pointers,
636 NULL
637 },
638 "items-properties-updated"
639 };
640
641 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_layout_updated_ARG_revision =
642 {
643 {
644 -1,
645 (gchar *) "revision",
646 (gchar *) "u",
647 NULL
648 },
649 FALSE
650 };
651
652 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_layout_updated_ARG_parent =
653 {
654 {
655 -1,
656 (gchar *) "parent",
657 (gchar *) "i",
658 NULL
659 },
660 FALSE
661 };
662
663 static const GDBusArgInfo * const _sn_dbus_menu_gen_signal_info_layout_updated_ARG_pointers[] =
664 {
665 &_sn_dbus_menu_gen_signal_info_layout_updated_ARG_revision.parent_struct,
666 &_sn_dbus_menu_gen_signal_info_layout_updated_ARG_parent.parent_struct,
667 NULL
668 };
669
670 static const _ExtendedGDBusSignalInfo _sn_dbus_menu_gen_signal_info_layout_updated =
671 {
672 {
673 -1,
674 (gchar *) "LayoutUpdated",
675 (GDBusArgInfo **) &_sn_dbus_menu_gen_signal_info_layout_updated_ARG_pointers,
676 NULL
677 },
678 "layout-updated"
679 };
680
681 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_id =
682 {
683 {
684 -1,
685 (gchar *) "id",
686 (gchar *) "i",
687 NULL
688 },
689 FALSE
690 };
691
692 static const _ExtendedGDBusArgInfo _sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_timestamp =
693 {
694 {
695 -1,
696 (gchar *) "timestamp",
697 (gchar *) "u",
698 NULL
699 },
700 FALSE
701 };
702
703 static const GDBusArgInfo * const _sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_pointers[] =
704 {
705 &_sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_id.parent_struct,
706 &_sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_timestamp.parent_struct,
707 NULL
708 };
709
710 static const _ExtendedGDBusSignalInfo _sn_dbus_menu_gen_signal_info_item_activation_requested =
711 {
712 {
713 -1,
714 (gchar *) "ItemActivationRequested",
715 (GDBusArgInfo **) &_sn_dbus_menu_gen_signal_info_item_activation_requested_ARG_pointers,
716 NULL
717 },
718 "item-activation-requested"
719 };
720
721 static const GDBusSignalInfo * const _sn_dbus_menu_gen_signal_info_pointers[] =
722 {
723 &_sn_dbus_menu_gen_signal_info_items_properties_updated.parent_struct,
724 &_sn_dbus_menu_gen_signal_info_layout_updated.parent_struct,
725 &_sn_dbus_menu_gen_signal_info_item_activation_requested.parent_struct,
726 NULL
727 };
728
729 static const _ExtendedGDBusPropertyInfo _sn_dbus_menu_gen_property_info_version =
730 {
731 {
732 -1,
733 (gchar *) "Version",
734 (gchar *) "u",
735 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
736 NULL
737 },
738 "version",
739 FALSE,
740 TRUE
741 };
742
743 static const _ExtendedGDBusPropertyInfo _sn_dbus_menu_gen_property_info_text_direction =
744 {
745 {
746 -1,
747 (gchar *) "TextDirection",
748 (gchar *) "s",
749 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
750 NULL
751 },
752 "text-direction",
753 FALSE,
754 TRUE
755 };
756
757 static const _ExtendedGDBusPropertyInfo _sn_dbus_menu_gen_property_info_status =
758 {
759 {
760 -1,
761 (gchar *) "Status",
762 (gchar *) "s",
763 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
764 NULL
765 },
766 "status",
767 FALSE,
768 TRUE
769 };
770
771 static const _ExtendedGDBusPropertyInfo _sn_dbus_menu_gen_property_info_icon_theme_path =
772 {
773 {
774 -1,
775 (gchar *) "IconThemePath",
776 (gchar *) "as",
777 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
778 NULL
779 },
780 "icon-theme-path",
781 FALSE,
782 TRUE
783 };
784
785 static const GDBusPropertyInfo * const _sn_dbus_menu_gen_property_info_pointers[] =
786 {
787 &_sn_dbus_menu_gen_property_info_version.parent_struct,
788 &_sn_dbus_menu_gen_property_info_text_direction.parent_struct,
789 &_sn_dbus_menu_gen_property_info_status.parent_struct,
790 &_sn_dbus_menu_gen_property_info_icon_theme_path.parent_struct,
791 NULL
792 };
793
794 static const _ExtendedGDBusInterfaceInfo _sn_dbus_menu_gen_interface_info =
795 {
796 {
797 -1,
798 (gchar *) "com.canonical.dbusmenu",
799 (GDBusMethodInfo **) &_sn_dbus_menu_gen_method_info_pointers,
800 (GDBusSignalInfo **) &_sn_dbus_menu_gen_signal_info_pointers,
801 (GDBusPropertyInfo **) &_sn_dbus_menu_gen_property_info_pointers,
802 NULL
803 },
804 "dbus-menu-gen",
805 };
806
807
808 /**
809 * sn_dbus_menu_gen_interface_info:
810 *
811 * Gets a machine-readable description of the <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link> D-Bus interface.
812 *
813 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
814 */
815 GDBusInterfaceInfo *
sn_dbus_menu_gen_interface_info(void)816 sn_dbus_menu_gen_interface_info (void)
817 {
818 return (GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct;
819 }
820
821 /**
822 * sn_dbus_menu_gen_override_properties:
823 * @klass: The class structure for a #GObject derived class.
824 * @property_id_begin: The property id to assign to the first overridden property.
825 *
826 * Overrides all #GObject properties in the #SnDBusMenuGen interface for a concrete class.
827 * The properties are overridden in the order they are defined.
828 *
829 * Returns: The last property id.
830 */
831 guint
sn_dbus_menu_gen_override_properties(GObjectClass * klass,guint property_id_begin)832 sn_dbus_menu_gen_override_properties (GObjectClass *klass, guint property_id_begin)
833 {
834 g_object_class_override_property (klass, property_id_begin++, "version");
835 g_object_class_override_property (klass, property_id_begin++, "text-direction");
836 g_object_class_override_property (klass, property_id_begin++, "status");
837 g_object_class_override_property (klass, property_id_begin++, "icon-theme-path");
838 return property_id_begin - 1;
839 }
840
841
842
843 /**
844 * SnDBusMenuGen:
845 *
846 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link>.
847 */
848
849 /**
850 * SnDBusMenuGenIface:
851 * @parent_iface: The parent interface.
852 * @handle_about_to_show: Handler for the #SnDBusMenuGen::handle-about-to-show signal.
853 * @handle_about_to_show_group: Handler for the #SnDBusMenuGen::handle-about-to-show-group signal.
854 * @handle_event: Handler for the #SnDBusMenuGen::handle-event signal.
855 * @handle_event_group: Handler for the #SnDBusMenuGen::handle-event-group signal.
856 * @handle_get_group_properties: Handler for the #SnDBusMenuGen::handle-get-group-properties signal.
857 * @handle_get_layout: Handler for the #SnDBusMenuGen::handle-get-layout signal.
858 * @handle_get_property: Handler for the #SnDBusMenuGen::handle-get-property signal.
859 * @get_icon_theme_path: Getter for the #SnDBusMenuGen:icon-theme-path property.
860 * @get_status: Getter for the #SnDBusMenuGen:status property.
861 * @get_text_direction: Getter for the #SnDBusMenuGen:text-direction property.
862 * @get_version: Getter for the #SnDBusMenuGen:version property.
863 * @item_activation_requested: Handler for the #SnDBusMenuGen::item-activation-requested signal.
864 * @items_properties_updated: Handler for the #SnDBusMenuGen::items-properties-updated signal.
865 * @layout_updated: Handler for the #SnDBusMenuGen::layout-updated signal.
866 *
867 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link>.
868 */
869
870 typedef SnDBusMenuGenIface SnDBusMenuGenInterface;
G_DEFINE_INTERFACE(SnDBusMenuGen,sn_dbus_menu_gen,G_TYPE_OBJECT)871 G_DEFINE_INTERFACE (SnDBusMenuGen, sn_dbus_menu_gen, G_TYPE_OBJECT)
872
873 static void
874 sn_dbus_menu_gen_default_init (SnDBusMenuGenIface *iface)
875 {
876 /* GObject signals for incoming D-Bus method calls: */
877 /**
878 * SnDBusMenuGen::handle-get-layout:
879 * @object: A #SnDBusMenuGen.
880 * @invocation: A #GDBusMethodInvocation.
881 * @arg_parentId: Argument passed by remote caller.
882 * @arg_recursionDepth: Argument passed by remote caller.
883 * @arg_propertyNames: Argument passed by remote caller.
884 *
885 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.GetLayout">GetLayout()</link> D-Bus method.
886 *
887 * 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 sn_dbus_menu_gen_complete_get_layout() 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.
888 *
889 * 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.
890 */
891 g_signal_new ("handle-get-layout",
892 G_TYPE_FROM_INTERFACE (iface),
893 G_SIGNAL_RUN_LAST,
894 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_get_layout),
895 g_signal_accumulator_true_handled,
896 NULL,
897 g_cclosure_marshal_generic,
898 G_TYPE_BOOLEAN,
899 4,
900 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRV);
901
902 /**
903 * SnDBusMenuGen::handle-get-group-properties:
904 * @object: A #SnDBusMenuGen.
905 * @invocation: A #GDBusMethodInvocation.
906 * @arg_ids: Argument passed by remote caller.
907 * @arg_propertyNames: Argument passed by remote caller.
908 *
909 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.GetGroupProperties">GetGroupProperties()</link> D-Bus method.
910 *
911 * 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 sn_dbus_menu_gen_complete_get_group_properties() 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.
912 *
913 * 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.
914 */
915 g_signal_new ("handle-get-group-properties",
916 G_TYPE_FROM_INTERFACE (iface),
917 G_SIGNAL_RUN_LAST,
918 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_get_group_properties),
919 g_signal_accumulator_true_handled,
920 NULL,
921 g_cclosure_marshal_generic,
922 G_TYPE_BOOLEAN,
923 3,
924 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_STRV);
925
926 /**
927 * SnDBusMenuGen::handle-get-property:
928 * @object: A #SnDBusMenuGen.
929 * @invocation: A #GDBusMethodInvocation.
930 * @arg_id: Argument passed by remote caller.
931 * @arg_name: Argument passed by remote caller.
932 *
933 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.GetProperty">GetProperty()</link> D-Bus method.
934 *
935 * 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 sn_dbus_menu_gen_complete_get_property() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
936 *
937 * 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.
938 */
939 g_signal_new ("handle-get-property",
940 G_TYPE_FROM_INTERFACE (iface),
941 G_SIGNAL_RUN_LAST,
942 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_get_property),
943 g_signal_accumulator_true_handled,
944 NULL,
945 g_cclosure_marshal_generic,
946 G_TYPE_BOOLEAN,
947 3,
948 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_STRING);
949
950 /**
951 * SnDBusMenuGen::handle-event:
952 * @object: A #SnDBusMenuGen.
953 * @invocation: A #GDBusMethodInvocation.
954 * @arg_id: Argument passed by remote caller.
955 * @arg_eventId: Argument passed by remote caller.
956 * @arg_data: Argument passed by remote caller.
957 * @arg_timestamp: Argument passed by remote caller.
958 *
959 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.Event">Event()</link> D-Bus method.
960 *
961 * 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 sn_dbus_menu_gen_complete_event() 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.
962 *
963 * 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.
964 */
965 g_signal_new ("handle-event",
966 G_TYPE_FROM_INTERFACE (iface),
967 G_SIGNAL_RUN_LAST,
968 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_event),
969 g_signal_accumulator_true_handled,
970 NULL,
971 g_cclosure_marshal_generic,
972 G_TYPE_BOOLEAN,
973 5,
974 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT);
975
976 /**
977 * SnDBusMenuGen::handle-event-group:
978 * @object: A #SnDBusMenuGen.
979 * @invocation: A #GDBusMethodInvocation.
980 * @arg_events: Argument passed by remote caller.
981 *
982 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.EventGroup">EventGroup()</link> D-Bus method.
983 *
984 * 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 sn_dbus_menu_gen_complete_event_group() 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.
985 *
986 * 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.
987 */
988 g_signal_new ("handle-event-group",
989 G_TYPE_FROM_INTERFACE (iface),
990 G_SIGNAL_RUN_LAST,
991 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_event_group),
992 g_signal_accumulator_true_handled,
993 NULL,
994 g_cclosure_marshal_generic,
995 G_TYPE_BOOLEAN,
996 2,
997 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
998
999 /**
1000 * SnDBusMenuGen::handle-about-to-show:
1001 * @object: A #SnDBusMenuGen.
1002 * @invocation: A #GDBusMethodInvocation.
1003 * @arg_id: Argument passed by remote caller.
1004 *
1005 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShow">AboutToShow()</link> D-Bus method.
1006 *
1007 * 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 sn_dbus_menu_gen_complete_about_to_show() 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.
1008 *
1009 * 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.
1010 */
1011 g_signal_new ("handle-about-to-show",
1012 G_TYPE_FROM_INTERFACE (iface),
1013 G_SIGNAL_RUN_LAST,
1014 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_about_to_show),
1015 g_signal_accumulator_true_handled,
1016 NULL,
1017 g_cclosure_marshal_generic,
1018 G_TYPE_BOOLEAN,
1019 2,
1020 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1021
1022 /**
1023 * SnDBusMenuGen::handle-about-to-show-group:
1024 * @object: A #SnDBusMenuGen.
1025 * @invocation: A #GDBusMethodInvocation.
1026 * @arg_ids: Argument passed by remote caller.
1027 *
1028 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShowGroup">AboutToShowGroup()</link> D-Bus method.
1029 *
1030 * 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 sn_dbus_menu_gen_complete_about_to_show_group() 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.
1031 *
1032 * 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.
1033 */
1034 g_signal_new ("handle-about-to-show-group",
1035 G_TYPE_FROM_INTERFACE (iface),
1036 G_SIGNAL_RUN_LAST,
1037 G_STRUCT_OFFSET (SnDBusMenuGenIface, handle_about_to_show_group),
1038 g_signal_accumulator_true_handled,
1039 NULL,
1040 g_cclosure_marshal_generic,
1041 G_TYPE_BOOLEAN,
1042 2,
1043 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
1044
1045 /* GObject signals for received D-Bus signals: */
1046 /**
1047 * SnDBusMenuGen::items-properties-updated:
1048 * @object: A #SnDBusMenuGen.
1049 * @arg_updatedProps: Argument.
1050 * @arg_removedProps: Argument.
1051 *
1052 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-com-canonical-dbusmenu.ItemsPropertiesUpdated">"ItemsPropertiesUpdated"</link> is received.
1053 *
1054 * 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.
1055 */
1056 g_signal_new ("items-properties-updated",
1057 G_TYPE_FROM_INTERFACE (iface),
1058 G_SIGNAL_RUN_LAST,
1059 G_STRUCT_OFFSET (SnDBusMenuGenIface, items_properties_updated),
1060 NULL,
1061 NULL,
1062 g_cclosure_marshal_generic,
1063 G_TYPE_NONE,
1064 2, G_TYPE_VARIANT, G_TYPE_VARIANT);
1065
1066 /**
1067 * SnDBusMenuGen::layout-updated:
1068 * @object: A #SnDBusMenuGen.
1069 * @arg_revision: Argument.
1070 * @arg_parent: Argument.
1071 *
1072 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-com-canonical-dbusmenu.LayoutUpdated">"LayoutUpdated"</link> is received.
1073 *
1074 * 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.
1075 */
1076 g_signal_new ("layout-updated",
1077 G_TYPE_FROM_INTERFACE (iface),
1078 G_SIGNAL_RUN_LAST,
1079 G_STRUCT_OFFSET (SnDBusMenuGenIface, layout_updated),
1080 NULL,
1081 NULL,
1082 g_cclosure_marshal_generic,
1083 G_TYPE_NONE,
1084 2, G_TYPE_UINT, G_TYPE_INT);
1085
1086 /**
1087 * SnDBusMenuGen::item-activation-requested:
1088 * @object: A #SnDBusMenuGen.
1089 * @arg_id: Argument.
1090 * @arg_timestamp: Argument.
1091 *
1092 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-com-canonical-dbusmenu.ItemActivationRequested">"ItemActivationRequested"</link> is received.
1093 *
1094 * 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.
1095 */
1096 g_signal_new ("item-activation-requested",
1097 G_TYPE_FROM_INTERFACE (iface),
1098 G_SIGNAL_RUN_LAST,
1099 G_STRUCT_OFFSET (SnDBusMenuGenIface, item_activation_requested),
1100 NULL,
1101 NULL,
1102 g_cclosure_marshal_generic,
1103 G_TYPE_NONE,
1104 2, G_TYPE_INT, G_TYPE_UINT);
1105
1106 /* GObject properties for D-Bus properties: */
1107 /**
1108 * SnDBusMenuGen:version:
1109 *
1110 * Represents the D-Bus property <link linkend="gdbus-property-com-canonical-dbusmenu.Version">"Version"</link>.
1111 *
1112 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1113 */
1114 g_object_interface_install_property (iface,
1115 g_param_spec_uint ("version", "Version", "Version", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1116 /**
1117 * SnDBusMenuGen:text-direction:
1118 *
1119 * Represents the D-Bus property <link linkend="gdbus-property-com-canonical-dbusmenu.TextDirection">"TextDirection"</link>.
1120 *
1121 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1122 */
1123 g_object_interface_install_property (iface,
1124 g_param_spec_string ("text-direction", "TextDirection", "TextDirection", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1125 /**
1126 * SnDBusMenuGen:status:
1127 *
1128 * Represents the D-Bus property <link linkend="gdbus-property-com-canonical-dbusmenu.Status">"Status"</link>.
1129 *
1130 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1131 */
1132 g_object_interface_install_property (iface,
1133 g_param_spec_string ("status", "Status", "Status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1134 /**
1135 * SnDBusMenuGen:icon-theme-path:
1136 *
1137 * Represents the D-Bus property <link linkend="gdbus-property-com-canonical-dbusmenu.IconThemePath">"IconThemePath"</link>.
1138 *
1139 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1140 */
1141 g_object_interface_install_property (iface,
1142 g_param_spec_boxed ("icon-theme-path", "IconThemePath", "IconThemePath", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1143 }
1144
1145 /**
1146 * sn_dbus_menu_gen_get_version: (skip)
1147 * @object: A #SnDBusMenuGen.
1148 *
1149 * Gets the value of the <link linkend="gdbus-property-com-canonical-dbusmenu.Version">"Version"</link> D-Bus property.
1150 *
1151 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1152 *
1153 * Returns: The property value.
1154 */
1155 guint
sn_dbus_menu_gen_get_version(SnDBusMenuGen * object)1156 sn_dbus_menu_gen_get_version (SnDBusMenuGen *object)
1157 {
1158 return SN_DBUS_MENU_GEN_GET_IFACE (object)->get_version (object);
1159 }
1160
1161 /**
1162 * sn_dbus_menu_gen_set_version: (skip)
1163 * @object: A #SnDBusMenuGen.
1164 * @value: The value to set.
1165 *
1166 * Sets the <link linkend="gdbus-property-com-canonical-dbusmenu.Version">"Version"</link> D-Bus property to @value.
1167 *
1168 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1169 */
1170 void
sn_dbus_menu_gen_set_version(SnDBusMenuGen * object,guint value)1171 sn_dbus_menu_gen_set_version (SnDBusMenuGen *object, guint value)
1172 {
1173 g_object_set (G_OBJECT (object), "version", value, NULL);
1174 }
1175
1176 /**
1177 * sn_dbus_menu_gen_get_text_direction: (skip)
1178 * @object: A #SnDBusMenuGen.
1179 *
1180 * Gets the value of the <link linkend="gdbus-property-com-canonical-dbusmenu.TextDirection">"TextDirection"</link> D-Bus property.
1181 *
1182 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1183 *
1184 * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sn_dbus_menu_gen_dup_text_direction() if on another thread.
1185 *
1186 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1187 */
1188 const gchar *
sn_dbus_menu_gen_get_text_direction(SnDBusMenuGen * object)1189 sn_dbus_menu_gen_get_text_direction (SnDBusMenuGen *object)
1190 {
1191 return SN_DBUS_MENU_GEN_GET_IFACE (object)->get_text_direction (object);
1192 }
1193
1194 /**
1195 * sn_dbus_menu_gen_dup_text_direction: (skip)
1196 * @object: A #SnDBusMenuGen.
1197 *
1198 * Gets a copy of the <link linkend="gdbus-property-com-canonical-dbusmenu.TextDirection">"TextDirection"</link> D-Bus property.
1199 *
1200 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1201 *
1202 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1203 */
1204 gchar *
sn_dbus_menu_gen_dup_text_direction(SnDBusMenuGen * object)1205 sn_dbus_menu_gen_dup_text_direction (SnDBusMenuGen *object)
1206 {
1207 gchar *value;
1208 g_object_get (G_OBJECT (object), "text-direction", &value, NULL);
1209 return value;
1210 }
1211
1212 /**
1213 * sn_dbus_menu_gen_set_text_direction: (skip)
1214 * @object: A #SnDBusMenuGen.
1215 * @value: The value to set.
1216 *
1217 * Sets the <link linkend="gdbus-property-com-canonical-dbusmenu.TextDirection">"TextDirection"</link> D-Bus property to @value.
1218 *
1219 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1220 */
1221 void
sn_dbus_menu_gen_set_text_direction(SnDBusMenuGen * object,const gchar * value)1222 sn_dbus_menu_gen_set_text_direction (SnDBusMenuGen *object, const gchar *value)
1223 {
1224 g_object_set (G_OBJECT (object), "text-direction", value, NULL);
1225 }
1226
1227 /**
1228 * sn_dbus_menu_gen_get_status: (skip)
1229 * @object: A #SnDBusMenuGen.
1230 *
1231 * Gets the value of the <link linkend="gdbus-property-com-canonical-dbusmenu.Status">"Status"</link> D-Bus property.
1232 *
1233 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1234 *
1235 * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sn_dbus_menu_gen_dup_status() if on another thread.
1236 *
1237 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1238 */
1239 const gchar *
sn_dbus_menu_gen_get_status(SnDBusMenuGen * object)1240 sn_dbus_menu_gen_get_status (SnDBusMenuGen *object)
1241 {
1242 return SN_DBUS_MENU_GEN_GET_IFACE (object)->get_status (object);
1243 }
1244
1245 /**
1246 * sn_dbus_menu_gen_dup_status: (skip)
1247 * @object: A #SnDBusMenuGen.
1248 *
1249 * Gets a copy of the <link linkend="gdbus-property-com-canonical-dbusmenu.Status">"Status"</link> D-Bus property.
1250 *
1251 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1252 *
1253 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1254 */
1255 gchar *
sn_dbus_menu_gen_dup_status(SnDBusMenuGen * object)1256 sn_dbus_menu_gen_dup_status (SnDBusMenuGen *object)
1257 {
1258 gchar *value;
1259 g_object_get (G_OBJECT (object), "status", &value, NULL);
1260 return value;
1261 }
1262
1263 /**
1264 * sn_dbus_menu_gen_set_status: (skip)
1265 * @object: A #SnDBusMenuGen.
1266 * @value: The value to set.
1267 *
1268 * Sets the <link linkend="gdbus-property-com-canonical-dbusmenu.Status">"Status"</link> D-Bus property to @value.
1269 *
1270 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1271 */
1272 void
sn_dbus_menu_gen_set_status(SnDBusMenuGen * object,const gchar * value)1273 sn_dbus_menu_gen_set_status (SnDBusMenuGen *object, const gchar *value)
1274 {
1275 g_object_set (G_OBJECT (object), "status", value, NULL);
1276 }
1277
1278 /**
1279 * sn_dbus_menu_gen_get_icon_theme_path: (skip)
1280 * @object: A #SnDBusMenuGen.
1281 *
1282 * Gets the value of the <link linkend="gdbus-property-com-canonical-dbusmenu.IconThemePath">"IconThemePath"</link> D-Bus property.
1283 *
1284 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1285 *
1286 * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sn_dbus_menu_gen_dup_icon_theme_path() if on another thread.
1287 *
1288 * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1289 */
1290 const gchar *const *
sn_dbus_menu_gen_get_icon_theme_path(SnDBusMenuGen * object)1291 sn_dbus_menu_gen_get_icon_theme_path (SnDBusMenuGen *object)
1292 {
1293 return SN_DBUS_MENU_GEN_GET_IFACE (object)->get_icon_theme_path (object);
1294 }
1295
1296 /**
1297 * sn_dbus_menu_gen_dup_icon_theme_path: (skip)
1298 * @object: A #SnDBusMenuGen.
1299 *
1300 * Gets a copy of the <link linkend="gdbus-property-com-canonical-dbusmenu.IconThemePath">"IconThemePath"</link> D-Bus property.
1301 *
1302 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1303 *
1304 * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
1305 */
1306 gchar **
sn_dbus_menu_gen_dup_icon_theme_path(SnDBusMenuGen * object)1307 sn_dbus_menu_gen_dup_icon_theme_path (SnDBusMenuGen *object)
1308 {
1309 gchar **value;
1310 g_object_get (G_OBJECT (object), "icon-theme-path", &value, NULL);
1311 return value;
1312 }
1313
1314 /**
1315 * sn_dbus_menu_gen_set_icon_theme_path: (skip)
1316 * @object: A #SnDBusMenuGen.
1317 * @value: The value to set.
1318 *
1319 * Sets the <link linkend="gdbus-property-com-canonical-dbusmenu.IconThemePath">"IconThemePath"</link> D-Bus property to @value.
1320 *
1321 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1322 */
1323 void
sn_dbus_menu_gen_set_icon_theme_path(SnDBusMenuGen * object,const gchar * const * value)1324 sn_dbus_menu_gen_set_icon_theme_path (SnDBusMenuGen *object, const gchar *const *value)
1325 {
1326 g_object_set (G_OBJECT (object), "icon-theme-path", value, NULL);
1327 }
1328
1329 /**
1330 * sn_dbus_menu_gen_emit_items_properties_updated:
1331 * @object: A #SnDBusMenuGen.
1332 * @arg_updatedProps: Argument to pass with the signal.
1333 * @arg_removedProps: Argument to pass with the signal.
1334 *
1335 * Emits the <link linkend="gdbus-signal-com-canonical-dbusmenu.ItemsPropertiesUpdated">"ItemsPropertiesUpdated"</link> D-Bus signal.
1336 */
1337 void
sn_dbus_menu_gen_emit_items_properties_updated(SnDBusMenuGen * object,GVariant * arg_updatedProps,GVariant * arg_removedProps)1338 sn_dbus_menu_gen_emit_items_properties_updated (
1339 SnDBusMenuGen *object,
1340 GVariant *arg_updatedProps,
1341 GVariant *arg_removedProps)
1342 {
1343 g_signal_emit_by_name (object, "items-properties-updated", arg_updatedProps, arg_removedProps);
1344 }
1345
1346 /**
1347 * sn_dbus_menu_gen_emit_layout_updated:
1348 * @object: A #SnDBusMenuGen.
1349 * @arg_revision: Argument to pass with the signal.
1350 * @arg_parent: Argument to pass with the signal.
1351 *
1352 * Emits the <link linkend="gdbus-signal-com-canonical-dbusmenu.LayoutUpdated">"LayoutUpdated"</link> D-Bus signal.
1353 */
1354 void
sn_dbus_menu_gen_emit_layout_updated(SnDBusMenuGen * object,guint arg_revision,gint arg_parent)1355 sn_dbus_menu_gen_emit_layout_updated (
1356 SnDBusMenuGen *object,
1357 guint arg_revision,
1358 gint arg_parent)
1359 {
1360 g_signal_emit_by_name (object, "layout-updated", arg_revision, arg_parent);
1361 }
1362
1363 /**
1364 * sn_dbus_menu_gen_emit_item_activation_requested:
1365 * @object: A #SnDBusMenuGen.
1366 * @arg_id: Argument to pass with the signal.
1367 * @arg_timestamp: Argument to pass with the signal.
1368 *
1369 * Emits the <link linkend="gdbus-signal-com-canonical-dbusmenu.ItemActivationRequested">"ItemActivationRequested"</link> D-Bus signal.
1370 */
1371 void
sn_dbus_menu_gen_emit_item_activation_requested(SnDBusMenuGen * object,gint arg_id,guint arg_timestamp)1372 sn_dbus_menu_gen_emit_item_activation_requested (
1373 SnDBusMenuGen *object,
1374 gint arg_id,
1375 guint arg_timestamp)
1376 {
1377 g_signal_emit_by_name (object, "item-activation-requested", arg_id, arg_timestamp);
1378 }
1379
1380 /**
1381 * sn_dbus_menu_gen_call_get_layout:
1382 * @proxy: A #SnDBusMenuGenProxy.
1383 * @arg_parentId: Argument to pass with the method invocation.
1384 * @arg_recursionDepth: Argument to pass with the method invocation.
1385 * @arg_propertyNames: Argument to pass with the method invocation.
1386 * @cancellable: (nullable): A #GCancellable or %NULL.
1387 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1388 * @user_data: User data to pass to @callback.
1389 *
1390 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetLayout">GetLayout()</link> D-Bus method on @proxy.
1391 * 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()).
1392 * You can then call sn_dbus_menu_gen_call_get_layout_finish() to get the result of the operation.
1393 *
1394 * See sn_dbus_menu_gen_call_get_layout_sync() for the synchronous, blocking version of this method.
1395 */
1396 void
sn_dbus_menu_gen_call_get_layout(SnDBusMenuGen * proxy,gint arg_parentId,gint arg_recursionDepth,const gchar * const * arg_propertyNames,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1397 sn_dbus_menu_gen_call_get_layout (
1398 SnDBusMenuGen *proxy,
1399 gint arg_parentId,
1400 gint arg_recursionDepth,
1401 const gchar *const *arg_propertyNames,
1402 GCancellable *cancellable,
1403 GAsyncReadyCallback callback,
1404 gpointer user_data)
1405 {
1406 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1407 "GetLayout",
1408 g_variant_new ("(ii^as)",
1409 arg_parentId,
1410 arg_recursionDepth,
1411 arg_propertyNames),
1412 G_DBUS_CALL_FLAGS_NONE,
1413 -1,
1414 cancellable,
1415 callback,
1416 user_data);
1417 }
1418
1419 /**
1420 * sn_dbus_menu_gen_call_get_layout_finish:
1421 * @proxy: A #SnDBusMenuGenProxy.
1422 * @out_revision: (out) (optional): Return location for return parameter or %NULL to ignore.
1423 * @out_layout: (out) (optional): Return location for return parameter or %NULL to ignore.
1424 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_get_layout().
1425 * @error: Return location for error or %NULL.
1426 *
1427 * Finishes an operation started with sn_dbus_menu_gen_call_get_layout().
1428 *
1429 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1430 */
1431 gboolean
sn_dbus_menu_gen_call_get_layout_finish(SnDBusMenuGen * proxy,guint * out_revision,GVariant ** out_layout,GAsyncResult * res,GError ** error)1432 sn_dbus_menu_gen_call_get_layout_finish (
1433 SnDBusMenuGen *proxy,
1434 guint *out_revision,
1435 GVariant **out_layout,
1436 GAsyncResult *res,
1437 GError **error)
1438 {
1439 GVariant *_ret;
1440 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1441 if (_ret == NULL)
1442 goto _out;
1443 g_variant_get (_ret,
1444 "(u@(ia{sv}av))",
1445 out_revision,
1446 out_layout);
1447 g_variant_unref (_ret);
1448 _out:
1449 return _ret != NULL;
1450 }
1451
1452 /**
1453 * sn_dbus_menu_gen_call_get_layout_sync:
1454 * @proxy: A #SnDBusMenuGenProxy.
1455 * @arg_parentId: Argument to pass with the method invocation.
1456 * @arg_recursionDepth: Argument to pass with the method invocation.
1457 * @arg_propertyNames: Argument to pass with the method invocation.
1458 * @out_revision: (out) (optional): Return location for return parameter or %NULL to ignore.
1459 * @out_layout: (out) (optional): Return location for return parameter or %NULL to ignore.
1460 * @cancellable: (nullable): A #GCancellable or %NULL.
1461 * @error: Return location for error or %NULL.
1462 *
1463 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetLayout">GetLayout()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1464 *
1465 * See sn_dbus_menu_gen_call_get_layout() for the asynchronous version of this method.
1466 *
1467 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1468 */
1469 gboolean
sn_dbus_menu_gen_call_get_layout_sync(SnDBusMenuGen * proxy,gint arg_parentId,gint arg_recursionDepth,const gchar * const * arg_propertyNames,guint * out_revision,GVariant ** out_layout,GCancellable * cancellable,GError ** error)1470 sn_dbus_menu_gen_call_get_layout_sync (
1471 SnDBusMenuGen *proxy,
1472 gint arg_parentId,
1473 gint arg_recursionDepth,
1474 const gchar *const *arg_propertyNames,
1475 guint *out_revision,
1476 GVariant **out_layout,
1477 GCancellable *cancellable,
1478 GError **error)
1479 {
1480 GVariant *_ret;
1481 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1482 "GetLayout",
1483 g_variant_new ("(ii^as)",
1484 arg_parentId,
1485 arg_recursionDepth,
1486 arg_propertyNames),
1487 G_DBUS_CALL_FLAGS_NONE,
1488 -1,
1489 cancellable,
1490 error);
1491 if (_ret == NULL)
1492 goto _out;
1493 g_variant_get (_ret,
1494 "(u@(ia{sv}av))",
1495 out_revision,
1496 out_layout);
1497 g_variant_unref (_ret);
1498 _out:
1499 return _ret != NULL;
1500 }
1501
1502 /**
1503 * sn_dbus_menu_gen_call_get_group_properties:
1504 * @proxy: A #SnDBusMenuGenProxy.
1505 * @arg_ids: Argument to pass with the method invocation.
1506 * @arg_propertyNames: Argument to pass with the method invocation.
1507 * @cancellable: (nullable): A #GCancellable or %NULL.
1508 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1509 * @user_data: User data to pass to @callback.
1510 *
1511 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetGroupProperties">GetGroupProperties()</link> D-Bus method on @proxy.
1512 * 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()).
1513 * You can then call sn_dbus_menu_gen_call_get_group_properties_finish() to get the result of the operation.
1514 *
1515 * See sn_dbus_menu_gen_call_get_group_properties_sync() for the synchronous, blocking version of this method.
1516 */
1517 void
sn_dbus_menu_gen_call_get_group_properties(SnDBusMenuGen * proxy,GVariant * arg_ids,const gchar * const * arg_propertyNames,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1518 sn_dbus_menu_gen_call_get_group_properties (
1519 SnDBusMenuGen *proxy,
1520 GVariant *arg_ids,
1521 const gchar *const *arg_propertyNames,
1522 GCancellable *cancellable,
1523 GAsyncReadyCallback callback,
1524 gpointer user_data)
1525 {
1526 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1527 "GetGroupProperties",
1528 g_variant_new ("(@ai^as)",
1529 arg_ids,
1530 arg_propertyNames),
1531 G_DBUS_CALL_FLAGS_NONE,
1532 -1,
1533 cancellable,
1534 callback,
1535 user_data);
1536 }
1537
1538 /**
1539 * sn_dbus_menu_gen_call_get_group_properties_finish:
1540 * @proxy: A #SnDBusMenuGenProxy.
1541 * @out_properties: (out) (optional): Return location for return parameter or %NULL to ignore.
1542 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_get_group_properties().
1543 * @error: Return location for error or %NULL.
1544 *
1545 * Finishes an operation started with sn_dbus_menu_gen_call_get_group_properties().
1546 *
1547 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1548 */
1549 gboolean
sn_dbus_menu_gen_call_get_group_properties_finish(SnDBusMenuGen * proxy,GVariant ** out_properties,GAsyncResult * res,GError ** error)1550 sn_dbus_menu_gen_call_get_group_properties_finish (
1551 SnDBusMenuGen *proxy,
1552 GVariant **out_properties,
1553 GAsyncResult *res,
1554 GError **error)
1555 {
1556 GVariant *_ret;
1557 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1558 if (_ret == NULL)
1559 goto _out;
1560 g_variant_get (_ret,
1561 "(@a(ia{sv}))",
1562 out_properties);
1563 g_variant_unref (_ret);
1564 _out:
1565 return _ret != NULL;
1566 }
1567
1568 /**
1569 * sn_dbus_menu_gen_call_get_group_properties_sync:
1570 * @proxy: A #SnDBusMenuGenProxy.
1571 * @arg_ids: Argument to pass with the method invocation.
1572 * @arg_propertyNames: Argument to pass with the method invocation.
1573 * @out_properties: (out) (optional): Return location for return parameter or %NULL to ignore.
1574 * @cancellable: (nullable): A #GCancellable or %NULL.
1575 * @error: Return location for error or %NULL.
1576 *
1577 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetGroupProperties">GetGroupProperties()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1578 *
1579 * See sn_dbus_menu_gen_call_get_group_properties() for the asynchronous version of this method.
1580 *
1581 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1582 */
1583 gboolean
sn_dbus_menu_gen_call_get_group_properties_sync(SnDBusMenuGen * proxy,GVariant * arg_ids,const gchar * const * arg_propertyNames,GVariant ** out_properties,GCancellable * cancellable,GError ** error)1584 sn_dbus_menu_gen_call_get_group_properties_sync (
1585 SnDBusMenuGen *proxy,
1586 GVariant *arg_ids,
1587 const gchar *const *arg_propertyNames,
1588 GVariant **out_properties,
1589 GCancellable *cancellable,
1590 GError **error)
1591 {
1592 GVariant *_ret;
1593 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1594 "GetGroupProperties",
1595 g_variant_new ("(@ai^as)",
1596 arg_ids,
1597 arg_propertyNames),
1598 G_DBUS_CALL_FLAGS_NONE,
1599 -1,
1600 cancellable,
1601 error);
1602 if (_ret == NULL)
1603 goto _out;
1604 g_variant_get (_ret,
1605 "(@a(ia{sv}))",
1606 out_properties);
1607 g_variant_unref (_ret);
1608 _out:
1609 return _ret != NULL;
1610 }
1611
1612 /**
1613 * sn_dbus_menu_gen_call_get_property:
1614 * @proxy: A #SnDBusMenuGenProxy.
1615 * @arg_id: Argument to pass with the method invocation.
1616 * @arg_name: Argument to pass with the method invocation.
1617 * @cancellable: (nullable): A #GCancellable or %NULL.
1618 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1619 * @user_data: User data to pass to @callback.
1620 *
1621 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetProperty">GetProperty()</link> D-Bus method on @proxy.
1622 * 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()).
1623 * You can then call sn_dbus_menu_gen_call_get_property_finish() to get the result of the operation.
1624 *
1625 * See sn_dbus_menu_gen_call_get_property_sync() for the synchronous, blocking version of this method.
1626 */
1627 void
sn_dbus_menu_gen_call_get_property(SnDBusMenuGen * proxy,gint arg_id,const gchar * arg_name,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1628 sn_dbus_menu_gen_call_get_property (
1629 SnDBusMenuGen *proxy,
1630 gint arg_id,
1631 const gchar *arg_name,
1632 GCancellable *cancellable,
1633 GAsyncReadyCallback callback,
1634 gpointer user_data)
1635 {
1636 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1637 "GetProperty",
1638 g_variant_new ("(is)",
1639 arg_id,
1640 arg_name),
1641 G_DBUS_CALL_FLAGS_NONE,
1642 -1,
1643 cancellable,
1644 callback,
1645 user_data);
1646 }
1647
1648 /**
1649 * sn_dbus_menu_gen_call_get_property_finish:
1650 * @proxy: A #SnDBusMenuGenProxy.
1651 * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore.
1652 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_get_property().
1653 * @error: Return location for error or %NULL.
1654 *
1655 * Finishes an operation started with sn_dbus_menu_gen_call_get_property().
1656 *
1657 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1658 */
1659 gboolean
sn_dbus_menu_gen_call_get_property_finish(SnDBusMenuGen * proxy,GVariant ** out_value,GAsyncResult * res,GError ** error)1660 sn_dbus_menu_gen_call_get_property_finish (
1661 SnDBusMenuGen *proxy,
1662 GVariant **out_value,
1663 GAsyncResult *res,
1664 GError **error)
1665 {
1666 GVariant *_ret;
1667 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1668 if (_ret == NULL)
1669 goto _out;
1670 g_variant_get (_ret,
1671 "(@v)",
1672 out_value);
1673 g_variant_unref (_ret);
1674 _out:
1675 return _ret != NULL;
1676 }
1677
1678 /**
1679 * sn_dbus_menu_gen_call_get_property_sync:
1680 * @proxy: A #SnDBusMenuGenProxy.
1681 * @arg_id: Argument to pass with the method invocation.
1682 * @arg_name: Argument to pass with the method invocation.
1683 * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore.
1684 * @cancellable: (nullable): A #GCancellable or %NULL.
1685 * @error: Return location for error or %NULL.
1686 *
1687 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.GetProperty">GetProperty()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1688 *
1689 * See sn_dbus_menu_gen_call_get_property() for the asynchronous version of this method.
1690 *
1691 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1692 */
1693 gboolean
sn_dbus_menu_gen_call_get_property_sync(SnDBusMenuGen * proxy,gint arg_id,const gchar * arg_name,GVariant ** out_value,GCancellable * cancellable,GError ** error)1694 sn_dbus_menu_gen_call_get_property_sync (
1695 SnDBusMenuGen *proxy,
1696 gint arg_id,
1697 const gchar *arg_name,
1698 GVariant **out_value,
1699 GCancellable *cancellable,
1700 GError **error)
1701 {
1702 GVariant *_ret;
1703 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1704 "GetProperty",
1705 g_variant_new ("(is)",
1706 arg_id,
1707 arg_name),
1708 G_DBUS_CALL_FLAGS_NONE,
1709 -1,
1710 cancellable,
1711 error);
1712 if (_ret == NULL)
1713 goto _out;
1714 g_variant_get (_ret,
1715 "(@v)",
1716 out_value);
1717 g_variant_unref (_ret);
1718 _out:
1719 return _ret != NULL;
1720 }
1721
1722 /**
1723 * sn_dbus_menu_gen_call_event:
1724 * @proxy: A #SnDBusMenuGenProxy.
1725 * @arg_id: Argument to pass with the method invocation.
1726 * @arg_eventId: Argument to pass with the method invocation.
1727 * @arg_data: Argument to pass with the method invocation.
1728 * @arg_timestamp: Argument to pass with the method invocation.
1729 * @cancellable: (nullable): A #GCancellable or %NULL.
1730 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1731 * @user_data: User data to pass to @callback.
1732 *
1733 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.Event">Event()</link> D-Bus method on @proxy.
1734 * 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()).
1735 * You can then call sn_dbus_menu_gen_call_event_finish() to get the result of the operation.
1736 *
1737 * See sn_dbus_menu_gen_call_event_sync() for the synchronous, blocking version of this method.
1738 */
1739 void
sn_dbus_menu_gen_call_event(SnDBusMenuGen * proxy,gint arg_id,const gchar * arg_eventId,GVariant * arg_data,guint arg_timestamp,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1740 sn_dbus_menu_gen_call_event (
1741 SnDBusMenuGen *proxy,
1742 gint arg_id,
1743 const gchar *arg_eventId,
1744 GVariant *arg_data,
1745 guint arg_timestamp,
1746 GCancellable *cancellable,
1747 GAsyncReadyCallback callback,
1748 gpointer user_data)
1749 {
1750 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1751 "Event",
1752 g_variant_new ("(is@vu)",
1753 arg_id,
1754 arg_eventId,
1755 arg_data,
1756 arg_timestamp),
1757 G_DBUS_CALL_FLAGS_NONE,
1758 -1,
1759 cancellable,
1760 callback,
1761 user_data);
1762 }
1763
1764 /**
1765 * sn_dbus_menu_gen_call_event_finish:
1766 * @proxy: A #SnDBusMenuGenProxy.
1767 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_event().
1768 * @error: Return location for error or %NULL.
1769 *
1770 * Finishes an operation started with sn_dbus_menu_gen_call_event().
1771 *
1772 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1773 */
1774 gboolean
sn_dbus_menu_gen_call_event_finish(SnDBusMenuGen * proxy,GAsyncResult * res,GError ** error)1775 sn_dbus_menu_gen_call_event_finish (
1776 SnDBusMenuGen *proxy,
1777 GAsyncResult *res,
1778 GError **error)
1779 {
1780 GVariant *_ret;
1781 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1782 if (_ret == NULL)
1783 goto _out;
1784 g_variant_get (_ret,
1785 "()");
1786 g_variant_unref (_ret);
1787 _out:
1788 return _ret != NULL;
1789 }
1790
1791 /**
1792 * sn_dbus_menu_gen_call_event_sync:
1793 * @proxy: A #SnDBusMenuGenProxy.
1794 * @arg_id: Argument to pass with the method invocation.
1795 * @arg_eventId: Argument to pass with the method invocation.
1796 * @arg_data: Argument to pass with the method invocation.
1797 * @arg_timestamp: Argument to pass with the method invocation.
1798 * @cancellable: (nullable): A #GCancellable or %NULL.
1799 * @error: Return location for error or %NULL.
1800 *
1801 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.Event">Event()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1802 *
1803 * See sn_dbus_menu_gen_call_event() for the asynchronous version of this method.
1804 *
1805 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1806 */
1807 gboolean
sn_dbus_menu_gen_call_event_sync(SnDBusMenuGen * proxy,gint arg_id,const gchar * arg_eventId,GVariant * arg_data,guint arg_timestamp,GCancellable * cancellable,GError ** error)1808 sn_dbus_menu_gen_call_event_sync (
1809 SnDBusMenuGen *proxy,
1810 gint arg_id,
1811 const gchar *arg_eventId,
1812 GVariant *arg_data,
1813 guint arg_timestamp,
1814 GCancellable *cancellable,
1815 GError **error)
1816 {
1817 GVariant *_ret;
1818 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1819 "Event",
1820 g_variant_new ("(is@vu)",
1821 arg_id,
1822 arg_eventId,
1823 arg_data,
1824 arg_timestamp),
1825 G_DBUS_CALL_FLAGS_NONE,
1826 -1,
1827 cancellable,
1828 error);
1829 if (_ret == NULL)
1830 goto _out;
1831 g_variant_get (_ret,
1832 "()");
1833 g_variant_unref (_ret);
1834 _out:
1835 return _ret != NULL;
1836 }
1837
1838 /**
1839 * sn_dbus_menu_gen_call_event_group:
1840 * @proxy: A #SnDBusMenuGenProxy.
1841 * @arg_events: Argument to pass with the method invocation.
1842 * @cancellable: (nullable): A #GCancellable or %NULL.
1843 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1844 * @user_data: User data to pass to @callback.
1845 *
1846 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.EventGroup">EventGroup()</link> D-Bus method on @proxy.
1847 * 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()).
1848 * You can then call sn_dbus_menu_gen_call_event_group_finish() to get the result of the operation.
1849 *
1850 * See sn_dbus_menu_gen_call_event_group_sync() for the synchronous, blocking version of this method.
1851 */
1852 void
sn_dbus_menu_gen_call_event_group(SnDBusMenuGen * proxy,GVariant * arg_events,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1853 sn_dbus_menu_gen_call_event_group (
1854 SnDBusMenuGen *proxy,
1855 GVariant *arg_events,
1856 GCancellable *cancellable,
1857 GAsyncReadyCallback callback,
1858 gpointer user_data)
1859 {
1860 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1861 "EventGroup",
1862 g_variant_new ("(@a(isvu))",
1863 arg_events),
1864 G_DBUS_CALL_FLAGS_NONE,
1865 -1,
1866 cancellable,
1867 callback,
1868 user_data);
1869 }
1870
1871 /**
1872 * sn_dbus_menu_gen_call_event_group_finish:
1873 * @proxy: A #SnDBusMenuGenProxy.
1874 * @out_idErrors: (out) (optional): Return location for return parameter or %NULL to ignore.
1875 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_event_group().
1876 * @error: Return location for error or %NULL.
1877 *
1878 * Finishes an operation started with sn_dbus_menu_gen_call_event_group().
1879 *
1880 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1881 */
1882 gboolean
sn_dbus_menu_gen_call_event_group_finish(SnDBusMenuGen * proxy,GVariant ** out_idErrors,GAsyncResult * res,GError ** error)1883 sn_dbus_menu_gen_call_event_group_finish (
1884 SnDBusMenuGen *proxy,
1885 GVariant **out_idErrors,
1886 GAsyncResult *res,
1887 GError **error)
1888 {
1889 GVariant *_ret;
1890 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1891 if (_ret == NULL)
1892 goto _out;
1893 g_variant_get (_ret,
1894 "(@ai)",
1895 out_idErrors);
1896 g_variant_unref (_ret);
1897 _out:
1898 return _ret != NULL;
1899 }
1900
1901 /**
1902 * sn_dbus_menu_gen_call_event_group_sync:
1903 * @proxy: A #SnDBusMenuGenProxy.
1904 * @arg_events: Argument to pass with the method invocation.
1905 * @out_idErrors: (out) (optional): Return location for return parameter or %NULL to ignore.
1906 * @cancellable: (nullable): A #GCancellable or %NULL.
1907 * @error: Return location for error or %NULL.
1908 *
1909 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.EventGroup">EventGroup()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1910 *
1911 * See sn_dbus_menu_gen_call_event_group() for the asynchronous version of this method.
1912 *
1913 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1914 */
1915 gboolean
sn_dbus_menu_gen_call_event_group_sync(SnDBusMenuGen * proxy,GVariant * arg_events,GVariant ** out_idErrors,GCancellable * cancellable,GError ** error)1916 sn_dbus_menu_gen_call_event_group_sync (
1917 SnDBusMenuGen *proxy,
1918 GVariant *arg_events,
1919 GVariant **out_idErrors,
1920 GCancellable *cancellable,
1921 GError **error)
1922 {
1923 GVariant *_ret;
1924 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1925 "EventGroup",
1926 g_variant_new ("(@a(isvu))",
1927 arg_events),
1928 G_DBUS_CALL_FLAGS_NONE,
1929 -1,
1930 cancellable,
1931 error);
1932 if (_ret == NULL)
1933 goto _out;
1934 g_variant_get (_ret,
1935 "(@ai)",
1936 out_idErrors);
1937 g_variant_unref (_ret);
1938 _out:
1939 return _ret != NULL;
1940 }
1941
1942 /**
1943 * sn_dbus_menu_gen_call_about_to_show:
1944 * @proxy: A #SnDBusMenuGenProxy.
1945 * @arg_id: Argument to pass with the method invocation.
1946 * @cancellable: (nullable): A #GCancellable or %NULL.
1947 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1948 * @user_data: User data to pass to @callback.
1949 *
1950 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShow">AboutToShow()</link> D-Bus method on @proxy.
1951 * 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()).
1952 * You can then call sn_dbus_menu_gen_call_about_to_show_finish() to get the result of the operation.
1953 *
1954 * See sn_dbus_menu_gen_call_about_to_show_sync() for the synchronous, blocking version of this method.
1955 */
1956 void
sn_dbus_menu_gen_call_about_to_show(SnDBusMenuGen * proxy,gint arg_id,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)1957 sn_dbus_menu_gen_call_about_to_show (
1958 SnDBusMenuGen *proxy,
1959 gint arg_id,
1960 GCancellable *cancellable,
1961 GAsyncReadyCallback callback,
1962 gpointer user_data)
1963 {
1964 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1965 "AboutToShow",
1966 g_variant_new ("(i)",
1967 arg_id),
1968 G_DBUS_CALL_FLAGS_NONE,
1969 -1,
1970 cancellable,
1971 callback,
1972 user_data);
1973 }
1974
1975 /**
1976 * sn_dbus_menu_gen_call_about_to_show_finish:
1977 * @proxy: A #SnDBusMenuGenProxy.
1978 * @out_needUpdate: (out) (optional): Return location for return parameter or %NULL to ignore.
1979 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_about_to_show().
1980 * @error: Return location for error or %NULL.
1981 *
1982 * Finishes an operation started with sn_dbus_menu_gen_call_about_to_show().
1983 *
1984 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
1985 */
1986 gboolean
sn_dbus_menu_gen_call_about_to_show_finish(SnDBusMenuGen * proxy,gboolean * out_needUpdate,GAsyncResult * res,GError ** error)1987 sn_dbus_menu_gen_call_about_to_show_finish (
1988 SnDBusMenuGen *proxy,
1989 gboolean *out_needUpdate,
1990 GAsyncResult *res,
1991 GError **error)
1992 {
1993 GVariant *_ret;
1994 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1995 if (_ret == NULL)
1996 goto _out;
1997 g_variant_get (_ret,
1998 "(b)",
1999 out_needUpdate);
2000 g_variant_unref (_ret);
2001 _out:
2002 return _ret != NULL;
2003 }
2004
2005 /**
2006 * sn_dbus_menu_gen_call_about_to_show_sync:
2007 * @proxy: A #SnDBusMenuGenProxy.
2008 * @arg_id: Argument to pass with the method invocation.
2009 * @out_needUpdate: (out) (optional): Return location for return parameter or %NULL to ignore.
2010 * @cancellable: (nullable): A #GCancellable or %NULL.
2011 * @error: Return location for error or %NULL.
2012 *
2013 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShow">AboutToShow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2014 *
2015 * See sn_dbus_menu_gen_call_about_to_show() for the asynchronous version of this method.
2016 *
2017 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2018 */
2019 gboolean
sn_dbus_menu_gen_call_about_to_show_sync(SnDBusMenuGen * proxy,gint arg_id,gboolean * out_needUpdate,GCancellable * cancellable,GError ** error)2020 sn_dbus_menu_gen_call_about_to_show_sync (
2021 SnDBusMenuGen *proxy,
2022 gint arg_id,
2023 gboolean *out_needUpdate,
2024 GCancellable *cancellable,
2025 GError **error)
2026 {
2027 GVariant *_ret;
2028 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2029 "AboutToShow",
2030 g_variant_new ("(i)",
2031 arg_id),
2032 G_DBUS_CALL_FLAGS_NONE,
2033 -1,
2034 cancellable,
2035 error);
2036 if (_ret == NULL)
2037 goto _out;
2038 g_variant_get (_ret,
2039 "(b)",
2040 out_needUpdate);
2041 g_variant_unref (_ret);
2042 _out:
2043 return _ret != NULL;
2044 }
2045
2046 /**
2047 * sn_dbus_menu_gen_call_about_to_show_group:
2048 * @proxy: A #SnDBusMenuGenProxy.
2049 * @arg_ids: Argument to pass with the method invocation.
2050 * @cancellable: (nullable): A #GCancellable or %NULL.
2051 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2052 * @user_data: User data to pass to @callback.
2053 *
2054 * Asynchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShowGroup">AboutToShowGroup()</link> D-Bus method on @proxy.
2055 * 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()).
2056 * You can then call sn_dbus_menu_gen_call_about_to_show_group_finish() to get the result of the operation.
2057 *
2058 * See sn_dbus_menu_gen_call_about_to_show_group_sync() for the synchronous, blocking version of this method.
2059 */
2060 void
sn_dbus_menu_gen_call_about_to_show_group(SnDBusMenuGen * proxy,GVariant * arg_ids,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2061 sn_dbus_menu_gen_call_about_to_show_group (
2062 SnDBusMenuGen *proxy,
2063 GVariant *arg_ids,
2064 GCancellable *cancellable,
2065 GAsyncReadyCallback callback,
2066 gpointer user_data)
2067 {
2068 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2069 "AboutToShowGroup",
2070 g_variant_new ("(@ai)",
2071 arg_ids),
2072 G_DBUS_CALL_FLAGS_NONE,
2073 -1,
2074 cancellable,
2075 callback,
2076 user_data);
2077 }
2078
2079 /**
2080 * sn_dbus_menu_gen_call_about_to_show_group_finish:
2081 * @proxy: A #SnDBusMenuGenProxy.
2082 * @out_updatesNeeded: (out) (optional): Return location for return parameter or %NULL to ignore.
2083 * @out_idErrors: (out) (optional): Return location for return parameter or %NULL to ignore.
2084 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_call_about_to_show_group().
2085 * @error: Return location for error or %NULL.
2086 *
2087 * Finishes an operation started with sn_dbus_menu_gen_call_about_to_show_group().
2088 *
2089 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2090 */
2091 gboolean
sn_dbus_menu_gen_call_about_to_show_group_finish(SnDBusMenuGen * proxy,GVariant ** out_updatesNeeded,GVariant ** out_idErrors,GAsyncResult * res,GError ** error)2092 sn_dbus_menu_gen_call_about_to_show_group_finish (
2093 SnDBusMenuGen *proxy,
2094 GVariant **out_updatesNeeded,
2095 GVariant **out_idErrors,
2096 GAsyncResult *res,
2097 GError **error)
2098 {
2099 GVariant *_ret;
2100 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2101 if (_ret == NULL)
2102 goto _out;
2103 g_variant_get (_ret,
2104 "(@ai@ai)",
2105 out_updatesNeeded,
2106 out_idErrors);
2107 g_variant_unref (_ret);
2108 _out:
2109 return _ret != NULL;
2110 }
2111
2112 /**
2113 * sn_dbus_menu_gen_call_about_to_show_group_sync:
2114 * @proxy: A #SnDBusMenuGenProxy.
2115 * @arg_ids: Argument to pass with the method invocation.
2116 * @out_updatesNeeded: (out) (optional): Return location for return parameter or %NULL to ignore.
2117 * @out_idErrors: (out) (optional): Return location for return parameter or %NULL to ignore.
2118 * @cancellable: (nullable): A #GCancellable or %NULL.
2119 * @error: Return location for error or %NULL.
2120 *
2121 * Synchronously invokes the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShowGroup">AboutToShowGroup()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2122 *
2123 * See sn_dbus_menu_gen_call_about_to_show_group() for the asynchronous version of this method.
2124 *
2125 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set.
2126 */
2127 gboolean
sn_dbus_menu_gen_call_about_to_show_group_sync(SnDBusMenuGen * proxy,GVariant * arg_ids,GVariant ** out_updatesNeeded,GVariant ** out_idErrors,GCancellable * cancellable,GError ** error)2128 sn_dbus_menu_gen_call_about_to_show_group_sync (
2129 SnDBusMenuGen *proxy,
2130 GVariant *arg_ids,
2131 GVariant **out_updatesNeeded,
2132 GVariant **out_idErrors,
2133 GCancellable *cancellable,
2134 GError **error)
2135 {
2136 GVariant *_ret;
2137 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2138 "AboutToShowGroup",
2139 g_variant_new ("(@ai)",
2140 arg_ids),
2141 G_DBUS_CALL_FLAGS_NONE,
2142 -1,
2143 cancellable,
2144 error);
2145 if (_ret == NULL)
2146 goto _out;
2147 g_variant_get (_ret,
2148 "(@ai@ai)",
2149 out_updatesNeeded,
2150 out_idErrors);
2151 g_variant_unref (_ret);
2152 _out:
2153 return _ret != NULL;
2154 }
2155
2156 /**
2157 * sn_dbus_menu_gen_complete_get_layout:
2158 * @object: A #SnDBusMenuGen.
2159 * @invocation: (transfer full): A #GDBusMethodInvocation.
2160 * @revision: Parameter to return.
2161 * @layout: Parameter to return.
2162 *
2163 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.GetLayout">GetLayout()</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.
2164 *
2165 * This method will free @invocation, you cannot use it afterwards.
2166 */
2167 void
sn_dbus_menu_gen_complete_get_layout(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,guint revision,GVariant * layout)2168 sn_dbus_menu_gen_complete_get_layout (
2169 SnDBusMenuGen *object G_GNUC_UNUSED,
2170 GDBusMethodInvocation *invocation,
2171 guint revision,
2172 GVariant *layout)
2173 {
2174 g_dbus_method_invocation_return_value (invocation,
2175 g_variant_new ("(u@(ia{sv}av))",
2176 revision,
2177 layout));
2178 }
2179
2180 /**
2181 * sn_dbus_menu_gen_complete_get_group_properties:
2182 * @object: A #SnDBusMenuGen.
2183 * @invocation: (transfer full): A #GDBusMethodInvocation.
2184 * @properties: Parameter to return.
2185 *
2186 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.GetGroupProperties">GetGroupProperties()</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.
2187 *
2188 * This method will free @invocation, you cannot use it afterwards.
2189 */
2190 void
sn_dbus_menu_gen_complete_get_group_properties(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * properties)2191 sn_dbus_menu_gen_complete_get_group_properties (
2192 SnDBusMenuGen *object G_GNUC_UNUSED,
2193 GDBusMethodInvocation *invocation,
2194 GVariant *properties)
2195 {
2196 g_dbus_method_invocation_return_value (invocation,
2197 g_variant_new ("(@a(ia{sv}))",
2198 properties));
2199 }
2200
2201 /**
2202 * sn_dbus_menu_gen_complete_get_property:
2203 * @object: A #SnDBusMenuGen.
2204 * @invocation: (transfer full): A #GDBusMethodInvocation.
2205 * @value: Parameter to return.
2206 *
2207 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.GetProperty">GetProperty()</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.
2208 *
2209 * This method will free @invocation, you cannot use it afterwards.
2210 */
2211 void
sn_dbus_menu_gen_complete_get_property(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * value)2212 sn_dbus_menu_gen_complete_get_property (
2213 SnDBusMenuGen *object G_GNUC_UNUSED,
2214 GDBusMethodInvocation *invocation,
2215 GVariant *value)
2216 {
2217 g_dbus_method_invocation_return_value (invocation,
2218 g_variant_new ("(@v)",
2219 value));
2220 }
2221
2222 /**
2223 * sn_dbus_menu_gen_complete_event:
2224 * @object: A #SnDBusMenuGen.
2225 * @invocation: (transfer full): A #GDBusMethodInvocation.
2226 *
2227 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.Event">Event()</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.
2228 *
2229 * This method will free @invocation, you cannot use it afterwards.
2230 */
2231 void
sn_dbus_menu_gen_complete_event(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation)2232 sn_dbus_menu_gen_complete_event (
2233 SnDBusMenuGen *object G_GNUC_UNUSED,
2234 GDBusMethodInvocation *invocation)
2235 {
2236 g_dbus_method_invocation_return_value (invocation,
2237 g_variant_new ("()"));
2238 }
2239
2240 /**
2241 * sn_dbus_menu_gen_complete_event_group:
2242 * @object: A #SnDBusMenuGen.
2243 * @invocation: (transfer full): A #GDBusMethodInvocation.
2244 * @idErrors: Parameter to return.
2245 *
2246 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.EventGroup">EventGroup()</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.
2247 *
2248 * This method will free @invocation, you cannot use it afterwards.
2249 */
2250 void
sn_dbus_menu_gen_complete_event_group(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * idErrors)2251 sn_dbus_menu_gen_complete_event_group (
2252 SnDBusMenuGen *object G_GNUC_UNUSED,
2253 GDBusMethodInvocation *invocation,
2254 GVariant *idErrors)
2255 {
2256 g_dbus_method_invocation_return_value (invocation,
2257 g_variant_new ("(@ai)",
2258 idErrors));
2259 }
2260
2261 /**
2262 * sn_dbus_menu_gen_complete_about_to_show:
2263 * @object: A #SnDBusMenuGen.
2264 * @invocation: (transfer full): A #GDBusMethodInvocation.
2265 * @needUpdate: Parameter to return.
2266 *
2267 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShow">AboutToShow()</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.
2268 *
2269 * This method will free @invocation, you cannot use it afterwards.
2270 */
2271 void
sn_dbus_menu_gen_complete_about_to_show(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,gboolean needUpdate)2272 sn_dbus_menu_gen_complete_about_to_show (
2273 SnDBusMenuGen *object G_GNUC_UNUSED,
2274 GDBusMethodInvocation *invocation,
2275 gboolean needUpdate)
2276 {
2277 g_dbus_method_invocation_return_value (invocation,
2278 g_variant_new ("(b)",
2279 needUpdate));
2280 }
2281
2282 /**
2283 * sn_dbus_menu_gen_complete_about_to_show_group:
2284 * @object: A #SnDBusMenuGen.
2285 * @invocation: (transfer full): A #GDBusMethodInvocation.
2286 * @updatesNeeded: Parameter to return.
2287 * @idErrors: Parameter to return.
2288 *
2289 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-com-canonical-dbusmenu.AboutToShowGroup">AboutToShowGroup()</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.
2290 *
2291 * This method will free @invocation, you cannot use it afterwards.
2292 */
2293 void
sn_dbus_menu_gen_complete_about_to_show_group(SnDBusMenuGen * object G_GNUC_UNUSED,GDBusMethodInvocation * invocation,GVariant * updatesNeeded,GVariant * idErrors)2294 sn_dbus_menu_gen_complete_about_to_show_group (
2295 SnDBusMenuGen *object G_GNUC_UNUSED,
2296 GDBusMethodInvocation *invocation,
2297 GVariant *updatesNeeded,
2298 GVariant *idErrors)
2299 {
2300 g_dbus_method_invocation_return_value (invocation,
2301 g_variant_new ("(@ai@ai)",
2302 updatesNeeded,
2303 idErrors));
2304 }
2305
2306 /* ------------------------------------------------------------------------ */
2307
2308 /**
2309 * SnDBusMenuGenProxy:
2310 *
2311 * The #SnDBusMenuGenProxy structure contains only private data and should only be accessed using the provided API.
2312 */
2313
2314 /**
2315 * SnDBusMenuGenProxyClass:
2316 * @parent_class: The parent class.
2317 *
2318 * Class structure for #SnDBusMenuGenProxy.
2319 */
2320
2321 struct _SnDBusMenuGenProxyPrivate
2322 {
2323 GData *qdata;
2324 };
2325
2326 static void sn_dbus_menu_gen_proxy_iface_init (SnDBusMenuGenIface *iface);
2327
2328 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SnDBusMenuGenProxy,sn_dbus_menu_gen_proxy,G_TYPE_DBUS_PROXY,G_ADD_PRIVATE (SnDBusMenuGenProxy)G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN,sn_dbus_menu_gen_proxy_iface_init))2329 G_DEFINE_TYPE_WITH_CODE (SnDBusMenuGenProxy, sn_dbus_menu_gen_proxy, G_TYPE_DBUS_PROXY,
2330 G_ADD_PRIVATE (SnDBusMenuGenProxy)
2331 G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN, sn_dbus_menu_gen_proxy_iface_init))
2332
2333 #else
2334 G_DEFINE_TYPE_WITH_CODE (SnDBusMenuGenProxy, sn_dbus_menu_gen_proxy, G_TYPE_DBUS_PROXY,
2335 G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN, sn_dbus_menu_gen_proxy_iface_init))
2336
2337 #endif
2338 static void
2339 sn_dbus_menu_gen_proxy_finalize (GObject *object)
2340 {
2341 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (object);
2342 g_datalist_clear (&proxy->priv->qdata);
2343 G_OBJECT_CLASS (sn_dbus_menu_gen_proxy_parent_class)->finalize (object);
2344 }
2345
2346 static void
sn_dbus_menu_gen_proxy_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2347 sn_dbus_menu_gen_proxy_get_property (GObject *object,
2348 guint prop_id,
2349 GValue *value,
2350 GParamSpec *pspec G_GNUC_UNUSED)
2351 {
2352 const _ExtendedGDBusPropertyInfo *info;
2353 GVariant *variant;
2354 g_assert (prop_id != 0 && prop_id - 1 < 4);
2355 info = (const _ExtendedGDBusPropertyInfo *) _sn_dbus_menu_gen_property_info_pointers[prop_id - 1];
2356 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2357 if (info->use_gvariant)
2358 {
2359 g_value_set_variant (value, variant);
2360 }
2361 else
2362 {
2363 if (variant != NULL)
2364 g_dbus_gvariant_to_gvalue (variant, value);
2365 }
2366 if (variant != NULL)
2367 g_variant_unref (variant);
2368 }
2369
2370 static void
sn_dbus_menu_gen_proxy_set_property_cb(GDBusProxy * proxy,GAsyncResult * res,gpointer user_data)2371 sn_dbus_menu_gen_proxy_set_property_cb (GDBusProxy *proxy,
2372 GAsyncResult *res,
2373 gpointer user_data)
2374 {
2375 const _ExtendedGDBusPropertyInfo *info = user_data;
2376 GError *error;
2377 GVariant *_ret;
2378 error = NULL;
2379 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2380 if (!_ret)
2381 {
2382 g_warning ("Error setting property '%s' on interface com.canonical.dbusmenu: %s (%s, %d)",
2383 info->parent_struct.name,
2384 error->message, g_quark_to_string (error->domain), error->code);
2385 g_error_free (error);
2386 }
2387 else
2388 {
2389 g_variant_unref (_ret);
2390 }
2391 }
2392
2393 static void
sn_dbus_menu_gen_proxy_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec G_GNUC_UNUSED)2394 sn_dbus_menu_gen_proxy_set_property (GObject *object,
2395 guint prop_id,
2396 const GValue *value,
2397 GParamSpec *pspec G_GNUC_UNUSED)
2398 {
2399 const _ExtendedGDBusPropertyInfo *info;
2400 GVariant *variant;
2401 g_assert (prop_id != 0 && prop_id - 1 < 4);
2402 info = (const _ExtendedGDBusPropertyInfo *) _sn_dbus_menu_gen_property_info_pointers[prop_id - 1];
2403 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2404 g_dbus_proxy_call (G_DBUS_PROXY (object),
2405 "org.freedesktop.DBus.Properties.Set",
2406 g_variant_new ("(ssv)", "com.canonical.dbusmenu", info->parent_struct.name, variant),
2407 G_DBUS_CALL_FLAGS_NONE,
2408 -1,
2409 NULL, (GAsyncReadyCallback) sn_dbus_menu_gen_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2410 g_variant_unref (variant);
2411 }
2412
2413 static void
sn_dbus_menu_gen_proxy_g_signal(GDBusProxy * proxy,const gchar * sender_name G_GNUC_UNUSED,const gchar * signal_name,GVariant * parameters)2414 sn_dbus_menu_gen_proxy_g_signal (GDBusProxy *proxy,
2415 const gchar *sender_name G_GNUC_UNUSED,
2416 const gchar *signal_name,
2417 GVariant *parameters)
2418 {
2419 _ExtendedGDBusSignalInfo *info;
2420 GVariantIter iter;
2421 GVariant *child;
2422 GValue *paramv;
2423 gsize num_params;
2424 gsize n;
2425 guint signal_id;
2426 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct, signal_name);
2427 if (info == NULL)
2428 return;
2429 num_params = g_variant_n_children (parameters);
2430 paramv = g_new0 (GValue, num_params + 1);
2431 g_value_init (¶mv[0], SN_TYPE_DBUS_MENU_GEN);
2432 g_value_set_object (¶mv[0], proxy);
2433 g_variant_iter_init (&iter, parameters);
2434 n = 1;
2435 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2436 {
2437 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2438 if (arg_info->use_gvariant)
2439 {
2440 g_value_init (¶mv[n], G_TYPE_VARIANT);
2441 g_value_set_variant (¶mv[n], child);
2442 n++;
2443 }
2444 else
2445 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
2446 g_variant_unref (child);
2447 }
2448 signal_id = g_signal_lookup (info->signal_name, SN_TYPE_DBUS_MENU_GEN);
2449 g_signal_emitv (paramv, signal_id, 0, NULL);
2450 for (n = 0; n < num_params + 1; n++)
2451 g_value_unset (¶mv[n]);
2452 g_free (paramv);
2453 }
2454
2455 static void
sn_dbus_menu_gen_proxy_g_properties_changed(GDBusProxy * _proxy,GVariant * changed_properties,const gchar * const * invalidated_properties)2456 sn_dbus_menu_gen_proxy_g_properties_changed (GDBusProxy *_proxy,
2457 GVariant *changed_properties,
2458 const gchar *const *invalidated_properties)
2459 {
2460 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (_proxy);
2461 guint n;
2462 const gchar *key;
2463 GVariantIter *iter;
2464 _ExtendedGDBusPropertyInfo *info;
2465 g_variant_get (changed_properties, "a{sv}", &iter);
2466 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2467 {
2468 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct, key);
2469 g_datalist_remove_data (&proxy->priv->qdata, key);
2470 if (info != NULL)
2471 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2472 }
2473 g_variant_iter_free (iter);
2474 for (n = 0; invalidated_properties[n] != NULL; n++)
2475 {
2476 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct, invalidated_properties[n]);
2477 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2478 if (info != NULL)
2479 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2480 }
2481 }
2482
2483 static guint
sn_dbus_menu_gen_proxy_get_version(SnDBusMenuGen * object)2484 sn_dbus_menu_gen_proxy_get_version (SnDBusMenuGen *object)
2485 {
2486 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (object);
2487 GVariant *variant;
2488 guint value = 0;
2489 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Version");
2490 if (variant != NULL)
2491 {
2492 value = g_variant_get_uint32 (variant);
2493 g_variant_unref (variant);
2494 }
2495 return value;
2496 }
2497
2498 static const gchar *
sn_dbus_menu_gen_proxy_get_text_direction(SnDBusMenuGen * object)2499 sn_dbus_menu_gen_proxy_get_text_direction (SnDBusMenuGen *object)
2500 {
2501 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (object);
2502 GVariant *variant;
2503 const gchar *value = NULL;
2504 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "TextDirection");
2505 if (variant != NULL)
2506 {
2507 value = g_variant_get_string (variant, NULL);
2508 g_variant_unref (variant);
2509 }
2510 return value;
2511 }
2512
2513 static const gchar *
sn_dbus_menu_gen_proxy_get_status(SnDBusMenuGen * object)2514 sn_dbus_menu_gen_proxy_get_status (SnDBusMenuGen *object)
2515 {
2516 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (object);
2517 GVariant *variant;
2518 const gchar *value = NULL;
2519 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Status");
2520 if (variant != NULL)
2521 {
2522 value = g_variant_get_string (variant, NULL);
2523 g_variant_unref (variant);
2524 }
2525 return value;
2526 }
2527
2528 static const gchar *const *
sn_dbus_menu_gen_proxy_get_icon_theme_path(SnDBusMenuGen * object)2529 sn_dbus_menu_gen_proxy_get_icon_theme_path (SnDBusMenuGen *object)
2530 {
2531 SnDBusMenuGenProxy *proxy = SN_DBUS_MENU_GEN_PROXY (object);
2532 GVariant *variant;
2533 const gchar *const *value = NULL;
2534 value = g_datalist_get_data (&proxy->priv->qdata, "IconThemePath");
2535 if (value != NULL)
2536 return value;
2537 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IconThemePath");
2538 if (variant != NULL)
2539 {
2540 value = g_variant_get_strv (variant, NULL);
2541 g_datalist_set_data_full (&proxy->priv->qdata, "IconThemePath", (gpointer) value, g_free);
2542 g_variant_unref (variant);
2543 }
2544 return value;
2545 }
2546
2547 static void
sn_dbus_menu_gen_proxy_init(SnDBusMenuGenProxy * proxy)2548 sn_dbus_menu_gen_proxy_init (SnDBusMenuGenProxy *proxy)
2549 {
2550 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2551 proxy->priv = sn_dbus_menu_gen_proxy_get_instance_private (proxy);
2552 #else
2553 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, SN_TYPE_DBUS_MENU_GEN_PROXY, SnDBusMenuGenProxyPrivate);
2554 #endif
2555
2556 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sn_dbus_menu_gen_interface_info ());
2557 }
2558
2559 static void
sn_dbus_menu_gen_proxy_class_init(SnDBusMenuGenProxyClass * klass)2560 sn_dbus_menu_gen_proxy_class_init (SnDBusMenuGenProxyClass *klass)
2561 {
2562 GObjectClass *gobject_class;
2563 GDBusProxyClass *proxy_class;
2564
2565 gobject_class = G_OBJECT_CLASS (klass);
2566 gobject_class->finalize = sn_dbus_menu_gen_proxy_finalize;
2567 gobject_class->get_property = sn_dbus_menu_gen_proxy_get_property;
2568 gobject_class->set_property = sn_dbus_menu_gen_proxy_set_property;
2569
2570 proxy_class = G_DBUS_PROXY_CLASS (klass);
2571 proxy_class->g_signal = sn_dbus_menu_gen_proxy_g_signal;
2572 proxy_class->g_properties_changed = sn_dbus_menu_gen_proxy_g_properties_changed;
2573
2574 sn_dbus_menu_gen_override_properties (gobject_class, 1);
2575
2576 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2577 g_type_class_add_private (klass, sizeof (SnDBusMenuGenProxyPrivate));
2578 #endif
2579 }
2580
2581 static void
sn_dbus_menu_gen_proxy_iface_init(SnDBusMenuGenIface * iface)2582 sn_dbus_menu_gen_proxy_iface_init (SnDBusMenuGenIface *iface)
2583 {
2584 iface->get_version = sn_dbus_menu_gen_proxy_get_version;
2585 iface->get_text_direction = sn_dbus_menu_gen_proxy_get_text_direction;
2586 iface->get_status = sn_dbus_menu_gen_proxy_get_status;
2587 iface->get_icon_theme_path = sn_dbus_menu_gen_proxy_get_icon_theme_path;
2588 }
2589
2590 /**
2591 * sn_dbus_menu_gen_proxy_new:
2592 * @connection: A #GDBusConnection.
2593 * @flags: Flags from the #GDBusProxyFlags enumeration.
2594 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2595 * @object_path: An object path.
2596 * @cancellable: (nullable): A #GCancellable or %NULL.
2597 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2598 * @user_data: User data to pass to @callback.
2599 *
2600 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link>. See g_dbus_proxy_new() for more details.
2601 *
2602 * 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()).
2603 * You can then call sn_dbus_menu_gen_proxy_new_finish() to get the result of the operation.
2604 *
2605 * See sn_dbus_menu_gen_proxy_new_sync() for the synchronous, blocking version of this constructor.
2606 */
2607 void
sn_dbus_menu_gen_proxy_new(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2608 sn_dbus_menu_gen_proxy_new (
2609 GDBusConnection *connection,
2610 GDBusProxyFlags flags,
2611 const gchar *name,
2612 const gchar *object_path,
2613 GCancellable *cancellable,
2614 GAsyncReadyCallback callback,
2615 gpointer user_data)
2616 {
2617 g_async_initable_new_async (SN_TYPE_DBUS_MENU_GEN_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", "com.canonical.dbusmenu", NULL);
2618 }
2619
2620 /**
2621 * sn_dbus_menu_gen_proxy_new_finish:
2622 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_proxy_new().
2623 * @error: Return location for error or %NULL
2624 *
2625 * Finishes an operation started with sn_dbus_menu_gen_proxy_new().
2626 *
2627 * Returns: (transfer full) (type SnDBusMenuGenProxy): The constructed proxy object or %NULL if @error is set.
2628 */
2629 SnDBusMenuGen *
sn_dbus_menu_gen_proxy_new_finish(GAsyncResult * res,GError ** error)2630 sn_dbus_menu_gen_proxy_new_finish (
2631 GAsyncResult *res,
2632 GError **error)
2633 {
2634 GObject *ret;
2635 GObject *source_object;
2636 source_object = g_async_result_get_source_object (res);
2637 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2638 g_object_unref (source_object);
2639 if (ret != NULL)
2640 return SN_DBUS_MENU_GEN (ret);
2641 else
2642 return NULL;
2643 }
2644
2645 /**
2646 * sn_dbus_menu_gen_proxy_new_sync:
2647 * @connection: A #GDBusConnection.
2648 * @flags: Flags from the #GDBusProxyFlags enumeration.
2649 * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2650 * @object_path: An object path.
2651 * @cancellable: (nullable): A #GCancellable or %NULL.
2652 * @error: Return location for error or %NULL
2653 *
2654 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link>. See g_dbus_proxy_new_sync() for more details.
2655 *
2656 * The calling thread is blocked until a reply is received.
2657 *
2658 * See sn_dbus_menu_gen_proxy_new() for the asynchronous version of this constructor.
2659 *
2660 * Returns: (transfer full) (type SnDBusMenuGenProxy): The constructed proxy object or %NULL if @error is set.
2661 */
2662 SnDBusMenuGen *
sn_dbus_menu_gen_proxy_new_sync(GDBusConnection * connection,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)2663 sn_dbus_menu_gen_proxy_new_sync (
2664 GDBusConnection *connection,
2665 GDBusProxyFlags flags,
2666 const gchar *name,
2667 const gchar *object_path,
2668 GCancellable *cancellable,
2669 GError **error)
2670 {
2671 GInitable *ret;
2672 ret = g_initable_new (SN_TYPE_DBUS_MENU_GEN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "com.canonical.dbusmenu", NULL);
2673 if (ret != NULL)
2674 return SN_DBUS_MENU_GEN (ret);
2675 else
2676 return NULL;
2677 }
2678
2679
2680 /**
2681 * sn_dbus_menu_gen_proxy_new_for_bus:
2682 * @bus_type: A #GBusType.
2683 * @flags: Flags from the #GDBusProxyFlags enumeration.
2684 * @name: A bus name (well-known or unique).
2685 * @object_path: An object path.
2686 * @cancellable: (nullable): A #GCancellable or %NULL.
2687 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2688 * @user_data: User data to pass to @callback.
2689 *
2690 * Like sn_dbus_menu_gen_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2691 *
2692 * 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()).
2693 * You can then call sn_dbus_menu_gen_proxy_new_for_bus_finish() to get the result of the operation.
2694 *
2695 * See sn_dbus_menu_gen_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2696 */
2697 void
sn_dbus_menu_gen_proxy_new_for_bus(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GAsyncReadyCallback callback,gpointer user_data)2698 sn_dbus_menu_gen_proxy_new_for_bus (
2699 GBusType bus_type,
2700 GDBusProxyFlags flags,
2701 const gchar *name,
2702 const gchar *object_path,
2703 GCancellable *cancellable,
2704 GAsyncReadyCallback callback,
2705 gpointer user_data)
2706 {
2707 g_async_initable_new_async (SN_TYPE_DBUS_MENU_GEN_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", "com.canonical.dbusmenu", NULL);
2708 }
2709
2710 /**
2711 * sn_dbus_menu_gen_proxy_new_for_bus_finish:
2712 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sn_dbus_menu_gen_proxy_new_for_bus().
2713 * @error: Return location for error or %NULL
2714 *
2715 * Finishes an operation started with sn_dbus_menu_gen_proxy_new_for_bus().
2716 *
2717 * Returns: (transfer full) (type SnDBusMenuGenProxy): The constructed proxy object or %NULL if @error is set.
2718 */
2719 SnDBusMenuGen *
sn_dbus_menu_gen_proxy_new_for_bus_finish(GAsyncResult * res,GError ** error)2720 sn_dbus_menu_gen_proxy_new_for_bus_finish (
2721 GAsyncResult *res,
2722 GError **error)
2723 {
2724 GObject *ret;
2725 GObject *source_object;
2726 source_object = g_async_result_get_source_object (res);
2727 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2728 g_object_unref (source_object);
2729 if (ret != NULL)
2730 return SN_DBUS_MENU_GEN (ret);
2731 else
2732 return NULL;
2733 }
2734
2735 /**
2736 * sn_dbus_menu_gen_proxy_new_for_bus_sync:
2737 * @bus_type: A #GBusType.
2738 * @flags: Flags from the #GDBusProxyFlags enumeration.
2739 * @name: A bus name (well-known or unique).
2740 * @object_path: An object path.
2741 * @cancellable: (nullable): A #GCancellable or %NULL.
2742 * @error: Return location for error or %NULL
2743 *
2744 * Like sn_dbus_menu_gen_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2745 *
2746 * The calling thread is blocked until a reply is received.
2747 *
2748 * See sn_dbus_menu_gen_proxy_new_for_bus() for the asynchronous version of this constructor.
2749 *
2750 * Returns: (transfer full) (type SnDBusMenuGenProxy): The constructed proxy object or %NULL if @error is set.
2751 */
2752 SnDBusMenuGen *
sn_dbus_menu_gen_proxy_new_for_bus_sync(GBusType bus_type,GDBusProxyFlags flags,const gchar * name,const gchar * object_path,GCancellable * cancellable,GError ** error)2753 sn_dbus_menu_gen_proxy_new_for_bus_sync (
2754 GBusType bus_type,
2755 GDBusProxyFlags flags,
2756 const gchar *name,
2757 const gchar *object_path,
2758 GCancellable *cancellable,
2759 GError **error)
2760 {
2761 GInitable *ret;
2762 ret = g_initable_new (SN_TYPE_DBUS_MENU_GEN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "com.canonical.dbusmenu", NULL);
2763 if (ret != NULL)
2764 return SN_DBUS_MENU_GEN (ret);
2765 else
2766 return NULL;
2767 }
2768
2769
2770 /* ------------------------------------------------------------------------ */
2771
2772 /**
2773 * SnDBusMenuGenSkeleton:
2774 *
2775 * The #SnDBusMenuGenSkeleton structure contains only private data and should only be accessed using the provided API.
2776 */
2777
2778 /**
2779 * SnDBusMenuGenSkeletonClass:
2780 * @parent_class: The parent class.
2781 *
2782 * Class structure for #SnDBusMenuGenSkeleton.
2783 */
2784
2785 struct _SnDBusMenuGenSkeletonPrivate
2786 {
2787 GValue *properties;
2788 GList *changed_properties;
2789 GSource *changed_properties_idle_source;
2790 GMainContext *context;
2791 GMutex lock;
2792 };
2793
2794 static void
_sn_dbus_menu_gen_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)2795 _sn_dbus_menu_gen_skeleton_handle_method_call (
2796 GDBusConnection *connection G_GNUC_UNUSED,
2797 const gchar *sender G_GNUC_UNUSED,
2798 const gchar *object_path G_GNUC_UNUSED,
2799 const gchar *interface_name,
2800 const gchar *method_name,
2801 GVariant *parameters,
2802 GDBusMethodInvocation *invocation,
2803 gpointer user_data)
2804 {
2805 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (user_data);
2806 _ExtendedGDBusMethodInfo *info;
2807 GVariantIter iter;
2808 GVariant *child;
2809 GValue *paramv;
2810 gsize num_params;
2811 guint num_extra;
2812 gsize n;
2813 guint signal_id;
2814 GValue return_value = G_VALUE_INIT;
2815 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2816 g_assert (info != NULL);
2817 num_params = g_variant_n_children (parameters);
2818 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2819 n = 0;
2820 g_value_init (¶mv[n], SN_TYPE_DBUS_MENU_GEN);
2821 g_value_set_object (¶mv[n++], skeleton);
2822 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2823 g_value_set_object (¶mv[n++], invocation);
2824 if (info->pass_fdlist)
2825 {
2826 #ifdef G_OS_UNIX
2827 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
2828 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2829 #else
2830 g_assert_not_reached ();
2831 #endif
2832 }
2833 g_variant_iter_init (&iter, parameters);
2834 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2835 {
2836 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2837 if (arg_info->use_gvariant)
2838 {
2839 g_value_init (¶mv[n], G_TYPE_VARIANT);
2840 g_value_set_variant (¶mv[n], child);
2841 n++;
2842 }
2843 else
2844 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
2845 g_variant_unref (child);
2846 }
2847 signal_id = g_signal_lookup (info->signal_name, SN_TYPE_DBUS_MENU_GEN);
2848 g_value_init (&return_value, G_TYPE_BOOLEAN);
2849 g_signal_emitv (paramv, signal_id, 0, &return_value);
2850 if (!g_value_get_boolean (&return_value))
2851 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);
2852 g_value_unset (&return_value);
2853 for (n = 0; n < num_params + num_extra; n++)
2854 g_value_unset (¶mv[n]);
2855 g_free (paramv);
2856 }
2857
2858 static GVariant *
_sn_dbus_menu_gen_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)2859 _sn_dbus_menu_gen_skeleton_handle_get_property (
2860 GDBusConnection *connection G_GNUC_UNUSED,
2861 const gchar *sender G_GNUC_UNUSED,
2862 const gchar *object_path G_GNUC_UNUSED,
2863 const gchar *interface_name G_GNUC_UNUSED,
2864 const gchar *property_name,
2865 GError **error,
2866 gpointer user_data)
2867 {
2868 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (user_data);
2869 GValue value = G_VALUE_INIT;
2870 GParamSpec *pspec;
2871 _ExtendedGDBusPropertyInfo *info;
2872 GVariant *ret;
2873 ret = NULL;
2874 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct, property_name);
2875 g_assert (info != NULL);
2876 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2877 if (pspec == NULL)
2878 {
2879 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2880 }
2881 else
2882 {
2883 g_value_init (&value, pspec->value_type);
2884 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2885 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2886 g_value_unset (&value);
2887 }
2888 return ret;
2889 }
2890
2891 static gboolean
_sn_dbus_menu_gen_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)2892 _sn_dbus_menu_gen_skeleton_handle_set_property (
2893 GDBusConnection *connection G_GNUC_UNUSED,
2894 const gchar *sender G_GNUC_UNUSED,
2895 const gchar *object_path G_GNUC_UNUSED,
2896 const gchar *interface_name G_GNUC_UNUSED,
2897 const gchar *property_name,
2898 GVariant *variant,
2899 GError **error,
2900 gpointer user_data)
2901 {
2902 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (user_data);
2903 GValue value = G_VALUE_INIT;
2904 GParamSpec *pspec;
2905 _ExtendedGDBusPropertyInfo *info;
2906 gboolean ret;
2907 ret = FALSE;
2908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sn_dbus_menu_gen_interface_info.parent_struct, property_name);
2909 g_assert (info != NULL);
2910 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2911 if (pspec == NULL)
2912 {
2913 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2914 }
2915 else
2916 {
2917 if (info->use_gvariant)
2918 g_value_set_variant (&value, variant);
2919 else
2920 g_dbus_gvariant_to_gvalue (variant, &value);
2921 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2922 g_value_unset (&value);
2923 ret = TRUE;
2924 }
2925 return ret;
2926 }
2927
2928 static const GDBusInterfaceVTable _sn_dbus_menu_gen_skeleton_vtable =
2929 {
2930 _sn_dbus_menu_gen_skeleton_handle_method_call,
2931 _sn_dbus_menu_gen_skeleton_handle_get_property,
2932 _sn_dbus_menu_gen_skeleton_handle_set_property,
2933 {NULL}
2934 };
2935
2936 static GDBusInterfaceInfo *
sn_dbus_menu_gen_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)2937 sn_dbus_menu_gen_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2938 {
2939 return sn_dbus_menu_gen_interface_info ();
2940 }
2941
2942 static GDBusInterfaceVTable *
sn_dbus_menu_gen_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED)2943 sn_dbus_menu_gen_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2944 {
2945 return (GDBusInterfaceVTable *) &_sn_dbus_menu_gen_skeleton_vtable;
2946 }
2947
2948 static GVariant *
sn_dbus_menu_gen_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton)2949 sn_dbus_menu_gen_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2950 {
2951 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (_skeleton);
2952
2953 GVariantBuilder builder;
2954 guint n;
2955 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2956 if (_sn_dbus_menu_gen_interface_info.parent_struct.properties == NULL)
2957 goto out;
2958 for (n = 0; _sn_dbus_menu_gen_interface_info.parent_struct.properties[n] != NULL; n++)
2959 {
2960 GDBusPropertyInfo *info = _sn_dbus_menu_gen_interface_info.parent_struct.properties[n];
2961 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2962 {
2963 GVariant *value;
2964 value = _sn_dbus_menu_gen_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)), "com.canonical.dbusmenu", info->name, NULL, skeleton);
2965 if (value != NULL)
2966 {
2967 g_variant_take_ref (value);
2968 g_variant_builder_add (&builder, "{sv}", info->name, value);
2969 g_variant_unref (value);
2970 }
2971 }
2972 }
2973 out:
2974 return g_variant_builder_end (&builder);
2975 }
2976
2977 static gboolean _sn_dbus_menu_gen_emit_changed (gpointer user_data);
2978
2979 static void
sn_dbus_menu_gen_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton)2980 sn_dbus_menu_gen_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2981 {
2982 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (_skeleton);
2983 gboolean emit_changed = FALSE;
2984
2985 g_mutex_lock (&skeleton->priv->lock);
2986 if (skeleton->priv->changed_properties_idle_source != NULL)
2987 {
2988 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2989 skeleton->priv->changed_properties_idle_source = NULL;
2990 emit_changed = TRUE;
2991 }
2992 g_mutex_unlock (&skeleton->priv->lock);
2993
2994 if (emit_changed)
2995 _sn_dbus_menu_gen_emit_changed (skeleton);
2996 }
2997
2998 static void
_sn_dbus_menu_gen_on_signal_items_properties_updated(SnDBusMenuGen * object,GVariant * arg_updatedProps,GVariant * arg_removedProps)2999 _sn_dbus_menu_gen_on_signal_items_properties_updated (
3000 SnDBusMenuGen *object,
3001 GVariant *arg_updatedProps,
3002 GVariant *arg_removedProps)
3003 {
3004 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3005
3006 GList *connections, *l;
3007 GVariant *signal_variant;
3008 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3009
3010 signal_variant = g_variant_ref_sink (g_variant_new ("(@a(ia{sv})@a(ias))",
3011 arg_updatedProps,
3012 arg_removedProps));
3013 for (l = connections; l != NULL; l = l->next)
3014 {
3015 GDBusConnection *connection = l->data;
3016 g_dbus_connection_emit_signal (connection,
3017 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "com.canonical.dbusmenu", "ItemsPropertiesUpdated",
3018 signal_variant, NULL);
3019 }
3020 g_variant_unref (signal_variant);
3021 g_list_free_full (connections, g_object_unref);
3022 }
3023
3024 static void
_sn_dbus_menu_gen_on_signal_layout_updated(SnDBusMenuGen * object,guint arg_revision,gint arg_parent)3025 _sn_dbus_menu_gen_on_signal_layout_updated (
3026 SnDBusMenuGen *object,
3027 guint arg_revision,
3028 gint arg_parent)
3029 {
3030 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3031
3032 GList *connections, *l;
3033 GVariant *signal_variant;
3034 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3035
3036 signal_variant = g_variant_ref_sink (g_variant_new ("(ui)",
3037 arg_revision,
3038 arg_parent));
3039 for (l = connections; l != NULL; l = l->next)
3040 {
3041 GDBusConnection *connection = l->data;
3042 g_dbus_connection_emit_signal (connection,
3043 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "com.canonical.dbusmenu", "LayoutUpdated",
3044 signal_variant, NULL);
3045 }
3046 g_variant_unref (signal_variant);
3047 g_list_free_full (connections, g_object_unref);
3048 }
3049
3050 static void
_sn_dbus_menu_gen_on_signal_item_activation_requested(SnDBusMenuGen * object,gint arg_id,guint arg_timestamp)3051 _sn_dbus_menu_gen_on_signal_item_activation_requested (
3052 SnDBusMenuGen *object,
3053 gint arg_id,
3054 guint arg_timestamp)
3055 {
3056 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3057
3058 GList *connections, *l;
3059 GVariant *signal_variant;
3060 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3061
3062 signal_variant = g_variant_ref_sink (g_variant_new ("(iu)",
3063 arg_id,
3064 arg_timestamp));
3065 for (l = connections; l != NULL; l = l->next)
3066 {
3067 GDBusConnection *connection = l->data;
3068 g_dbus_connection_emit_signal (connection,
3069 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "com.canonical.dbusmenu", "ItemActivationRequested",
3070 signal_variant, NULL);
3071 }
3072 g_variant_unref (signal_variant);
3073 g_list_free_full (connections, g_object_unref);
3074 }
3075
3076 static void sn_dbus_menu_gen_skeleton_iface_init (SnDBusMenuGenIface *iface);
3077 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE(SnDBusMenuGenSkeleton,sn_dbus_menu_gen_skeleton,G_TYPE_DBUS_INTERFACE_SKELETON,G_ADD_PRIVATE (SnDBusMenuGenSkeleton)G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN,sn_dbus_menu_gen_skeleton_iface_init))3078 G_DEFINE_TYPE_WITH_CODE (SnDBusMenuGenSkeleton, sn_dbus_menu_gen_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3079 G_ADD_PRIVATE (SnDBusMenuGenSkeleton)
3080 G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN, sn_dbus_menu_gen_skeleton_iface_init))
3081
3082 #else
3083 G_DEFINE_TYPE_WITH_CODE (SnDBusMenuGenSkeleton, sn_dbus_menu_gen_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3084 G_IMPLEMENT_INTERFACE (SN_TYPE_DBUS_MENU_GEN, sn_dbus_menu_gen_skeleton_iface_init))
3085
3086 #endif
3087 static void
3088 sn_dbus_menu_gen_skeleton_finalize (GObject *object)
3089 {
3090 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3091 guint n;
3092 for (n = 0; n < 4; n++)
3093 g_value_unset (&skeleton->priv->properties[n]);
3094 g_free (skeleton->priv->properties);
3095 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3096 if (skeleton->priv->changed_properties_idle_source != NULL)
3097 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3098 g_main_context_unref (skeleton->priv->context);
3099 g_mutex_clear (&skeleton->priv->lock);
3100 G_OBJECT_CLASS (sn_dbus_menu_gen_skeleton_parent_class)->finalize (object);
3101 }
3102
3103 static void
sn_dbus_menu_gen_skeleton_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec G_GNUC_UNUSED)3104 sn_dbus_menu_gen_skeleton_get_property (GObject *object,
3105 guint prop_id,
3106 GValue *value,
3107 GParamSpec *pspec G_GNUC_UNUSED)
3108 {
3109 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3110 g_assert (prop_id != 0 && prop_id - 1 < 4);
3111 g_mutex_lock (&skeleton->priv->lock);
3112 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3113 g_mutex_unlock (&skeleton->priv->lock);
3114 }
3115
3116 static gboolean
_sn_dbus_menu_gen_emit_changed(gpointer user_data)3117 _sn_dbus_menu_gen_emit_changed (gpointer user_data)
3118 {
3119 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (user_data);
3120 GList *l;
3121 GVariantBuilder builder;
3122 GVariantBuilder invalidated_builder;
3123 guint num_changes;
3124
3125 g_mutex_lock (&skeleton->priv->lock);
3126 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3127 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3128 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3129 {
3130 ChangedProperty *cp = l->data;
3131 GVariant *variant;
3132 const GValue *cur_value;
3133
3134 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3135 if (!_g_value_equal (cur_value, &cp->orig_value))
3136 {
3137 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3138 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3139 g_variant_unref (variant);
3140 num_changes++;
3141 }
3142 }
3143 if (num_changes > 0)
3144 {
3145 GList *connections, *ll;
3146 GVariant *signal_variant;
3147 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "com.canonical.dbusmenu",
3148 &builder, &invalidated_builder));
3149 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3150 for (ll = connections; ll != NULL; ll = ll->next)
3151 {
3152 GDBusConnection *connection = ll->data;
3153
3154 g_dbus_connection_emit_signal (connection,
3155 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3156 "org.freedesktop.DBus.Properties",
3157 "PropertiesChanged",
3158 signal_variant,
3159 NULL);
3160 }
3161 g_variant_unref (signal_variant);
3162 g_list_free_full (connections, g_object_unref);
3163 }
3164 else
3165 {
3166 g_variant_builder_clear (&builder);
3167 g_variant_builder_clear (&invalidated_builder);
3168 }
3169 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3170 skeleton->priv->changed_properties = NULL;
3171 skeleton->priv->changed_properties_idle_source = NULL;
3172 g_mutex_unlock (&skeleton->priv->lock);
3173 return FALSE;
3174 }
3175
3176 static void
_sn_dbus_menu_gen_schedule_emit_changed(SnDBusMenuGenSkeleton * skeleton,const _ExtendedGDBusPropertyInfo * info,guint prop_id,const GValue * orig_value)3177 _sn_dbus_menu_gen_schedule_emit_changed (SnDBusMenuGenSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3178 {
3179 ChangedProperty *cp;
3180 GList *l;
3181 cp = NULL;
3182 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3183 {
3184 ChangedProperty *i_cp = l->data;
3185 if (i_cp->info == info)
3186 {
3187 cp = i_cp;
3188 break;
3189 }
3190 }
3191 if (cp == NULL)
3192 {
3193 cp = g_new0 (ChangedProperty, 1);
3194 cp->prop_id = prop_id;
3195 cp->info = info;
3196 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3197 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3198 g_value_copy (orig_value, &cp->orig_value);
3199 }
3200 }
3201
3202 static void
sn_dbus_menu_gen_skeleton_notify(GObject * object,GParamSpec * pspec G_GNUC_UNUSED)3203 sn_dbus_menu_gen_skeleton_notify (GObject *object,
3204 GParamSpec *pspec G_GNUC_UNUSED)
3205 {
3206 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3207 g_mutex_lock (&skeleton->priv->lock);
3208 if (skeleton->priv->changed_properties != NULL &&
3209 skeleton->priv->changed_properties_idle_source == NULL)
3210 {
3211 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3212 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3213 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sn_dbus_menu_gen_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3214 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sn_dbus_menu_gen_emit_changed");
3215 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3216 g_source_unref (skeleton->priv->changed_properties_idle_source);
3217 }
3218 g_mutex_unlock (&skeleton->priv->lock);
3219 }
3220
3221 static void
sn_dbus_menu_gen_skeleton_set_property(GObject * object,guint prop_id,const GValue * value,GParamSpec * pspec)3222 sn_dbus_menu_gen_skeleton_set_property (GObject *object,
3223 guint prop_id,
3224 const GValue *value,
3225 GParamSpec *pspec)
3226 {
3227 const _ExtendedGDBusPropertyInfo *info;
3228 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3229 g_assert (prop_id != 0 && prop_id - 1 < 4);
3230 info = (const _ExtendedGDBusPropertyInfo *) _sn_dbus_menu_gen_property_info_pointers[prop_id - 1];
3231 g_mutex_lock (&skeleton->priv->lock);
3232 g_object_freeze_notify (object);
3233 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3234 {
3235 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
3236 info->emits_changed_signal)
3237 _sn_dbus_menu_gen_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
3238 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3239 g_object_notify_by_pspec (object, pspec);
3240 }
3241 g_mutex_unlock (&skeleton->priv->lock);
3242 g_object_thaw_notify (object);
3243 }
3244
3245 static void
sn_dbus_menu_gen_skeleton_init(SnDBusMenuGenSkeleton * skeleton)3246 sn_dbus_menu_gen_skeleton_init (SnDBusMenuGenSkeleton *skeleton)
3247 {
3248 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3249 skeleton->priv = sn_dbus_menu_gen_skeleton_get_instance_private (skeleton);
3250 #else
3251 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, SN_TYPE_DBUS_MENU_GEN_SKELETON, SnDBusMenuGenSkeletonPrivate);
3252 #endif
3253
3254 g_mutex_init (&skeleton->priv->lock);
3255 skeleton->priv->context = g_main_context_ref_thread_default ();
3256 skeleton->priv->properties = g_new0 (GValue, 4);
3257 g_value_init (&skeleton->priv->properties[0], G_TYPE_UINT);
3258 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
3259 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
3260 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRV);
3261 }
3262
3263 static guint
sn_dbus_menu_gen_skeleton_get_version(SnDBusMenuGen * object)3264 sn_dbus_menu_gen_skeleton_get_version (SnDBusMenuGen *object)
3265 {
3266 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3267 guint value;
3268 g_mutex_lock (&skeleton->priv->lock);
3269 value = g_value_get_uint (&(skeleton->priv->properties[0]));
3270 g_mutex_unlock (&skeleton->priv->lock);
3271 return value;
3272 }
3273
3274 static const gchar *
sn_dbus_menu_gen_skeleton_get_text_direction(SnDBusMenuGen * object)3275 sn_dbus_menu_gen_skeleton_get_text_direction (SnDBusMenuGen *object)
3276 {
3277 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3278 const gchar *value;
3279 g_mutex_lock (&skeleton->priv->lock);
3280 value = g_value_get_string (&(skeleton->priv->properties[1]));
3281 g_mutex_unlock (&skeleton->priv->lock);
3282 return value;
3283 }
3284
3285 static const gchar *
sn_dbus_menu_gen_skeleton_get_status(SnDBusMenuGen * object)3286 sn_dbus_menu_gen_skeleton_get_status (SnDBusMenuGen *object)
3287 {
3288 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3289 const gchar *value;
3290 g_mutex_lock (&skeleton->priv->lock);
3291 value = g_value_get_string (&(skeleton->priv->properties[2]));
3292 g_mutex_unlock (&skeleton->priv->lock);
3293 return value;
3294 }
3295
3296 static const gchar *const *
sn_dbus_menu_gen_skeleton_get_icon_theme_path(SnDBusMenuGen * object)3297 sn_dbus_menu_gen_skeleton_get_icon_theme_path (SnDBusMenuGen *object)
3298 {
3299 SnDBusMenuGenSkeleton *skeleton = SN_DBUS_MENU_GEN_SKELETON (object);
3300 const gchar *const *value;
3301 g_mutex_lock (&skeleton->priv->lock);
3302 value = g_value_get_boxed (&(skeleton->priv->properties[3]));
3303 g_mutex_unlock (&skeleton->priv->lock);
3304 return value;
3305 }
3306
3307 static void
sn_dbus_menu_gen_skeleton_class_init(SnDBusMenuGenSkeletonClass * klass)3308 sn_dbus_menu_gen_skeleton_class_init (SnDBusMenuGenSkeletonClass *klass)
3309 {
3310 GObjectClass *gobject_class;
3311 GDBusInterfaceSkeletonClass *skeleton_class;
3312
3313 gobject_class = G_OBJECT_CLASS (klass);
3314 gobject_class->finalize = sn_dbus_menu_gen_skeleton_finalize;
3315 gobject_class->get_property = sn_dbus_menu_gen_skeleton_get_property;
3316 gobject_class->set_property = sn_dbus_menu_gen_skeleton_set_property;
3317 gobject_class->notify = sn_dbus_menu_gen_skeleton_notify;
3318
3319
3320 sn_dbus_menu_gen_override_properties (gobject_class, 1);
3321
3322 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3323 skeleton_class->get_info = sn_dbus_menu_gen_skeleton_dbus_interface_get_info;
3324 skeleton_class->get_properties = sn_dbus_menu_gen_skeleton_dbus_interface_get_properties;
3325 skeleton_class->flush = sn_dbus_menu_gen_skeleton_dbus_interface_flush;
3326 skeleton_class->get_vtable = sn_dbus_menu_gen_skeleton_dbus_interface_get_vtable;
3327
3328 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3329 g_type_class_add_private (klass, sizeof (SnDBusMenuGenSkeletonPrivate));
3330 #endif
3331 }
3332
3333 static void
sn_dbus_menu_gen_skeleton_iface_init(SnDBusMenuGenIface * iface)3334 sn_dbus_menu_gen_skeleton_iface_init (SnDBusMenuGenIface *iface)
3335 {
3336 iface->items_properties_updated = _sn_dbus_menu_gen_on_signal_items_properties_updated;
3337 iface->layout_updated = _sn_dbus_menu_gen_on_signal_layout_updated;
3338 iface->item_activation_requested = _sn_dbus_menu_gen_on_signal_item_activation_requested;
3339 iface->get_version = sn_dbus_menu_gen_skeleton_get_version;
3340 iface->get_text_direction = sn_dbus_menu_gen_skeleton_get_text_direction;
3341 iface->get_status = sn_dbus_menu_gen_skeleton_get_status;
3342 iface->get_icon_theme_path = sn_dbus_menu_gen_skeleton_get_icon_theme_path;
3343 }
3344
3345 /**
3346 * sn_dbus_menu_gen_skeleton_new:
3347 *
3348 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-com-canonical-dbusmenu.top_of_page">com.canonical.dbusmenu</link>.
3349 *
3350 * Returns: (transfer full) (type SnDBusMenuGenSkeleton): The skeleton object.
3351 */
3352 SnDBusMenuGen *
sn_dbus_menu_gen_skeleton_new(void)3353 sn_dbus_menu_gen_skeleton_new (void)
3354 {
3355 return SN_DBUS_MENU_GEN (g_object_new (SN_TYPE_DBUS_MENU_GEN_SKELETON, NULL));
3356 }
3357
3358