86cb7727 |
1 | /* |
2 | * Generated by gdbus-codegen 2.40.0. DO NOT EDIT. |
3 | * |
4 | * The license of this code is the same as for the source it was derived from. |
5 | */ |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | # include "config.h" |
9 | #endif |
10 | |
11 | #include "src/interfaces/localed/localed-gen.h" |
12 | |
13 | #include <string.h> |
14 | #ifdef G_OS_UNIX |
15 | # include <gio/gunixfdlist.h> |
16 | #endif |
17 | |
18 | typedef struct |
19 | { |
20 | GDBusArgInfo parent_struct; |
21 | gboolean use_gvariant; |
22 | } _ExtendedGDBusArgInfo; |
23 | |
24 | typedef struct |
25 | { |
26 | GDBusMethodInfo parent_struct; |
27 | const gchar *signal_name; |
28 | gboolean pass_fdlist; |
29 | } _ExtendedGDBusMethodInfo; |
30 | |
31 | typedef struct |
32 | { |
33 | GDBusSignalInfo parent_struct; |
34 | const gchar *signal_name; |
35 | } _ExtendedGDBusSignalInfo; |
36 | |
37 | typedef struct |
38 | { |
39 | GDBusPropertyInfo parent_struct; |
40 | const gchar *hyphen_name; |
41 | gboolean use_gvariant; |
42 | } _ExtendedGDBusPropertyInfo; |
43 | |
44 | typedef struct |
45 | { |
46 | GDBusInterfaceInfo parent_struct; |
47 | const gchar *hyphen_name; |
48 | } _ExtendedGDBusInterfaceInfo; |
49 | |
50 | typedef struct |
51 | { |
52 | const _ExtendedGDBusPropertyInfo *info; |
53 | guint prop_id; |
54 | GValue orig_value; /* the value before the change */ |
55 | } ChangedProperty; |
56 | |
57 | static void |
58 | _changed_property_free (ChangedProperty *data) |
59 | { |
60 | g_value_unset (&data->orig_value); |
61 | g_free (data); |
62 | } |
63 | |
64 | static gboolean |
65 | _g_strv_equal0 (gchar **a, gchar **b) |
66 | { |
67 | gboolean ret = FALSE; |
68 | guint n; |
69 | if (a == NULL && b == NULL) |
70 | { |
71 | ret = TRUE; |
72 | goto out; |
73 | } |
74 | if (a == NULL || b == NULL) |
75 | goto out; |
76 | if (g_strv_length (a) != g_strv_length (b)) |
77 | goto out; |
78 | for (n = 0; a[n] != NULL; n++) |
79 | if (g_strcmp0 (a[n], b[n]) != 0) |
80 | goto out; |
81 | ret = TRUE; |
82 | out: |
83 | return ret; |
84 | } |
85 | |
86 | static gboolean |
87 | _g_variant_equal0 (GVariant *a, GVariant *b) |
88 | { |
89 | gboolean ret = FALSE; |
90 | if (a == NULL && b == NULL) |
91 | { |
92 | ret = TRUE; |
93 | goto out; |
94 | } |
95 | if (a == NULL || b == NULL) |
96 | goto out; |
97 | ret = g_variant_equal (a, b); |
98 | out: |
99 | return ret; |
100 | } |
101 | |
102 | G_GNUC_UNUSED static gboolean |
103 | _g_value_equal (const GValue *a, const GValue *b) |
104 | { |
105 | gboolean ret = FALSE; |
106 | g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); |
107 | switch (G_VALUE_TYPE (a)) |
108 | { |
109 | case G_TYPE_BOOLEAN: |
110 | ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); |
111 | break; |
112 | case G_TYPE_UCHAR: |
113 | ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); |
114 | break; |
115 | case G_TYPE_INT: |
116 | ret = (g_value_get_int (a) == g_value_get_int (b)); |
117 | break; |
118 | case G_TYPE_UINT: |
119 | ret = (g_value_get_uint (a) == g_value_get_uint (b)); |
120 | break; |
121 | case G_TYPE_INT64: |
122 | ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); |
123 | break; |
124 | case G_TYPE_UINT64: |
125 | ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); |
126 | break; |
127 | case G_TYPE_DOUBLE: |
128 | { |
129 | /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ |
130 | gdouble da = g_value_get_double (a); |
131 | gdouble db = g_value_get_double (b); |
132 | ret = memcmp (&da, &db, sizeof (gdouble)) == 0; |
133 | } |
134 | break; |
135 | case G_TYPE_STRING: |
136 | ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); |
137 | break; |
138 | case G_TYPE_VARIANT: |
139 | ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); |
140 | break; |
141 | default: |
142 | if (G_VALUE_TYPE (a) == G_TYPE_STRV) |
143 | ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); |
144 | else |
145 | g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); |
146 | break; |
147 | } |
148 | return ret; |
149 | } |
150 | |
151 | /* ------------------------------------------------------------------------ |
152 | * Code for interface org.freedesktop.locale1 |
153 | * ------------------------------------------------------------------------ |
154 | */ |
155 | |
156 | /** |
157 | * SECTION:Locale1 |
158 | * @title: Locale1 |
159 | * @short_description: Generated C code for the org.freedesktop.locale1 D-Bus interface |
160 | * |
161 | * This section contains code for working with the <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link> D-Bus interface in C. |
162 | */ |
163 | |
164 | /* ---- Introspection data for org.freedesktop.locale1 ---- */ |
165 | |
166 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_locale_IN_ARG_locale = |
167 | { |
168 | { |
169 | -1, |
170 | (gchar *) "locale", |
171 | (gchar *) "as", |
172 | NULL |
173 | }, |
174 | FALSE |
175 | }; |
176 | |
177 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_locale_IN_ARG_user_interaction = |
178 | { |
179 | { |
180 | -1, |
181 | (gchar *) "user_interaction", |
182 | (gchar *) "b", |
183 | NULL |
184 | }, |
185 | FALSE |
186 | }; |
187 | |
188 | static const _ExtendedGDBusArgInfo * const _locale1_method_info_set_locale_IN_ARG_pointers[] = |
189 | { |
190 | &_locale1_method_info_set_locale_IN_ARG_locale, |
191 | &_locale1_method_info_set_locale_IN_ARG_user_interaction, |
192 | NULL |
193 | }; |
194 | |
195 | static const _ExtendedGDBusMethodInfo _locale1_method_info_set_locale = |
196 | { |
197 | { |
198 | -1, |
199 | (gchar *) "SetLocale", |
200 | (GDBusArgInfo **) &_locale1_method_info_set_locale_IN_ARG_pointers, |
201 | NULL, |
202 | NULL |
203 | }, |
204 | "handle-set-locale", |
205 | FALSE |
206 | }; |
207 | |
208 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_vconsole_keyboard_IN_ARG_keymap = |
209 | { |
210 | { |
211 | -1, |
212 | (gchar *) "keymap", |
213 | (gchar *) "s", |
214 | NULL |
215 | }, |
216 | FALSE |
217 | }; |
218 | |
219 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_vconsole_keyboard_IN_ARG_keymap_toggle = |
220 | { |
221 | { |
222 | -1, |
223 | (gchar *) "keymap_toggle", |
224 | (gchar *) "s", |
225 | NULL |
226 | }, |
227 | FALSE |
228 | }; |
229 | |
230 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_vconsole_keyboard_IN_ARG_convert = |
231 | { |
232 | { |
233 | -1, |
234 | (gchar *) "convert", |
235 | (gchar *) "b", |
236 | NULL |
237 | }, |
238 | FALSE |
239 | }; |
240 | |
241 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_vconsole_keyboard_IN_ARG_user_interaction = |
242 | { |
243 | { |
244 | -1, |
245 | (gchar *) "user_interaction", |
246 | (gchar *) "b", |
247 | NULL |
248 | }, |
249 | FALSE |
250 | }; |
251 | |
252 | static const _ExtendedGDBusArgInfo * const _locale1_method_info_set_vconsole_keyboard_IN_ARG_pointers[] = |
253 | { |
254 | &_locale1_method_info_set_vconsole_keyboard_IN_ARG_keymap, |
255 | &_locale1_method_info_set_vconsole_keyboard_IN_ARG_keymap_toggle, |
256 | &_locale1_method_info_set_vconsole_keyboard_IN_ARG_convert, |
257 | &_locale1_method_info_set_vconsole_keyboard_IN_ARG_user_interaction, |
258 | NULL |
259 | }; |
260 | |
261 | static const _ExtendedGDBusMethodInfo _locale1_method_info_set_vconsole_keyboard = |
262 | { |
263 | { |
264 | -1, |
265 | (gchar *) "SetVConsoleKeyboard", |
266 | (GDBusArgInfo **) &_locale1_method_info_set_vconsole_keyboard_IN_ARG_pointers, |
267 | NULL, |
268 | NULL |
269 | }, |
270 | "handle-set-vconsole-keyboard", |
271 | FALSE |
272 | }; |
273 | |
274 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_layout = |
275 | { |
276 | { |
277 | -1, |
278 | (gchar *) "layout", |
279 | (gchar *) "s", |
280 | NULL |
281 | }, |
282 | FALSE |
283 | }; |
284 | |
285 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_model = |
286 | { |
287 | { |
288 | -1, |
289 | (gchar *) "model", |
290 | (gchar *) "s", |
291 | NULL |
292 | }, |
293 | FALSE |
294 | }; |
295 | |
296 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_variant = |
297 | { |
298 | { |
299 | -1, |
300 | (gchar *) "variant", |
301 | (gchar *) "s", |
302 | NULL |
303 | }, |
304 | FALSE |
305 | }; |
306 | |
307 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_options = |
308 | { |
309 | { |
310 | -1, |
311 | (gchar *) "options", |
312 | (gchar *) "s", |
313 | NULL |
314 | }, |
315 | FALSE |
316 | }; |
317 | |
318 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_convert = |
319 | { |
320 | { |
321 | -1, |
322 | (gchar *) "convert", |
323 | (gchar *) "b", |
324 | NULL |
325 | }, |
326 | FALSE |
327 | }; |
328 | |
329 | static const _ExtendedGDBusArgInfo _locale1_method_info_set_x11_keyboard_IN_ARG_user_interaction = |
330 | { |
331 | { |
332 | -1, |
333 | (gchar *) "user_interaction", |
334 | (gchar *) "b", |
335 | NULL |
336 | }, |
337 | FALSE |
338 | }; |
339 | |
340 | static const _ExtendedGDBusArgInfo * const _locale1_method_info_set_x11_keyboard_IN_ARG_pointers[] = |
341 | { |
342 | &_locale1_method_info_set_x11_keyboard_IN_ARG_layout, |
343 | &_locale1_method_info_set_x11_keyboard_IN_ARG_model, |
344 | &_locale1_method_info_set_x11_keyboard_IN_ARG_variant, |
345 | &_locale1_method_info_set_x11_keyboard_IN_ARG_options, |
346 | &_locale1_method_info_set_x11_keyboard_IN_ARG_convert, |
347 | &_locale1_method_info_set_x11_keyboard_IN_ARG_user_interaction, |
348 | NULL |
349 | }; |
350 | |
351 | static const _ExtendedGDBusMethodInfo _locale1_method_info_set_x11_keyboard = |
352 | { |
353 | { |
354 | -1, |
355 | (gchar *) "SetX11Keyboard", |
356 | (GDBusArgInfo **) &_locale1_method_info_set_x11_keyboard_IN_ARG_pointers, |
357 | NULL, |
358 | NULL |
359 | }, |
360 | "handle-set-x11-keyboard", |
361 | FALSE |
362 | }; |
363 | |
364 | static const _ExtendedGDBusMethodInfo * const _locale1_method_info_pointers[] = |
365 | { |
366 | &_locale1_method_info_set_locale, |
367 | &_locale1_method_info_set_vconsole_keyboard, |
368 | &_locale1_method_info_set_x11_keyboard, |
369 | NULL |
370 | }; |
371 | |
372 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_locale = |
373 | { |
374 | { |
375 | -1, |
376 | (gchar *) "Locale", |
377 | (gchar *) "as", |
378 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
379 | NULL |
380 | }, |
381 | "locale", |
382 | FALSE |
383 | }; |
384 | |
385 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_vconsole_keymap = |
386 | { |
387 | { |
388 | -1, |
389 | (gchar *) "VConsoleKeymap", |
390 | (gchar *) "s", |
391 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
392 | NULL |
393 | }, |
394 | "vconsole-keymap", |
395 | FALSE |
396 | }; |
397 | |
398 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_vconsole_keymap_toggle = |
399 | { |
400 | { |
401 | -1, |
402 | (gchar *) "VConsoleKeymapToggle", |
403 | (gchar *) "s", |
404 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
405 | NULL |
406 | }, |
407 | "vconsole-keymap-toggle", |
408 | FALSE |
409 | }; |
410 | |
411 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_x11_layout = |
412 | { |
413 | { |
414 | -1, |
415 | (gchar *) "X11Layout", |
416 | (gchar *) "s", |
417 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
418 | NULL |
419 | }, |
420 | "x11-layout", |
421 | FALSE |
422 | }; |
423 | |
424 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_x11_model = |
425 | { |
426 | { |
427 | -1, |
428 | (gchar *) "X11Model", |
429 | (gchar *) "s", |
430 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
431 | NULL |
432 | }, |
433 | "x11-model", |
434 | FALSE |
435 | }; |
436 | |
437 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_x11_variant = |
438 | { |
439 | { |
440 | -1, |
441 | (gchar *) "X11Variant", |
442 | (gchar *) "s", |
443 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
444 | NULL |
445 | }, |
446 | "x11-variant", |
447 | FALSE |
448 | }; |
449 | |
450 | static const _ExtendedGDBusPropertyInfo _locale1_property_info_x11_options = |
451 | { |
452 | { |
453 | -1, |
454 | (gchar *) "X11Options", |
455 | (gchar *) "s", |
456 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE, |
457 | NULL |
458 | }, |
459 | "x11-options", |
460 | FALSE |
461 | }; |
462 | |
463 | static const _ExtendedGDBusPropertyInfo * const _locale1_property_info_pointers[] = |
464 | { |
465 | &_locale1_property_info_locale, |
466 | &_locale1_property_info_vconsole_keymap, |
467 | &_locale1_property_info_vconsole_keymap_toggle, |
468 | &_locale1_property_info_x11_layout, |
469 | &_locale1_property_info_x11_model, |
470 | &_locale1_property_info_x11_variant, |
471 | &_locale1_property_info_x11_options, |
472 | NULL |
473 | }; |
474 | |
475 | static const _ExtendedGDBusInterfaceInfo _locale1_interface_info = |
476 | { |
477 | { |
478 | -1, |
479 | (gchar *) "org.freedesktop.locale1", |
480 | (GDBusMethodInfo **) &_locale1_method_info_pointers, |
481 | NULL, |
482 | (GDBusPropertyInfo **) &_locale1_property_info_pointers, |
483 | NULL |
484 | }, |
485 | "locale1", |
486 | }; |
487 | |
488 | |
489 | /** |
490 | * locale1_interface_info: |
491 | * |
492 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link> D-Bus interface. |
493 | * |
494 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. |
495 | */ |
496 | GDBusInterfaceInfo * |
497 | locale1_interface_info (void) |
498 | { |
499 | return (GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct; |
500 | } |
501 | |
502 | /** |
503 | * locale1_override_properties: |
504 | * @klass: The class structure for a #GObject<!-- -->-derived class. |
505 | * @property_id_begin: The property id to assign to the first overridden property. |
506 | * |
507 | * Overrides all #GObject properties in the #Locale1 interface for a concrete class. |
508 | * The properties are overridden in the order they are defined. |
509 | * |
510 | * Returns: The last property id. |
511 | */ |
512 | guint |
513 | locale1_override_properties (GObjectClass *klass, guint property_id_begin) |
514 | { |
515 | g_object_class_override_property (klass, property_id_begin++, "locale"); |
516 | g_object_class_override_property (klass, property_id_begin++, "vconsole-keymap"); |
517 | g_object_class_override_property (klass, property_id_begin++, "vconsole-keymap-toggle"); |
518 | g_object_class_override_property (klass, property_id_begin++, "x11-layout"); |
519 | g_object_class_override_property (klass, property_id_begin++, "x11-model"); |
520 | g_object_class_override_property (klass, property_id_begin++, "x11-variant"); |
521 | g_object_class_override_property (klass, property_id_begin++, "x11-options"); |
522 | return property_id_begin - 1; |
523 | } |
524 | |
525 | |
526 | |
527 | /** |
528 | * Locale1: |
529 | * |
530 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link>. |
531 | */ |
532 | |
533 | /** |
534 | * Locale1Iface: |
535 | * @parent_iface: The parent interface. |
536 | * @handle_set_locale: Handler for the #Locale1::handle-set-locale signal. |
537 | * @handle_set_vconsole_keyboard: Handler for the #Locale1::handle-set-vconsole-keyboard signal. |
538 | * @handle_set_x11_keyboard: Handler for the #Locale1::handle-set-x11-keyboard signal. |
539 | * @get_locale: Getter for the #Locale1:locale property. |
540 | * @get_vconsole_keymap: Getter for the #Locale1:vconsole-keymap property. |
541 | * @get_vconsole_keymap_toggle: Getter for the #Locale1:vconsole-keymap-toggle property. |
542 | * @get_x11_layout: Getter for the #Locale1:x11-layout property. |
543 | * @get_x11_model: Getter for the #Locale1:x11-model property. |
544 | * @get_x11_options: Getter for the #Locale1:x11-options property. |
545 | * @get_x11_variant: Getter for the #Locale1:x11-variant property. |
546 | * |
547 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link>. |
548 | */ |
549 | |
550 | typedef Locale1Iface Locale1Interface; |
551 | G_DEFINE_INTERFACE (Locale1, locale1, G_TYPE_OBJECT); |
552 | |
553 | static void |
554 | locale1_default_init (Locale1Iface *iface) |
555 | { |
556 | /* GObject signals for incoming D-Bus method calls: */ |
557 | /** |
558 | * Locale1::handle-set-locale: |
559 | * @object: A #Locale1. |
560 | * @invocation: A #GDBusMethodInvocation. |
561 | * @arg_locale: Argument passed by remote caller. |
562 | * @arg_user_interaction: Argument passed by remote caller. |
563 | * |
564 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-locale1.SetLocale">SetLocale()</link> D-Bus method. |
565 | * |
566 | * 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 locale1_complete_set_locale() 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. |
567 | * |
568 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
569 | */ |
570 | g_signal_new ("handle-set-locale", |
571 | G_TYPE_FROM_INTERFACE (iface), |
572 | G_SIGNAL_RUN_LAST, |
573 | G_STRUCT_OFFSET (Locale1Iface, handle_set_locale), |
574 | g_signal_accumulator_true_handled, |
575 | NULL, |
576 | g_cclosure_marshal_generic, |
577 | G_TYPE_BOOLEAN, |
578 | 3, |
579 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV, G_TYPE_BOOLEAN); |
580 | |
581 | /** |
582 | * Locale1::handle-set-vconsole-keyboard: |
583 | * @object: A #Locale1. |
584 | * @invocation: A #GDBusMethodInvocation. |
585 | * @arg_keymap: Argument passed by remote caller. |
586 | * @arg_keymap_toggle: Argument passed by remote caller. |
587 | * @arg_convert: Argument passed by remote caller. |
588 | * @arg_user_interaction: Argument passed by remote caller. |
589 | * |
590 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-locale1.SetVConsoleKeyboard">SetVConsoleKeyboard()</link> D-Bus method. |
591 | * |
592 | * 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 locale1_complete_set_vconsole_keyboard() 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. |
593 | * |
594 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
595 | */ |
596 | g_signal_new ("handle-set-vconsole-keyboard", |
597 | G_TYPE_FROM_INTERFACE (iface), |
598 | G_SIGNAL_RUN_LAST, |
599 | G_STRUCT_OFFSET (Locale1Iface, handle_set_vconsole_keyboard), |
600 | g_signal_accumulator_true_handled, |
601 | NULL, |
602 | g_cclosure_marshal_generic, |
603 | G_TYPE_BOOLEAN, |
604 | 5, |
605 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); |
606 | |
607 | /** |
608 | * Locale1::handle-set-x11-keyboard: |
609 | * @object: A #Locale1. |
610 | * @invocation: A #GDBusMethodInvocation. |
611 | * @arg_layout: Argument passed by remote caller. |
612 | * @arg_model: Argument passed by remote caller. |
613 | * @arg_variant: Argument passed by remote caller. |
614 | * @arg_options: Argument passed by remote caller. |
615 | * @arg_convert: Argument passed by remote caller. |
616 | * @arg_user_interaction: Argument passed by remote caller. |
617 | * |
618 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-locale1.SetX11Keyboard">SetX11Keyboard()</link> D-Bus method. |
619 | * |
620 | * 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 locale1_complete_set_x11_keyboard() 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. |
621 | * |
622 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. |
623 | */ |
624 | g_signal_new ("handle-set-x11-keyboard", |
625 | G_TYPE_FROM_INTERFACE (iface), |
626 | G_SIGNAL_RUN_LAST, |
627 | G_STRUCT_OFFSET (Locale1Iface, handle_set_x11_keyboard), |
628 | g_signal_accumulator_true_handled, |
629 | NULL, |
630 | g_cclosure_marshal_generic, |
631 | G_TYPE_BOOLEAN, |
632 | 7, |
633 | G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); |
634 | |
635 | /* GObject properties for D-Bus properties: */ |
636 | /** |
637 | * Locale1:locale: |
638 | * |
639 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.Locale">"Locale"</link>. |
640 | * |
641 | * 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. |
642 | */ |
643 | g_object_interface_install_property (iface, |
644 | g_param_spec_boxed ("locale", "Locale", "Locale", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
645 | /** |
646 | * Locale1:vconsole-keymap: |
647 | * |
648 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymap">"VConsoleKeymap"</link>. |
649 | * |
650 | * 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. |
651 | */ |
652 | g_object_interface_install_property (iface, |
653 | g_param_spec_string ("vconsole-keymap", "VConsoleKeymap", "VConsoleKeymap", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
654 | /** |
655 | * Locale1:vconsole-keymap-toggle: |
656 | * |
657 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymapToggle">"VConsoleKeymapToggle"</link>. |
658 | * |
659 | * 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. |
660 | */ |
661 | g_object_interface_install_property (iface, |
662 | g_param_spec_string ("vconsole-keymap-toggle", "VConsoleKeymapToggle", "VConsoleKeymapToggle", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
663 | /** |
664 | * Locale1:x11-layout: |
665 | * |
666 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.X11Layout">"X11Layout"</link>. |
667 | * |
668 | * 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. |
669 | */ |
670 | g_object_interface_install_property (iface, |
671 | g_param_spec_string ("x11-layout", "X11Layout", "X11Layout", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
672 | /** |
673 | * Locale1:x11-model: |
674 | * |
675 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.X11Model">"X11Model"</link>. |
676 | * |
677 | * 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. |
678 | */ |
679 | g_object_interface_install_property (iface, |
680 | g_param_spec_string ("x11-model", "X11Model", "X11Model", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
681 | /** |
682 | * Locale1:x11-variant: |
683 | * |
684 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.X11Variant">"X11Variant"</link>. |
685 | * |
686 | * 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. |
687 | */ |
688 | g_object_interface_install_property (iface, |
689 | g_param_spec_string ("x11-variant", "X11Variant", "X11Variant", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
690 | /** |
691 | * Locale1:x11-options: |
692 | * |
693 | * Represents the D-Bus property <link linkend="gdbus-property-org-freedesktop-locale1.X11Options">"X11Options"</link>. |
694 | * |
695 | * 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. |
696 | */ |
697 | g_object_interface_install_property (iface, |
698 | g_param_spec_string ("x11-options", "X11Options", "X11Options", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
699 | } |
700 | |
701 | /** |
702 | * locale1_get_locale: (skip) |
703 | * @object: A #Locale1. |
704 | * |
705 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.Locale">"Locale"</link> D-Bus property. |
706 | * |
707 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
708 | * |
709 | * <warning>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 locale1_dup_locale() if on another thread.</warning> |
710 | * |
711 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
712 | */ |
713 | const gchar *const * |
714 | locale1_get_locale (Locale1 *object) |
715 | { |
716 | return LOCALE1_GET_IFACE (object)->get_locale (object); |
717 | } |
718 | |
719 | /** |
720 | * locale1_dup_locale: (skip) |
721 | * @object: A #Locale1. |
722 | * |
723 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.Locale">"Locale"</link> D-Bus property. |
724 | * |
725 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
726 | * |
727 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). |
728 | */ |
729 | gchar ** |
730 | locale1_dup_locale (Locale1 *object) |
731 | { |
732 | gchar **value; |
733 | g_object_get (G_OBJECT (object), "locale", &value, NULL); |
734 | return value; |
735 | } |
736 | |
737 | /** |
738 | * locale1_set_locale: (skip) |
739 | * @object: A #Locale1. |
740 | * @value: The value to set. |
741 | * |
742 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.Locale">"Locale"</link> D-Bus property to @value. |
743 | * |
744 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
745 | */ |
746 | void |
747 | locale1_set_locale (Locale1 *object, const gchar *const *value) |
748 | { |
749 | g_object_set (G_OBJECT (object), "locale", value, NULL); |
750 | } |
751 | |
752 | /** |
753 | * locale1_get_vconsole_keymap: (skip) |
754 | * @object: A #Locale1. |
755 | * |
756 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymap">"VConsoleKeymap"</link> D-Bus property. |
757 | * |
758 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
759 | * |
760 | * <warning>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 locale1_dup_vconsole_keymap() if on another thread.</warning> |
761 | * |
762 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
763 | */ |
764 | const gchar * |
765 | locale1_get_vconsole_keymap (Locale1 *object) |
766 | { |
767 | return LOCALE1_GET_IFACE (object)->get_vconsole_keymap (object); |
768 | } |
769 | |
770 | /** |
771 | * locale1_dup_vconsole_keymap: (skip) |
772 | * @object: A #Locale1. |
773 | * |
774 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymap">"VConsoleKeymap"</link> D-Bus property. |
775 | * |
776 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
777 | * |
778 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
779 | */ |
780 | gchar * |
781 | locale1_dup_vconsole_keymap (Locale1 *object) |
782 | { |
783 | gchar *value; |
784 | g_object_get (G_OBJECT (object), "vconsole-keymap", &value, NULL); |
785 | return value; |
786 | } |
787 | |
788 | /** |
789 | * locale1_set_vconsole_keymap: (skip) |
790 | * @object: A #Locale1. |
791 | * @value: The value to set. |
792 | * |
793 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymap">"VConsoleKeymap"</link> D-Bus property to @value. |
794 | * |
795 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
796 | */ |
797 | void |
798 | locale1_set_vconsole_keymap (Locale1 *object, const gchar *value) |
799 | { |
800 | g_object_set (G_OBJECT (object), "vconsole-keymap", value, NULL); |
801 | } |
802 | |
803 | /** |
804 | * locale1_get_vconsole_keymap_toggle: (skip) |
805 | * @object: A #Locale1. |
806 | * |
807 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymapToggle">"VConsoleKeymapToggle"</link> D-Bus property. |
808 | * |
809 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
810 | * |
811 | * <warning>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 locale1_dup_vconsole_keymap_toggle() if on another thread.</warning> |
812 | * |
813 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
814 | */ |
815 | const gchar * |
816 | locale1_get_vconsole_keymap_toggle (Locale1 *object) |
817 | { |
818 | return LOCALE1_GET_IFACE (object)->get_vconsole_keymap_toggle (object); |
819 | } |
820 | |
821 | /** |
822 | * locale1_dup_vconsole_keymap_toggle: (skip) |
823 | * @object: A #Locale1. |
824 | * |
825 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymapToggle">"VConsoleKeymapToggle"</link> D-Bus property. |
826 | * |
827 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
828 | * |
829 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
830 | */ |
831 | gchar * |
832 | locale1_dup_vconsole_keymap_toggle (Locale1 *object) |
833 | { |
834 | gchar *value; |
835 | g_object_get (G_OBJECT (object), "vconsole-keymap-toggle", &value, NULL); |
836 | return value; |
837 | } |
838 | |
839 | /** |
840 | * locale1_set_vconsole_keymap_toggle: (skip) |
841 | * @object: A #Locale1. |
842 | * @value: The value to set. |
843 | * |
844 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.VConsoleKeymapToggle">"VConsoleKeymapToggle"</link> D-Bus property to @value. |
845 | * |
846 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
847 | */ |
848 | void |
849 | locale1_set_vconsole_keymap_toggle (Locale1 *object, const gchar *value) |
850 | { |
851 | g_object_set (G_OBJECT (object), "vconsole-keymap-toggle", value, NULL); |
852 | } |
853 | |
854 | /** |
855 | * locale1_get_x11_layout: (skip) |
856 | * @object: A #Locale1. |
857 | * |
858 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Layout">"X11Layout"</link> D-Bus property. |
859 | * |
860 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
861 | * |
862 | * <warning>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 locale1_dup_x11_layout() if on another thread.</warning> |
863 | * |
864 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
865 | */ |
866 | const gchar * |
867 | locale1_get_x11_layout (Locale1 *object) |
868 | { |
869 | return LOCALE1_GET_IFACE (object)->get_x11_layout (object); |
870 | } |
871 | |
872 | /** |
873 | * locale1_dup_x11_layout: (skip) |
874 | * @object: A #Locale1. |
875 | * |
876 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Layout">"X11Layout"</link> D-Bus property. |
877 | * |
878 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
879 | * |
880 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
881 | */ |
882 | gchar * |
883 | locale1_dup_x11_layout (Locale1 *object) |
884 | { |
885 | gchar *value; |
886 | g_object_get (G_OBJECT (object), "x11-layout", &value, NULL); |
887 | return value; |
888 | } |
889 | |
890 | /** |
891 | * locale1_set_x11_layout: (skip) |
892 | * @object: A #Locale1. |
893 | * @value: The value to set. |
894 | * |
895 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.X11Layout">"X11Layout"</link> D-Bus property to @value. |
896 | * |
897 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
898 | */ |
899 | void |
900 | locale1_set_x11_layout (Locale1 *object, const gchar *value) |
901 | { |
902 | g_object_set (G_OBJECT (object), "x11-layout", value, NULL); |
903 | } |
904 | |
905 | /** |
906 | * locale1_get_x11_model: (skip) |
907 | * @object: A #Locale1. |
908 | * |
909 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Model">"X11Model"</link> D-Bus property. |
910 | * |
911 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
912 | * |
913 | * <warning>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 locale1_dup_x11_model() if on another thread.</warning> |
914 | * |
915 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
916 | */ |
917 | const gchar * |
918 | locale1_get_x11_model (Locale1 *object) |
919 | { |
920 | return LOCALE1_GET_IFACE (object)->get_x11_model (object); |
921 | } |
922 | |
923 | /** |
924 | * locale1_dup_x11_model: (skip) |
925 | * @object: A #Locale1. |
926 | * |
927 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Model">"X11Model"</link> D-Bus property. |
928 | * |
929 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
930 | * |
931 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
932 | */ |
933 | gchar * |
934 | locale1_dup_x11_model (Locale1 *object) |
935 | { |
936 | gchar *value; |
937 | g_object_get (G_OBJECT (object), "x11-model", &value, NULL); |
938 | return value; |
939 | } |
940 | |
941 | /** |
942 | * locale1_set_x11_model: (skip) |
943 | * @object: A #Locale1. |
944 | * @value: The value to set. |
945 | * |
946 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.X11Model">"X11Model"</link> D-Bus property to @value. |
947 | * |
948 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
949 | */ |
950 | void |
951 | locale1_set_x11_model (Locale1 *object, const gchar *value) |
952 | { |
953 | g_object_set (G_OBJECT (object), "x11-model", value, NULL); |
954 | } |
955 | |
956 | /** |
957 | * locale1_get_x11_variant: (skip) |
958 | * @object: A #Locale1. |
959 | * |
960 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Variant">"X11Variant"</link> D-Bus property. |
961 | * |
962 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
963 | * |
964 | * <warning>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 locale1_dup_x11_variant() if on another thread.</warning> |
965 | * |
966 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
967 | */ |
968 | const gchar * |
969 | locale1_get_x11_variant (Locale1 *object) |
970 | { |
971 | return LOCALE1_GET_IFACE (object)->get_x11_variant (object); |
972 | } |
973 | |
974 | /** |
975 | * locale1_dup_x11_variant: (skip) |
976 | * @object: A #Locale1. |
977 | * |
978 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Variant">"X11Variant"</link> D-Bus property. |
979 | * |
980 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
981 | * |
982 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
983 | */ |
984 | gchar * |
985 | locale1_dup_x11_variant (Locale1 *object) |
986 | { |
987 | gchar *value; |
988 | g_object_get (G_OBJECT (object), "x11-variant", &value, NULL); |
989 | return value; |
990 | } |
991 | |
992 | /** |
993 | * locale1_set_x11_variant: (skip) |
994 | * @object: A #Locale1. |
995 | * @value: The value to set. |
996 | * |
997 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.X11Variant">"X11Variant"</link> D-Bus property to @value. |
998 | * |
999 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1000 | */ |
1001 | void |
1002 | locale1_set_x11_variant (Locale1 *object, const gchar *value) |
1003 | { |
1004 | g_object_set (G_OBJECT (object), "x11-variant", value, NULL); |
1005 | } |
1006 | |
1007 | /** |
1008 | * locale1_get_x11_options: (skip) |
1009 | * @object: A #Locale1. |
1010 | * |
1011 | * Gets the value of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Options">"X11Options"</link> D-Bus property. |
1012 | * |
1013 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1014 | * |
1015 | * <warning>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 locale1_dup_x11_options() if on another thread.</warning> |
1016 | * |
1017 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. |
1018 | */ |
1019 | const gchar * |
1020 | locale1_get_x11_options (Locale1 *object) |
1021 | { |
1022 | return LOCALE1_GET_IFACE (object)->get_x11_options (object); |
1023 | } |
1024 | |
1025 | /** |
1026 | * locale1_dup_x11_options: (skip) |
1027 | * @object: A #Locale1. |
1028 | * |
1029 | * Gets a copy of the <link linkend="gdbus-property-org-freedesktop-locale1.X11Options">"X11Options"</link> D-Bus property. |
1030 | * |
1031 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. |
1032 | * |
1033 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). |
1034 | */ |
1035 | gchar * |
1036 | locale1_dup_x11_options (Locale1 *object) |
1037 | { |
1038 | gchar *value; |
1039 | g_object_get (G_OBJECT (object), "x11-options", &value, NULL); |
1040 | return value; |
1041 | } |
1042 | |
1043 | /** |
1044 | * locale1_set_x11_options: (skip) |
1045 | * @object: A #Locale1. |
1046 | * @value: The value to set. |
1047 | * |
1048 | * Sets the <link linkend="gdbus-property-org-freedesktop-locale1.X11Options">"X11Options"</link> D-Bus property to @value. |
1049 | * |
1050 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. |
1051 | */ |
1052 | void |
1053 | locale1_set_x11_options (Locale1 *object, const gchar *value) |
1054 | { |
1055 | g_object_set (G_OBJECT (object), "x11-options", value, NULL); |
1056 | } |
1057 | |
1058 | /** |
1059 | * locale1_call_set_locale: |
1060 | * @proxy: A #Locale1Proxy. |
1061 | * @arg_locale: Argument to pass with the method invocation. |
1062 | * @arg_user_interaction: Argument to pass with the method invocation. |
1063 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1064 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1065 | * @user_data: User data to pass to @callback. |
1066 | * |
1067 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetLocale">SetLocale()</link> D-Bus method on @proxy. |
1068 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1069 | * You can then call locale1_call_set_locale_finish() to get the result of the operation. |
1070 | * |
1071 | * See locale1_call_set_locale_sync() for the synchronous, blocking version of this method. |
1072 | */ |
1073 | void |
1074 | locale1_call_set_locale ( |
1075 | Locale1 *proxy, |
1076 | const gchar *const *arg_locale, |
1077 | gboolean arg_user_interaction, |
1078 | GCancellable *cancellable, |
1079 | GAsyncReadyCallback callback, |
1080 | gpointer user_data) |
1081 | { |
1082 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1083 | "SetLocale", |
1084 | g_variant_new ("(^asb)", |
1085 | arg_locale, |
1086 | arg_user_interaction), |
1087 | G_DBUS_CALL_FLAGS_NONE, |
1088 | -1, |
1089 | cancellable, |
1090 | callback, |
1091 | user_data); |
1092 | } |
1093 | |
1094 | /** |
1095 | * locale1_call_set_locale_finish: |
1096 | * @proxy: A #Locale1Proxy. |
1097 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to locale1_call_set_locale(). |
1098 | * @error: Return location for error or %NULL. |
1099 | * |
1100 | * Finishes an operation started with locale1_call_set_locale(). |
1101 | * |
1102 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1103 | */ |
1104 | gboolean |
1105 | locale1_call_set_locale_finish ( |
1106 | Locale1 *proxy, |
1107 | GAsyncResult *res, |
1108 | GError **error) |
1109 | { |
1110 | GVariant *_ret; |
1111 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1112 | if (_ret == NULL) |
1113 | goto _out; |
1114 | g_variant_get (_ret, |
1115 | "()"); |
1116 | g_variant_unref (_ret); |
1117 | _out: |
1118 | return _ret != NULL; |
1119 | } |
1120 | |
1121 | /** |
1122 | * locale1_call_set_locale_sync: |
1123 | * @proxy: A #Locale1Proxy. |
1124 | * @arg_locale: Argument to pass with the method invocation. |
1125 | * @arg_user_interaction: Argument to pass with the method invocation. |
1126 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1127 | * @error: Return location for error or %NULL. |
1128 | * |
1129 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetLocale">SetLocale()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1130 | * |
1131 | * See locale1_call_set_locale() for the asynchronous version of this method. |
1132 | * |
1133 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1134 | */ |
1135 | gboolean |
1136 | locale1_call_set_locale_sync ( |
1137 | Locale1 *proxy, |
1138 | const gchar *const *arg_locale, |
1139 | gboolean arg_user_interaction, |
1140 | GCancellable *cancellable, |
1141 | GError **error) |
1142 | { |
1143 | GVariant *_ret; |
1144 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1145 | "SetLocale", |
1146 | g_variant_new ("(^asb)", |
1147 | arg_locale, |
1148 | arg_user_interaction), |
1149 | G_DBUS_CALL_FLAGS_NONE, |
1150 | -1, |
1151 | cancellable, |
1152 | error); |
1153 | if (_ret == NULL) |
1154 | goto _out; |
1155 | g_variant_get (_ret, |
1156 | "()"); |
1157 | g_variant_unref (_ret); |
1158 | _out: |
1159 | return _ret != NULL; |
1160 | } |
1161 | |
1162 | /** |
1163 | * locale1_call_set_vconsole_keyboard: |
1164 | * @proxy: A #Locale1Proxy. |
1165 | * @arg_keymap: Argument to pass with the method invocation. |
1166 | * @arg_keymap_toggle: Argument to pass with the method invocation. |
1167 | * @arg_convert: Argument to pass with the method invocation. |
1168 | * @arg_user_interaction: Argument to pass with the method invocation. |
1169 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1170 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1171 | * @user_data: User data to pass to @callback. |
1172 | * |
1173 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetVConsoleKeyboard">SetVConsoleKeyboard()</link> D-Bus method on @proxy. |
1174 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1175 | * You can then call locale1_call_set_vconsole_keyboard_finish() to get the result of the operation. |
1176 | * |
1177 | * See locale1_call_set_vconsole_keyboard_sync() for the synchronous, blocking version of this method. |
1178 | */ |
1179 | void |
1180 | locale1_call_set_vconsole_keyboard ( |
1181 | Locale1 *proxy, |
1182 | const gchar *arg_keymap, |
1183 | const gchar *arg_keymap_toggle, |
1184 | gboolean arg_convert, |
1185 | gboolean arg_user_interaction, |
1186 | GCancellable *cancellable, |
1187 | GAsyncReadyCallback callback, |
1188 | gpointer user_data) |
1189 | { |
1190 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1191 | "SetVConsoleKeyboard", |
1192 | g_variant_new ("(ssbb)", |
1193 | arg_keymap, |
1194 | arg_keymap_toggle, |
1195 | arg_convert, |
1196 | arg_user_interaction), |
1197 | G_DBUS_CALL_FLAGS_NONE, |
1198 | -1, |
1199 | cancellable, |
1200 | callback, |
1201 | user_data); |
1202 | } |
1203 | |
1204 | /** |
1205 | * locale1_call_set_vconsole_keyboard_finish: |
1206 | * @proxy: A #Locale1Proxy. |
1207 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to locale1_call_set_vconsole_keyboard(). |
1208 | * @error: Return location for error or %NULL. |
1209 | * |
1210 | * Finishes an operation started with locale1_call_set_vconsole_keyboard(). |
1211 | * |
1212 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1213 | */ |
1214 | gboolean |
1215 | locale1_call_set_vconsole_keyboard_finish ( |
1216 | Locale1 *proxy, |
1217 | GAsyncResult *res, |
1218 | GError **error) |
1219 | { |
1220 | GVariant *_ret; |
1221 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1222 | if (_ret == NULL) |
1223 | goto _out; |
1224 | g_variant_get (_ret, |
1225 | "()"); |
1226 | g_variant_unref (_ret); |
1227 | _out: |
1228 | return _ret != NULL; |
1229 | } |
1230 | |
1231 | /** |
1232 | * locale1_call_set_vconsole_keyboard_sync: |
1233 | * @proxy: A #Locale1Proxy. |
1234 | * @arg_keymap: Argument to pass with the method invocation. |
1235 | * @arg_keymap_toggle: Argument to pass with the method invocation. |
1236 | * @arg_convert: Argument to pass with the method invocation. |
1237 | * @arg_user_interaction: Argument to pass with the method invocation. |
1238 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1239 | * @error: Return location for error or %NULL. |
1240 | * |
1241 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetVConsoleKeyboard">SetVConsoleKeyboard()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1242 | * |
1243 | * See locale1_call_set_vconsole_keyboard() for the asynchronous version of this method. |
1244 | * |
1245 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1246 | */ |
1247 | gboolean |
1248 | locale1_call_set_vconsole_keyboard_sync ( |
1249 | Locale1 *proxy, |
1250 | const gchar *arg_keymap, |
1251 | const gchar *arg_keymap_toggle, |
1252 | gboolean arg_convert, |
1253 | gboolean arg_user_interaction, |
1254 | GCancellable *cancellable, |
1255 | GError **error) |
1256 | { |
1257 | GVariant *_ret; |
1258 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1259 | "SetVConsoleKeyboard", |
1260 | g_variant_new ("(ssbb)", |
1261 | arg_keymap, |
1262 | arg_keymap_toggle, |
1263 | arg_convert, |
1264 | arg_user_interaction), |
1265 | G_DBUS_CALL_FLAGS_NONE, |
1266 | -1, |
1267 | cancellable, |
1268 | error); |
1269 | if (_ret == NULL) |
1270 | goto _out; |
1271 | g_variant_get (_ret, |
1272 | "()"); |
1273 | g_variant_unref (_ret); |
1274 | _out: |
1275 | return _ret != NULL; |
1276 | } |
1277 | |
1278 | /** |
1279 | * locale1_call_set_x11_keyboard: |
1280 | * @proxy: A #Locale1Proxy. |
1281 | * @arg_layout: Argument to pass with the method invocation. |
1282 | * @arg_model: Argument to pass with the method invocation. |
1283 | * @arg_variant: Argument to pass with the method invocation. |
1284 | * @arg_options: Argument to pass with the method invocation. |
1285 | * @arg_convert: Argument to pass with the method invocation. |
1286 | * @arg_user_interaction: Argument to pass with the method invocation. |
1287 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1288 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. |
1289 | * @user_data: User data to pass to @callback. |
1290 | * |
1291 | * Asynchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetX11Keyboard">SetX11Keyboard()</link> D-Bus method on @proxy. |
1292 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1293 | * You can then call locale1_call_set_x11_keyboard_finish() to get the result of the operation. |
1294 | * |
1295 | * See locale1_call_set_x11_keyboard_sync() for the synchronous, blocking version of this method. |
1296 | */ |
1297 | void |
1298 | locale1_call_set_x11_keyboard ( |
1299 | Locale1 *proxy, |
1300 | const gchar *arg_layout, |
1301 | const gchar *arg_model, |
1302 | const gchar *arg_variant, |
1303 | const gchar *arg_options, |
1304 | gboolean arg_convert, |
1305 | gboolean arg_user_interaction, |
1306 | GCancellable *cancellable, |
1307 | GAsyncReadyCallback callback, |
1308 | gpointer user_data) |
1309 | { |
1310 | g_dbus_proxy_call (G_DBUS_PROXY (proxy), |
1311 | "SetX11Keyboard", |
1312 | g_variant_new ("(ssssbb)", |
1313 | arg_layout, |
1314 | arg_model, |
1315 | arg_variant, |
1316 | arg_options, |
1317 | arg_convert, |
1318 | arg_user_interaction), |
1319 | G_DBUS_CALL_FLAGS_NONE, |
1320 | -1, |
1321 | cancellable, |
1322 | callback, |
1323 | user_data); |
1324 | } |
1325 | |
1326 | /** |
1327 | * locale1_call_set_x11_keyboard_finish: |
1328 | * @proxy: A #Locale1Proxy. |
1329 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to locale1_call_set_x11_keyboard(). |
1330 | * @error: Return location for error or %NULL. |
1331 | * |
1332 | * Finishes an operation started with locale1_call_set_x11_keyboard(). |
1333 | * |
1334 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1335 | */ |
1336 | gboolean |
1337 | locale1_call_set_x11_keyboard_finish ( |
1338 | Locale1 *proxy, |
1339 | GAsyncResult *res, |
1340 | GError **error) |
1341 | { |
1342 | GVariant *_ret; |
1343 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); |
1344 | if (_ret == NULL) |
1345 | goto _out; |
1346 | g_variant_get (_ret, |
1347 | "()"); |
1348 | g_variant_unref (_ret); |
1349 | _out: |
1350 | return _ret != NULL; |
1351 | } |
1352 | |
1353 | /** |
1354 | * locale1_call_set_x11_keyboard_sync: |
1355 | * @proxy: A #Locale1Proxy. |
1356 | * @arg_layout: Argument to pass with the method invocation. |
1357 | * @arg_model: Argument to pass with the method invocation. |
1358 | * @arg_variant: Argument to pass with the method invocation. |
1359 | * @arg_options: Argument to pass with the method invocation. |
1360 | * @arg_convert: Argument to pass with the method invocation. |
1361 | * @arg_user_interaction: Argument to pass with the method invocation. |
1362 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1363 | * @error: Return location for error or %NULL. |
1364 | * |
1365 | * Synchronously invokes the <link linkend="gdbus-method-org-freedesktop-locale1.SetX11Keyboard">SetX11Keyboard()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. |
1366 | * |
1367 | * See locale1_call_set_x11_keyboard() for the asynchronous version of this method. |
1368 | * |
1369 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. |
1370 | */ |
1371 | gboolean |
1372 | locale1_call_set_x11_keyboard_sync ( |
1373 | Locale1 *proxy, |
1374 | const gchar *arg_layout, |
1375 | const gchar *arg_model, |
1376 | const gchar *arg_variant, |
1377 | const gchar *arg_options, |
1378 | gboolean arg_convert, |
1379 | gboolean arg_user_interaction, |
1380 | GCancellable *cancellable, |
1381 | GError **error) |
1382 | { |
1383 | GVariant *_ret; |
1384 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), |
1385 | "SetX11Keyboard", |
1386 | g_variant_new ("(ssssbb)", |
1387 | arg_layout, |
1388 | arg_model, |
1389 | arg_variant, |
1390 | arg_options, |
1391 | arg_convert, |
1392 | arg_user_interaction), |
1393 | G_DBUS_CALL_FLAGS_NONE, |
1394 | -1, |
1395 | cancellable, |
1396 | error); |
1397 | if (_ret == NULL) |
1398 | goto _out; |
1399 | g_variant_get (_ret, |
1400 | "()"); |
1401 | g_variant_unref (_ret); |
1402 | _out: |
1403 | return _ret != NULL; |
1404 | } |
1405 | |
1406 | /** |
1407 | * locale1_complete_set_locale: |
1408 | * @object: A #Locale1. |
1409 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1410 | * |
1411 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-locale1.SetLocale">SetLocale()</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. |
1412 | * |
1413 | * This method will free @invocation, you cannot use it afterwards. |
1414 | */ |
1415 | void |
1416 | locale1_complete_set_locale ( |
1417 | Locale1 *object, |
1418 | GDBusMethodInvocation *invocation) |
1419 | { |
1420 | g_dbus_method_invocation_return_value (invocation, |
1421 | g_variant_new ("()")); |
1422 | } |
1423 | |
1424 | /** |
1425 | * locale1_complete_set_vconsole_keyboard: |
1426 | * @object: A #Locale1. |
1427 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1428 | * |
1429 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-locale1.SetVConsoleKeyboard">SetVConsoleKeyboard()</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. |
1430 | * |
1431 | * This method will free @invocation, you cannot use it afterwards. |
1432 | */ |
1433 | void |
1434 | locale1_complete_set_vconsole_keyboard ( |
1435 | Locale1 *object, |
1436 | GDBusMethodInvocation *invocation) |
1437 | { |
1438 | g_dbus_method_invocation_return_value (invocation, |
1439 | g_variant_new ("()")); |
1440 | } |
1441 | |
1442 | /** |
1443 | * locale1_complete_set_x11_keyboard: |
1444 | * @object: A #Locale1. |
1445 | * @invocation: (transfer full): A #GDBusMethodInvocation. |
1446 | * |
1447 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-freedesktop-locale1.SetX11Keyboard">SetX11Keyboard()</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. |
1448 | * |
1449 | * This method will free @invocation, you cannot use it afterwards. |
1450 | */ |
1451 | void |
1452 | locale1_complete_set_x11_keyboard ( |
1453 | Locale1 *object, |
1454 | GDBusMethodInvocation *invocation) |
1455 | { |
1456 | g_dbus_method_invocation_return_value (invocation, |
1457 | g_variant_new ("()")); |
1458 | } |
1459 | |
1460 | /* ------------------------------------------------------------------------ */ |
1461 | |
1462 | /** |
1463 | * Locale1Proxy: |
1464 | * |
1465 | * The #Locale1Proxy structure contains only private data and should only be accessed using the provided API. |
1466 | */ |
1467 | |
1468 | /** |
1469 | * Locale1ProxyClass: |
1470 | * @parent_class: The parent class. |
1471 | * |
1472 | * Class structure for #Locale1Proxy. |
1473 | */ |
1474 | |
1475 | struct _Locale1ProxyPrivate |
1476 | { |
1477 | GData *qdata; |
1478 | }; |
1479 | |
1480 | static void locale1_proxy_iface_init (Locale1Iface *iface); |
1481 | |
1482 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1483 | G_DEFINE_TYPE_WITH_CODE (Locale1Proxy, locale1_proxy, G_TYPE_DBUS_PROXY, |
1484 | G_ADD_PRIVATE (Locale1Proxy) |
1485 | G_IMPLEMENT_INTERFACE (TYPE_LOCALE1, locale1_proxy_iface_init)); |
1486 | |
1487 | #else |
1488 | G_DEFINE_TYPE_WITH_CODE (Locale1Proxy, locale1_proxy, G_TYPE_DBUS_PROXY, |
1489 | G_IMPLEMENT_INTERFACE (TYPE_LOCALE1, locale1_proxy_iface_init)); |
1490 | |
1491 | #endif |
1492 | static void |
1493 | locale1_proxy_finalize (GObject *object) |
1494 | { |
1495 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1496 | g_datalist_clear (&proxy->priv->qdata); |
1497 | G_OBJECT_CLASS (locale1_proxy_parent_class)->finalize (object); |
1498 | } |
1499 | |
1500 | static void |
1501 | locale1_proxy_get_property (GObject *object, |
1502 | guint prop_id, |
1503 | GValue *value, |
1504 | GParamSpec *pspec G_GNUC_UNUSED) |
1505 | { |
1506 | const _ExtendedGDBusPropertyInfo *info; |
1507 | GVariant *variant; |
1508 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
1509 | info = _locale1_property_info_pointers[prop_id - 1]; |
1510 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); |
1511 | if (info->use_gvariant) |
1512 | { |
1513 | g_value_set_variant (value, variant); |
1514 | } |
1515 | else |
1516 | { |
1517 | if (variant != NULL) |
1518 | g_dbus_gvariant_to_gvalue (variant, value); |
1519 | } |
1520 | if (variant != NULL) |
1521 | g_variant_unref (variant); |
1522 | } |
1523 | |
1524 | static void |
1525 | locale1_proxy_set_property_cb (GDBusProxy *proxy, |
1526 | GAsyncResult *res, |
1527 | gpointer user_data) |
1528 | { |
1529 | const _ExtendedGDBusPropertyInfo *info = user_data; |
1530 | GError *error; |
1531 | GVariant *_ret; |
1532 | error = NULL; |
1533 | _ret = g_dbus_proxy_call_finish (proxy, res, &error); |
1534 | if (!_ret) |
1535 | { |
1536 | g_warning ("Error setting property '%s' on interface org.freedesktop.locale1: %s (%s, %d)", |
1537 | info->parent_struct.name, |
1538 | error->message, g_quark_to_string (error->domain), error->code); |
1539 | g_error_free (error); |
1540 | } |
1541 | else |
1542 | { |
1543 | g_variant_unref (_ret); |
1544 | } |
1545 | } |
1546 | |
1547 | static void |
1548 | locale1_proxy_set_property (GObject *object, |
1549 | guint prop_id, |
1550 | const GValue *value, |
1551 | GParamSpec *pspec G_GNUC_UNUSED) |
1552 | { |
1553 | const _ExtendedGDBusPropertyInfo *info; |
1554 | GVariant *variant; |
1555 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
1556 | info = _locale1_property_info_pointers[prop_id - 1]; |
1557 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); |
1558 | g_dbus_proxy_call (G_DBUS_PROXY (object), |
1559 | "org.freedesktop.DBus.Properties.Set", |
1560 | g_variant_new ("(ssv)", "org.freedesktop.locale1", info->parent_struct.name, variant), |
1561 | G_DBUS_CALL_FLAGS_NONE, |
1562 | -1, |
1563 | NULL, (GAsyncReadyCallback) locale1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); |
1564 | g_variant_unref (variant); |
1565 | } |
1566 | |
1567 | static void |
1568 | locale1_proxy_g_signal (GDBusProxy *proxy, |
1569 | const gchar *sender_name G_GNUC_UNUSED, |
1570 | const gchar *signal_name, |
1571 | GVariant *parameters) |
1572 | { |
1573 | _ExtendedGDBusSignalInfo *info; |
1574 | GVariantIter iter; |
1575 | GVariant *child; |
1576 | GValue *paramv; |
1577 | guint num_params; |
1578 | guint n; |
1579 | guint signal_id; |
1580 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct, signal_name); |
1581 | if (info == NULL) |
1582 | return; |
1583 | num_params = g_variant_n_children (parameters); |
1584 | paramv = g_new0 (GValue, num_params + 1); |
1585 | g_value_init (¶mv[0], TYPE_LOCALE1); |
1586 | g_value_set_object (¶mv[0], proxy); |
1587 | g_variant_iter_init (&iter, parameters); |
1588 | n = 1; |
1589 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
1590 | { |
1591 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; |
1592 | if (arg_info->use_gvariant) |
1593 | { |
1594 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
1595 | g_value_set_variant (¶mv[n], child); |
1596 | n++; |
1597 | } |
1598 | else |
1599 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
1600 | g_variant_unref (child); |
1601 | } |
1602 | signal_id = g_signal_lookup (info->signal_name, TYPE_LOCALE1); |
1603 | g_signal_emitv (paramv, signal_id, 0, NULL); |
1604 | for (n = 0; n < num_params + 1; n++) |
1605 | g_value_unset (¶mv[n]); |
1606 | g_free (paramv); |
1607 | } |
1608 | |
1609 | static void |
1610 | locale1_proxy_g_properties_changed (GDBusProxy *_proxy, |
1611 | GVariant *changed_properties, |
1612 | const gchar *const *invalidated_properties) |
1613 | { |
1614 | Locale1Proxy *proxy = LOCALE1_PROXY (_proxy); |
1615 | guint n; |
1616 | const gchar *key; |
1617 | GVariantIter *iter; |
1618 | _ExtendedGDBusPropertyInfo *info; |
1619 | g_variant_get (changed_properties, "a{sv}", &iter); |
1620 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) |
1621 | { |
1622 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct, key); |
1623 | g_datalist_remove_data (&proxy->priv->qdata, key); |
1624 | if (info != NULL) |
1625 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1626 | } |
1627 | g_variant_iter_free (iter); |
1628 | for (n = 0; invalidated_properties[n] != NULL; n++) |
1629 | { |
1630 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct, invalidated_properties[n]); |
1631 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); |
1632 | if (info != NULL) |
1633 | g_object_notify (G_OBJECT (proxy), info->hyphen_name); |
1634 | } |
1635 | } |
1636 | |
1637 | static const gchar *const * |
1638 | locale1_proxy_get_locale (Locale1 *object) |
1639 | { |
1640 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1641 | GVariant *variant; |
1642 | const gchar *const *value = NULL; |
1643 | value = g_datalist_get_data (&proxy->priv->qdata, "Locale"); |
1644 | if (value != NULL) |
1645 | return value; |
1646 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Locale"); |
1647 | if (variant != NULL) |
1648 | { |
1649 | value = g_variant_get_strv (variant, NULL); |
1650 | g_datalist_set_data_full (&proxy->priv->qdata, "Locale", (gpointer) value, g_free); |
1651 | g_variant_unref (variant); |
1652 | } |
1653 | return value; |
1654 | } |
1655 | |
1656 | static const gchar * |
1657 | locale1_proxy_get_vconsole_keymap (Locale1 *object) |
1658 | { |
1659 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1660 | GVariant *variant; |
1661 | const gchar *value = NULL; |
1662 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "VConsoleKeymap"); |
1663 | if (variant != NULL) |
1664 | { |
1665 | value = g_variant_get_string (variant, NULL); |
1666 | g_variant_unref (variant); |
1667 | } |
1668 | return value; |
1669 | } |
1670 | |
1671 | static const gchar * |
1672 | locale1_proxy_get_vconsole_keymap_toggle (Locale1 *object) |
1673 | { |
1674 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1675 | GVariant *variant; |
1676 | const gchar *value = NULL; |
1677 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "VConsoleKeymapToggle"); |
1678 | if (variant != NULL) |
1679 | { |
1680 | value = g_variant_get_string (variant, NULL); |
1681 | g_variant_unref (variant); |
1682 | } |
1683 | return value; |
1684 | } |
1685 | |
1686 | static const gchar * |
1687 | locale1_proxy_get_x11_layout (Locale1 *object) |
1688 | { |
1689 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1690 | GVariant *variant; |
1691 | const gchar *value = NULL; |
1692 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "X11Layout"); |
1693 | if (variant != NULL) |
1694 | { |
1695 | value = g_variant_get_string (variant, NULL); |
1696 | g_variant_unref (variant); |
1697 | } |
1698 | return value; |
1699 | } |
1700 | |
1701 | static const gchar * |
1702 | locale1_proxy_get_x11_model (Locale1 *object) |
1703 | { |
1704 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1705 | GVariant *variant; |
1706 | const gchar *value = NULL; |
1707 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "X11Model"); |
1708 | if (variant != NULL) |
1709 | { |
1710 | value = g_variant_get_string (variant, NULL); |
1711 | g_variant_unref (variant); |
1712 | } |
1713 | return value; |
1714 | } |
1715 | |
1716 | static const gchar * |
1717 | locale1_proxy_get_x11_variant (Locale1 *object) |
1718 | { |
1719 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1720 | GVariant *variant; |
1721 | const gchar *value = NULL; |
1722 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "X11Variant"); |
1723 | if (variant != NULL) |
1724 | { |
1725 | value = g_variant_get_string (variant, NULL); |
1726 | g_variant_unref (variant); |
1727 | } |
1728 | return value; |
1729 | } |
1730 | |
1731 | static const gchar * |
1732 | locale1_proxy_get_x11_options (Locale1 *object) |
1733 | { |
1734 | Locale1Proxy *proxy = LOCALE1_PROXY (object); |
1735 | GVariant *variant; |
1736 | const gchar *value = NULL; |
1737 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "X11Options"); |
1738 | if (variant != NULL) |
1739 | { |
1740 | value = g_variant_get_string (variant, NULL); |
1741 | g_variant_unref (variant); |
1742 | } |
1743 | return value; |
1744 | } |
1745 | |
1746 | static void |
1747 | locale1_proxy_init (Locale1Proxy *proxy) |
1748 | { |
1749 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
1750 | proxy->priv = locale1_proxy_get_instance_private (proxy); |
1751 | #else |
1752 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LOCALE1_PROXY, Locale1ProxyPrivate); |
1753 | #endif |
1754 | |
1755 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), locale1_interface_info ()); |
1756 | } |
1757 | |
1758 | static void |
1759 | locale1_proxy_class_init (Locale1ProxyClass *klass) |
1760 | { |
1761 | GObjectClass *gobject_class; |
1762 | GDBusProxyClass *proxy_class; |
1763 | |
1764 | gobject_class = G_OBJECT_CLASS (klass); |
1765 | gobject_class->finalize = locale1_proxy_finalize; |
1766 | gobject_class->get_property = locale1_proxy_get_property; |
1767 | gobject_class->set_property = locale1_proxy_set_property; |
1768 | |
1769 | proxy_class = G_DBUS_PROXY_CLASS (klass); |
1770 | proxy_class->g_signal = locale1_proxy_g_signal; |
1771 | proxy_class->g_properties_changed = locale1_proxy_g_properties_changed; |
1772 | |
1773 | locale1_override_properties (gobject_class, 1); |
1774 | |
1775 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
1776 | g_type_class_add_private (klass, sizeof (Locale1ProxyPrivate)); |
1777 | #endif |
1778 | } |
1779 | |
1780 | static void |
1781 | locale1_proxy_iface_init (Locale1Iface *iface) |
1782 | { |
1783 | iface->get_locale = locale1_proxy_get_locale; |
1784 | iface->get_vconsole_keymap = locale1_proxy_get_vconsole_keymap; |
1785 | iface->get_vconsole_keymap_toggle = locale1_proxy_get_vconsole_keymap_toggle; |
1786 | iface->get_x11_layout = locale1_proxy_get_x11_layout; |
1787 | iface->get_x11_model = locale1_proxy_get_x11_model; |
1788 | iface->get_x11_variant = locale1_proxy_get_x11_variant; |
1789 | iface->get_x11_options = locale1_proxy_get_x11_options; |
1790 | } |
1791 | |
1792 | /** |
1793 | * locale1_proxy_new: |
1794 | * @connection: A #GDBusConnection. |
1795 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1796 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1797 | * @object_path: An object path. |
1798 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1799 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1800 | * @user_data: User data to pass to @callback. |
1801 | * |
1802 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link>. See g_dbus_proxy_new() for more details. |
1803 | * |
1804 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1805 | * You can then call locale1_proxy_new_finish() to get the result of the operation. |
1806 | * |
1807 | * See locale1_proxy_new_sync() for the synchronous, blocking version of this constructor. |
1808 | */ |
1809 | void |
1810 | locale1_proxy_new ( |
1811 | GDBusConnection *connection, |
1812 | GDBusProxyFlags flags, |
1813 | const gchar *name, |
1814 | const gchar *object_path, |
1815 | GCancellable *cancellable, |
1816 | GAsyncReadyCallback callback, |
1817 | gpointer user_data) |
1818 | { |
1819 | g_async_initable_new_async (TYPE_LOCALE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.locale1", NULL); |
1820 | } |
1821 | |
1822 | /** |
1823 | * locale1_proxy_new_finish: |
1824 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to locale1_proxy_new(). |
1825 | * @error: Return location for error or %NULL |
1826 | * |
1827 | * Finishes an operation started with locale1_proxy_new(). |
1828 | * |
1829 | * Returns: (transfer full) (type Locale1Proxy): The constructed proxy object or %NULL if @error is set. |
1830 | */ |
1831 | Locale1 * |
1832 | locale1_proxy_new_finish ( |
1833 | GAsyncResult *res, |
1834 | GError **error) |
1835 | { |
1836 | GObject *ret; |
1837 | GObject *source_object; |
1838 | source_object = g_async_result_get_source_object (res); |
1839 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1840 | g_object_unref (source_object); |
1841 | if (ret != NULL) |
1842 | return LOCALE1 (ret); |
1843 | else |
1844 | return NULL; |
1845 | } |
1846 | |
1847 | /** |
1848 | * locale1_proxy_new_sync: |
1849 | * @connection: A #GDBusConnection. |
1850 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1851 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. |
1852 | * @object_path: An object path. |
1853 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1854 | * @error: Return location for error or %NULL |
1855 | * |
1856 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link>. See g_dbus_proxy_new_sync() for more details. |
1857 | * |
1858 | * The calling thread is blocked until a reply is received. |
1859 | * |
1860 | * See locale1_proxy_new() for the asynchronous version of this constructor. |
1861 | * |
1862 | * Returns: (transfer full) (type Locale1Proxy): The constructed proxy object or %NULL if @error is set. |
1863 | */ |
1864 | Locale1 * |
1865 | locale1_proxy_new_sync ( |
1866 | GDBusConnection *connection, |
1867 | GDBusProxyFlags flags, |
1868 | const gchar *name, |
1869 | const gchar *object_path, |
1870 | GCancellable *cancellable, |
1871 | GError **error) |
1872 | { |
1873 | GInitable *ret; |
1874 | ret = g_initable_new (TYPE_LOCALE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.freedesktop.locale1", NULL); |
1875 | if (ret != NULL) |
1876 | return LOCALE1 (ret); |
1877 | else |
1878 | return NULL; |
1879 | } |
1880 | |
1881 | |
1882 | /** |
1883 | * locale1_proxy_new_for_bus: |
1884 | * @bus_type: A #GBusType. |
1885 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1886 | * @name: A bus name (well-known or unique). |
1887 | * @object_path: An object path. |
1888 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1889 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied. |
1890 | * @user_data: User data to pass to @callback. |
1891 | * |
1892 | * Like locale1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. |
1893 | * |
1894 | * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. |
1895 | * You can then call locale1_proxy_new_for_bus_finish() to get the result of the operation. |
1896 | * |
1897 | * See locale1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. |
1898 | */ |
1899 | void |
1900 | locale1_proxy_new_for_bus ( |
1901 | GBusType bus_type, |
1902 | GDBusProxyFlags flags, |
1903 | const gchar *name, |
1904 | const gchar *object_path, |
1905 | GCancellable *cancellable, |
1906 | GAsyncReadyCallback callback, |
1907 | gpointer user_data) |
1908 | { |
1909 | g_async_initable_new_async (TYPE_LOCALE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.locale1", NULL); |
1910 | } |
1911 | |
1912 | /** |
1913 | * locale1_proxy_new_for_bus_finish: |
1914 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to locale1_proxy_new_for_bus(). |
1915 | * @error: Return location for error or %NULL |
1916 | * |
1917 | * Finishes an operation started with locale1_proxy_new_for_bus(). |
1918 | * |
1919 | * Returns: (transfer full) (type Locale1Proxy): The constructed proxy object or %NULL if @error is set. |
1920 | */ |
1921 | Locale1 * |
1922 | locale1_proxy_new_for_bus_finish ( |
1923 | GAsyncResult *res, |
1924 | GError **error) |
1925 | { |
1926 | GObject *ret; |
1927 | GObject *source_object; |
1928 | source_object = g_async_result_get_source_object (res); |
1929 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); |
1930 | g_object_unref (source_object); |
1931 | if (ret != NULL) |
1932 | return LOCALE1 (ret); |
1933 | else |
1934 | return NULL; |
1935 | } |
1936 | |
1937 | /** |
1938 | * locale1_proxy_new_for_bus_sync: |
1939 | * @bus_type: A #GBusType. |
1940 | * @flags: Flags from the #GDBusProxyFlags enumeration. |
1941 | * @name: A bus name (well-known or unique). |
1942 | * @object_path: An object path. |
1943 | * @cancellable: (allow-none): A #GCancellable or %NULL. |
1944 | * @error: Return location for error or %NULL |
1945 | * |
1946 | * Like locale1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. |
1947 | * |
1948 | * The calling thread is blocked until a reply is received. |
1949 | * |
1950 | * See locale1_proxy_new_for_bus() for the asynchronous version of this constructor. |
1951 | * |
1952 | * Returns: (transfer full) (type Locale1Proxy): The constructed proxy object or %NULL if @error is set. |
1953 | */ |
1954 | Locale1 * |
1955 | locale1_proxy_new_for_bus_sync ( |
1956 | GBusType bus_type, |
1957 | GDBusProxyFlags flags, |
1958 | const gchar *name, |
1959 | const gchar *object_path, |
1960 | GCancellable *cancellable, |
1961 | GError **error) |
1962 | { |
1963 | GInitable *ret; |
1964 | ret = g_initable_new (TYPE_LOCALE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.freedesktop.locale1", NULL); |
1965 | if (ret != NULL) |
1966 | return LOCALE1 (ret); |
1967 | else |
1968 | return NULL; |
1969 | } |
1970 | |
1971 | |
1972 | /* ------------------------------------------------------------------------ */ |
1973 | |
1974 | /** |
1975 | * Locale1Skeleton: |
1976 | * |
1977 | * The #Locale1Skeleton structure contains only private data and should only be accessed using the provided API. |
1978 | */ |
1979 | |
1980 | /** |
1981 | * Locale1SkeletonClass: |
1982 | * @parent_class: The parent class. |
1983 | * |
1984 | * Class structure for #Locale1Skeleton. |
1985 | */ |
1986 | |
1987 | struct _Locale1SkeletonPrivate |
1988 | { |
1989 | GValue *properties; |
1990 | GList *changed_properties; |
1991 | GSource *changed_properties_idle_source; |
1992 | GMainContext *context; |
1993 | GMutex lock; |
1994 | }; |
1995 | |
1996 | static void |
1997 | _locale1_skeleton_handle_method_call ( |
1998 | GDBusConnection *connection G_GNUC_UNUSED, |
1999 | const gchar *sender G_GNUC_UNUSED, |
2000 | const gchar *object_path G_GNUC_UNUSED, |
2001 | const gchar *interface_name, |
2002 | const gchar *method_name, |
2003 | GVariant *parameters, |
2004 | GDBusMethodInvocation *invocation, |
2005 | gpointer user_data) |
2006 | { |
2007 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (user_data); |
2008 | _ExtendedGDBusMethodInfo *info; |
2009 | GVariantIter iter; |
2010 | GVariant *child; |
2011 | GValue *paramv; |
2012 | guint num_params; |
2013 | guint num_extra; |
2014 | guint n; |
2015 | guint signal_id; |
2016 | GValue return_value = G_VALUE_INIT; |
2017 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); |
2018 | g_assert (info != NULL); |
2019 | num_params = g_variant_n_children (parameters); |
2020 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); |
2021 | n = 0; |
2022 | g_value_init (¶mv[n], TYPE_LOCALE1); |
2023 | g_value_set_object (¶mv[n++], skeleton); |
2024 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); |
2025 | g_value_set_object (¶mv[n++], invocation); |
2026 | if (info->pass_fdlist) |
2027 | { |
2028 | #ifdef G_OS_UNIX |
2029 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); |
2030 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); |
2031 | #else |
2032 | g_assert_not_reached (); |
2033 | #endif |
2034 | } |
2035 | g_variant_iter_init (&iter, parameters); |
2036 | while ((child = g_variant_iter_next_value (&iter)) != NULL) |
2037 | { |
2038 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; |
2039 | if (arg_info->use_gvariant) |
2040 | { |
2041 | g_value_init (¶mv[n], G_TYPE_VARIANT); |
2042 | g_value_set_variant (¶mv[n], child); |
2043 | n++; |
2044 | } |
2045 | else |
2046 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); |
2047 | g_variant_unref (child); |
2048 | } |
2049 | signal_id = g_signal_lookup (info->signal_name, TYPE_LOCALE1); |
2050 | g_value_init (&return_value, G_TYPE_BOOLEAN); |
2051 | g_signal_emitv (paramv, signal_id, 0, &return_value); |
2052 | if (!g_value_get_boolean (&return_value)) |
2053 | 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); |
2054 | g_value_unset (&return_value); |
2055 | for (n = 0; n < num_params + num_extra; n++) |
2056 | g_value_unset (¶mv[n]); |
2057 | g_free (paramv); |
2058 | } |
2059 | |
2060 | static GVariant * |
2061 | _locale1_skeleton_handle_get_property ( |
2062 | GDBusConnection *connection G_GNUC_UNUSED, |
2063 | const gchar *sender G_GNUC_UNUSED, |
2064 | const gchar *object_path G_GNUC_UNUSED, |
2065 | const gchar *interface_name G_GNUC_UNUSED, |
2066 | const gchar *property_name, |
2067 | GError **error, |
2068 | gpointer user_data) |
2069 | { |
2070 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (user_data); |
2071 | GValue value = G_VALUE_INIT; |
2072 | GParamSpec *pspec; |
2073 | _ExtendedGDBusPropertyInfo *info; |
2074 | GVariant *ret; |
2075 | ret = NULL; |
2076 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct, property_name); |
2077 | g_assert (info != NULL); |
2078 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
2079 | if (pspec == NULL) |
2080 | { |
2081 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
2082 | } |
2083 | else |
2084 | { |
2085 | g_value_init (&value, pspec->value_type); |
2086 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
2087 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); |
2088 | g_value_unset (&value); |
2089 | } |
2090 | return ret; |
2091 | } |
2092 | |
2093 | static gboolean |
2094 | _locale1_skeleton_handle_set_property ( |
2095 | GDBusConnection *connection G_GNUC_UNUSED, |
2096 | const gchar *sender G_GNUC_UNUSED, |
2097 | const gchar *object_path G_GNUC_UNUSED, |
2098 | const gchar *interface_name G_GNUC_UNUSED, |
2099 | const gchar *property_name, |
2100 | GVariant *variant, |
2101 | GError **error, |
2102 | gpointer user_data) |
2103 | { |
2104 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (user_data); |
2105 | GValue value = G_VALUE_INIT; |
2106 | GParamSpec *pspec; |
2107 | _ExtendedGDBusPropertyInfo *info; |
2108 | gboolean ret; |
2109 | ret = FALSE; |
2110 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_locale1_interface_info.parent_struct, property_name); |
2111 | g_assert (info != NULL); |
2112 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); |
2113 | if (pspec == NULL) |
2114 | { |
2115 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); |
2116 | } |
2117 | else |
2118 | { |
2119 | if (info->use_gvariant) |
2120 | g_value_set_variant (&value, variant); |
2121 | else |
2122 | g_dbus_gvariant_to_gvalue (variant, &value); |
2123 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); |
2124 | g_value_unset (&value); |
2125 | ret = TRUE; |
2126 | } |
2127 | return ret; |
2128 | } |
2129 | |
2130 | static const GDBusInterfaceVTable _locale1_skeleton_vtable = |
2131 | { |
2132 | _locale1_skeleton_handle_method_call, |
2133 | _locale1_skeleton_handle_get_property, |
2134 | _locale1_skeleton_handle_set_property, |
2135 | {NULL} |
2136 | }; |
2137 | |
2138 | static GDBusInterfaceInfo * |
2139 | locale1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
2140 | { |
2141 | return locale1_interface_info (); |
2142 | } |
2143 | |
2144 | static GDBusInterfaceVTable * |
2145 | locale1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) |
2146 | { |
2147 | return (GDBusInterfaceVTable *) &_locale1_skeleton_vtable; |
2148 | } |
2149 | |
2150 | static GVariant * |
2151 | locale1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) |
2152 | { |
2153 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (_skeleton); |
2154 | |
2155 | GVariantBuilder builder; |
2156 | guint n; |
2157 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
2158 | if (_locale1_interface_info.parent_struct.properties == NULL) |
2159 | goto out; |
2160 | for (n = 0; _locale1_interface_info.parent_struct.properties[n] != NULL; n++) |
2161 | { |
2162 | GDBusPropertyInfo *info = _locale1_interface_info.parent_struct.properties[n]; |
2163 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) |
2164 | { |
2165 | GVariant *value; |
2166 | value = _locale1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.freedesktop.locale1", info->name, NULL, skeleton); |
2167 | if (value != NULL) |
2168 | { |
2169 | g_variant_take_ref (value); |
2170 | g_variant_builder_add (&builder, "{sv}", info->name, value); |
2171 | g_variant_unref (value); |
2172 | } |
2173 | } |
2174 | } |
2175 | out: |
2176 | return g_variant_builder_end (&builder); |
2177 | } |
2178 | |
2179 | static gboolean _locale1_emit_changed (gpointer user_data); |
2180 | |
2181 | static void |
2182 | locale1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) |
2183 | { |
2184 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (_skeleton); |
2185 | gboolean emit_changed = FALSE; |
2186 | |
2187 | g_mutex_lock (&skeleton->priv->lock); |
2188 | if (skeleton->priv->changed_properties_idle_source != NULL) |
2189 | { |
2190 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
2191 | skeleton->priv->changed_properties_idle_source = NULL; |
2192 | emit_changed = TRUE; |
2193 | } |
2194 | g_mutex_unlock (&skeleton->priv->lock); |
2195 | |
2196 | if (emit_changed) |
2197 | _locale1_emit_changed (skeleton); |
2198 | } |
2199 | |
2200 | static void locale1_skeleton_iface_init (Locale1Iface *iface); |
2201 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2202 | G_DEFINE_TYPE_WITH_CODE (Locale1Skeleton, locale1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
2203 | G_ADD_PRIVATE (Locale1Skeleton) |
2204 | G_IMPLEMENT_INTERFACE (TYPE_LOCALE1, locale1_skeleton_iface_init)); |
2205 | |
2206 | #else |
2207 | G_DEFINE_TYPE_WITH_CODE (Locale1Skeleton, locale1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, |
2208 | G_IMPLEMENT_INTERFACE (TYPE_LOCALE1, locale1_skeleton_iface_init)); |
2209 | |
2210 | #endif |
2211 | static void |
2212 | locale1_skeleton_finalize (GObject *object) |
2213 | { |
2214 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2215 | guint n; |
2216 | for (n = 0; n < 7; n++) |
2217 | g_value_unset (&skeleton->priv->properties[n]); |
2218 | g_free (skeleton->priv->properties); |
2219 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2220 | if (skeleton->priv->changed_properties_idle_source != NULL) |
2221 | g_source_destroy (skeleton->priv->changed_properties_idle_source); |
2222 | g_main_context_unref (skeleton->priv->context); |
2223 | g_mutex_clear (&skeleton->priv->lock); |
2224 | G_OBJECT_CLASS (locale1_skeleton_parent_class)->finalize (object); |
2225 | } |
2226 | |
2227 | static void |
2228 | locale1_skeleton_get_property (GObject *object, |
2229 | guint prop_id, |
2230 | GValue *value, |
2231 | GParamSpec *pspec G_GNUC_UNUSED) |
2232 | { |
2233 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2234 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
2235 | g_mutex_lock (&skeleton->priv->lock); |
2236 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value); |
2237 | g_mutex_unlock (&skeleton->priv->lock); |
2238 | } |
2239 | |
2240 | static gboolean |
2241 | _locale1_emit_changed (gpointer user_data) |
2242 | { |
2243 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (user_data); |
2244 | GList *l; |
2245 | GVariantBuilder builder; |
2246 | GVariantBuilder invalidated_builder; |
2247 | guint num_changes; |
2248 | |
2249 | g_mutex_lock (&skeleton->priv->lock); |
2250 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); |
2251 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); |
2252 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) |
2253 | { |
2254 | ChangedProperty *cp = l->data; |
2255 | GVariant *variant; |
2256 | const GValue *cur_value; |
2257 | |
2258 | cur_value = &skeleton->priv->properties[cp->prop_id - 1]; |
2259 | if (!_g_value_equal (cur_value, &cp->orig_value)) |
2260 | { |
2261 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); |
2262 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); |
2263 | g_variant_unref (variant); |
2264 | num_changes++; |
2265 | } |
2266 | } |
2267 | if (num_changes > 0) |
2268 | { |
2269 | GList *connections, *ll; |
2270 | GVariant *signal_variant; |
2271 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.freedesktop.locale1", |
2272 | &builder, &invalidated_builder)); |
2273 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); |
2274 | for (ll = connections; ll != NULL; ll = ll->next) |
2275 | { |
2276 | GDBusConnection *connection = ll->data; |
2277 | |
2278 | g_dbus_connection_emit_signal (connection, |
2279 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), |
2280 | "org.freedesktop.DBus.Properties", |
2281 | "PropertiesChanged", |
2282 | signal_variant, |
2283 | NULL); |
2284 | } |
2285 | g_variant_unref (signal_variant); |
2286 | g_list_free_full (connections, g_object_unref); |
2287 | } |
2288 | else |
2289 | { |
2290 | g_variant_builder_clear (&builder); |
2291 | g_variant_builder_clear (&invalidated_builder); |
2292 | } |
2293 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); |
2294 | skeleton->priv->changed_properties = NULL; |
2295 | skeleton->priv->changed_properties_idle_source = NULL; |
2296 | g_mutex_unlock (&skeleton->priv->lock); |
2297 | return FALSE; |
2298 | } |
2299 | |
2300 | static void |
2301 | _locale1_schedule_emit_changed (Locale1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) |
2302 | { |
2303 | ChangedProperty *cp; |
2304 | GList *l; |
2305 | cp = NULL; |
2306 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) |
2307 | { |
2308 | ChangedProperty *i_cp = l->data; |
2309 | if (i_cp->info == info) |
2310 | { |
2311 | cp = i_cp; |
2312 | break; |
2313 | } |
2314 | } |
2315 | if (cp == NULL) |
2316 | { |
2317 | cp = g_new0 (ChangedProperty, 1); |
2318 | cp->prop_id = prop_id; |
2319 | cp->info = info; |
2320 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); |
2321 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); |
2322 | g_value_copy (orig_value, &cp->orig_value); |
2323 | } |
2324 | } |
2325 | |
2326 | static void |
2327 | locale1_skeleton_notify (GObject *object, |
2328 | GParamSpec *pspec G_GNUC_UNUSED) |
2329 | { |
2330 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2331 | g_mutex_lock (&skeleton->priv->lock); |
2332 | if (skeleton->priv->changed_properties != NULL && |
2333 | skeleton->priv->changed_properties_idle_source == NULL) |
2334 | { |
2335 | skeleton->priv->changed_properties_idle_source = g_idle_source_new (); |
2336 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); |
2337 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _locale1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); |
2338 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); |
2339 | g_source_unref (skeleton->priv->changed_properties_idle_source); |
2340 | } |
2341 | g_mutex_unlock (&skeleton->priv->lock); |
2342 | } |
2343 | |
2344 | static void |
2345 | locale1_skeleton_set_property (GObject *object, |
2346 | guint prop_id, |
2347 | const GValue *value, |
2348 | GParamSpec *pspec) |
2349 | { |
2350 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2351 | g_assert (prop_id != 0 && prop_id - 1 < 7); |
2352 | g_mutex_lock (&skeleton->priv->lock); |
2353 | g_object_freeze_notify (object); |
2354 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) |
2355 | { |
2356 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) |
2357 | _locale1_schedule_emit_changed (skeleton, _locale1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); |
2358 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); |
2359 | g_object_notify_by_pspec (object, pspec); |
2360 | } |
2361 | g_mutex_unlock (&skeleton->priv->lock); |
2362 | g_object_thaw_notify (object); |
2363 | } |
2364 | |
2365 | static void |
2366 | locale1_skeleton_init (Locale1Skeleton *skeleton) |
2367 | { |
2368 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 |
2369 | skeleton->priv = locale1_skeleton_get_instance_private (skeleton); |
2370 | #else |
2371 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LOCALE1_SKELETON, Locale1SkeletonPrivate); |
2372 | #endif |
2373 | |
2374 | g_mutex_init (&skeleton->priv->lock); |
2375 | skeleton->priv->context = g_main_context_ref_thread_default (); |
2376 | skeleton->priv->properties = g_new0 (GValue, 7); |
2377 | g_value_init (&skeleton->priv->properties[0], G_TYPE_STRV); |
2378 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); |
2379 | g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); |
2380 | g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); |
2381 | g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); |
2382 | g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); |
2383 | g_value_init (&skeleton->priv->properties[6], G_TYPE_STRING); |
2384 | } |
2385 | |
2386 | static const gchar *const * |
2387 | locale1_skeleton_get_locale (Locale1 *object) |
2388 | { |
2389 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2390 | const gchar *const *value; |
2391 | g_mutex_lock (&skeleton->priv->lock); |
2392 | value = g_value_get_boxed (&(skeleton->priv->properties[0])); |
2393 | g_mutex_unlock (&skeleton->priv->lock); |
2394 | return value; |
2395 | } |
2396 | |
2397 | static const gchar * |
2398 | locale1_skeleton_get_vconsole_keymap (Locale1 *object) |
2399 | { |
2400 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2401 | const gchar *value; |
2402 | g_mutex_lock (&skeleton->priv->lock); |
2403 | value = g_value_get_string (&(skeleton->priv->properties[1])); |
2404 | g_mutex_unlock (&skeleton->priv->lock); |
2405 | return value; |
2406 | } |
2407 | |
2408 | static const gchar * |
2409 | locale1_skeleton_get_vconsole_keymap_toggle (Locale1 *object) |
2410 | { |
2411 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2412 | const gchar *value; |
2413 | g_mutex_lock (&skeleton->priv->lock); |
2414 | value = g_value_get_string (&(skeleton->priv->properties[2])); |
2415 | g_mutex_unlock (&skeleton->priv->lock); |
2416 | return value; |
2417 | } |
2418 | |
2419 | static const gchar * |
2420 | locale1_skeleton_get_x11_layout (Locale1 *object) |
2421 | { |
2422 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2423 | const gchar *value; |
2424 | g_mutex_lock (&skeleton->priv->lock); |
2425 | value = g_value_get_string (&(skeleton->priv->properties[3])); |
2426 | g_mutex_unlock (&skeleton->priv->lock); |
2427 | return value; |
2428 | } |
2429 | |
2430 | static const gchar * |
2431 | locale1_skeleton_get_x11_model (Locale1 *object) |
2432 | { |
2433 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2434 | const gchar *value; |
2435 | g_mutex_lock (&skeleton->priv->lock); |
2436 | value = g_value_get_string (&(skeleton->priv->properties[4])); |
2437 | g_mutex_unlock (&skeleton->priv->lock); |
2438 | return value; |
2439 | } |
2440 | |
2441 | static const gchar * |
2442 | locale1_skeleton_get_x11_variant (Locale1 *object) |
2443 | { |
2444 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2445 | const gchar *value; |
2446 | g_mutex_lock (&skeleton->priv->lock); |
2447 | value = g_value_get_string (&(skeleton->priv->properties[5])); |
2448 | g_mutex_unlock (&skeleton->priv->lock); |
2449 | return value; |
2450 | } |
2451 | |
2452 | static const gchar * |
2453 | locale1_skeleton_get_x11_options (Locale1 *object) |
2454 | { |
2455 | Locale1Skeleton *skeleton = LOCALE1_SKELETON (object); |
2456 | const gchar *value; |
2457 | g_mutex_lock (&skeleton->priv->lock); |
2458 | value = g_value_get_string (&(skeleton->priv->properties[6])); |
2459 | g_mutex_unlock (&skeleton->priv->lock); |
2460 | return value; |
2461 | } |
2462 | |
2463 | static void |
2464 | locale1_skeleton_class_init (Locale1SkeletonClass *klass) |
2465 | { |
2466 | GObjectClass *gobject_class; |
2467 | GDBusInterfaceSkeletonClass *skeleton_class; |
2468 | |
2469 | gobject_class = G_OBJECT_CLASS (klass); |
2470 | gobject_class->finalize = locale1_skeleton_finalize; |
2471 | gobject_class->get_property = locale1_skeleton_get_property; |
2472 | gobject_class->set_property = locale1_skeleton_set_property; |
2473 | gobject_class->notify = locale1_skeleton_notify; |
2474 | |
2475 | |
2476 | locale1_override_properties (gobject_class, 1); |
2477 | |
2478 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); |
2479 | skeleton_class->get_info = locale1_skeleton_dbus_interface_get_info; |
2480 | skeleton_class->get_properties = locale1_skeleton_dbus_interface_get_properties; |
2481 | skeleton_class->flush = locale1_skeleton_dbus_interface_flush; |
2482 | skeleton_class->get_vtable = locale1_skeleton_dbus_interface_get_vtable; |
2483 | |
2484 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 |
2485 | g_type_class_add_private (klass, sizeof (Locale1SkeletonPrivate)); |
2486 | #endif |
2487 | } |
2488 | |
2489 | static void |
2490 | locale1_skeleton_iface_init (Locale1Iface *iface) |
2491 | { |
2492 | iface->get_locale = locale1_skeleton_get_locale; |
2493 | iface->get_vconsole_keymap = locale1_skeleton_get_vconsole_keymap; |
2494 | iface->get_vconsole_keymap_toggle = locale1_skeleton_get_vconsole_keymap_toggle; |
2495 | iface->get_x11_layout = locale1_skeleton_get_x11_layout; |
2496 | iface->get_x11_model = locale1_skeleton_get_x11_model; |
2497 | iface->get_x11_variant = locale1_skeleton_get_x11_variant; |
2498 | iface->get_x11_options = locale1_skeleton_get_x11_options; |
2499 | } |
2500 | |
2501 | /** |
2502 | * locale1_skeleton_new: |
2503 | * |
2504 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-freedesktop-locale1.top_of_page">org.freedesktop.locale1</link>. |
2505 | * |
2506 | * Returns: (transfer full) (type Locale1Skeleton): The skeleton object. |
2507 | */ |
2508 | Locale1 * |
2509 | locale1_skeleton_new (void) |
2510 | { |
2511 | return LOCALE1 (g_object_new (TYPE_LOCALE1_SKELETON, NULL)); |
2512 | } |
2513 | |