Add sample application[phone]
[staging/soundmanager.git] / sample / phone / telephony-binding / gdbus / ofono_manager_interface.c
1 /*
2  * Generated by gdbus-codegen 2.50.3. 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 "ofono_manager_interface.h"
12
13 #include <string.h>
14 #ifdef G_OS_UNIX
15 #  include <gio/gunixfdlist.h>
16 #endif
17
18 typedef struct
19 {
20   GDBusArgInfo parent_struct;
21   gboolean use_gvariant;
22 } _ExtendedGDBusArgInfo;
23
24 typedef struct
25 {
26   GDBusMethodInfo parent_struct;
27   const gchar *signal_name;
28   gboolean pass_fdlist;
29 } _ExtendedGDBusMethodInfo;
30
31 typedef struct
32 {
33   GDBusSignalInfo parent_struct;
34   const gchar *signal_name;
35 } _ExtendedGDBusSignalInfo;
36
37 typedef struct
38 {
39   GDBusPropertyInfo parent_struct;
40   const gchar *hyphen_name;
41   gboolean use_gvariant;
42 } _ExtendedGDBusPropertyInfo;
43
44 typedef struct
45 {
46   GDBusInterfaceInfo parent_struct;
47   const gchar *hyphen_name;
48 } _ExtendedGDBusInterfaceInfo;
49
50 typedef struct
51 {
52   const _ExtendedGDBusPropertyInfo *info;
53   guint prop_id;
54   GValue orig_value; /* the value before the change */
55 } ChangedProperty;
56
57 static void
58 _changed_property_free (ChangedProperty *data)
59 {
60   g_value_unset (&data->orig_value);
61   g_free (data);
62 }
63
64 static gboolean
65 _g_strv_equal0 (gchar **a, gchar **b)
66 {
67   gboolean ret = FALSE;
68   guint n;
69   if (a == NULL && b == NULL)
70     {
71       ret = TRUE;
72       goto out;
73     }
74   if (a == NULL || b == NULL)
75     goto out;
76   if (g_strv_length (a) != g_strv_length (b))
77     goto out;
78   for (n = 0; a[n] != NULL; n++)
79     if (g_strcmp0 (a[n], b[n]) != 0)
80       goto out;
81   ret = TRUE;
82 out:
83   return ret;
84 }
85
86 static gboolean
87 _g_variant_equal0 (GVariant *a, GVariant *b)
88 {
89   gboolean ret = FALSE;
90   if (a == NULL && b == NULL)
91     {
92       ret = TRUE;
93       goto out;
94     }
95   if (a == NULL || b == NULL)
96     goto out;
97   ret = g_variant_equal (a, b);
98 out:
99   return ret;
100 }
101
102 G_GNUC_UNUSED static gboolean
103 _g_value_equal (const GValue *a, const GValue *b)
104 {
105   gboolean ret = FALSE;
106   g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107   switch (G_VALUE_TYPE (a))
108     {
109       case G_TYPE_BOOLEAN:
110         ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111         break;
112       case G_TYPE_UCHAR:
113         ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114         break;
115       case G_TYPE_INT:
116         ret = (g_value_get_int (a) == g_value_get_int (b));
117         break;
118       case G_TYPE_UINT:
119         ret = (g_value_get_uint (a) == g_value_get_uint (b));
120         break;
121       case G_TYPE_INT64:
122         ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123         break;
124       case G_TYPE_UINT64:
125         ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126         break;
127       case G_TYPE_DOUBLE:
128         {
129           /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130           gdouble da = g_value_get_double (a);
131           gdouble db = g_value_get_double (b);
132           ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133         }
134         break;
135       case G_TYPE_STRING:
136         ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137         break;
138       case G_TYPE_VARIANT:
139         ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140         break;
141       default:
142         if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143           ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144         else
145           g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146         break;
147     }
148   return ret;
149 }
150
151 /* ------------------------------------------------------------------------
152  * Code for interface org.ofono.Manager
153  * ------------------------------------------------------------------------
154  */
155
156 /**
157  * SECTION:OrgOfonoManager
158  * @title: OrgOfonoManager
159  * @short_description: Generated C code for the org.ofono.Manager D-Bus interface
160  *
161  * This section contains code for working with the <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link> D-Bus interface in C.
162  */
163
164 /* ---- Introspection data for org.ofono.Manager ---- */
165
166 static const _ExtendedGDBusArgInfo _org_ofono_manager_method_info_get_modems_OUT_ARG_unnamed_arg0 =
167 {
168   {
169     -1,
170     (gchar *) "unnamed_arg0",
171     (gchar *) "a(oa{sv})",
172     NULL
173   },
174   FALSE
175 };
176
177 static const _ExtendedGDBusArgInfo * const _org_ofono_manager_method_info_get_modems_OUT_ARG_pointers[] =
178 {
179   &_org_ofono_manager_method_info_get_modems_OUT_ARG_unnamed_arg0,
180   NULL
181 };
182
183 static const _ExtendedGDBusMethodInfo _org_ofono_manager_method_info_get_modems =
184 {
185   {
186     -1,
187     (gchar *) "GetModems",
188     NULL,
189     (GDBusArgInfo **) &_org_ofono_manager_method_info_get_modems_OUT_ARG_pointers,
190     NULL
191   },
192   "handle-get-modems",
193   FALSE
194 };
195
196 static const _ExtendedGDBusMethodInfo * const _org_ofono_manager_method_info_pointers[] =
197 {
198   &_org_ofono_manager_method_info_get_modems,
199   NULL
200 };
201
202 static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg0 =
203 {
204   {
205     -1,
206     (gchar *) "unnamed_arg0",
207     (gchar *) "o",
208     NULL
209   },
210   FALSE
211 };
212
213 static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg1 =
214 {
215   {
216     -1,
217     (gchar *) "unnamed_arg1",
218     (gchar *) "a{sv}",
219     NULL
220   },
221   FALSE
222 };
223
224 static const _ExtendedGDBusArgInfo * const _org_ofono_manager_signal_info_modem_added_ARG_pointers[] =
225 {
226   &_org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg0,
227   &_org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg1,
228   NULL
229 };
230
231 static const _ExtendedGDBusSignalInfo _org_ofono_manager_signal_info_modem_added =
232 {
233   {
234     -1,
235     (gchar *) "ModemAdded",
236     (GDBusArgInfo **) &_org_ofono_manager_signal_info_modem_added_ARG_pointers,
237     NULL
238   },
239   "modem-added"
240 };
241
242 static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_removed_ARG_unnamed_arg0 =
243 {
244   {
245     -1,
246     (gchar *) "unnamed_arg0",
247     (gchar *) "o",
248     NULL
249   },
250   FALSE
251 };
252
253 static const _ExtendedGDBusArgInfo * const _org_ofono_manager_signal_info_modem_removed_ARG_pointers[] =
254 {
255   &_org_ofono_manager_signal_info_modem_removed_ARG_unnamed_arg0,
256   NULL
257 };
258
259 static const _ExtendedGDBusSignalInfo _org_ofono_manager_signal_info_modem_removed =
260 {
261   {
262     -1,
263     (gchar *) "ModemRemoved",
264     (GDBusArgInfo **) &_org_ofono_manager_signal_info_modem_removed_ARG_pointers,
265     NULL
266   },
267   "modem-removed"
268 };
269
270 static const _ExtendedGDBusSignalInfo * const _org_ofono_manager_signal_info_pointers[] =
271 {
272   &_org_ofono_manager_signal_info_modem_added,
273   &_org_ofono_manager_signal_info_modem_removed,
274   NULL
275 };
276
277 static const _ExtendedGDBusInterfaceInfo _org_ofono_manager_interface_info =
278 {
279   {
280     -1,
281     (gchar *) "org.ofono.Manager",
282     (GDBusMethodInfo **) &_org_ofono_manager_method_info_pointers,
283     (GDBusSignalInfo **) &_org_ofono_manager_signal_info_pointers,
284     NULL,
285     NULL
286   },
287   "org-ofono-manager",
288 };
289
290
291 /**
292  * org_ofono_manager_interface_info:
293  *
294  * Gets a machine-readable description of the <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link> D-Bus interface.
295  *
296  * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
297  */
298 GDBusInterfaceInfo *
299 org_ofono_manager_interface_info (void)
300 {
301   return (GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct;
302 }
303
304 /**
305  * org_ofono_manager_override_properties:
306  * @klass: The class structure for a #GObject<!-- -->-derived class.
307  * @property_id_begin: The property id to assign to the first overridden property.
308  *
309  * Overrides all #GObject properties in the #OrgOfonoManager interface for a concrete class.
310  * The properties are overridden in the order they are defined.
311  *
312  * Returns: The last property id.
313  */
314 guint
315 org_ofono_manager_override_properties (GObjectClass *klass, guint property_id_begin)
316 {
317   return property_id_begin - 1;
318 }
319
320
321
322 /**
323  * OrgOfonoManager:
324  *
325  * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>.
326  */
327
328 /**
329  * OrgOfonoManagerIface:
330  * @parent_iface: The parent interface.
331  * @handle_get_modems: Handler for the #OrgOfonoManager::handle-get-modems signal.
332  * @modem_added: Handler for the #OrgOfonoManager::modem-added signal.
333  * @modem_removed: Handler for the #OrgOfonoManager::modem-removed signal.
334  *
335  * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>.
336  */
337
338 typedef OrgOfonoManagerIface OrgOfonoManagerInterface;
339 G_DEFINE_INTERFACE (OrgOfonoManager, org_ofono_manager, G_TYPE_OBJECT);
340
341 static void
342 org_ofono_manager_default_init (OrgOfonoManagerIface *iface)
343 {
344   /* GObject signals for incoming D-Bus method calls: */
345   /**
346    * OrgOfonoManager::handle-get-modems:
347    * @object: A #OrgOfonoManager.
348    * @invocation: A #GDBusMethodInvocation.
349    *
350    * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-ofono-Manager.GetModems">GetModems()</link> D-Bus method.
351    *
352    * 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 org_ofono_manager_complete_get_modems() 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.
353    *
354    * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
355    */
356   g_signal_new ("handle-get-modems",
357     G_TYPE_FROM_INTERFACE (iface),
358     G_SIGNAL_RUN_LAST,
359     G_STRUCT_OFFSET (OrgOfonoManagerIface, handle_get_modems),
360     g_signal_accumulator_true_handled,
361     NULL,
362     g_cclosure_marshal_generic,
363     G_TYPE_BOOLEAN,
364     1,
365     G_TYPE_DBUS_METHOD_INVOCATION);
366
367   /* GObject signals for received D-Bus signals: */
368   /**
369    * OrgOfonoManager::modem-added:
370    * @object: A #OrgOfonoManager.
371    * @arg_unnamed_arg0: Argument.
372    * @arg_unnamed_arg1: Argument.
373    *
374    * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-ofono-Manager.ModemAdded">"ModemAdded"</link> is received.
375    *
376    * 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.
377    */
378   g_signal_new ("modem-added",
379     G_TYPE_FROM_INTERFACE (iface),
380     G_SIGNAL_RUN_LAST,
381     G_STRUCT_OFFSET (OrgOfonoManagerIface, modem_added),
382     NULL,
383     NULL,
384     g_cclosure_marshal_generic,
385     G_TYPE_NONE,
386     2, G_TYPE_STRING, G_TYPE_VARIANT);
387
388   /**
389    * OrgOfonoManager::modem-removed:
390    * @object: A #OrgOfonoManager.
391    * @arg_unnamed_arg0: Argument.
392    *
393    * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-ofono-Manager.ModemRemoved">"ModemRemoved"</link> is received.
394    *
395    * 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.
396    */
397   g_signal_new ("modem-removed",
398     G_TYPE_FROM_INTERFACE (iface),
399     G_SIGNAL_RUN_LAST,
400     G_STRUCT_OFFSET (OrgOfonoManagerIface, modem_removed),
401     NULL,
402     NULL,
403     g_cclosure_marshal_generic,
404     G_TYPE_NONE,
405     1, G_TYPE_STRING);
406
407 }
408
409 /**
410  * org_ofono_manager_emit_modem_added:
411  * @object: A #OrgOfonoManager.
412  * @arg_unnamed_arg0: Argument to pass with the signal.
413  * @arg_unnamed_arg1: Argument to pass with the signal.
414  *
415  * Emits the <link linkend="gdbus-signal-org-ofono-Manager.ModemAdded">"ModemAdded"</link> D-Bus signal.
416  */
417 void
418 org_ofono_manager_emit_modem_added (
419     OrgOfonoManager *object,
420     const gchar *arg_unnamed_arg0,
421     GVariant *arg_unnamed_arg1)
422 {
423   g_signal_emit_by_name (object, "modem-added", arg_unnamed_arg0, arg_unnamed_arg1);
424 }
425
426 /**
427  * org_ofono_manager_emit_modem_removed:
428  * @object: A #OrgOfonoManager.
429  * @arg_unnamed_arg0: Argument to pass with the signal.
430  *
431  * Emits the <link linkend="gdbus-signal-org-ofono-Manager.ModemRemoved">"ModemRemoved"</link> D-Bus signal.
432  */
433 void
434 org_ofono_manager_emit_modem_removed (
435     OrgOfonoManager *object,
436     const gchar *arg_unnamed_arg0)
437 {
438   g_signal_emit_by_name (object, "modem-removed", arg_unnamed_arg0);
439 }
440
441 /**
442  * org_ofono_manager_call_get_modems:
443  * @proxy: A #OrgOfonoManagerProxy.
444  * @cancellable: (allow-none): A #GCancellable or %NULL.
445  * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
446  * @user_data: User data to pass to @callback.
447  *
448  * Asynchronously invokes the <link linkend="gdbus-method-org-ofono-Manager.GetModems">GetModems()</link> D-Bus method on @proxy.
449  * 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.
450  * You can then call org_ofono_manager_call_get_modems_finish() to get the result of the operation.
451  *
452  * See org_ofono_manager_call_get_modems_sync() for the synchronous, blocking version of this method.
453  */
454 void
455 org_ofono_manager_call_get_modems (
456     OrgOfonoManager *proxy,
457     GCancellable *cancellable,
458     GAsyncReadyCallback callback,
459     gpointer user_data)
460 {
461   g_dbus_proxy_call (G_DBUS_PROXY (proxy),
462     "GetModems",
463     g_variant_new ("()"),
464     G_DBUS_CALL_FLAGS_NONE,
465     -1,
466     cancellable,
467     callback,
468     user_data);
469 }
470
471 /**
472  * org_ofono_manager_call_get_modems_finish:
473  * @proxy: A #OrgOfonoManagerProxy.
474  * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore.
475  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_call_get_modems().
476  * @error: Return location for error or %NULL.
477  *
478  * Finishes an operation started with org_ofono_manager_call_get_modems().
479  *
480  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
481  */
482 gboolean
483 org_ofono_manager_call_get_modems_finish (
484     OrgOfonoManager *proxy,
485     GVariant **out_unnamed_arg0,
486     GAsyncResult *res,
487     GError **error)
488 {
489   GVariant *_ret;
490   _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
491   if (_ret == NULL)
492     goto _out;
493   g_variant_get (_ret,
494                  "(@a(oa{sv}))",
495                  out_unnamed_arg0);
496   g_variant_unref (_ret);
497 _out:
498   return _ret != NULL;
499 }
500
501 /**
502  * org_ofono_manager_call_get_modems_sync:
503  * @proxy: A #OrgOfonoManagerProxy.
504  * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore.
505  * @cancellable: (allow-none): A #GCancellable or %NULL.
506  * @error: Return location for error or %NULL.
507  *
508  * Synchronously invokes the <link linkend="gdbus-method-org-ofono-Manager.GetModems">GetModems()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
509  *
510  * See org_ofono_manager_call_get_modems() for the asynchronous version of this method.
511  *
512  * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
513  */
514 gboolean
515 org_ofono_manager_call_get_modems_sync (
516     OrgOfonoManager *proxy,
517     GVariant **out_unnamed_arg0,
518     GCancellable *cancellable,
519     GError **error)
520 {
521   GVariant *_ret;
522   _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
523     "GetModems",
524     g_variant_new ("()"),
525     G_DBUS_CALL_FLAGS_NONE,
526     -1,
527     cancellable,
528     error);
529   if (_ret == NULL)
530     goto _out;
531   g_variant_get (_ret,
532                  "(@a(oa{sv}))",
533                  out_unnamed_arg0);
534   g_variant_unref (_ret);
535 _out:
536   return _ret != NULL;
537 }
538
539 /**
540  * org_ofono_manager_complete_get_modems:
541  * @object: A #OrgOfonoManager.
542  * @invocation: (transfer full): A #GDBusMethodInvocation.
543  * @unnamed_arg0: Parameter to return.
544  *
545  * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-ofono-Manager.GetModems">GetModems()</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.
546  *
547  * This method will free @invocation, you cannot use it afterwards.
548  */
549 void
550 org_ofono_manager_complete_get_modems (
551     OrgOfonoManager *object,
552     GDBusMethodInvocation *invocation,
553     GVariant *unnamed_arg0)
554 {
555   g_dbus_method_invocation_return_value (invocation,
556     g_variant_new ("(@a(oa{sv}))",
557                    unnamed_arg0));
558 }
559
560 /* ------------------------------------------------------------------------ */
561
562 /**
563  * OrgOfonoManagerProxy:
564  *
565  * The #OrgOfonoManagerProxy structure contains only private data and should only be accessed using the provided API.
566  */
567
568 /**
569  * OrgOfonoManagerProxyClass:
570  * @parent_class: The parent class.
571  *
572  * Class structure for #OrgOfonoManagerProxy.
573  */
574
575 struct _OrgOfonoManagerProxyPrivate
576 {
577   GData *qdata;
578 };
579
580 static void org_ofono_manager_proxy_iface_init (OrgOfonoManagerIface *iface);
581
582 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
583 G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerProxy, org_ofono_manager_proxy, G_TYPE_DBUS_PROXY,
584                          G_ADD_PRIVATE (OrgOfonoManagerProxy)
585                          G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_proxy_iface_init));
586
587 #else
588 G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerProxy, org_ofono_manager_proxy, G_TYPE_DBUS_PROXY,
589                          G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_proxy_iface_init));
590
591 #endif
592 static void
593 org_ofono_manager_proxy_finalize (GObject *object)
594 {
595   OrgOfonoManagerProxy *proxy = ORG_OFONO_MANAGER_PROXY (object);
596   g_datalist_clear (&proxy->priv->qdata);
597   G_OBJECT_CLASS (org_ofono_manager_proxy_parent_class)->finalize (object);
598 }
599
600 static void
601 org_ofono_manager_proxy_get_property (GObject      *object,
602   guint         prop_id,
603   GValue       *value,
604   GParamSpec   *pspec G_GNUC_UNUSED)
605 {
606 }
607
608 static void
609 org_ofono_manager_proxy_set_property (GObject      *object,
610   guint         prop_id,
611   const GValue *value,
612   GParamSpec   *pspec G_GNUC_UNUSED)
613 {
614 }
615
616 static void
617 org_ofono_manager_proxy_g_signal (GDBusProxy *proxy,
618   const gchar *sender_name G_GNUC_UNUSED,
619   const gchar *signal_name,
620   GVariant *parameters)
621 {
622   _ExtendedGDBusSignalInfo *info;
623   GVariantIter iter;
624   GVariant *child;
625   GValue *paramv;
626   guint num_params;
627   guint n;
628   guint signal_id;
629   info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct, signal_name);
630   if (info == NULL)
631     return;
632   num_params = g_variant_n_children (parameters);
633   paramv = g_new0 (GValue, num_params + 1);
634   g_value_init (&paramv[0], TYPE_ORG_OFONO_MANAGER);
635   g_value_set_object (&paramv[0], proxy);
636   g_variant_iter_init (&iter, parameters);
637   n = 1;
638   while ((child = g_variant_iter_next_value (&iter)) != NULL)
639     {
640       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
641       if (arg_info->use_gvariant)
642         {
643           g_value_init (&paramv[n], G_TYPE_VARIANT);
644           g_value_set_variant (&paramv[n], child);
645           n++;
646         }
647       else
648         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
649       g_variant_unref (child);
650     }
651   signal_id = g_signal_lookup (info->signal_name, TYPE_ORG_OFONO_MANAGER);
652   g_signal_emitv (paramv, signal_id, 0, NULL);
653   for (n = 0; n < num_params + 1; n++)
654     g_value_unset (&paramv[n]);
655   g_free (paramv);
656 }
657
658 static void
659 org_ofono_manager_proxy_g_properties_changed (GDBusProxy *_proxy,
660   GVariant *changed_properties,
661   const gchar *const *invalidated_properties)
662 {
663   OrgOfonoManagerProxy *proxy = ORG_OFONO_MANAGER_PROXY (_proxy);
664   guint n;
665   const gchar *key;
666   GVariantIter *iter;
667   _ExtendedGDBusPropertyInfo *info;
668   g_variant_get (changed_properties, "a{sv}", &iter);
669   while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
670     {
671       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct, key);
672       g_datalist_remove_data (&proxy->priv->qdata, key);
673       if (info != NULL)
674         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
675     }
676   g_variant_iter_free (iter);
677   for (n = 0; invalidated_properties[n] != NULL; n++)
678     {
679       info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct, invalidated_properties[n]);
680       g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
681       if (info != NULL)
682         g_object_notify (G_OBJECT (proxy), info->hyphen_name);
683     }
684 }
685
686 static void
687 org_ofono_manager_proxy_init (OrgOfonoManagerProxy *proxy)
688 {
689 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
690   proxy->priv = org_ofono_manager_proxy_get_instance_private (proxy);
691 #else
692   proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ORG_OFONO_MANAGER_PROXY, OrgOfonoManagerProxyPrivate);
693 #endif
694
695   g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), org_ofono_manager_interface_info ());
696 }
697
698 static void
699 org_ofono_manager_proxy_class_init (OrgOfonoManagerProxyClass *klass)
700 {
701   GObjectClass *gobject_class;
702   GDBusProxyClass *proxy_class;
703
704   gobject_class = G_OBJECT_CLASS (klass);
705   gobject_class->finalize     = org_ofono_manager_proxy_finalize;
706   gobject_class->get_property = org_ofono_manager_proxy_get_property;
707   gobject_class->set_property = org_ofono_manager_proxy_set_property;
708
709   proxy_class = G_DBUS_PROXY_CLASS (klass);
710   proxy_class->g_signal = org_ofono_manager_proxy_g_signal;
711   proxy_class->g_properties_changed = org_ofono_manager_proxy_g_properties_changed;
712
713 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
714   g_type_class_add_private (klass, sizeof (OrgOfonoManagerProxyPrivate));
715 #endif
716 }
717
718 static void
719 org_ofono_manager_proxy_iface_init (OrgOfonoManagerIface *iface)
720 {
721 }
722
723 /**
724  * org_ofono_manager_proxy_new:
725  * @connection: A #GDBusConnection.
726  * @flags: Flags from the #GDBusProxyFlags enumeration.
727  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
728  * @object_path: An object path.
729  * @cancellable: (allow-none): A #GCancellable or %NULL.
730  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
731  * @user_data: User data to pass to @callback.
732  *
733  * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>. See g_dbus_proxy_new() for more details.
734  *
735  * 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.
736  * You can then call org_ofono_manager_proxy_new_finish() to get the result of the operation.
737  *
738  * See org_ofono_manager_proxy_new_sync() for the synchronous, blocking version of this constructor.
739  */
740 void
741 org_ofono_manager_proxy_new (
742     GDBusConnection     *connection,
743     GDBusProxyFlags      flags,
744     const gchar         *name,
745     const gchar         *object_path,
746     GCancellable        *cancellable,
747     GAsyncReadyCallback  callback,
748     gpointer             user_data)
749 {
750   g_async_initable_new_async (TYPE_ORG_OFONO_MANAGER_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.ofono.Manager", NULL);
751 }
752
753 /**
754  * org_ofono_manager_proxy_new_finish:
755  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_proxy_new().
756  * @error: Return location for error or %NULL
757  *
758  * Finishes an operation started with org_ofono_manager_proxy_new().
759  *
760  * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set.
761  */
762 OrgOfonoManager *
763 org_ofono_manager_proxy_new_finish (
764     GAsyncResult        *res,
765     GError             **error)
766 {
767   GObject *ret;
768   GObject *source_object;
769   source_object = g_async_result_get_source_object (res);
770   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
771   g_object_unref (source_object);
772   if (ret != NULL)
773     return ORG_OFONO_MANAGER (ret);
774   else
775     return NULL;
776 }
777
778 /**
779  * org_ofono_manager_proxy_new_sync:
780  * @connection: A #GDBusConnection.
781  * @flags: Flags from the #GDBusProxyFlags enumeration.
782  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
783  * @object_path: An object path.
784  * @cancellable: (allow-none): A #GCancellable or %NULL.
785  * @error: Return location for error or %NULL
786  *
787  * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>. See g_dbus_proxy_new_sync() for more details.
788  *
789  * The calling thread is blocked until a reply is received.
790  *
791  * See org_ofono_manager_proxy_new() for the asynchronous version of this constructor.
792  *
793  * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set.
794  */
795 OrgOfonoManager *
796 org_ofono_manager_proxy_new_sync (
797     GDBusConnection     *connection,
798     GDBusProxyFlags      flags,
799     const gchar         *name,
800     const gchar         *object_path,
801     GCancellable        *cancellable,
802     GError             **error)
803 {
804   GInitable *ret;
805   ret = g_initable_new (TYPE_ORG_OFONO_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.ofono.Manager", NULL);
806   if (ret != NULL)
807     return ORG_OFONO_MANAGER (ret);
808   else
809     return NULL;
810 }
811
812
813 /**
814  * org_ofono_manager_proxy_new_for_bus:
815  * @bus_type: A #GBusType.
816  * @flags: Flags from the #GDBusProxyFlags enumeration.
817  * @name: A bus name (well-known or unique).
818  * @object_path: An object path.
819  * @cancellable: (allow-none): A #GCancellable or %NULL.
820  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
821  * @user_data: User data to pass to @callback.
822  *
823  * Like org_ofono_manager_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
824  *
825  * 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.
826  * You can then call org_ofono_manager_proxy_new_for_bus_finish() to get the result of the operation.
827  *
828  * See org_ofono_manager_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
829  */
830 void
831 org_ofono_manager_proxy_new_for_bus (
832     GBusType             bus_type,
833     GDBusProxyFlags      flags,
834     const gchar         *name,
835     const gchar         *object_path,
836     GCancellable        *cancellable,
837     GAsyncReadyCallback  callback,
838     gpointer             user_data)
839 {
840   g_async_initable_new_async (TYPE_ORG_OFONO_MANAGER_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.ofono.Manager", NULL);
841 }
842
843 /**
844  * org_ofono_manager_proxy_new_for_bus_finish:
845  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_proxy_new_for_bus().
846  * @error: Return location for error or %NULL
847  *
848  * Finishes an operation started with org_ofono_manager_proxy_new_for_bus().
849  *
850  * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set.
851  */
852 OrgOfonoManager *
853 org_ofono_manager_proxy_new_for_bus_finish (
854     GAsyncResult        *res,
855     GError             **error)
856 {
857   GObject *ret;
858   GObject *source_object;
859   source_object = g_async_result_get_source_object (res);
860   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
861   g_object_unref (source_object);
862   if (ret != NULL)
863     return ORG_OFONO_MANAGER (ret);
864   else
865     return NULL;
866 }
867
868 /**
869  * org_ofono_manager_proxy_new_for_bus_sync:
870  * @bus_type: A #GBusType.
871  * @flags: Flags from the #GDBusProxyFlags enumeration.
872  * @name: A bus name (well-known or unique).
873  * @object_path: An object path.
874  * @cancellable: (allow-none): A #GCancellable or %NULL.
875  * @error: Return location for error or %NULL
876  *
877  * Like org_ofono_manager_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
878  *
879  * The calling thread is blocked until a reply is received.
880  *
881  * See org_ofono_manager_proxy_new_for_bus() for the asynchronous version of this constructor.
882  *
883  * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set.
884  */
885 OrgOfonoManager *
886 org_ofono_manager_proxy_new_for_bus_sync (
887     GBusType             bus_type,
888     GDBusProxyFlags      flags,
889     const gchar         *name,
890     const gchar         *object_path,
891     GCancellable        *cancellable,
892     GError             **error)
893 {
894   GInitable *ret;
895   ret = g_initable_new (TYPE_ORG_OFONO_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.ofono.Manager", NULL);
896   if (ret != NULL)
897     return ORG_OFONO_MANAGER (ret);
898   else
899     return NULL;
900 }
901
902
903 /* ------------------------------------------------------------------------ */
904
905 /**
906  * OrgOfonoManagerSkeleton:
907  *
908  * The #OrgOfonoManagerSkeleton structure contains only private data and should only be accessed using the provided API.
909  */
910
911 /**
912  * OrgOfonoManagerSkeletonClass:
913  * @parent_class: The parent class.
914  *
915  * Class structure for #OrgOfonoManagerSkeleton.
916  */
917
918 struct _OrgOfonoManagerSkeletonPrivate
919 {
920   GValue *properties;
921   GList *changed_properties;
922   GSource *changed_properties_idle_source;
923   GMainContext *context;
924   GMutex lock;
925 };
926
927 static void
928 _org_ofono_manager_skeleton_handle_method_call (
929   GDBusConnection *connection G_GNUC_UNUSED,
930   const gchar *sender G_GNUC_UNUSED,
931   const gchar *object_path G_GNUC_UNUSED,
932   const gchar *interface_name,
933   const gchar *method_name,
934   GVariant *parameters,
935   GDBusMethodInvocation *invocation,
936   gpointer user_data)
937 {
938   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (user_data);
939   _ExtendedGDBusMethodInfo *info;
940   GVariantIter iter;
941   GVariant *child;
942   GValue *paramv;
943   guint num_params;
944   guint num_extra;
945   guint n;
946   guint signal_id;
947   GValue return_value = G_VALUE_INIT;
948   info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
949   g_assert (info != NULL);
950   num_params = g_variant_n_children (parameters);
951   num_extra = info->pass_fdlist ? 3 : 2;  paramv = g_new0 (GValue, num_params + num_extra);
952   n = 0;
953   g_value_init (&paramv[n], TYPE_ORG_OFONO_MANAGER);
954   g_value_set_object (&paramv[n++], skeleton);
955   g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
956   g_value_set_object (&paramv[n++], invocation);
957   if (info->pass_fdlist)
958     {
959 #ifdef G_OS_UNIX
960       g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
961       g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
962 #else
963       g_assert_not_reached ();
964 #endif
965     }
966   g_variant_iter_init (&iter, parameters);
967   while ((child = g_variant_iter_next_value (&iter)) != NULL)
968     {
969       _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
970       if (arg_info->use_gvariant)
971         {
972           g_value_init (&paramv[n], G_TYPE_VARIANT);
973           g_value_set_variant (&paramv[n], child);
974           n++;
975         }
976       else
977         g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
978       g_variant_unref (child);
979     }
980   signal_id = g_signal_lookup (info->signal_name, TYPE_ORG_OFONO_MANAGER);
981   g_value_init (&return_value, G_TYPE_BOOLEAN);
982   g_signal_emitv (paramv, signal_id, 0, &return_value);
983   if (!g_value_get_boolean (&return_value))
984     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);
985   g_value_unset (&return_value);
986   for (n = 0; n < num_params + num_extra; n++)
987     g_value_unset (&paramv[n]);
988   g_free (paramv);
989 }
990
991 static GVariant *
992 _org_ofono_manager_skeleton_handle_get_property (
993   GDBusConnection *connection G_GNUC_UNUSED,
994   const gchar *sender G_GNUC_UNUSED,
995   const gchar *object_path G_GNUC_UNUSED,
996   const gchar *interface_name G_GNUC_UNUSED,
997   const gchar *property_name,
998   GError **error,
999   gpointer user_data)
1000 {
1001   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (user_data);
1002   GValue value = G_VALUE_INIT;
1003   GParamSpec *pspec;
1004   _ExtendedGDBusPropertyInfo *info;
1005   GVariant *ret;
1006   ret = NULL;
1007   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct, property_name);
1008   g_assert (info != NULL);
1009   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1010   if (pspec == NULL)
1011     {
1012       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1013     }
1014   else
1015     {
1016       g_value_init (&value, pspec->value_type);
1017       g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1018       ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1019       g_value_unset (&value);
1020     }
1021   return ret;
1022 }
1023
1024 static gboolean
1025 _org_ofono_manager_skeleton_handle_set_property (
1026   GDBusConnection *connection G_GNUC_UNUSED,
1027   const gchar *sender G_GNUC_UNUSED,
1028   const gchar *object_path G_GNUC_UNUSED,
1029   const gchar *interface_name G_GNUC_UNUSED,
1030   const gchar *property_name,
1031   GVariant *variant,
1032   GError **error,
1033   gpointer user_data)
1034 {
1035   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (user_data);
1036   GValue value = G_VALUE_INIT;
1037   GParamSpec *pspec;
1038   _ExtendedGDBusPropertyInfo *info;
1039   gboolean ret;
1040   ret = FALSE;
1041   info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct, property_name);
1042   g_assert (info != NULL);
1043   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1044   if (pspec == NULL)
1045     {
1046       g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1047     }
1048   else
1049     {
1050       if (info->use_gvariant)
1051         g_value_set_variant (&value, variant);
1052       else
1053         g_dbus_gvariant_to_gvalue (variant, &value);
1054       g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1055       g_value_unset (&value);
1056       ret = TRUE;
1057     }
1058   return ret;
1059 }
1060
1061 static const GDBusInterfaceVTable _org_ofono_manager_skeleton_vtable =
1062 {
1063   _org_ofono_manager_skeleton_handle_method_call,
1064   _org_ofono_manager_skeleton_handle_get_property,
1065   _org_ofono_manager_skeleton_handle_set_property,
1066   {NULL}
1067 };
1068
1069 static GDBusInterfaceInfo *
1070 org_ofono_manager_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1071 {
1072   return org_ofono_manager_interface_info ();
1073 }
1074
1075 static GDBusInterfaceVTable *
1076 org_ofono_manager_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1077 {
1078   return (GDBusInterfaceVTable *) &_org_ofono_manager_skeleton_vtable;
1079 }
1080
1081 static GVariant *
1082 org_ofono_manager_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1083 {
1084   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (_skeleton);
1085
1086   GVariantBuilder builder;
1087   guint n;
1088   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1089   if (_org_ofono_manager_interface_info.parent_struct.properties == NULL)
1090     goto out;
1091   for (n = 0; _org_ofono_manager_interface_info.parent_struct.properties[n] != NULL; n++)
1092     {
1093       GDBusPropertyInfo *info = _org_ofono_manager_interface_info.parent_struct.properties[n];
1094       if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1095         {
1096           GVariant *value;
1097           value = _org_ofono_manager_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.ofono.Manager", info->name, NULL, skeleton);
1098           if (value != NULL)
1099             {
1100               g_variant_take_ref (value);
1101               g_variant_builder_add (&builder, "{sv}", info->name, value);
1102               g_variant_unref (value);
1103             }
1104         }
1105     }
1106 out:
1107   return g_variant_builder_end (&builder);
1108 }
1109
1110 static void
1111 org_ofono_manager_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1112 {
1113 }
1114
1115 static void
1116 _org_ofono_manager_on_signal_modem_added (
1117     OrgOfonoManager *object,
1118     const gchar *arg_unnamed_arg0,
1119     GVariant *arg_unnamed_arg1)
1120 {
1121   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object);
1122
1123   GList      *connections, *l;
1124   GVariant   *signal_variant;
1125   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1126
1127   signal_variant = g_variant_ref_sink (g_variant_new ("(o@a{sv})",
1128                    arg_unnamed_arg0,
1129                    arg_unnamed_arg1));
1130   for (l = connections; l != NULL; l = l->next)
1131     {
1132       GDBusConnection *connection = l->data;
1133       g_dbus_connection_emit_signal (connection,
1134         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.Manager", "ModemAdded",
1135         signal_variant, NULL);
1136     }
1137   g_variant_unref (signal_variant);
1138   g_list_free_full (connections, g_object_unref);
1139 }
1140
1141 static void
1142 _org_ofono_manager_on_signal_modem_removed (
1143     OrgOfonoManager *object,
1144     const gchar *arg_unnamed_arg0)
1145 {
1146   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object);
1147
1148   GList      *connections, *l;
1149   GVariant   *signal_variant;
1150   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1151
1152   signal_variant = g_variant_ref_sink (g_variant_new ("(o)",
1153                    arg_unnamed_arg0));
1154   for (l = connections; l != NULL; l = l->next)
1155     {
1156       GDBusConnection *connection = l->data;
1157       g_dbus_connection_emit_signal (connection,
1158         NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.Manager", "ModemRemoved",
1159         signal_variant, NULL);
1160     }
1161   g_variant_unref (signal_variant);
1162   g_list_free_full (connections, g_object_unref);
1163 }
1164
1165 static void org_ofono_manager_skeleton_iface_init (OrgOfonoManagerIface *iface);
1166 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1167 G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerSkeleton, org_ofono_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1168                          G_ADD_PRIVATE (OrgOfonoManagerSkeleton)
1169                          G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_skeleton_iface_init));
1170
1171 #else
1172 G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerSkeleton, org_ofono_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1173                          G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_skeleton_iface_init));
1174
1175 #endif
1176 static void
1177 org_ofono_manager_skeleton_finalize (GObject *object)
1178 {
1179   OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object);
1180   g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1181   if (skeleton->priv->changed_properties_idle_source != NULL)
1182     g_source_destroy (skeleton->priv->changed_properties_idle_source);
1183   g_main_context_unref (skeleton->priv->context);
1184   g_mutex_clear (&skeleton->priv->lock);
1185   G_OBJECT_CLASS (org_ofono_manager_skeleton_parent_class)->finalize (object);
1186 }
1187
1188 static void
1189 org_ofono_manager_skeleton_init (OrgOfonoManagerSkeleton *skeleton)
1190 {
1191 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1192   skeleton->priv = org_ofono_manager_skeleton_get_instance_private (skeleton);
1193 #else
1194   skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ORG_OFONO_MANAGER_SKELETON, OrgOfonoManagerSkeletonPrivate);
1195 #endif
1196
1197   g_mutex_init (&skeleton->priv->lock);
1198   skeleton->priv->context = g_main_context_ref_thread_default ();
1199 }
1200
1201 static void
1202 org_ofono_manager_skeleton_class_init (OrgOfonoManagerSkeletonClass *klass)
1203 {
1204   GObjectClass *gobject_class;
1205   GDBusInterfaceSkeletonClass *skeleton_class;
1206
1207   gobject_class = G_OBJECT_CLASS (klass);
1208   gobject_class->finalize = org_ofono_manager_skeleton_finalize;
1209
1210   skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1211   skeleton_class->get_info = org_ofono_manager_skeleton_dbus_interface_get_info;
1212   skeleton_class->get_properties = org_ofono_manager_skeleton_dbus_interface_get_properties;
1213   skeleton_class->flush = org_ofono_manager_skeleton_dbus_interface_flush;
1214   skeleton_class->get_vtable = org_ofono_manager_skeleton_dbus_interface_get_vtable;
1215
1216 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1217   g_type_class_add_private (klass, sizeof (OrgOfonoManagerSkeletonPrivate));
1218 #endif
1219 }
1220
1221 static void
1222 org_ofono_manager_skeleton_iface_init (OrgOfonoManagerIface *iface)
1223 {
1224   iface->modem_added = _org_ofono_manager_on_signal_modem_added;
1225   iface->modem_removed = _org_ofono_manager_on_signal_modem_removed;
1226 }
1227
1228 /**
1229  * org_ofono_manager_skeleton_new:
1230  *
1231  * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>.
1232  *
1233  * Returns: (transfer full) (type OrgOfonoManagerSkeleton): The skeleton object.
1234  */
1235 OrgOfonoManager *
1236 org_ofono_manager_skeleton_new (void)
1237 {
1238   return ORG_OFONO_MANAGER (g_object_new (TYPE_ORG_OFONO_MANAGER_SKELETON, NULL));
1239 }
1240
1241 /* ------------------------------------------------------------------------
1242  * Code for Object, ObjectProxy and ObjectSkeleton
1243  * ------------------------------------------------------------------------
1244  */
1245
1246 /**
1247  * SECTION:Object
1248  * @title: Object
1249  * @short_description: Specialized GDBusObject types
1250  *
1251  * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
1252  */
1253
1254 /**
1255  * Object:
1256  *
1257  * The #Object type is a specialized container of interfaces.
1258  */
1259
1260 /**
1261  * ObjectIface:
1262  * @parent_iface: The parent interface.
1263  *
1264  * Virtual table for the #Object interface.
1265  */
1266
1267 typedef ObjectIface ObjectInterface;
1268 G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
1269
1270 static void
1271 object_default_init (ObjectIface *iface)
1272 {
1273   /**
1274    * Object:org-ofono-manager:
1275    *
1276    * The #OrgOfonoManager instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link>, if any.
1277    *
1278    * Connect to the #GObject::notify signal to get informed of property changes.
1279    */
1280   g_object_interface_install_property (iface, g_param_spec_object ("org-ofono-manager", "org-ofono-manager", "org-ofono-manager", TYPE_ORG_OFONO_MANAGER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
1281
1282 }
1283
1284 /**
1285  * object_get_org_ofono_manager:
1286  * @object: A #Object.
1287  *
1288  * Gets the #OrgOfonoManager instance for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link> on @object, if any.
1289  *
1290  * Returns: (transfer full): A #OrgOfonoManager that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
1291  */
1292 OrgOfonoManager *object_get_org_ofono_manager (Object *object)
1293 {
1294   GDBusInterface *ret;
1295   ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager");
1296   if (ret == NULL)
1297     return NULL;
1298   return ORG_OFONO_MANAGER (ret);
1299 }
1300
1301
1302 /**
1303  * object_peek_org_ofono_manager: (skip)
1304  * @object: A #Object.
1305  *
1306  * Like object_get_org_ofono_manager() but doesn't increase the reference count on the returned object.
1307  *
1308  * <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>
1309  *
1310  * Returns: (transfer none): A #OrgOfonoManager or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
1311  */
1312 OrgOfonoManager *object_peek_org_ofono_manager (Object *object)
1313 {
1314   GDBusInterface *ret;
1315   ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager");
1316   if (ret == NULL)
1317     return NULL;
1318   g_object_unref (ret);
1319   return ORG_OFONO_MANAGER (ret);
1320 }
1321
1322
1323 static void
1324 object_notify (GDBusObject *object, GDBusInterface *interface)
1325 {
1326   _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
1327   /* info can be NULL if the other end is using a D-Bus interface we don't know
1328    * anything about, for example old generated code in this process talking to
1329    * newer generated code in the other process. */
1330   if (info != NULL)
1331     g_object_notify (G_OBJECT (object), info->hyphen_name);
1332 }
1333
1334 /**
1335  * ObjectProxy:
1336  *
1337  * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
1338  */
1339
1340 /**
1341  * ObjectProxyClass:
1342  * @parent_class: The parent class.
1343  *
1344  * Class structure for #ObjectProxy.
1345  */
1346
1347 static void
1348 object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1349 {
1350 }
1351
1352 static void
1353 object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
1354 {
1355   iface->interface_added = object_notify;
1356   iface->interface_removed = object_notify;
1357 }
1358
1359
1360 G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
1361                          G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
1362                          G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
1363
1364 static void
1365 object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
1366 {
1367 }
1368
1369 static void
1370 object_proxy_set_property (GObject      *gobject,
1371   guint         prop_id,
1372   const GValue *value G_GNUC_UNUSED,
1373   GParamSpec   *pspec)
1374 {
1375   G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1376 }
1377
1378 static void
1379 object_proxy_get_property (GObject      *gobject,
1380   guint         prop_id,
1381   GValue       *value,
1382   GParamSpec   *pspec)
1383 {
1384   ObjectProxy *object = OBJECT_PROXY (gobject);
1385   GDBusInterface *interface;
1386
1387   switch (prop_id)
1388     {
1389     case 1:
1390       interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager");
1391       g_value_take_object (value, interface);
1392       break;
1393
1394     default:
1395       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1396       break;
1397   }
1398 }
1399
1400 static void
1401 object_proxy_class_init (ObjectProxyClass *klass)
1402 {
1403   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1404
1405   gobject_class->set_property = object_proxy_set_property;
1406   gobject_class->get_property = object_proxy_get_property;
1407
1408   g_object_class_override_property (gobject_class, 1, "org-ofono-manager");
1409 }
1410
1411 /**
1412  * object_proxy_new:
1413  * @connection: A #GDBusConnection.
1414  * @object_path: An object path.
1415  *
1416  * Creates a new proxy object.
1417  *
1418  * Returns: (transfer full): The proxy object.
1419  */
1420 ObjectProxy *
1421 object_proxy_new (GDBusConnection *connection,
1422   const gchar *object_path)
1423 {
1424   g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
1425   g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1426   return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
1427 }
1428
1429 /**
1430  * ObjectSkeleton:
1431  *
1432  * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
1433  */
1434
1435 /**
1436  * ObjectSkeletonClass:
1437  * @parent_class: The parent class.
1438  *
1439  * Class structure for #ObjectSkeleton.
1440  */
1441
1442 static void
1443 object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
1444 {
1445 }
1446
1447
1448 static void
1449 object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
1450 {
1451   iface->interface_added = object_notify;
1452   iface->interface_removed = object_notify;
1453 }
1454
1455 G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
1456                          G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
1457                          G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
1458
1459 static void
1460 object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
1461 {
1462 }
1463
1464 static void
1465 object_skeleton_set_property (GObject      *gobject,
1466   guint         prop_id,
1467   const GValue *value,
1468   GParamSpec   *pspec)
1469 {
1470   ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1471   GDBusInterfaceSkeleton *interface;
1472
1473   switch (prop_id)
1474     {
1475     case 1:
1476       interface = g_value_get_object (value);
1477       if (interface != NULL)
1478         {
1479           g_warn_if_fail (IS_ORG_OFONO_MANAGER (interface));
1480           g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
1481         }
1482       else
1483         {
1484           g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.ofono.Manager");
1485         }
1486       break;
1487
1488     default:
1489       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1490       break;
1491   }
1492 }
1493
1494 static void
1495 object_skeleton_get_property (GObject      *gobject,
1496   guint         prop_id,
1497   GValue       *value,
1498   GParamSpec   *pspec)
1499 {
1500   ObjectSkeleton *object = OBJECT_SKELETON (gobject);
1501   GDBusInterface *interface;
1502
1503   switch (prop_id)
1504     {
1505     case 1:
1506       interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager");
1507       g_value_take_object (value, interface);
1508       break;
1509
1510     default:
1511       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
1512       break;
1513   }
1514 }
1515
1516 static void
1517 object_skeleton_class_init (ObjectSkeletonClass *klass)
1518 {
1519   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1520
1521   gobject_class->set_property = object_skeleton_set_property;
1522   gobject_class->get_property = object_skeleton_get_property;
1523
1524   g_object_class_override_property (gobject_class, 1, "org-ofono-manager");
1525 }
1526
1527 /**
1528  * object_skeleton_new:
1529  * @object_path: An object path.
1530  *
1531  * Creates a new skeleton object.
1532  *
1533  * Returns: (transfer full): The skeleton object.
1534  */
1535 ObjectSkeleton *
1536 object_skeleton_new (const gchar *object_path)
1537 {
1538   g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
1539   return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
1540 }
1541
1542 /**
1543  * object_skeleton_set_org_ofono_manager:
1544  * @object: A #ObjectSkeleton.
1545  * @interface_: (allow-none): A #OrgOfonoManager or %NULL to clear the interface.
1546  *
1547  * Sets the #OrgOfonoManager instance for the D-Bus interface <link linkend="gdbus-interface-org-ofono-Manager.top_of_page">org.ofono.Manager</link> on @object.
1548  */
1549 void object_skeleton_set_org_ofono_manager (ObjectSkeleton *object, OrgOfonoManager *interface_)
1550 {
1551   g_object_set (G_OBJECT (object), "org-ofono-manager", interface_, NULL);
1552 }
1553
1554
1555 /* ------------------------------------------------------------------------
1556  * Code for ObjectManager client
1557  * ------------------------------------------------------------------------
1558  */
1559
1560 /**
1561  * SECTION:ObjectManagerClient
1562  * @title: ObjectManagerClient
1563  * @short_description: Generated GDBusObjectManagerClient type
1564  *
1565  * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
1566  */
1567
1568 /**
1569  * ObjectManagerClient:
1570  *
1571  * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
1572  */
1573
1574 /**
1575  * ObjectManagerClientClass:
1576  * @parent_class: The parent class.
1577  *
1578  * Class structure for #ObjectManagerClient.
1579  */
1580
1581 G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
1582
1583 static void
1584 object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
1585 {
1586 }
1587
1588 static void
1589 object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
1590 {
1591 }
1592
1593 /**
1594  * object_manager_client_get_proxy_type:
1595  * @manager: A #GDBusObjectManagerClient.
1596  * @object_path: The object path of the remote object (unused).
1597  * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
1598  * @user_data: User data (unused).
1599  *
1600  * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
1601  *
1602  * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
1603  */
1604 GType
1605 object_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)
1606 {
1607   static gsize once_init_value = 0;
1608   static GHashTable *lookup_hash;
1609   GType ret;
1610
1611   if (interface_name == NULL)
1612     return TYPE_OBJECT_PROXY;
1613   if (g_once_init_enter (&once_init_value))
1614     {
1615       lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
1616       g_hash_table_insert (lookup_hash, (gpointer) "org.ofono.Manager", GSIZE_TO_POINTER (TYPE_ORG_OFONO_MANAGER_PROXY));
1617       g_once_init_leave (&once_init_value, 1);
1618     }
1619   ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
1620   if (ret == (GType) 0)
1621     ret = G_TYPE_DBUS_PROXY;
1622   return ret;
1623 }
1624
1625 /**
1626  * object_manager_client_new:
1627  * @connection: A #GDBusConnection.
1628  * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1629  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1630  * @object_path: An object path.
1631  * @cancellable: (allow-none): A #GCancellable or %NULL.
1632  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1633  * @user_data: User data to pass to @callback.
1634  *
1635  * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
1636  *
1637  * 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.
1638  * You can then call object_manager_client_new_finish() to get the result of the operation.
1639  *
1640  * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
1641  */
1642 void
1643 object_manager_client_new (
1644     GDBusConnection        *connection,
1645     GDBusObjectManagerClientFlags  flags,
1646     const gchar            *name,
1647     const gchar            *object_path,
1648     GCancellable           *cancellable,
1649     GAsyncReadyCallback     callback,
1650     gpointer                user_data)
1651 {
1652   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);
1653 }
1654
1655 /**
1656  * object_manager_client_new_finish:
1657  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
1658  * @error: Return location for error or %NULL
1659  *
1660  * Finishes an operation started with object_manager_client_new().
1661  *
1662  * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1663  */
1664 GDBusObjectManager *
1665 object_manager_client_new_finish (
1666     GAsyncResult        *res,
1667     GError             **error)
1668 {
1669   GObject *ret;
1670   GObject *source_object;
1671   source_object = g_async_result_get_source_object (res);
1672   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1673   g_object_unref (source_object);
1674   if (ret != NULL)
1675     return G_DBUS_OBJECT_MANAGER (ret);
1676   else
1677     return NULL;
1678 }
1679
1680 /**
1681  * object_manager_client_new_sync:
1682  * @connection: A #GDBusConnection.
1683  * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1684  * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1685  * @object_path: An object path.
1686  * @cancellable: (allow-none): A #GCancellable or %NULL.
1687  * @error: Return location for error or %NULL
1688  *
1689  * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
1690  *
1691  * The calling thread is blocked until a reply is received.
1692  *
1693  * See object_manager_client_new() for the asynchronous version of this constructor.
1694  *
1695  * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1696  */
1697 GDBusObjectManager *
1698 object_manager_client_new_sync (
1699     GDBusConnection        *connection,
1700     GDBusObjectManagerClientFlags  flags,
1701     const gchar            *name,
1702     const gchar            *object_path,
1703     GCancellable           *cancellable,
1704     GError                **error)
1705 {
1706   GInitable *ret;
1707   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);
1708   if (ret != NULL)
1709     return G_DBUS_OBJECT_MANAGER (ret);
1710   else
1711     return NULL;
1712 }
1713
1714
1715 /**
1716  * object_manager_client_new_for_bus:
1717  * @bus_type: A #GBusType.
1718  * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1719  * @name: A bus name (well-known or unique).
1720  * @object_path: An object path.
1721  * @cancellable: (allow-none): A #GCancellable or %NULL.
1722  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1723  * @user_data: User data to pass to @callback.
1724  *
1725  * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
1726  *
1727  * 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.
1728  * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
1729  *
1730  * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1731  */
1732 void
1733 object_manager_client_new_for_bus (
1734     GBusType                bus_type,
1735     GDBusObjectManagerClientFlags  flags,
1736     const gchar            *name,
1737     const gchar            *object_path,
1738     GCancellable           *cancellable,
1739     GAsyncReadyCallback     callback,
1740     gpointer                user_data)
1741 {
1742   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);
1743 }
1744
1745 /**
1746  * object_manager_client_new_for_bus_finish:
1747  * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
1748  * @error: Return location for error or %NULL
1749  *
1750  * Finishes an operation started with object_manager_client_new_for_bus().
1751  *
1752  * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1753  */
1754 GDBusObjectManager *
1755 object_manager_client_new_for_bus_finish (
1756     GAsyncResult        *res,
1757     GError             **error)
1758 {
1759   GObject *ret;
1760   GObject *source_object;
1761   source_object = g_async_result_get_source_object (res);
1762   ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1763   g_object_unref (source_object);
1764   if (ret != NULL)
1765     return G_DBUS_OBJECT_MANAGER (ret);
1766   else
1767     return NULL;
1768 }
1769
1770 /**
1771  * object_manager_client_new_for_bus_sync:
1772  * @bus_type: A #GBusType.
1773  * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
1774  * @name: A bus name (well-known or unique).
1775  * @object_path: An object path.
1776  * @cancellable: (allow-none): A #GCancellable or %NULL.
1777  * @error: Return location for error or %NULL
1778  *
1779  * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1780  *
1781  * The calling thread is blocked until a reply is received.
1782  *
1783  * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
1784  *
1785  * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
1786  */
1787 GDBusObjectManager *
1788 object_manager_client_new_for_bus_sync (
1789     GBusType                bus_type,
1790     GDBusObjectManagerClientFlags  flags,
1791     const gchar            *name,
1792     const gchar            *object_path,
1793     GCancellable           *cancellable,
1794     GError                **error)
1795 {
1796   GInitable *ret;
1797   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);
1798   if (ret != NULL)
1799     return G_DBUS_OBJECT_MANAGER (ret);
1800   else
1801     return NULL;
1802 }
1803
1804