blob: bdd0095d960b468230709293df39cad3de57663f [file] [log] [blame]
Norman Jamese2765102015-08-19 22:00:55 -05001/*
2 * Generated by gdbus-codegen 2.40.2. 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 "interfaces/eventlog.h"
12
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static 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;
82out:
83 return ret;
84}
85
86static 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);
98out:
99 return ret;
100}
101
102G_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.openbmc.EventLog
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:EventLog
158 * @title: EventLog
159 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.EventLog ---- */
165
166static const _ExtendedGDBusArgInfo _event_log_method_info_error_IN_ARG_message =
167{
168 {
169 -1,
170 (gchar *) "message",
171 (gchar *) "s",
172 NULL
173 },
174 FALSE
175};
176
177static const _ExtendedGDBusArgInfo * const _event_log_method_info_error_IN_ARG_pointers[] =
178{
179 &_event_log_method_info_error_IN_ARG_message,
180 NULL
181};
182
183static const _ExtendedGDBusMethodInfo _event_log_method_info_error =
184{
185 {
186 -1,
187 (gchar *) "error",
188 (GDBusArgInfo **) &_event_log_method_info_error_IN_ARG_pointers,
189 NULL,
190 NULL
191 },
192 "handle-error",
193 FALSE
194};
195
196static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
197{
198 &_event_log_method_info_error,
199 NULL
200};
201
202static const _ExtendedGDBusArgInfo _event_log_signal_info_error_event_ARG_message =
203{
204 {
205 -1,
206 (gchar *) "message",
207 (gchar *) "s",
208 NULL
209 },
210 FALSE
211};
212
213static const _ExtendedGDBusArgInfo * const _event_log_signal_info_error_event_ARG_pointers[] =
214{
215 &_event_log_signal_info_error_event_ARG_message,
216 NULL
217};
218
219static const _ExtendedGDBusSignalInfo _event_log_signal_info_error_event =
220{
221 {
222 -1,
223 (gchar *) "ErrorEvent",
224 (GDBusArgInfo **) &_event_log_signal_info_error_event_ARG_pointers,
225 NULL
226 },
227 "error-event"
228};
229
230static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
231{
232 &_event_log_signal_info_error_event,
233 NULL
234};
235
236static const _ExtendedGDBusPropertyInfo _event_log_property_info_message =
237{
238 {
239 -1,
240 (gchar *) "message",
241 (gchar *) "s",
242 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
243 NULL
244 },
245 "message",
246 FALSE
247};
248
249static const _ExtendedGDBusPropertyInfo * const _event_log_property_info_pointers[] =
250{
251 &_event_log_property_info_message,
252 NULL
253};
254
255static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
256{
257 {
258 -1,
259 (gchar *) "org.openbmc.EventLog",
260 (GDBusMethodInfo **) &_event_log_method_info_pointers,
261 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
262 (GDBusPropertyInfo **) &_event_log_property_info_pointers,
263 NULL
264 },
265 "event-log",
266};
267
268
269/**
270 * event_log_interface_info:
271 *
272 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
273 *
274 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
275 */
276GDBusInterfaceInfo *
277event_log_interface_info (void)
278{
279 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
280}
281
282/**
283 * event_log_override_properties:
284 * @klass: The class structure for a #GObject<!-- -->-derived class.
285 * @property_id_begin: The property id to assign to the first overridden property.
286 *
287 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
288 * The properties are overridden in the order they are defined.
289 *
290 * Returns: The last property id.
291 */
292guint
293event_log_override_properties (GObjectClass *klass, guint property_id_begin)
294{
295 g_object_class_override_property (klass, property_id_begin++, "message");
296 return property_id_begin - 1;
297}
298
299
300
301/**
302 * EventLog:
303 *
304 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
305 */
306
307/**
308 * EventLogIface:
309 * @parent_iface: The parent interface.
310 * @handle_error: Handler for the #EventLog::handle-error signal.
311 * @get_message: Getter for the #EventLog:message property.
312 * @error_event: Handler for the #EventLog::error-event signal.
313 *
314 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
315 */
316
317typedef EventLogIface EventLogInterface;
318G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
319
320static void
321event_log_default_init (EventLogIface *iface)
322{
323 /* GObject signals for incoming D-Bus method calls: */
324 /**
325 * EventLog::handle-error:
326 * @object: A #EventLog.
327 * @invocation: A #GDBusMethodInvocation.
328 * @arg_message: Argument passed by remote caller.
329 *
330 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.error">error()</link> D-Bus method.
331 *
332 * 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 event_log_complete_error() 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.
333 *
334 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
335 */
336 g_signal_new ("handle-error",
337 G_TYPE_FROM_INTERFACE (iface),
338 G_SIGNAL_RUN_LAST,
339 G_STRUCT_OFFSET (EventLogIface, handle_error),
340 g_signal_accumulator_true_handled,
341 NULL,
342 g_cclosure_marshal_generic,
343 G_TYPE_BOOLEAN,
344 2,
345 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
346
347 /* GObject signals for received D-Bus signals: */
348 /**
349 * EventLog::error-event:
350 * @object: A #EventLog.
351 * @arg_message: Argument.
352 *
353 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.ErrorEvent">"ErrorEvent"</link> is received.
354 *
355 * 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.
356 */
357 g_signal_new ("error-event",
358 G_TYPE_FROM_INTERFACE (iface),
359 G_SIGNAL_RUN_LAST,
360 G_STRUCT_OFFSET (EventLogIface, error_event),
361 NULL,
362 NULL,
363 g_cclosure_marshal_generic,
364 G_TYPE_NONE,
365 1, G_TYPE_STRING);
366
367 /* GObject properties for D-Bus properties: */
368 /**
369 * EventLog:message:
370 *
371 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link>.
372 *
373 * 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.
374 */
375 g_object_interface_install_property (iface,
376 g_param_spec_string ("message", "message", "message", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
377}
378
379/**
380 * event_log_get_message: (skip)
381 * @object: A #EventLog.
382 *
383 * Gets the value of the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property.
384 *
385 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
386 *
387 * <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 event_log_dup_message() if on another thread.</warning>
388 *
389 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
390 */
391const gchar *
392event_log_get_message (EventLog *object)
393{
394 return EVENT_LOG_GET_IFACE (object)->get_message (object);
395}
396
397/**
398 * event_log_dup_message: (skip)
399 * @object: A #EventLog.
400 *
401 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property.
402 *
403 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
404 *
405 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
406 */
407gchar *
408event_log_dup_message (EventLog *object)
409{
410 gchar *value;
411 g_object_get (G_OBJECT (object), "message", &value, NULL);
412 return value;
413}
414
415/**
416 * event_log_set_message: (skip)
417 * @object: A #EventLog.
418 * @value: The value to set.
419 *
420 * Sets the <link linkend="gdbus-property-org-openbmc-EventLog.message">"message"</link> D-Bus property to @value.
421 *
422 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
423 */
424void
425event_log_set_message (EventLog *object, const gchar *value)
426{
427 g_object_set (G_OBJECT (object), "message", value, NULL);
428}
429
430/**
431 * event_log_emit_error_event:
432 * @object: A #EventLog.
433 * @arg_message: Argument to pass with the signal.
434 *
435 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.ErrorEvent">"ErrorEvent"</link> D-Bus signal.
436 */
437void
438event_log_emit_error_event (
439 EventLog *object,
440 const gchar *arg_message)
441{
442 g_signal_emit_by_name (object, "error-event", arg_message);
443}
444
445/**
446 * event_log_call_error:
447 * @proxy: A #EventLogProxy.
448 * @arg_message: Argument to pass with the method invocation.
449 * @cancellable: (allow-none): A #GCancellable or %NULL.
450 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
451 * @user_data: User data to pass to @callback.
452 *
453 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.error">error()</link> D-Bus method on @proxy.
454 * 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.
455 * You can then call event_log_call_error_finish() to get the result of the operation.
456 *
457 * See event_log_call_error_sync() for the synchronous, blocking version of this method.
458 */
459void
460event_log_call_error (
461 EventLog *proxy,
462 const gchar *arg_message,
463 GCancellable *cancellable,
464 GAsyncReadyCallback callback,
465 gpointer user_data)
466{
467 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
468 "error",
469 g_variant_new ("(s)",
470 arg_message),
471 G_DBUS_CALL_FLAGS_NONE,
472 -1,
473 cancellable,
474 callback,
475 user_data);
476}
477
478/**
479 * event_log_call_error_finish:
480 * @proxy: A #EventLogProxy.
481 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_error().
482 * @error: Return location for error or %NULL.
483 *
484 * Finishes an operation started with event_log_call_error().
485 *
486 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
487 */
488gboolean
489event_log_call_error_finish (
490 EventLog *proxy,
491 GAsyncResult *res,
492 GError **error)
493{
494 GVariant *_ret;
495 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
496 if (_ret == NULL)
497 goto _out;
498 g_variant_get (_ret,
499 "()");
500 g_variant_unref (_ret);
501_out:
502 return _ret != NULL;
503}
504
505/**
506 * event_log_call_error_sync:
507 * @proxy: A #EventLogProxy.
508 * @arg_message: Argument to pass with the method invocation.
509 * @cancellable: (allow-none): A #GCancellable or %NULL.
510 * @error: Return location for error or %NULL.
511 *
512 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
513 *
514 * See event_log_call_error() for the asynchronous version of this method.
515 *
516 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
517 */
518gboolean
519event_log_call_error_sync (
520 EventLog *proxy,
521 const gchar *arg_message,
522 GCancellable *cancellable,
523 GError **error)
524{
525 GVariant *_ret;
526 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
527 "error",
528 g_variant_new ("(s)",
529 arg_message),
530 G_DBUS_CALL_FLAGS_NONE,
531 -1,
532 cancellable,
533 error);
534 if (_ret == NULL)
535 goto _out;
536 g_variant_get (_ret,
537 "()");
538 g_variant_unref (_ret);
539_out:
540 return _ret != NULL;
541}
542
543/**
544 * event_log_complete_error:
545 * @object: A #EventLog.
546 * @invocation: (transfer full): A #GDBusMethodInvocation.
547 *
548 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.error">error()</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.
549 *
550 * This method will free @invocation, you cannot use it afterwards.
551 */
552void
553event_log_complete_error (
554 EventLog *object,
555 GDBusMethodInvocation *invocation)
556{
557 g_dbus_method_invocation_return_value (invocation,
558 g_variant_new ("()"));
559}
560
561/* ------------------------------------------------------------------------ */
562
563/**
564 * EventLogProxy:
565 *
566 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
567 */
568
569/**
570 * EventLogProxyClass:
571 * @parent_class: The parent class.
572 *
573 * Class structure for #EventLogProxy.
574 */
575
576struct _EventLogProxyPrivate
577{
578 GData *qdata;
579};
580
581static void event_log_proxy_iface_init (EventLogIface *iface);
582
583#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
584G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
585 G_ADD_PRIVATE (EventLogProxy)
586 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
587
588#else
589G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
590 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
591
592#endif
593static void
594event_log_proxy_finalize (GObject *object)
595{
596 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
597 g_datalist_clear (&proxy->priv->qdata);
598 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
599}
600
601static void
602event_log_proxy_get_property (GObject *object,
603 guint prop_id,
604 GValue *value,
605 GParamSpec *pspec G_GNUC_UNUSED)
606{
607 const _ExtendedGDBusPropertyInfo *info;
608 GVariant *variant;
609 g_assert (prop_id != 0 && prop_id - 1 < 1);
610 info = _event_log_property_info_pointers[prop_id - 1];
611 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
612 if (info->use_gvariant)
613 {
614 g_value_set_variant (value, variant);
615 }
616 else
617 {
618 if (variant != NULL)
619 g_dbus_gvariant_to_gvalue (variant, value);
620 }
621 if (variant != NULL)
622 g_variant_unref (variant);
623}
624
625static void
626event_log_proxy_set_property_cb (GDBusProxy *proxy,
627 GAsyncResult *res,
628 gpointer user_data)
629{
630 const _ExtendedGDBusPropertyInfo *info = user_data;
631 GError *error;
632 GVariant *_ret;
633 error = NULL;
634 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
635 if (!_ret)
636 {
637 g_warning ("Error setting property '%s' on interface org.openbmc.EventLog: %s (%s, %d)",
638 info->parent_struct.name,
639 error->message, g_quark_to_string (error->domain), error->code);
640 g_error_free (error);
641 }
642 else
643 {
644 g_variant_unref (_ret);
645 }
646}
647
648static void
649event_log_proxy_set_property (GObject *object,
650 guint prop_id,
651 const GValue *value,
652 GParamSpec *pspec G_GNUC_UNUSED)
653{
654 const _ExtendedGDBusPropertyInfo *info;
655 GVariant *variant;
656 g_assert (prop_id != 0 && prop_id - 1 < 1);
657 info = _event_log_property_info_pointers[prop_id - 1];
658 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
659 g_dbus_proxy_call (G_DBUS_PROXY (object),
660 "org.freedesktop.DBus.Properties.Set",
661 g_variant_new ("(ssv)", "org.openbmc.EventLog", info->parent_struct.name, variant),
662 G_DBUS_CALL_FLAGS_NONE,
663 -1,
664 NULL, (GAsyncReadyCallback) event_log_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
665 g_variant_unref (variant);
666}
667
668static void
669event_log_proxy_g_signal (GDBusProxy *proxy,
670 const gchar *sender_name G_GNUC_UNUSED,
671 const gchar *signal_name,
672 GVariant *parameters)
673{
674 _ExtendedGDBusSignalInfo *info;
675 GVariantIter iter;
676 GVariant *child;
677 GValue *paramv;
678 guint num_params;
679 guint n;
680 guint signal_id;
681 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
682 if (info == NULL)
683 return;
684 num_params = g_variant_n_children (parameters);
685 paramv = g_new0 (GValue, num_params + 1);
686 g_value_init (&paramv[0], TYPE_EVENT_LOG);
687 g_value_set_object (&paramv[0], proxy);
688 g_variant_iter_init (&iter, parameters);
689 n = 1;
690 while ((child = g_variant_iter_next_value (&iter)) != NULL)
691 {
692 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
693 if (arg_info->use_gvariant)
694 {
695 g_value_init (&paramv[n], G_TYPE_VARIANT);
696 g_value_set_variant (&paramv[n], child);
697 n++;
698 }
699 else
700 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
701 g_variant_unref (child);
702 }
703 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
704 g_signal_emitv (paramv, signal_id, 0, NULL);
705 for (n = 0; n < num_params + 1; n++)
706 g_value_unset (&paramv[n]);
707 g_free (paramv);
708}
709
710static void
711event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
712 GVariant *changed_properties,
713 const gchar *const *invalidated_properties)
714{
715 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
716 guint n;
717 const gchar *key;
718 GVariantIter *iter;
719 _ExtendedGDBusPropertyInfo *info;
720 g_variant_get (changed_properties, "a{sv}", &iter);
721 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
722 {
723 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
724 g_datalist_remove_data (&proxy->priv->qdata, key);
725 if (info != NULL)
726 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
727 }
728 g_variant_iter_free (iter);
729 for (n = 0; invalidated_properties[n] != NULL; n++)
730 {
731 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
732 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
733 if (info != NULL)
734 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
735 }
736}
737
738static const gchar *
739event_log_proxy_get_message (EventLog *object)
740{
741 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
742 GVariant *variant;
743 const gchar *value = NULL;
744 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "message");
745 if (variant != NULL)
746 {
747 value = g_variant_get_string (variant, NULL);
748 g_variant_unref (variant);
749 }
750 return value;
751}
752
753static void
754event_log_proxy_init (EventLogProxy *proxy)
755{
756#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
757 proxy->priv = event_log_proxy_get_instance_private (proxy);
758#else
759 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
760#endif
761
762 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
763}
764
765static void
766event_log_proxy_class_init (EventLogProxyClass *klass)
767{
768 GObjectClass *gobject_class;
769 GDBusProxyClass *proxy_class;
770
771 gobject_class = G_OBJECT_CLASS (klass);
772 gobject_class->finalize = event_log_proxy_finalize;
773 gobject_class->get_property = event_log_proxy_get_property;
774 gobject_class->set_property = event_log_proxy_set_property;
775
776 proxy_class = G_DBUS_PROXY_CLASS (klass);
777 proxy_class->g_signal = event_log_proxy_g_signal;
778 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
779
780 event_log_override_properties (gobject_class, 1);
781
782#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
783 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
784#endif
785}
786
787static void
788event_log_proxy_iface_init (EventLogIface *iface)
789{
790 iface->get_message = event_log_proxy_get_message;
791}
792
793/**
794 * event_log_proxy_new:
795 * @connection: A #GDBusConnection.
796 * @flags: Flags from the #GDBusProxyFlags enumeration.
797 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
798 * @object_path: An object path.
799 * @cancellable: (allow-none): A #GCancellable or %NULL.
800 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
801 * @user_data: User data to pass to @callback.
802 *
803 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details.
804 *
805 * 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.
806 * You can then call event_log_proxy_new_finish() to get the result of the operation.
807 *
808 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
809 */
810void
811event_log_proxy_new (
812 GDBusConnection *connection,
813 GDBusProxyFlags flags,
814 const gchar *name,
815 const gchar *object_path,
816 GCancellable *cancellable,
817 GAsyncReadyCallback callback,
818 gpointer user_data)
819{
820 g_async_initable_new_async (TYPE_EVENT_LOG_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.openbmc.EventLog", NULL);
821}
822
823/**
824 * event_log_proxy_new_finish:
825 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
826 * @error: Return location for error or %NULL
827 *
828 * Finishes an operation started with event_log_proxy_new().
829 *
830 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
831 */
832EventLog *
833event_log_proxy_new_finish (
834 GAsyncResult *res,
835 GError **error)
836{
837 GObject *ret;
838 GObject *source_object;
839 source_object = g_async_result_get_source_object (res);
840 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
841 g_object_unref (source_object);
842 if (ret != NULL)
843 return EVENT_LOG (ret);
844 else
845 return NULL;
846}
847
848/**
849 * event_log_proxy_new_sync:
850 * @connection: A #GDBusConnection.
851 * @flags: Flags from the #GDBusProxyFlags enumeration.
852 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
853 * @object_path: An object path.
854 * @cancellable: (allow-none): A #GCancellable or %NULL.
855 * @error: Return location for error or %NULL
856 *
857 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details.
858 *
859 * The calling thread is blocked until a reply is received.
860 *
861 * See event_log_proxy_new() for the asynchronous version of this constructor.
862 *
863 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
864 */
865EventLog *
866event_log_proxy_new_sync (
867 GDBusConnection *connection,
868 GDBusProxyFlags flags,
869 const gchar *name,
870 const gchar *object_path,
871 GCancellable *cancellable,
872 GError **error)
873{
874 GInitable *ret;
875 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
876 if (ret != NULL)
877 return EVENT_LOG (ret);
878 else
879 return NULL;
880}
881
882
883/**
884 * event_log_proxy_new_for_bus:
885 * @bus_type: A #GBusType.
886 * @flags: Flags from the #GDBusProxyFlags enumeration.
887 * @name: A bus name (well-known or unique).
888 * @object_path: An object path.
889 * @cancellable: (allow-none): A #GCancellable or %NULL.
890 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
891 * @user_data: User data to pass to @callback.
892 *
893 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
894 *
895 * 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.
896 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
897 *
898 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
899 */
900void
901event_log_proxy_new_for_bus (
902 GBusType bus_type,
903 GDBusProxyFlags flags,
904 const gchar *name,
905 const gchar *object_path,
906 GCancellable *cancellable,
907 GAsyncReadyCallback callback,
908 gpointer user_data)
909{
910 g_async_initable_new_async (TYPE_EVENT_LOG_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.openbmc.EventLog", NULL);
911}
912
913/**
914 * event_log_proxy_new_for_bus_finish:
915 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
916 * @error: Return location for error or %NULL
917 *
918 * Finishes an operation started with event_log_proxy_new_for_bus().
919 *
920 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
921 */
922EventLog *
923event_log_proxy_new_for_bus_finish (
924 GAsyncResult *res,
925 GError **error)
926{
927 GObject *ret;
928 GObject *source_object;
929 source_object = g_async_result_get_source_object (res);
930 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
931 g_object_unref (source_object);
932 if (ret != NULL)
933 return EVENT_LOG (ret);
934 else
935 return NULL;
936}
937
938/**
939 * event_log_proxy_new_for_bus_sync:
940 * @bus_type: A #GBusType.
941 * @flags: Flags from the #GDBusProxyFlags enumeration.
942 * @name: A bus name (well-known or unique).
943 * @object_path: An object path.
944 * @cancellable: (allow-none): A #GCancellable or %NULL.
945 * @error: Return location for error or %NULL
946 *
947 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
948 *
949 * The calling thread is blocked until a reply is received.
950 *
951 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
952 *
953 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
954 */
955EventLog *
956event_log_proxy_new_for_bus_sync (
957 GBusType bus_type,
958 GDBusProxyFlags flags,
959 const gchar *name,
960 const gchar *object_path,
961 GCancellable *cancellable,
962 GError **error)
963{
964 GInitable *ret;
965 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
966 if (ret != NULL)
967 return EVENT_LOG (ret);
968 else
969 return NULL;
970}
971
972
973/* ------------------------------------------------------------------------ */
974
975/**
976 * EventLogSkeleton:
977 *
978 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
979 */
980
981/**
982 * EventLogSkeletonClass:
983 * @parent_class: The parent class.
984 *
985 * Class structure for #EventLogSkeleton.
986 */
987
988struct _EventLogSkeletonPrivate
989{
990 GValue *properties;
991 GList *changed_properties;
992 GSource *changed_properties_idle_source;
993 GMainContext *context;
994 GMutex lock;
995};
996
997static void
998_event_log_skeleton_handle_method_call (
999 GDBusConnection *connection G_GNUC_UNUSED,
1000 const gchar *sender G_GNUC_UNUSED,
1001 const gchar *object_path G_GNUC_UNUSED,
1002 const gchar *interface_name,
1003 const gchar *method_name,
1004 GVariant *parameters,
1005 GDBusMethodInvocation *invocation,
1006 gpointer user_data)
1007{
1008 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
1009 _ExtendedGDBusMethodInfo *info;
1010 GVariantIter iter;
1011 GVariant *child;
1012 GValue *paramv;
1013 guint num_params;
1014 guint num_extra;
1015 guint n;
1016 guint signal_id;
1017 GValue return_value = G_VALUE_INIT;
1018 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1019 g_assert (info != NULL);
1020 num_params = g_variant_n_children (parameters);
1021 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1022 n = 0;
1023 g_value_init (&paramv[n], TYPE_EVENT_LOG);
1024 g_value_set_object (&paramv[n++], skeleton);
1025 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1026 g_value_set_object (&paramv[n++], invocation);
1027 if (info->pass_fdlist)
1028 {
1029#ifdef G_OS_UNIX
1030 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1031 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1032#else
1033 g_assert_not_reached ();
1034#endif
1035 }
1036 g_variant_iter_init (&iter, parameters);
1037 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1038 {
1039 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1040 if (arg_info->use_gvariant)
1041 {
1042 g_value_init (&paramv[n], G_TYPE_VARIANT);
1043 g_value_set_variant (&paramv[n], child);
1044 n++;
1045 }
1046 else
1047 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1048 g_variant_unref (child);
1049 }
1050 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
1051 g_value_init (&return_value, G_TYPE_BOOLEAN);
1052 g_signal_emitv (paramv, signal_id, 0, &return_value);
1053 if (!g_value_get_boolean (&return_value))
1054 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);
1055 g_value_unset (&return_value);
1056 for (n = 0; n < num_params + num_extra; n++)
1057 g_value_unset (&paramv[n]);
1058 g_free (paramv);
1059}
1060
1061static GVariant *
1062_event_log_skeleton_handle_get_property (
1063 GDBusConnection *connection G_GNUC_UNUSED,
1064 const gchar *sender G_GNUC_UNUSED,
1065 const gchar *object_path G_GNUC_UNUSED,
1066 const gchar *interface_name G_GNUC_UNUSED,
1067 const gchar *property_name,
1068 GError **error,
1069 gpointer user_data)
1070{
1071 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
1072 GValue value = G_VALUE_INIT;
1073 GParamSpec *pspec;
1074 _ExtendedGDBusPropertyInfo *info;
1075 GVariant *ret;
1076 ret = NULL;
1077 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
1078 g_assert (info != NULL);
1079 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1080 if (pspec == NULL)
1081 {
1082 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1083 }
1084 else
1085 {
1086 g_value_init (&value, pspec->value_type);
1087 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1088 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1089 g_value_unset (&value);
1090 }
1091 return ret;
1092}
1093
1094static gboolean
1095_event_log_skeleton_handle_set_property (
1096 GDBusConnection *connection G_GNUC_UNUSED,
1097 const gchar *sender G_GNUC_UNUSED,
1098 const gchar *object_path G_GNUC_UNUSED,
1099 const gchar *interface_name G_GNUC_UNUSED,
1100 const gchar *property_name,
1101 GVariant *variant,
1102 GError **error,
1103 gpointer user_data)
1104{
1105 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
1106 GValue value = G_VALUE_INIT;
1107 GParamSpec *pspec;
1108 _ExtendedGDBusPropertyInfo *info;
1109 gboolean ret;
1110 ret = FALSE;
1111 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
1112 g_assert (info != NULL);
1113 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1114 if (pspec == NULL)
1115 {
1116 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1117 }
1118 else
1119 {
1120 if (info->use_gvariant)
1121 g_value_set_variant (&value, variant);
1122 else
1123 g_dbus_gvariant_to_gvalue (variant, &value);
1124 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1125 g_value_unset (&value);
1126 ret = TRUE;
1127 }
1128 return ret;
1129}
1130
1131static const GDBusInterfaceVTable _event_log_skeleton_vtable =
1132{
1133 _event_log_skeleton_handle_method_call,
1134 _event_log_skeleton_handle_get_property,
1135 _event_log_skeleton_handle_set_property,
1136 {NULL}
1137};
1138
1139static GDBusInterfaceInfo *
1140event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1141{
1142 return event_log_interface_info ();
1143}
1144
1145static GDBusInterfaceVTable *
1146event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1147{
1148 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
1149}
1150
1151static GVariant *
1152event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1153{
1154 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
1155
1156 GVariantBuilder builder;
1157 guint n;
1158 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1159 if (_event_log_interface_info.parent_struct.properties == NULL)
1160 goto out;
1161 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
1162 {
1163 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
1164 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1165 {
1166 GVariant *value;
1167 value = _event_log_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.openbmc.EventLog", info->name, NULL, skeleton);
1168 if (value != NULL)
1169 {
1170 g_variant_take_ref (value);
1171 g_variant_builder_add (&builder, "{sv}", info->name, value);
1172 g_variant_unref (value);
1173 }
1174 }
1175 }
1176out:
1177 return g_variant_builder_end (&builder);
1178}
1179
1180static gboolean _event_log_emit_changed (gpointer user_data);
1181
1182static void
1183event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1184{
1185 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
1186 gboolean emit_changed = FALSE;
1187
1188 g_mutex_lock (&skeleton->priv->lock);
1189 if (skeleton->priv->changed_properties_idle_source != NULL)
1190 {
1191 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1192 skeleton->priv->changed_properties_idle_source = NULL;
1193 emit_changed = TRUE;
1194 }
1195 g_mutex_unlock (&skeleton->priv->lock);
1196
1197 if (emit_changed)
1198 _event_log_emit_changed (skeleton);
1199}
1200
1201static void
1202_event_log_on_signal_error_event (
1203 EventLog *object,
1204 const gchar *arg_message)
1205{
1206 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1207
1208 GList *connections, *l;
1209 GVariant *signal_variant;
1210 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1211
1212 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
1213 arg_message));
1214 for (l = connections; l != NULL; l = l->next)
1215 {
1216 GDBusConnection *connection = l->data;
1217 g_dbus_connection_emit_signal (connection,
1218 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "ErrorEvent",
1219 signal_variant, NULL);
1220 }
1221 g_variant_unref (signal_variant);
1222 g_list_free_full (connections, g_object_unref);
1223}
1224
1225static void event_log_skeleton_iface_init (EventLogIface *iface);
1226#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1227G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1228 G_ADD_PRIVATE (EventLogSkeleton)
1229 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
1230
1231#else
1232G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1233 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
1234
1235#endif
1236static void
1237event_log_skeleton_finalize (GObject *object)
1238{
1239 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1240 guint n;
1241 for (n = 0; n < 1; n++)
1242 g_value_unset (&skeleton->priv->properties[n]);
1243 g_free (skeleton->priv->properties);
1244 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1245 if (skeleton->priv->changed_properties_idle_source != NULL)
1246 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1247 g_main_context_unref (skeleton->priv->context);
1248 g_mutex_clear (&skeleton->priv->lock);
1249 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
1250}
1251
1252static void
1253event_log_skeleton_get_property (GObject *object,
1254 guint prop_id,
1255 GValue *value,
1256 GParamSpec *pspec G_GNUC_UNUSED)
1257{
1258 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1259 g_assert (prop_id != 0 && prop_id - 1 < 1);
1260 g_mutex_lock (&skeleton->priv->lock);
1261 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1262 g_mutex_unlock (&skeleton->priv->lock);
1263}
1264
1265static gboolean
1266_event_log_emit_changed (gpointer user_data)
1267{
1268 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
1269 GList *l;
1270 GVariantBuilder builder;
1271 GVariantBuilder invalidated_builder;
1272 guint num_changes;
1273
1274 g_mutex_lock (&skeleton->priv->lock);
1275 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1276 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1277 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1278 {
1279 ChangedProperty *cp = l->data;
1280 GVariant *variant;
1281 const GValue *cur_value;
1282
1283 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1284 if (!_g_value_equal (cur_value, &cp->orig_value))
1285 {
1286 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1287 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1288 g_variant_unref (variant);
1289 num_changes++;
1290 }
1291 }
1292 if (num_changes > 0)
1293 {
1294 GList *connections, *ll;
1295 GVariant *signal_variant;
1296 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.EventLog",
1297 &builder, &invalidated_builder));
1298 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1299 for (ll = connections; ll != NULL; ll = ll->next)
1300 {
1301 GDBusConnection *connection = ll->data;
1302
1303 g_dbus_connection_emit_signal (connection,
1304 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1305 "org.freedesktop.DBus.Properties",
1306 "PropertiesChanged",
1307 signal_variant,
1308 NULL);
1309 }
1310 g_variant_unref (signal_variant);
1311 g_list_free_full (connections, g_object_unref);
1312 }
1313 else
1314 {
1315 g_variant_builder_clear (&builder);
1316 g_variant_builder_clear (&invalidated_builder);
1317 }
1318 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1319 skeleton->priv->changed_properties = NULL;
1320 skeleton->priv->changed_properties_idle_source = NULL;
1321 g_mutex_unlock (&skeleton->priv->lock);
1322 return FALSE;
1323}
1324
1325static void
1326_event_log_schedule_emit_changed (EventLogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1327{
1328 ChangedProperty *cp;
1329 GList *l;
1330 cp = NULL;
1331 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1332 {
1333 ChangedProperty *i_cp = l->data;
1334 if (i_cp->info == info)
1335 {
1336 cp = i_cp;
1337 break;
1338 }
1339 }
1340 if (cp == NULL)
1341 {
1342 cp = g_new0 (ChangedProperty, 1);
1343 cp->prop_id = prop_id;
1344 cp->info = info;
1345 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1346 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1347 g_value_copy (orig_value, &cp->orig_value);
1348 }
1349}
1350
1351static void
1352event_log_skeleton_notify (GObject *object,
1353 GParamSpec *pspec G_GNUC_UNUSED)
1354{
1355 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1356 g_mutex_lock (&skeleton->priv->lock);
1357 if (skeleton->priv->changed_properties != NULL &&
1358 skeleton->priv->changed_properties_idle_source == NULL)
1359 {
1360 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1361 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1362 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _event_log_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1363 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1364 g_source_unref (skeleton->priv->changed_properties_idle_source);
1365 }
1366 g_mutex_unlock (&skeleton->priv->lock);
1367}
1368
1369static void
1370event_log_skeleton_set_property (GObject *object,
1371 guint prop_id,
1372 const GValue *value,
1373 GParamSpec *pspec)
1374{
1375 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1376 g_assert (prop_id != 0 && prop_id - 1 < 1);
1377 g_mutex_lock (&skeleton->priv->lock);
1378 g_object_freeze_notify (object);
1379 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1380 {
1381 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1382 _event_log_schedule_emit_changed (skeleton, _event_log_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1383 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1384 g_object_notify_by_pspec (object, pspec);
1385 }
1386 g_mutex_unlock (&skeleton->priv->lock);
1387 g_object_thaw_notify (object);
1388}
1389
1390static void
1391event_log_skeleton_init (EventLogSkeleton *skeleton)
1392{
1393#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1394 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
1395#else
1396 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
1397#endif
1398
1399 g_mutex_init (&skeleton->priv->lock);
1400 skeleton->priv->context = g_main_context_ref_thread_default ();
1401 skeleton->priv->properties = g_new0 (GValue, 1);
1402 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
1403}
1404
1405static const gchar *
1406event_log_skeleton_get_message (EventLog *object)
1407{
1408 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
1409 const gchar *value;
1410 g_mutex_lock (&skeleton->priv->lock);
1411 value = g_value_get_string (&(skeleton->priv->properties[0]));
1412 g_mutex_unlock (&skeleton->priv->lock);
1413 return value;
1414}
1415
1416static void
1417event_log_skeleton_class_init (EventLogSkeletonClass *klass)
1418{
1419 GObjectClass *gobject_class;
1420 GDBusInterfaceSkeletonClass *skeleton_class;
1421
1422 gobject_class = G_OBJECT_CLASS (klass);
1423 gobject_class->finalize = event_log_skeleton_finalize;
1424 gobject_class->get_property = event_log_skeleton_get_property;
1425 gobject_class->set_property = event_log_skeleton_set_property;
1426 gobject_class->notify = event_log_skeleton_notify;
1427
1428
1429 event_log_override_properties (gobject_class, 1);
1430
1431 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1432 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
1433 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
1434 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
1435 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
1436
1437#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1438 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
1439#endif
1440}
1441
1442static void
1443event_log_skeleton_iface_init (EventLogIface *iface)
1444{
1445 iface->error_event = _event_log_on_signal_error_event;
1446 iface->get_message = event_log_skeleton_get_message;
1447}
1448
1449/**
1450 * event_log_skeleton_new:
1451 *
1452 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
1453 *
1454 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
1455 */
1456EventLog *
1457event_log_skeleton_new (void)
1458{
1459 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
1460}
1461
1462/* ------------------------------------------------------------------------
1463 * Code for Object, ObjectProxy and ObjectSkeleton
1464 * ------------------------------------------------------------------------
1465 */
1466
1467/**
1468 * SECTION:Object
1469 * @title: Object
1470 * @short_description: Specialized GDBusObject types
1471 *
1472 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
1473 */
1474
1475/**
1476 * Object:
1477 *
1478 * The #Object type is a specialized container of interfaces.
1479 */
1480
1481/**
1482 * ObjectIface:
1483 * @parent_iface: The parent interface.
1484 *
1485 * Virtual table for the #Object interface.
1486 */
1487
1488typedef ObjectIface ObjectInterface;
1489G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
1490
1491static void
1492object_default_init (ObjectIface *iface)
1493{
1494 /**
1495 * Object:event-log:
1496 *
1497 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any.
1498 *
1499 * Connect to the #GObject::notify signal to get informed of property changes.
1500 */
1501 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
1502
1503}
1504
1505/**
1506 * object_get_event_log:
1507 * @object: A #Object.
1508 *
1509 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any.
1510 *
1511 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
1512 */
1513EventLog *object_get_event_log (Object *object)
1514{
1515 GDBusInterface *ret;
1516 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
1517 if (ret == NULL)
1518 return NULL;
1519 return EVENT_LOG (ret);
1520}
1521
1522
1523/**
1524 * object_peek_event_log: (skip)
1525 * @object: A #Object.
1526 *
1527 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
1528 *
1529 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
1530 *
1531 * Returns: (transfer none): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
1532 */
1533EventLog *object_peek_event_log (Object *object)
1534{
1535 GDBusInterface *ret;
1536 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
1537 if (ret == NULL)
1538 return NULL;
1539 g_object_unref (ret);
1540 return EVENT_LOG (ret);
1541}
1542
1543
1544static void
1545object_notify (GDBusObject *object, GDBusInterface *interface)
1546{
1547 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
1548 /* info can be NULL if the other end is using a D-Bus interface we don't know
1549 * anything about, for example old generated code in this process talking to
1550 * newer generated code in the other process. */
1551 if (info != NULL)
1552 g_object_notify (G_OBJECT (object), info->hyphen_name);
1553}
1554
1555/**
1556 * ObjectProxy:
1557 *
1558 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
1559 */
1560
1561/**
1562 * ObjectProxyClass:
1563 * @parent_class: The parent class.
1564 *
1565 * Class structure for #ObjectProxy.
1566 */
1567
1568static void
1569object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1570{
1571}
1572
1573static void
1574object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
1575{
1576 iface->interface_added = object_notify;
1577 iface->interface_removed = object_notify;
1578}
1579
1580
1581G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
1582 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
1583 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
1584
1585static void
1586object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
1587{
1588}
1589
1590static void
1591object_proxy_set_property (GObject *gobject,
1592 guint prop_id,
1593 const GValue *value G_GNUC_UNUSED,
1594 GParamSpec *pspec)
1595{
1596 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1597}
1598
1599static void
1600object_proxy_get_property (GObject *gobject,
1601 guint prop_id,
1602 GValue *value,
1603 GParamSpec *pspec)
1604{
1605 ObjectProxy *object = OBJECT_PROXY (gobject);
1606 GDBusInterface *interface;
1607
1608 switch (prop_id)
1609 {
1610 case 1:
1611 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
1612 g_value_take_object (value, interface);
1613 break;
1614
1615 default:
1616 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1617 break;
1618 }
1619}
1620
1621static void
1622object_proxy_class_init (ObjectProxyClass *klass)
1623{
1624 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1625
1626 gobject_class->set_property = object_proxy_set_property;
1627 gobject_class->get_property = object_proxy_get_property;
1628
1629 g_object_class_override_property (gobject_class, 1, "event-log");
1630}
1631
1632/**
1633 * object_proxy_new:
1634 * @connection: A #GDBusConnection.
1635 * @object_path: An object path.
1636 *
1637 * Creates a new proxy object.
1638 *
1639 * Returns: (transfer full): The proxy object.
1640 */
1641ObjectProxy *
1642object_proxy_new (GDBusConnection *connection,
1643 const gchar *object_path)
1644{
1645 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
1646 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1647 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
1648}
1649
1650/**
1651 * ObjectSkeleton:
1652 *
1653 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
1654 */
1655
1656/**
1657 * ObjectSkeletonClass:
1658 * @parent_class: The parent class.
1659 *
1660 * Class structure for #ObjectSkeleton.
1661 */
1662
1663static void
1664object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1665{
1666}
1667
1668
1669static void
1670object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
1671{
1672 iface->interface_added = object_notify;
1673 iface->interface_removed = object_notify;
1674}
1675
1676G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
1677 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
1678 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
1679
1680static void
1681object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
1682{
1683}
1684
1685static void
1686object_skeleton_set_property (GObject *gobject,
1687 guint prop_id,
1688 const GValue *value,
1689 GParamSpec *pspec)
1690{
1691 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1692 GDBusInterfaceSkeleton *interface;
1693
1694 switch (prop_id)
1695 {
1696 case 1:
1697 interface = g_value_get_object (value);
1698 if (interface != NULL)
1699 {
1700 g_warn_if_fail (IS_EVENT_LOG (interface));
1701 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
1702 }
1703 else
1704 {
1705 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
1706 }
1707 break;
1708
1709 default:
1710 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1711 break;
1712 }
1713}
1714
1715static void
1716object_skeleton_get_property (GObject *gobject,
1717 guint prop_id,
1718 GValue *value,
1719 GParamSpec *pspec)
1720{
1721 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1722 GDBusInterface *interface;
1723
1724 switch (prop_id)
1725 {
1726 case 1:
1727 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
1728 g_value_take_object (value, interface);
1729 break;
1730
1731 default:
1732 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1733 break;
1734 }
1735}
1736
1737static void
1738object_skeleton_class_init (ObjectSkeletonClass *klass)
1739{
1740 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1741
1742 gobject_class->set_property = object_skeleton_set_property;
1743 gobject_class->get_property = object_skeleton_get_property;
1744
1745 g_object_class_override_property (gobject_class, 1, "event-log");
1746}
1747
1748/**
1749 * object_skeleton_new:
1750 * @object_path: An object path.
1751 *
1752 * Creates a new skeleton object.
1753 *
1754 * Returns: (transfer full): The skeleton object.
1755 */
1756ObjectSkeleton *
1757object_skeleton_new (const gchar *object_path)
1758{
1759 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1760 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
1761}
1762
1763/**
1764 * object_skeleton_set_event_log:
1765 * @object: A #ObjectSkeleton.
1766 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
1767 *
1768 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object.
1769 */
1770void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
1771{
1772 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
1773}
1774
1775
1776/* ------------------------------------------------------------------------
1777 * Code for ObjectManager client
1778 * ------------------------------------------------------------------------
1779 */
1780
1781/**
1782 * SECTION:ObjectManagerClient
1783 * @title: ObjectManagerClient
1784 * @short_description: Generated GDBusObjectManagerClient type
1785 *
1786 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
1787 */
1788
1789/**
1790 * ObjectManagerClient:
1791 *
1792 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
1793 */
1794
1795/**
1796 * ObjectManagerClientClass:
1797 * @parent_class: The parent class.
1798 *
1799 * Class structure for #ObjectManagerClient.
1800 */
1801
1802G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
1803
1804static void
1805object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
1806{
1807}
1808
1809static void
1810object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
1811{
1812}
1813
1814/**
1815 * object_manager_client_get_proxy_type:
1816 * @manager: A #GDBusObjectManagerClient.
1817 * @object_path: The object path of the remote object (unused).
1818 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
1819 * @user_data: User data (unused).
1820 *
1821 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
1822 *
1823 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
1824 */
1825GType
1826object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
1827{
1828 static gsize once_init_value = 0;
1829 static GHashTable *lookup_hash;
1830 GType ret;
1831
1832 if (interface_name == NULL)
1833 return TYPE_OBJECT_PROXY;
1834 if (g_once_init_enter (&once_init_value))
1835 {
1836 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
1837 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
1838 g_once_init_leave (&once_init_value, 1);
1839 }
1840 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
1841 if (ret == (GType) 0)
1842 ret = G_TYPE_DBUS_PROXY;
1843 return ret;
1844}
1845
1846/**
1847 * object_manager_client_new:
1848 * @connection: A #GDBusConnection.
1849 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1850 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1851 * @object_path: An object path.
1852 * @cancellable: (allow-none): A #GCancellable or %NULL.
1853 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1854 * @user_data: User data to pass to @callback.
1855 *
1856 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
1857 *
1858 * 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.
1859 * You can then call object_manager_client_new_finish() to get the result of the operation.
1860 *
1861 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
1862 */
1863void
1864object_manager_client_new (
1865 GDBusConnection *connection,
1866 GDBusObjectManagerClientFlags flags,
1867 const gchar *name,
1868 const gchar *object_path,
1869 GCancellable *cancellable,
1870 GAsyncReadyCallback callback,
1871 gpointer user_data)
1872{
1873 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
1874}
1875
1876/**
1877 * object_manager_client_new_finish:
1878 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
1879 * @error: Return location for error or %NULL
1880 *
1881 * Finishes an operation started with object_manager_client_new().
1882 *
1883 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1884 */
1885GDBusObjectManager *
1886object_manager_client_new_finish (
1887 GAsyncResult *res,
1888 GError **error)
1889{
1890 GObject *ret;
1891 GObject *source_object;
1892 source_object = g_async_result_get_source_object (res);
1893 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1894 g_object_unref (source_object);
1895 if (ret != NULL)
1896 return G_DBUS_OBJECT_MANAGER (ret);
1897 else
1898 return NULL;
1899}
1900
1901/**
1902 * object_manager_client_new_sync:
1903 * @connection: A #GDBusConnection.
1904 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1905 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1906 * @object_path: An object path.
1907 * @cancellable: (allow-none): A #GCancellable or %NULL.
1908 * @error: Return location for error or %NULL
1909 *
1910 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
1911 *
1912 * The calling thread is blocked until a reply is received.
1913 *
1914 * See object_manager_client_new() for the asynchronous version of this constructor.
1915 *
1916 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1917 */
1918GDBusObjectManager *
1919object_manager_client_new_sync (
1920 GDBusConnection *connection,
1921 GDBusObjectManagerClientFlags flags,
1922 const gchar *name,
1923 const gchar *object_path,
1924 GCancellable *cancellable,
1925 GError **error)
1926{
1927 GInitable *ret;
1928 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
1929 if (ret != NULL)
1930 return G_DBUS_OBJECT_MANAGER (ret);
1931 else
1932 return NULL;
1933}
1934
1935
1936/**
1937 * object_manager_client_new_for_bus:
1938 * @bus_type: A #GBusType.
1939 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1940 * @name: A bus name (well-known or unique).
1941 * @object_path: An object path.
1942 * @cancellable: (allow-none): A #GCancellable or %NULL.
1943 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1944 * @user_data: User data to pass to @callback.
1945 *
1946 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
1947 *
1948 * 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.
1949 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
1950 *
1951 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1952 */
1953void
1954object_manager_client_new_for_bus (
1955 GBusType bus_type,
1956 GDBusObjectManagerClientFlags flags,
1957 const gchar *name,
1958 const gchar *object_path,
1959 GCancellable *cancellable,
1960 GAsyncReadyCallback callback,
1961 gpointer user_data)
1962{
1963 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
1964}
1965
1966/**
1967 * object_manager_client_new_for_bus_finish:
1968 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
1969 * @error: Return location for error or %NULL
1970 *
1971 * Finishes an operation started with object_manager_client_new_for_bus().
1972 *
1973 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1974 */
1975GDBusObjectManager *
1976object_manager_client_new_for_bus_finish (
1977 GAsyncResult *res,
1978 GError **error)
1979{
1980 GObject *ret;
1981 GObject *source_object;
1982 source_object = g_async_result_get_source_object (res);
1983 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1984 g_object_unref (source_object);
1985 if (ret != NULL)
1986 return G_DBUS_OBJECT_MANAGER (ret);
1987 else
1988 return NULL;
1989}
1990
1991/**
1992 * object_manager_client_new_for_bus_sync:
1993 * @bus_type: A #GBusType.
1994 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1995 * @name: A bus name (well-known or unique).
1996 * @object_path: An object path.
1997 * @cancellable: (allow-none): A #GCancellable or %NULL.
1998 * @error: Return location for error or %NULL
1999 *
2000 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2001 *
2002 * The calling thread is blocked until a reply is received.
2003 *
2004 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
2005 *
2006 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
2007 */
2008GDBusObjectManager *
2009object_manager_client_new_for_bus_sync (
2010 GBusType bus_type,
2011 GDBusObjectManagerClientFlags flags,
2012 const gchar *name,
2013 const gchar *object_path,
2014 GCancellable *cancellable,
2015 GError **error)
2016{
2017 GInitable *ret;
2018 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
2019 if (ret != NULL)
2020 return G_DBUS_OBJECT_MANAGER (ret);
2021 else
2022 return NULL;
2023}
2024
2025