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