1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: David Zeuthen <davidz@redhat.com>
25 #include "gdbusobjectmanager.h"
26 #include "gdbusobjectmanagerclient.h"
27 #include "gdbusobject.h"
28 #include "gdbusprivate.h"
29 #include "gio-marshal.h"
30 #include "gioenumtypes.h"
31 #include "ginitable.h"
32 #include "gasyncresult.h"
33 #include "gsimpleasyncresult.h"
34 #include "gasyncinitable.h"
35 #include "gdbusconnection.h"
36 #include "gdbusutils.h"
37 #include "gdbusobject.h"
38 #include "gdbusobjectproxy.h"
39 #include "gdbusproxy.h"
40 #include "gdbusinterface.h"
45 * SECTION:gdbusobjectmanagerclient
46 * @short_description: Client-side object manager
49 * #GDBusObjectManagerClient is used to create, monitor and delete object
50 * proxies for remote objects exported by a #GDBusObjectManagerServer (or any
51 * code implementing the <ulink
52 * url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">org.freedesktop.DBus.ObjectManager</ulink>
55 * Once an instance of this type has been created, you can connect to
56 * the #GDBusObjectManager::object-added and
57 * #GDBusObjectManager::object-removed signals and inspect the
58 * #GDBusObjectProxy objects returned by
59 * g_dbus_object_manager_get_objects().
61 * If the name for a #GDBusObjectManagerClient is not owned by anyone at
62 * object construction time, the default behavior is to request the
63 * message bus to launch an owner for the name. This behavior can be
64 * disabled using the %G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START
65 * flag. It's also worth noting that this only works if the name of
66 * interest is activatable in the first place. E.g. in some cases it
67 * is not possible to launch an owner for the requested name. In this
68 * case, #GDBusObjectManagerClient object construction still succeeds but
69 * there will be no object proxies
70 * (e.g. g_dbus_object_manager_get_objects() returns the empty list) and
71 * the #GDBusObjectManagerClient:name-owner property is %NULL.
73 * The owner of the requested name can come and go (for example
74 * consider a system service being restarted) – #GDBusObjectManagerClient
75 * handles this case too; simply connect to the #GObject::notify
76 * signal to watch for changes on the #GDBusObjectManagerClient:name-owner
77 * property. When the name owner vanishes, the behavior is that
78 * #GDBusObjectManagerClient:name-owner is set to %NULL (this includes
79 * emission of the #GObject::notify signal) and then
80 * #GDBusObjectManager::object-removed signals are synthesized
81 * for all currently existing object proxies. Since
82 * #GDBusObjectManagerClient:name-owner is %NULL when this happens, you can
83 * use this information to disambiguate a synthesized signal from a
84 * genuine signal caused by object removal on the remote
85 * #GDBusObjectManager. Similarly, when a new name owner appears,
86 * #GDBusObjectManager::object-added signals are synthesized
87 * while #GDBusObjectManagerClient:name-owner is still %NULL. Only when all
88 * object proxies have been added, the #GDBusObjectManagerClient:name-owner
89 * is set to the new name owner (this includes emission of the
90 * #GObject::notify signal). Furthermore, you are guaranteed that
91 * #GDBusObjectManagerClient:name-owner will alternate between a name owner
92 * (e.g. <literal>:1.42</literal>) and %NULL even in the case where
93 * the name of interest is atomically replaced
95 * Ultimately, #GDBusObjectManagerClient is used to obtain #GDBusProxy
96 * instances. All signals (including the
97 * <literal>org.freedesktop.DBus.Properties::PropertiesChanged</literal>
98 * signal) delivered to #GDBusProxy instances are guaranteed to
99 * originate from the name owner. This guarantee along with the
100 * behavior described above, means that certain race conditions
101 * including the <emphasis><quote>half the proxy is from the old owner
102 * and the other half is from the new owner</quote></emphasis> problem
105 * To avoid having the application connect to signals on the returned
106 * #GDBusObjectProxy and #GDBusProxy objects, the
107 * #GDBusObject::interface-added,
108 * #GDBusObject::interface-removed,
109 * #GDBusProxy::g-properties-changed and
110 * #GDBusProxy::g-signal signals
111 * are also emitted on the #GDBusObjectManagerClient instance managing these
112 * objects. The signals emitted are
113 * #GDBusObjectManager::interface-added,
114 * #GDBusObjectManager::interface-removed,
115 * #GDBusObjectManagerClient::interface-proxy-properties-changed and
116 * #GDBusObjectManagerClient::interface-proxy-signal.
118 * Note that all callbacks and signals are emitted in the
119 * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
120 * that the #GDBusObjectManagerClient object was constructed
121 * in. Additionally, the #GDBusObjectProxy and #GDBusProxy objects
122 * originating from the #GDBusObjectManagerClient object will be created in
123 * the same context and, consequently, will deliver signals in the
127 struct _GDBusObjectManagerClientPrivate
130 GDBusConnection *connection;
134 GDBusObjectManagerClientFlags flags;
136 GDBusProxy *control_proxy;
138 GHashTable *map_object_path_to_object_proxy;
140 guint signal_subscription_id;
143 GDBusProxyTypeFunc get_proxy_type_func;
144 gpointer get_proxy_type_user_data;
156 PROP_GET_PROXY_TYPE_FUNC,
157 PROP_GET_PROXY_TYPE_USER_DATA
162 INTERFACE_PROXY_SIGNAL_SIGNAL,
163 INTERFACE_PROXY_PROPERTIES_CHANGED_SIGNAL,
167 static guint signals[LAST_SIGNAL] = { 0 };
169 static void initable_iface_init (GInitableIface *initable_iface);
170 static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface);
171 static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface);
173 G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT,
174 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
175 G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
176 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, dbus_object_manager_interface_init));
178 static void maybe_unsubscribe_signals (GDBusObjectManagerClient *manager);
180 static void on_control_proxy_g_signal (GDBusProxy *proxy,
181 const gchar *sender_name,
182 const gchar *signal_name,
183 GVariant *parameters,
186 static void process_get_all_result (GDBusObjectManagerClient *manager,
188 const gchar *name_owner);
191 g_dbus_object_manager_client_finalize (GObject *object)
193 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (object);
195 maybe_unsubscribe_signals (manager);
197 g_hash_table_unref (manager->priv->map_object_path_to_object_proxy);
199 if (manager->priv->control_proxy != NULL)
201 g_warn_if_fail (g_signal_handlers_disconnect_by_func (manager->priv->control_proxy,
202 on_control_proxy_g_signal,
204 g_object_unref (manager->priv->control_proxy);
206 g_object_unref (manager->priv->connection);
207 g_free (manager->priv->object_path);
208 g_free (manager->priv->name);
209 g_free (manager->priv->name_owner);
211 if (G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize != NULL)
212 G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize (object);
216 g_dbus_object_manager_client_get_property (GObject *_object,
221 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_object);
225 case PROP_CONNECTION:
226 g_value_set_object (value, g_dbus_object_manager_client_get_connection (manager));
229 case PROP_OBJECT_PATH:
230 g_value_set_string (value, g_dbus_object_manager_get_object_path (G_DBUS_OBJECT_MANAGER (manager)));
234 g_value_set_string (value, g_dbus_object_manager_client_get_name (manager));
238 g_value_set_flags (value, g_dbus_object_manager_client_get_flags (manager));
241 case PROP_NAME_OWNER:
242 g_value_take_string (value, g_dbus_object_manager_client_get_name_owner (manager));
246 G_OBJECT_WARN_INVALID_PROPERTY_ID (_object, prop_id, pspec);
252 g_dbus_object_manager_client_set_property (GObject *_object,
257 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_object);
262 manager->priv->bus_type = g_value_get_enum (value);
265 case PROP_CONNECTION:
266 if (g_value_get_object (value) != NULL)
268 g_assert (manager->priv->connection == NULL);
269 g_assert (G_IS_DBUS_CONNECTION (g_value_get_object (value)));
270 manager->priv->connection = g_value_dup_object (value);
274 case PROP_OBJECT_PATH:
275 g_assert (manager->priv->object_path == NULL);
276 g_assert (g_variant_is_object_path (g_value_get_string (value)));
277 manager->priv->object_path = g_value_dup_string (value);
281 g_assert (manager->priv->name == NULL);
282 g_assert (g_dbus_is_name (g_value_get_string (value)));
283 manager->priv->name = g_value_dup_string (value);
287 manager->priv->flags = g_value_get_flags (value);
290 case PROP_GET_PROXY_TYPE_FUNC:
291 manager->priv->get_proxy_type_func = g_value_get_pointer (value);
294 case PROP_GET_PROXY_TYPE_USER_DATA:
295 manager->priv->get_proxy_type_user_data = g_value_get_pointer (value);
299 G_OBJECT_WARN_INVALID_PROPERTY_ID (_object, prop_id, pspec);
305 g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
307 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
309 gobject_class->finalize = g_dbus_object_manager_client_finalize;
310 gobject_class->set_property = g_dbus_object_manager_client_set_property;
311 gobject_class->get_property = g_dbus_object_manager_client_get_property;
314 * GDBusObjectManagerClient:connection:
316 * The #GDBusConnection to use.
318 g_object_class_install_property (gobject_class,
320 g_param_spec_object ("connection",
322 "The connection to use",
323 G_TYPE_DBUS_CONNECTION,
326 G_PARAM_CONSTRUCT_ONLY |
327 G_PARAM_STATIC_STRINGS));
330 * GDBusObjectManagerClient:bus-type:
332 * If this property is not %G_BUS_TYPE_NONE, then
333 * #GDBusObjectManagerClient:connection must be %NULL and will be set to the
334 * #GDBusConnection obtained by calling g_bus_get() with the value
337 g_object_class_install_property (gobject_class,
339 g_param_spec_enum ("bus-type",
341 "The bus to connect to, if any",
345 G_PARAM_CONSTRUCT_ONLY |
346 G_PARAM_STATIC_NAME |
347 G_PARAM_STATIC_BLURB |
348 G_PARAM_STATIC_NICK));
351 * GDBusObjectManagerClient:flags:
353 * Flags from the #GDBusObjectManagerClientFlags enumeration.
355 g_object_class_install_property (gobject_class,
357 g_param_spec_flags ("flags",
359 "Flags for the proxy manager",
360 G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS,
361 G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
364 G_PARAM_CONSTRUCT_ONLY |
365 G_PARAM_STATIC_NAME |
366 G_PARAM_STATIC_BLURB |
367 G_PARAM_STATIC_NICK));
370 * GDBusObjectManagerClient:object-path:
372 * The object path the manager is for.
374 g_object_class_install_property (gobject_class,
376 g_param_spec_string ("object-path",
378 "The object path of the control object",
382 G_PARAM_CONSTRUCT_ONLY |
383 G_PARAM_STATIC_STRINGS));
386 * GDBusObjectManagerClient:name:
388 * The well-known name or unique name that the manager is for.
390 g_object_class_install_property (gobject_class,
392 g_param_spec_string ("name",
394 "Name that the manager is for",
398 G_PARAM_CONSTRUCT_ONLY |
399 G_PARAM_STATIC_STRINGS));
402 * GDBusObjectManagerClient:name-owner:
404 * The unique name that owns #GDBusObjectManagerClient:name or %NULL if
405 * no-one is currently owning the name. Connect to the
406 * #GObject::notify signal to track changes to this property.
408 g_object_class_install_property (gobject_class,
410 g_param_spec_string ("name-owner",
412 "The owner of the name we are watching",
415 G_PARAM_STATIC_STRINGS));
418 * GDBusObjectManagerClient:get-proxy-type-func:
420 * The #GDBusProxyTypeFunc to use when determining what #GType to
421 * use for interface proxies or %NULL.
423 g_object_class_install_property (gobject_class,
424 PROP_GET_PROXY_TYPE_FUNC,
425 g_param_spec_pointer ("get-proxy-type-func",
426 "GDBusProxyTypeFunc Function Pointer",
427 "The GDBusProxyTypeFunc pointer to use",
430 G_PARAM_CONSTRUCT_ONLY |
431 G_PARAM_STATIC_STRINGS));
434 * GDBusObjectManagerClient:get-proxy-type-user-data:
436 * The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.
438 g_object_class_install_property (gobject_class,
439 PROP_GET_PROXY_TYPE_USER_DATA,
440 g_param_spec_pointer ("get-proxy-type-user-data",
441 "GDBusProxyTypeFunc User Data",
442 "The GDBusProxyTypeFunc user_data",
445 G_PARAM_CONSTRUCT_ONLY |
446 G_PARAM_STATIC_STRINGS));
449 * GDBusObjectManagerClient::interface-proxy-signal:
450 * @manager: The #GDBusObjectManagerClient emitting the signal.
451 * @object_proxy: The #GDBusObjectProxy on which an interface is emitting a D-Bus signal.
452 * @interface_proxy: The #GDBusProxy that is emitting a D-Bus signal.
453 * @sender_name: The sender of the signal or NULL if the connection is not a bus connection.
454 * @signal_name: The signal name.
455 * @parameters: A #GVariant tuple with parameters for the signal.
457 * Emitted when a D-Bus signal is received on @interface_proxy.
459 * This signal exists purely as a convenience to avoid having to
460 * connect signals to all interface proxies managed by @manager.
462 * This signal is emitted in the
463 * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
464 * that @manager was constructed in.
466 signals[INTERFACE_PROXY_SIGNAL_SIGNAL] =
467 g_signal_new ("interface-proxy-signal",
468 G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
470 G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_signal),
473 _gio_marshal_VOID__OBJECT_OBJECT_STRING_STRING_VARIANT,
476 G_TYPE_DBUS_OBJECT_PROXY,
483 * GDBusObjectManagerClient::interface-proxy-properties-changed:
484 * @manager: The #GDBusObjectManagerClient emitting the signal.
485 * @object_proxy: The #GDBusObjectProxy on which an interface has properties that are changing.
486 * @interface_proxy: The #GDBusProxy that has properties that are changing.
487 * @changed_properties: A #GVariant containing the properties that changed.
488 * @invalidated_properties: A %NULL terminated array of properties that was invalidated.
490 * Emitted when one or more D-Bus properties on proxy changes. The
491 * local cache has already been updated when this signal fires. Note
492 * that both @changed_properties and @invalidated_properties are
493 * guaranteed to never be %NULL (either may be empty though).
495 * This signal exists purely as a convenience to avoid having to
496 * connect signals to all interface proxies managed by @manager.
498 * This signal is emitted in the
499 * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
500 * that @manager was constructed in.
502 signals[INTERFACE_PROXY_PROPERTIES_CHANGED_SIGNAL] =
503 g_signal_new ("interface-proxy-properties-changed",
504 G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
506 G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_properties_changed),
509 _gio_marshal_VOID__OBJECT_OBJECT_VARIANT_BOXED,
512 G_TYPE_DBUS_OBJECT_PROXY,
517 g_type_class_add_private (klass, sizeof (GDBusObjectManagerClientPrivate));
521 g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager)
523 manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
524 G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
525 GDBusObjectManagerClientPrivate);
526 manager->priv->map_object_path_to_object_proxy = g_hash_table_new_full (g_str_hash,
529 (GDestroyNotify) g_object_unref);
532 /* ---------------------------------------------------------------------------------------------------- */
535 * g_dbus_object_manager_client_new_sync:
536 * @connection: A #GDBusConnection.
537 * @flags: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
538 * @name: The owner of the control object (unique or well-known name).
539 * @object_path: The object path of the control object.
540 * @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
541 * @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
542 * @cancellable: A #GCancellable or %NULL
543 * @error: Return location for error or %NULL.
545 * Creates a new #GDBusObjectManagerClient object.
547 * This is a synchronous failable constructor - the calling thread is
548 * blocked until a reply is received. See g_dbus_object_manager_client_new()
549 * for the asynchronous version.
551 * Returns: A #GDBusObjectManagerClient object or %NULL if @error is
552 * set. Free with g_object_unref().
555 g_dbus_object_manager_client_new_sync (GDBusConnection *connection,
556 GDBusObjectManagerClientFlags flags,
558 const gchar *object_path,
559 GDBusProxyTypeFunc get_proxy_type_func,
560 gpointer get_proxy_type_user_data,
561 GCancellable *cancellable,
566 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
567 g_return_val_if_fail ((name == NULL && g_dbus_connection_get_unique_name (connection) == NULL) ||
568 g_dbus_is_name (name), NULL);
569 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
570 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
572 initable = g_initable_new (G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
575 "connection", connection,
578 "object-path", object_path,
579 "get-proxy-type-func", get_proxy_type_func,
580 "get-proxy-type-user-data", get_proxy_type_user_data,
582 if (initable != NULL)
583 return G_DBUS_OBJECT_MANAGER (initable);
589 * g_dbus_object_manager_client_new:
590 * @connection: A #GDBusConnection.
591 * @flags: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
592 * @name: The owner of the control object (unique or well-known name).
593 * @object_path: The object path of the control object.
594 * @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
595 * @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
596 * @cancellable: A #GCancellable or %NULL
597 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
598 * @user_data: The data to pass to @callback.
600 * Asynchronously creates a new #GDBusObjectManagerClient object.
602 * This is an asynchronous failable constructor. When the result is
603 * ready, @callback will be invoked in the
604 * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
605 * of the thread you are calling this method from. You can
606 * then call g_dbus_object_manager_client_new_finish() to get the result. See
607 * g_dbus_object_manager_client_new_sync() for the synchronous version.
610 g_dbus_object_manager_client_new (GDBusConnection *connection,
611 GDBusObjectManagerClientFlags flags,
613 const gchar *object_path,
614 GDBusProxyTypeFunc get_proxy_type_func,
615 gpointer get_proxy_type_user_data,
616 GCancellable *cancellable,
617 GAsyncReadyCallback callback,
620 g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
621 g_return_if_fail ((name == NULL && g_dbus_connection_get_unique_name (connection) == NULL) ||
622 g_dbus_is_name (name));
623 g_return_if_fail (g_variant_is_object_path (object_path));
625 g_async_initable_new_async (G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
630 "connection", connection,
633 "object-path", object_path,
634 "get-proxy-type-func", get_proxy_type_func,
635 "get-proxy-type-user-data", get_proxy_type_user_data,
640 * g_dbus_object_manager_client_new_finish:
641 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new().
642 * @error: Return location for error or %NULL.
644 * Finishes an operation started with g_dbus_object_manager_client_new().
646 * Returns: A #GDBusObjectManagerClient object or %NULL if @error is
647 * set. Free with g_object_unref().
650 g_dbus_object_manager_client_new_finish (GAsyncResult *res,
654 GObject *source_object;
656 source_object = g_async_result_get_source_object (res);
657 g_assert (source_object != NULL);
659 object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object),
662 g_object_unref (source_object);
665 return G_DBUS_OBJECT_MANAGER (object);
670 /* ---------------------------------------------------------------------------------------------------- */
673 * g_dbus_object_manager_client_new_for_bus_sync:
674 * @bus_type: A #GBusType.
675 * @flags: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
676 * @name: The owner of the control object (unique or well-known name).
677 * @object_path: The object path of the control object.
678 * @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
679 * @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
680 * @cancellable: A #GCancellable or %NULL
681 * @error: Return location for error or %NULL.
683 * Like g_dbus_object_manager_client_new_sync() but takes a #GBusType instead
684 * of a #GDBusConnection.
686 * This is a synchronous failable constructor - the calling thread is
687 * blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus()
688 * for the asynchronous version.
690 * Returns: A #GDBusObjectManagerClient object or %NULL if @error is
691 * set. Free with g_object_unref().
694 g_dbus_object_manager_client_new_for_bus_sync (GBusType bus_type,
695 GDBusObjectManagerClientFlags flags,
697 const gchar *object_path,
698 GDBusProxyTypeFunc get_proxy_type_func,
699 gpointer get_proxy_type_user_data,
700 GCancellable *cancellable,
705 g_return_val_if_fail (bus_type != G_BUS_TYPE_NONE, NULL);
706 g_return_val_if_fail (g_dbus_is_name (name), NULL);
707 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
708 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
710 initable = g_initable_new (G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
713 "bus-type", bus_type,
716 "object-path", object_path,
717 "get-proxy-type-func", get_proxy_type_func,
718 "get-proxy-type-user-data", get_proxy_type_user_data,
720 if (initable != NULL)
721 return G_DBUS_OBJECT_MANAGER (initable);
727 * g_dbus_object_manager_client_new_for_bus:
728 * @bus_type: A #GBusType.
729 * @flags: Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
730 * @name: The owner of the control object (unique or well-known name).
731 * @object_path: The object path of the control object.
732 * @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
733 * @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
734 * @cancellable: A #GCancellable or %NULL
735 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
736 * @user_data: The data to pass to @callback.
738 * Like g_dbus_object_manager_client_new() but takes a #GBusType instead of a
741 * This is an asynchronous failable constructor. When the result is
742 * ready, @callback will be invoked in the
743 * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
744 * of the thread you are calling this method from. You can
745 * then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See
746 * g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version.
749 g_dbus_object_manager_client_new_for_bus (GBusType bus_type,
750 GDBusObjectManagerClientFlags flags,
752 const gchar *object_path,
753 GDBusProxyTypeFunc get_proxy_type_func,
754 gpointer get_proxy_type_user_data,
755 GCancellable *cancellable,
756 GAsyncReadyCallback callback,
759 g_return_if_fail (bus_type != G_BUS_TYPE_NONE);
760 g_return_if_fail (g_dbus_is_name (name));
761 g_return_if_fail (g_variant_is_object_path (object_path));
763 g_async_initable_new_async (G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
768 "bus-type", bus_type,
771 "object-path", object_path,
772 "get-proxy-type-func", get_proxy_type_func,
773 "get-proxy-type-user-data", get_proxy_type_user_data,
778 * g_dbus_object_manager_client_new_for_bus_finish:
779 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to g_dbus_object_manager_client_new_for_bus().
780 * @error: Return location for error or %NULL.
782 * Finishes an operation started with g_dbus_object_manager_client_new_for_bus().
784 * Returns: A #GDBusObjectManagerClient object or %NULL if @error is
785 * set. Free with g_object_unref().
788 g_dbus_object_manager_client_new_for_bus_finish (GAsyncResult *res,
792 GObject *source_object;
794 source_object = g_async_result_get_source_object (res);
795 g_assert (source_object != NULL);
797 object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object),
800 g_object_unref (source_object);
803 return G_DBUS_OBJECT_MANAGER (object);
808 /* ---------------------------------------------------------------------------------------------------- */
811 * g_dbus_object_manager_client_get_connection:
812 * @manager: A #GDBusObjectManagerClient
814 * Gets the #GDBusConnection used by @manager.
816 * Returns: A #GDBusConnection object. Do not free, the object belongs
820 g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager)
822 g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
823 return manager->priv->connection;
827 * g_dbus_object_manager_client_get_name:
828 * @manager: A #GDBusObjectManagerClient
830 * Gets the name that @manager is for.
832 * Returns: A unique or well-known name. Do not free, the string
833 * belongs to @manager.
836 g_dbus_object_manager_client_get_name (GDBusObjectManagerClient *manager)
838 g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
839 return manager->priv->name;
843 * g_dbus_object_manager_client_get_flags:
844 * @manager: A #GDBusObjectManagerClient
846 * Gets the flags that @manager was constructed with.
848 * Returns: Zero of more flags from the #GDBusObjectManagerClientFlags
851 GDBusObjectManagerClientFlags
852 g_dbus_object_manager_client_get_flags (GDBusObjectManagerClient *manager)
854 g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE);
855 return manager->priv->flags;
859 * g_dbus_object_manager_client_get_name_owner:
860 * @manager: A #GDBusObjectManagerClient.
862 * The unique name that owns the name that @manager is for or %NULL if
863 * no-one currently owns that name. You can connect to the
864 * #GObject::notify signal to track changes to the
865 * #GDBusObjectManagerClient:name-owner property.
867 * Returns: The name owner or %NULL if no name owner exists. Free with
871 g_dbus_object_manager_client_get_name_owner (GDBusObjectManagerClient *manager)
873 g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
874 return g_strdup (manager->priv->name_owner);
877 /* ---------------------------------------------------------------------------------------------------- */
879 /* signal handler for all objects we manage - we dispatch signals
880 * from here to the objects
883 signal_cb (GDBusConnection *connection,
884 const gchar *sender_name,
885 const gchar *object_path,
886 const gchar *interface_name,
887 const gchar *signal_name,
888 GVariant *parameters,
891 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (user_data);
892 GDBusObjectProxy *object_proxy;
893 GDBusInterface *interface;
895 object_proxy = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
896 if (object_proxy == NULL)
899 //g_debug ("yay, signal_cb %s %s: %s\n", signal_name, object_path, g_variant_print (parameters, TRUE));
901 if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0)
903 if (g_strcmp0 (signal_name, "PropertiesChanged") == 0)
905 const gchar *interface_name;
906 GVariant *changed_properties;
907 const gchar **invalidated_properties;
909 g_variant_get (parameters,
913 &invalidated_properties);
915 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object_proxy), interface_name);
916 if (interface != NULL)
918 GVariantIter property_iter;
919 const gchar *property_name;
920 GVariant *property_value;
923 /* update caches... */
924 g_variant_iter_init (&property_iter, changed_properties);
925 while (g_variant_iter_next (&property_iter,
930 g_dbus_proxy_set_cached_property (G_DBUS_PROXY (interface),
933 g_variant_unref (property_value);
936 for (n = 0; invalidated_properties[n] != NULL; n++)
938 g_dbus_proxy_set_cached_property (G_DBUS_PROXY (interface),
939 invalidated_properties[n],
942 /* ... and then synthesize the signal */
943 g_signal_emit (manager,
944 signals[INTERFACE_PROXY_PROPERTIES_CHANGED_SIGNAL],
949 invalidated_properties);
950 g_signal_emit_by_name (interface,
951 "g-properties-changed",
953 invalidated_properties);
954 g_object_unref (interface);
956 g_variant_unref (changed_properties);
957 g_free (invalidated_properties);
962 /* regular signal - just dispatch it */
963 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object_proxy), interface_name);
964 if (interface != NULL)
966 g_signal_emit (manager,
967 signals[INTERFACE_PROXY_SIGNAL_SIGNAL],
974 g_signal_emit_by_name (interface,
979 g_object_unref (interface);
988 subscribe_signals (GDBusObjectManagerClient *manager,
989 const gchar *name_owner)
994 g_return_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager));
995 g_return_if_fail (manager->priv->signal_subscription_id == 0);
996 g_return_if_fail (g_dbus_is_unique_name (name_owner));
998 /* the bus daemon may not implement path_prefix so gracefully
999 * handle this by using a fallback
1001 manager->priv->match_rule = g_strdup_printf ("type='signal',sender='%s',path_namespace='%s'",
1003 manager->priv->object_path);
1006 ret = g_dbus_connection_call_sync (manager->priv->connection,
1007 "org.freedesktop.DBus",
1008 "/org/freedeskop/DBus",
1009 "org.freedesktop.DBus",
1011 g_variant_new ("(s)",
1012 manager->priv->match_rule),
1013 NULL, /* reply_type */
1014 G_DBUS_CALL_FLAGS_NONE,
1015 -1, /* default timeout */
1016 NULL, /* TODO: Cancellable */
1020 /* yay, bus daemon supports path_namespace */
1021 g_variant_unref (ret);
1023 /* still need to ask GDBusConnection for the callbacks */
1024 manager->priv->signal_subscription_id =
1025 g_dbus_connection_signal_subscribe (manager->priv->connection,
1027 NULL, /* interface */
1029 NULL, /* path - TODO: really want wilcard support here */
1031 G_DBUS_SIGNAL_FLAGS_NONE |
1032 G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE,
1035 NULL); /* user_data_free_func */
1040 /* TODO: we could report this to the user
1041 g_warning ("Message bus daemon does not support path_namespace: %s (%s %d)",
1043 g_quark_to_string (error->domain),
1047 g_error_free (error);
1049 /* no need to call RemoveMatch when done since it didn't work */
1050 g_free (manager->priv->match_rule);
1051 manager->priv->match_rule = NULL;
1053 /* Fallback is to subscribe to *all* signals from the name owner which
1054 * is rather wasteful. It's probably not a big practical problem because
1055 * users typically want all objects that the name owner supplies.
1057 manager->priv->signal_subscription_id =
1058 g_dbus_connection_signal_subscribe (manager->priv->connection,
1060 NULL, /* interface */
1062 NULL, /* path - TODO: really want wilcard support here */
1064 G_DBUS_SIGNAL_FLAGS_NONE,
1067 NULL); /* user_data_free_func */
1072 maybe_unsubscribe_signals (GDBusObjectManagerClient *manager)
1074 g_return_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager));
1076 if (manager->priv->signal_subscription_id > 0)
1078 g_dbus_connection_signal_unsubscribe (manager->priv->connection,
1079 manager->priv->signal_subscription_id);
1080 manager->priv->signal_subscription_id = 0;
1083 if (manager->priv->match_rule != NULL)
1085 /* Since the AddMatch call succeeded this is guaranteed to not
1086 * fail - therefore, don't bother checking the return value
1088 g_dbus_connection_call (manager->priv->connection,
1089 "org.freedesktop.DBus",
1090 "/org/freedeskop/DBus",
1091 "org.freedesktop.DBus",
1093 g_variant_new ("(s)",
1094 manager->priv->match_rule),
1095 NULL, /* reply_type */
1096 G_DBUS_CALL_FLAGS_NONE,
1097 -1, /* default timeout */
1098 NULL, /* GCancellable */
1099 NULL, /* GAsyncReadyCallback */
1100 NULL); /* user data */
1101 g_free (manager->priv->match_rule);
1102 manager->priv->match_rule = NULL;
1107 /* ---------------------------------------------------------------------------------------------------- */
1110 on_notify_g_name_owner (GObject *object,
1114 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (user_data);
1115 gchar *old_name_owner;
1116 gchar *new_name_owner;
1118 old_name_owner = manager->priv->name_owner;
1119 new_name_owner = g_dbus_proxy_get_name_owner (manager->priv->control_proxy);
1120 manager->priv->name_owner = NULL;
1122 if (g_strcmp0 (old_name_owner, new_name_owner) != 0)
1127 /* do the :name-owner notify with a NULL name - this way the user knows
1128 * the ::object-proxy-removed following is because the name owner went
1131 g_object_notify (G_OBJECT (manager), "name-owner");
1133 /* remote manager changed; nuke all local proxies */
1134 proxies = g_hash_table_get_values (manager->priv->map_object_path_to_object_proxy);
1135 g_list_foreach (proxies, (GFunc) g_object_ref, NULL);
1136 g_hash_table_remove_all (manager->priv->map_object_path_to_object_proxy);
1137 for (l = proxies; l != NULL; l = l->next)
1139 GDBusObjectProxy *object_proxy = G_DBUS_OBJECT_PROXY (l->data);
1140 g_signal_emit_by_name (manager, "object-removed", object_proxy);
1142 g_list_foreach (proxies, (GFunc) g_object_unref, NULL);
1143 g_list_free (proxies);
1145 /* nuke local filter */
1146 maybe_unsubscribe_signals (manager);
1149 if (new_name_owner != NULL)
1154 //g_debug ("repopulating for %s", new_name_owner);
1156 /* TODO: do this async! */
1157 subscribe_signals (manager,
1160 value = g_dbus_proxy_call_sync (manager->priv->control_proxy,
1161 "GetManagedObjects",
1162 NULL, /* parameters */
1163 G_DBUS_CALL_FLAGS_NONE,
1169 maybe_unsubscribe_signals (manager);
1170 g_warning ("Error calling GetManagedObjects() when name owner %s for name %s came back: %s",
1172 manager->priv->name,
1174 g_error_free (error);
1178 process_get_all_result (manager, value, new_name_owner);
1179 g_variant_unref (value);
1182 /* do the :name-owner notify *AFTER* emitting ::object-proxy-added signals - this
1183 * way the user knows that the signals were emitted because the name owner came back
1185 manager->priv->name_owner = new_name_owner;
1186 g_object_notify (G_OBJECT (manager), "name-owner");
1189 g_free (old_name_owner);
1193 initable_init (GInitable *initable,
1194 GCancellable *cancellable,
1197 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (initable);
1200 GDBusProxyFlags proxy_flags;
1204 if (manager->priv->bus_type != G_BUS_TYPE_NONE)
1206 g_assert (manager->priv->connection == NULL);
1207 manager->priv->connection = g_bus_get_sync (manager->priv->bus_type, cancellable, error);
1208 if (manager->priv->connection == NULL)
1212 proxy_flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES;
1213 if (manager->priv->flags & G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START)
1214 proxy_flags |= G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START;;
1216 manager->priv->control_proxy = g_dbus_proxy_new_sync (manager->priv->connection,
1218 NULL, /* GDBusInterfaceInfo* */
1219 manager->priv->name,
1220 manager->priv->object_path,
1221 "org.freedesktop.DBus.ObjectManager",
1224 if (manager->priv->control_proxy == NULL)
1227 g_signal_connect (G_OBJECT (manager->priv->control_proxy),
1228 "notify::g-name-owner",
1229 G_CALLBACK (on_notify_g_name_owner),
1232 manager->priv->name_owner = g_dbus_proxy_get_name_owner (manager->priv->control_proxy);
1233 if (manager->priv->name_owner == NULL)
1235 /* it's perfectly fine if there's no name owner.. we're just going to
1236 * wait until one is ready
1241 /* yay, we have a name owner */
1242 g_signal_connect (manager->priv->control_proxy,
1244 G_CALLBACK (on_control_proxy_g_signal),
1246 subscribe_signals (manager,
1247 manager->priv->name_owner);
1248 value = g_dbus_proxy_call_sync (manager->priv->control_proxy,
1249 "GetManagedObjects",
1250 NULL, /* parameters */
1251 G_DBUS_CALL_FLAGS_NONE,
1257 maybe_unsubscribe_signals (manager);
1258 g_warn_if_fail (g_signal_handlers_disconnect_by_func (manager->priv->control_proxy,
1259 on_control_proxy_g_signal,
1261 g_object_unref (manager->priv->control_proxy);
1262 manager->priv->control_proxy = NULL;
1266 process_get_all_result (manager, value, manager->priv->name_owner);
1267 g_variant_unref (value);
1277 initable_iface_init (GInitableIface *initable_iface)
1279 initable_iface->init = initable_init;
1283 async_initable_iface_init (GAsyncInitableIface *async_initable_iface)
1285 /* for now, just use default: run GInitable code in thread */
1288 /* ---------------------------------------------------------------------------------------------------- */
1291 add_interfaces (GDBusObjectManagerClient *manager,
1292 const gchar *object_path,
1293 GVariant *ifaces_and_properties,
1294 const gchar *name_owner)
1296 GDBusObjectProxy *op;
1299 const gchar *interface_name;
1300 GVariant *properties;
1302 g_return_if_fail (g_dbus_is_unique_name (name_owner));
1305 op = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
1308 op = _g_dbus_object_proxy_new (manager->priv->connection, object_path);
1312 g_variant_iter_init (&iter, ifaces_and_properties);
1313 while (g_variant_iter_next (&iter,
1318 GDBusProxy *interface_proxy;
1320 GType interface_proxy_type;
1322 if (manager->priv->get_proxy_type_func != NULL)
1324 interface_proxy_type = manager->priv->get_proxy_type_func (manager,
1327 manager->priv->get_proxy_type_user_data);
1328 g_warn_if_fail (g_type_is_a (interface_proxy_type, G_TYPE_DBUS_PROXY));
1332 interface_proxy_type = G_TYPE_DBUS_PROXY;
1335 /* this is fine - there is no blocking IO because we pass DO_NOT_LOAD_PROPERTIES and
1336 * DO_NOT_CONNECT_SIGNALS and use a unique name
1339 interface_proxy = g_initable_new (interface_proxy_type,
1340 NULL, /* GCancellable */
1342 "g-connection", manager->priv->connection,
1343 "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
1344 G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
1345 "g-name", name_owner,
1346 "g-object-path", object_path,
1347 "g-interface-name", interface_name,
1349 if (interface_proxy == NULL)
1351 g_warning ("%s: Error constructing proxy for path %s and interface %s: %s",
1356 g_error_free (error);
1360 GVariantIter property_iter;
1361 const gchar *property_name;
1362 GVariant *property_value;
1364 /* associate the interface proxy with the object */
1365 g_dbus_interface_set_object (G_DBUS_INTERFACE (interface_proxy),
1366 G_DBUS_OBJECT (op));
1368 g_variant_iter_init (&property_iter, properties);
1369 while (g_variant_iter_next (&property_iter,
1374 g_dbus_proxy_set_cached_property (interface_proxy,
1377 g_variant_unref (property_value);
1380 _g_dbus_object_proxy_add_interface (op, interface_proxy);
1382 g_signal_emit_by_name (manager, "interface-added", op, interface_proxy);
1383 g_object_unref (interface_proxy);
1385 g_variant_unref (properties);
1390 g_hash_table_insert (manager->priv->map_object_path_to_object_proxy,
1391 g_strdup (object_path),
1393 g_signal_emit_by_name (manager, "object-added", op);
1398 remove_interfaces (GDBusObjectManagerClient *manager,
1399 const gchar *object_path,
1400 const gchar *const *interface_names)
1402 GDBusObjectProxy *op;
1405 guint num_interfaces;
1406 guint num_interfaces_to_remove;
1408 op = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
1411 g_warning ("%s: Processing InterfaceRemoved signal for path %s but no object proxy exists",
1417 interfaces = g_dbus_object_get_interfaces (G_DBUS_OBJECT (op));
1418 num_interfaces = g_list_length (interfaces);
1419 g_list_foreach (interfaces, (GFunc) g_object_unref, NULL);
1420 g_list_free (interfaces);
1422 num_interfaces_to_remove = g_strv_length ((gchar **) interface_names);
1424 /* see if we are going to completety remove the object */
1425 if (num_interfaces_to_remove == num_interfaces)
1428 g_warn_if_fail (g_hash_table_remove (manager->priv->map_object_path_to_object_proxy, object_path));
1429 g_signal_emit_by_name (manager, "object-removed", op);
1430 g_object_unref (op);
1434 for (n = 0; interface_names != NULL && interface_names[n] != NULL; n++)
1436 GDBusInterface *interface;
1437 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (op), interface_names[n]);
1438 _g_dbus_object_proxy_remove_interface (op, interface_names[n]);
1439 if (interface != NULL)
1441 g_signal_emit_by_name (manager, "interface-removed", op, interface);
1442 g_object_unref (interface);
1451 process_get_all_result (GDBusObjectManagerClient *manager,
1453 const gchar *name_owner)
1456 const gchar *object_path;
1457 GVariant *ifaces_and_properties;
1460 g_return_if_fail (g_dbus_is_unique_name (name_owner));
1462 arg0 = g_variant_get_child_value (value, 0);
1463 g_variant_iter_init (&iter, arg0);
1464 while (g_variant_iter_next (&iter,
1467 &ifaces_and_properties))
1469 add_interfaces (manager, object_path, ifaces_and_properties, name_owner);
1470 g_variant_unref (ifaces_and_properties);
1472 g_variant_unref (arg0);
1476 on_control_proxy_g_signal (GDBusProxy *proxy,
1477 const gchar *sender_name,
1478 const gchar *signal_name,
1479 GVariant *parameters,
1482 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (user_data);
1483 const gchar *object_path;
1485 //g_debug ("yay, g_signal %s: %s\n", signal_name, g_variant_print (parameters, TRUE));
1487 if (g_strcmp0 (signal_name, "InterfacesAdded") == 0)
1489 GVariant *ifaces_and_properties;
1490 g_variant_get (parameters,
1493 &ifaces_and_properties);
1494 add_interfaces (manager, object_path, ifaces_and_properties, manager->priv->name_owner);
1495 g_variant_unref (ifaces_and_properties);
1497 else if (g_strcmp0 (signal_name, "InterfacesRemoved") == 0)
1499 const gchar **ifaces;
1500 g_variant_get (parameters,
1504 remove_interfaces (manager, object_path, ifaces);
1509 /* ---------------------------------------------------------------------------------------------------- */
1511 static const gchar *
1512 g_dbus_object_manager_client_get_object_path (GDBusObjectManager *_manager)
1514 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_manager);
1515 return manager->priv->object_path;
1518 static GDBusObject *
1519 g_dbus_object_manager_client_get_object (GDBusObjectManager *_manager,
1520 const gchar *object_path)
1522 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_manager);
1525 ret = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
1531 static GDBusInterface *
1532 g_dbus_object_manager_client_get_interface (GDBusObjectManager *_manager,
1533 const gchar *object_path,
1534 const gchar *interface_name)
1536 GDBusInterface *ret;
1537 GDBusObject *object;
1541 object = g_dbus_object_manager_get_object (_manager, object_path);
1545 ret = g_dbus_object_get_interface (object, interface_name);
1546 g_object_unref (object);
1553 g_dbus_object_manager_client_get_objects (GDBusObjectManager *_manager)
1555 GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_manager);
1558 g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
1560 ret = g_hash_table_get_values (manager->priv->map_object_path_to_object_proxy);
1561 g_list_foreach (ret, (GFunc) g_object_ref, NULL);
1567 dbus_object_manager_interface_init (GDBusObjectManagerIface *iface)
1569 iface->get_object_path = g_dbus_object_manager_client_get_object_path;
1570 iface->get_objects = g_dbus_object_manager_client_get_objects;
1571 iface->get_object = g_dbus_object_manager_client_get_object;
1572 iface->get_interface = g_dbus_object_manager_client_get_interface;
1575 /* ---------------------------------------------------------------------------------------------------- */