diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2014-03-31 07:10:31 -0400 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-01 14:44:53 +0100 |
commit | 48d8288c23f42098d7ce442d99dc8eee89ae4f98 (patch) | |
tree | c92b2f306b63381a0cd5c1f090198805b274fbaa | |
parent | 557f0efd64c4af7167802ff95b3b8f3d3948012f (diff) |
Rename remaining tp_dbus_daemon_*() to tp_dbus_connection_*()
Also moves their code to dbus.c/h module since their are only
GDBusConnection helpers now, not methods on TpDBusDaemon object.
48 files changed, 589 insertions, 662 deletions
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index eaff4e86e..f45ed8a42 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -1924,11 +1924,11 @@ tp_g_value_slice_new_object_path tp_g_value_slice_new_static_object_path tp_g_value_slice_new_take_object_path <SUBSECTION> -tp_dbus_daemon_release_name -tp_dbus_daemon_request_name -tp_dbus_daemon_register_object -tp_dbus_daemon_try_register_object -tp_dbus_daemon_unregister_object +tp_dbus_connection_release_name +tp_dbus_connection_request_name +tp_dbus_connection_register_object +tp_dbus_connection_try_register_object +tp_dbus_connection_unregister_object <SUBSECTION Standard> tp_dbus_name_type_get_type </SECTION> diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am index 3aae81205..3f42c9269 100644 --- a/telepathy-glib/Makefile.am +++ b/telepathy-glib/Makefile.am @@ -87,7 +87,6 @@ tpginclude_HEADERS = \ base-contact-list.h \ core-svc-interface.h \ dbus.h \ - dbus-daemon.h \ dbus-properties-mixin.h \ dbus-tube-channel.h \ defs.h \ @@ -284,7 +283,6 @@ libtelepathy_glib_main_internal_la_SOURCES = \ cm-message.c \ cm-message-internal.h \ dbus.c \ - dbus-daemon.c \ dbus-internal.h \ dbus-properties-mixin.c \ dbus-properties-mixin-internal.h \ diff --git a/telepathy-glib/base-call-content.c b/telepathy-glib/base-call-content.c index 3ac45365a..fd5c5eebf 100644 --- a/telepathy-glib/base-call-content.c +++ b/telepathy-glib/base-call-content.c @@ -213,7 +213,7 @@ tp_base_call_content_constructed (GObject *obj) G_OBJECT_CLASS (tp_base_call_content_parent_class)->constructed (obj); DEBUG ("Registering %s", self->priv->object_path); - tp_dbus_daemon_register_object (bus, self->priv->object_path, obj); + tp_dbus_connection_register_object (bus, self->priv->object_path, obj); } static void @@ -222,7 +222,7 @@ tp_base_call_content_deinit_real (TpBaseCallContent *self) GDBusConnection *bus = tp_base_connection_get_dbus_connection ( (TpBaseConnection *) self->priv->conn); - tp_dbus_daemon_unregister_object (bus, G_OBJECT (self)); + tp_dbus_connection_unregister_object (bus, G_OBJECT (self)); tp_clear_pointer (&self->priv->streams, _tp_object_list_free); } diff --git a/telepathy-glib/base-call-stream.c b/telepathy-glib/base-call-stream.c index 942bba15b..4bc5d87f3 100644 --- a/telepathy-glib/base-call-stream.c +++ b/telepathy-glib/base-call-stream.c @@ -172,7 +172,7 @@ tp_base_call_stream_constructed (GObject *obj) /* register object on the bus */ DEBUG ("Registering %s", self->priv->object_path); - tp_dbus_daemon_register_object (bus, self->priv->object_path, obj); + tp_dbus_connection_register_object (bus, self->priv->object_path, obj); } static GPtrArray * @@ -188,7 +188,7 @@ tp_base_call_stream_dispose (GObject *object) GDBusConnection *bus = tp_base_connection_get_dbus_connection ( (TpBaseConnection *) self->priv->conn); - tp_dbus_daemon_unregister_object (bus, G_OBJECT (self)); + tp_dbus_connection_unregister_object (bus, G_OBJECT (self)); tp_clear_object (&self->priv->conn); diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c index 4452df790..1435d4818 100644 --- a/telepathy-glib/base-channel.c +++ b/telepathy-glib/base-channel.c @@ -381,7 +381,7 @@ tp_base_channel_register (TpBaseChannel *chan) g_assert (chan->priv->object_path != NULL); g_return_if_fail (!chan->priv->registered); - tp_dbus_daemon_register_object (bus, chan->priv->object_path, chan); + tp_dbus_connection_register_object (bus, chan->priv->object_path, chan); chan->priv->registered = TRUE; } @@ -411,7 +411,7 @@ tp_base_channel_destroyed (TpBaseChannel *chan) if (chan->priv->registered) { - tp_dbus_daemon_unregister_object (bus, chan); + tp_dbus_connection_unregister_object (bus, chan); chan->priv->registered = FALSE; } @@ -467,7 +467,7 @@ tp_base_channel_disappear (TpBaseChannel *chan) if (priv->registered) { - tp_dbus_daemon_unregister_object (bus, chan); + tp_dbus_connection_unregister_object (bus, chan); priv->registered = FALSE; } diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index b162c69c2..e2cb1d9ec 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -935,14 +935,14 @@ tp_base_client_register (TpBaseClient *self, DEBUG ("request name %s", self->priv->bus_name); - if (!tp_dbus_daemon_try_register_object (self->priv->dbus, + if (!tp_dbus_connection_try_register_object (self->priv->dbus, self->priv->object_path, G_OBJECT (self), error)) { DEBUG ("Failed to register object path %s", self->priv->object_path); return FALSE; } - if (!tp_dbus_daemon_request_name (self->priv->dbus, self->priv->bus_name, + if (!tp_dbus_connection_request_name (self->priv->dbus, self->priv->bus_name, TRUE, error)) { DEBUG ("Failed to register bus name %s", self->priv->bus_name); @@ -2589,7 +2589,7 @@ tp_base_client_unregister (TpBaseClient *self) if (!self->priv->registered) return; - if (!tp_dbus_daemon_release_name (self->priv->dbus, self->priv->bus_name, + if (!tp_dbus_connection_release_name (self->priv->dbus, self->priv->bus_name, &error)) { WARNING ("Failed to release bus name (%s): %s", self->priv->bus_name, @@ -2598,7 +2598,7 @@ tp_base_client_unregister (TpBaseClient *self) g_error_free (error); } - tp_dbus_daemon_unregister_object (self->priv->dbus, self); + tp_dbus_connection_unregister_object (self->priv->dbus, self); if (self->priv->flags & CLIENT_IS_HANDLER) { diff --git a/telepathy-glib/base-connection-manager.c b/telepathy-glib/base-connection-manager.c index d8179e09e..346b37e7f 100644 --- a/telepathy-glib/base-connection-manager.c +++ b/telepathy-glib/base-connection-manager.c @@ -836,7 +836,7 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self) /* don't bother handling failure gracefully: CMs should know what * objects they export */ - tp_dbus_daemon_register_object (self->priv->dbus_connection, string->str, self); + tp_dbus_connection_register_object (self->priv->dbus_connection, string->str, self); g_hash_table_iter_init (&iter, self->priv->protocols); @@ -862,14 +862,14 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self) g_strdelimit (string->str, "-", '_'); - tp_dbus_daemon_register_object (self->priv->dbus_connection, string->str, + tp_dbus_connection_register_object (self->priv->dbus_connection, string->str, protocol); } g_string_assign (string, TP_CM_BUS_NAME_BASE); g_string_append (string, cls->cm_dbus_name); - if (!tp_dbus_daemon_request_name (self->priv->dbus_connection, string->str, + if (!tp_dbus_connection_request_name (self->priv->dbus_connection, string->str, TRUE, &error)) { WARNING ("Couldn't claim bus name. If you are trying to debug this " diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 8119df045..eabe3fd43 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -479,10 +479,10 @@ tp_base_connection_unregister (TpBaseConnection *self) if (priv->been_registered) { - tp_dbus_daemon_unregister_object (priv->dbus_connection, self); + tp_dbus_connection_unregister_object (priv->dbus_connection, self); if (priv->bus_name != NULL) - tp_dbus_daemon_release_name (priv->dbus_connection, priv->bus_name, + tp_dbus_connection_release_name (priv->dbus_connection, priv->bus_name, NULL); else DEBUG ("not releasing bus name: nothing to release"); @@ -1394,9 +1394,9 @@ tp_base_connection_register (TpBaseConnection *self, g_free (safe_proto); g_free (unique_name); - if (!tp_dbus_daemon_try_register_object (priv->dbus_connection, priv->object_path, + if (!tp_dbus_connection_try_register_object (priv->dbus_connection, priv->object_path, self, error) || - !tp_dbus_daemon_request_name (priv->dbus_connection, priv->bus_name, FALSE, + !tp_dbus_connection_request_name (priv->dbus_connection, priv->bus_name, FALSE, error)) { g_free (priv->bus_name); diff --git a/telepathy-glib/call-content-media-description.c b/telepathy-glib/call-content-media-description.c index 654130a10..4813ef77d 100644 --- a/telepathy-glib/call-content-media-description.c +++ b/telepathy-glib/call-content-media-description.c @@ -1111,7 +1111,7 @@ cancelled_cb (GCancellable *cancellable, { TpCallContentMediaDescription *self = user_data; - tp_dbus_daemon_unregister_object (self->priv->dbus_connection, + tp_dbus_connection_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); g_simple_async_result_set_error (self->priv->result, @@ -1146,7 +1146,7 @@ _tp_call_content_media_description_offer_async ( /* register object on the bus */ DEBUG ("Registering %s", self->priv->object_path); - tp_dbus_daemon_register_object (self->priv->dbus_connection, + tp_dbus_connection_register_object (self->priv->dbus_connection, self->priv->object_path, G_OBJECT (self)); } @@ -1232,7 +1232,7 @@ tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *ifa tp_svc_call1_content_media_description_return_from_accept (context); - tp_dbus_daemon_unregister_object (self->priv->dbus_connection, + tp_dbus_connection_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); } @@ -1269,7 +1269,7 @@ tp_call_content_media_description_reject (TpSvcCall1ContentMediaDescription *ifa tp_svc_call1_content_media_description_return_from_reject (context); - tp_dbus_daemon_unregister_object (self->priv->dbus_connection, + tp_dbus_connection_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); } diff --git a/telepathy-glib/call-stream-endpoint.c b/telepathy-glib/call-stream-endpoint.c index fe4e1a8aa..f2d96f0de 100644 --- a/telepathy-glib/call-stream-endpoint.c +++ b/telepathy-glib/call-stream-endpoint.c @@ -147,7 +147,7 @@ tp_call_stream_endpoint_constructed (GObject *obj) /* register object on the bus */ DEBUG ("Registering %s", self->priv->object_path); - tp_dbus_daemon_register_object (self->priv->dbus_connection, + tp_dbus_connection_register_object (self->priv->dbus_connection, self->priv->object_path, obj); if (G_OBJECT_CLASS (tp_call_stream_endpoint_parent_class)->constructed != NULL) @@ -159,7 +159,7 @@ tp_call_stream_endpoint_dispose (GObject *object) { TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (object); - tp_dbus_daemon_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); + tp_dbus_connection_unregister_object (self->priv->dbus_connection, G_OBJECT (self)); g_clear_object (&self->priv->dbus_connection); diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c index fd8a09b2f..3ca2d9c07 100644 --- a/telepathy-glib/channel-dispatch-operation.c +++ b/telepathy-glib/channel-dispatch-operation.c @@ -748,7 +748,7 @@ _tp_channel_dispatch_operation_new (TpClientFactory *factory, if (!tp_dbus_check_valid_object_path (object_path, error)) return NULL; - if (!_tp_dbus_daemon_get_name_owner ( + if (!_tp_dbus_connection_get_name_owner ( tp_client_factory_get_dbus_connection (factory), -1, TP_CHANNEL_DISPATCHER_BUS_NAME, &unique_name, error)) return NULL; diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c index 7a8b6e940..68b4c7f94 100644 --- a/telepathy-glib/channel-request.c +++ b/telepathy-glib/channel-request.c @@ -439,7 +439,7 @@ _tp_channel_request_new (TpClientFactory *factory, if (!tp_dbus_check_valid_object_path (object_path, error)) return NULL; - if (!_tp_dbus_daemon_get_name_owner ( + if (!_tp_dbus_connection_get_name_owner ( tp_client_factory_get_dbus_connection (factory), -1, TP_CHANNEL_DISPATCHER_BUS_NAME, &unique_name, error)) return NULL; diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c index 5a757a65c..692bde34e 100644 --- a/telepathy-glib/connection.c +++ b/telepathy-glib/connection.c @@ -2009,7 +2009,7 @@ _tp_connection_new (TpClientFactory *factory, /* Resolve unique name if necessary */ if (bus_name[0] != ':') { - if (!_tp_dbus_daemon_get_name_owner ( + if (!_tp_dbus_connection_get_name_owner ( tp_client_factory_get_dbus_connection (factory), 2000, bus_name, &dup_unique_name, error)) goto finally; diff --git a/telepathy-glib/dbus-daemon.c b/telepathy-glib/dbus-daemon.c deleted file mode 100644 index c5e17e7f7..000000000 --- a/telepathy-glib/dbus-daemon.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * dbus-daemon.c - Source for TpDBusDaemon - * - * Copyright (C) 2005-2009 Collabora Ltd. <http://www.collabora.co.uk/> - * Copyright (C) 2005-2009 Nokia Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include <telepathy-glib/dbus.h> -#include <telepathy-glib/dbus-internal.h> - -#include <dbus/dbus.h> -#include <dbus/dbus-glib-lowlevel.h> - -#include <telepathy-glib/cli-misc.h> -#include <telepathy-glib/errors.h> -#include <telepathy-glib/interfaces.h> -#include <telepathy-glib/proxy-subclass.h> -#include <telepathy-glib/svc-interface-skeleton-internal.h> -#include <telepathy-glib/util.h> - -#define DEBUG_FLAG TP_DEBUG_PROXY -#include "debug-internal.h" - -/* for internal use (TpChannel, TpConnection _new convenience functions) */ -gboolean -_tp_dbus_daemon_get_name_owner (GDBusConnection *dbus_connection, - gint timeout_ms, - const gchar *well_known_name, - gchar **unique_name, - GError **error) -{ - GVariant *tuple; - - g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - tuple = g_dbus_connection_call_sync (dbus_connection, - "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", - "GetNameOwner", g_variant_new ("(s)", well_known_name), - G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); - - if (tuple == NULL) - return FALSE; - - if (unique_name != NULL) - g_variant_get (tuple, "(s)", unique_name); - - g_variant_unref (tuple); - return TRUE; -} - -/** - * tp_dbus_daemon_request_name: - * @dbus_connection: a #GDBusConnection - * @well_known_name: a well-known name to acquire - * @idempotent: whether to consider it to be a success if this process - * already owns the name - * @error: used to raise an error if %FALSE is returned - * - * Claim the given well-known name without queueing, allowing replacement - * or replacing an existing name-owner. This makes a synchronous call to the - * bus daemon. - * - * Returns: %TRUE if @well_known_name was claimed, or %FALSE and sets @error if - * an error occurred. - * - * Since: 0.7.30 - */ -gboolean -tp_dbus_daemon_request_name (GDBusConnection *dbus_connection, - const gchar *well_known_name, - gboolean idempotent, - GError **error) -{ - GVariant *tuple; - guint32 result; - - g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); - g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name, - TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - DEBUG ("%s", well_known_name); - - tuple = g_dbus_connection_call_sync (dbus_connection, - "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", - "RequestName", - g_variant_new ("(su)", well_known_name, - (guint32) DBUS_NAME_FLAG_DO_NOT_QUEUE), - G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); - - if (tuple == NULL) - { - DEBUG ("- D-Bus error"); - return FALSE; - } - - g_variant_get (tuple, "(u)", &result); - g_variant_unref (tuple); - - switch (result) - { - case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: - DEBUG ("- acquired"); - return TRUE; - - case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: - DEBUG ("- already owned by us"); - - if (idempotent) - { - return TRUE; - } - else - { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "Name '%s' already in use by this process", well_known_name); - return FALSE; - } - - case DBUS_REQUEST_NAME_REPLY_EXISTS: - case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: - DEBUG ("- already owned by someone else"); - /* the latter shouldn't actually happen since we said DO_NOT_QUEUE */ - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "Name '%s' already in use by another process", well_known_name); - return FALSE; - - default: - DEBUG ("- unexpected code %u", result); - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "RequestName('%s') returned %u and I don't know what that means", - well_known_name, result); - return FALSE; - } -} - -/** - * tp_dbus_daemon_release_name: - * @dbus_connection: a #GDBusConnection - * @well_known_name: a well-known name owned by this process to release - * @error: used to raise an error if %FALSE is returned - * - * Release the given well-known name. This makes a synchronous call to the bus - * daemon. - * - * Returns: %TRUE if @well_known_name was released, or %FALSE and sets @error - * if an error occurred. - * - * Since: 0.7.30 - */ -gboolean -tp_dbus_daemon_release_name (GDBusConnection *dbus_connection, - const gchar *well_known_name, - GError **error) -{ - guint32 result; - GVariant *tuple; - - g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); - g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name, - TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - DEBUG ("%s", well_known_name); - - tuple = g_dbus_connection_call_sync (dbus_connection, - "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", - "ReleaseName", g_variant_new ("(s)", well_known_name), - G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); - - if (tuple == NULL) - { - DEBUG ("- D-Bus error"); - return FALSE; - } - - g_variant_get (tuple, "(u)", &result); - g_variant_unref (tuple); - - switch (result) - { - case DBUS_RELEASE_NAME_REPLY_RELEASED: - DEBUG ("- released"); - return TRUE; - - case DBUS_RELEASE_NAME_REPLY_NOT_OWNER: - DEBUG ("- not ours"); - g_set_error (error, TP_ERROR, TP_ERROR_NOT_YOURS, - "Name '%s' owned by another process", well_known_name); - return FALSE; - - case DBUS_RELEASE_NAME_REPLY_NON_EXISTENT: - DEBUG ("- not owned"); - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "Name '%s' not owned", well_known_name); - return FALSE; - - default: - DEBUG ("- unexpected code %u", result); - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "ReleaseName('%s') returned %u and I don't know what that means", - well_known_name, result); - return FALSE; - } -} - -typedef struct _Registration Registration; - -struct _Registration { - /* (transfer full) */ - GDBusConnection *conn; - /* (transfer full) */ - gchar *object_path; - /* (transfer full) */ - GList *skeletons; -}; - -static GQuark -registration_quark (void) -{ - static GQuark q = 0; - - if (G_UNLIKELY (q == 0)) - { - q = g_quark_from_static_string ("tp_dbus_daemon_register_object"); - } - - return q; -} - -static void -tp_dbus_daemon_registration_free (gpointer p) -{ - Registration *r = p; - GList *iter; - - DEBUG ("%s (r=%p)", r->object_path, r); - - for (iter = r->skeletons; iter != NULL; iter = iter->next) - { - DEBUG ("%p", iter->data); - g_assert (TP_IS_SVC_INTERFACE_SKELETON (iter->data)); - g_dbus_interface_skeleton_unexport (iter->data); - g_object_unref (iter->data); - } - - g_list_free (r->skeletons); - g_free (r->object_path); - g_clear_object (&r->conn); - g_slice_free (Registration, r); -} - -/** - * tp_dbus_daemon_register_object: - * @dbus_connection: a #GDBusConnection - * @object_path: an object path - * @object: (type GObject.Object) (transfer none): an object to export - * - * Export @object at @object_path. Its `TpSvc` interfaces will all - * be exported. - * - * It is considered to be a programming error to register an object - * at a path where another object already exists. - * - * Since 0.UNRELEASED, as a simplification, exporting an object in this - * way at more than one location or on more than one bus is not allowed, - * and is also considered to be a programming error. - * However, redundantly re-exporting the same object at the same path - * on the same bus is allowed. - * - * Also since 0.UNRELEASED, this function must be called *before* taking any - * bus name whose presence is meant to correspond to the existence of this - * object. It is *not* sufficient to take the bus name within the same - * main-loop iteration as registering the object (even though that - * was sufficient under dbus-glib), because GDBus dispatches - * method calls in a separate thread. - */ -void -tp_dbus_daemon_register_object (GDBusConnection *dbus_connection, - const gchar *object_path, - gpointer object) -{ - GError *error = NULL; - - if (!tp_dbus_daemon_try_register_object (dbus_connection, object_path, object, - &error)) - { - CRITICAL ("Unable to register %s %p at %s:%s: %s #%d: %s", - G_OBJECT_TYPE_NAME (object), object, - g_dbus_connection_get_unique_name (dbus_connection), - object_path, - g_quark_to_string (error->domain), error->code, - error->message); - } -} - -/** - * tp_dbus_daemon_try_register_object: - * @dbus_connection: a #GDBusConnection - * @object_path: an object path - * @object: (type GObject.Object) (transfer none): an object to export - * @error: used to raise %G_IO_ERROR_EXISTS if an object exists at that path - * - * The same as tp_dbus_daemon_register_object(), except that it is not - * considered to be a programming error to register an object at a path - * where another object exists. - * - * Returns: %TRUE if the object is successfully registered - */ -gboolean -tp_dbus_daemon_try_register_object (GDBusConnection *dbus_connection, - const gchar *object_path, - gpointer object, - GError **error) -{ - GDBusConnection *conn; - GType *interfaces; - guint n = 0; - guint i; - Registration *r; - gboolean ret = FALSE; - - g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); - g_return_val_if_fail (tp_dbus_check_valid_object_path (object_path, error), - FALSE); - g_return_val_if_fail (G_IS_OBJECT (object), FALSE); - - conn = dbus_connection; - r = g_slice_new0 (Registration); - r->conn = g_object_ref (conn); - r->object_path = g_strdup (object_path); - r->skeletons = NULL; - - DEBUG ("%p (r=%p) on %s (%p) at %s", object, r, - g_dbus_connection_get_unique_name (conn), conn, object_path); - - if (!g_object_replace_qdata (object, registration_quark (), - NULL, /* if old value is NULL... */ - r, /* ... replace it with r... */ - tp_dbus_daemon_registration_free, /* ... with this free-function... */ - NULL /* ... and don't retrieve the old free-function */ )) - { - DEBUG ("already exported, discarding %p", r); - tp_dbus_daemon_registration_free (r); - - /* dbus-glib silently allowed duplicate registrations; to avoid - * breaking too much existing code, so must we. We don't allow - * registrations on different connections or at different object - * paths, though, in the hope that nobody actually does that. */ - - r = g_object_get_qdata (object, registration_quark ()); - - if (!tp_strdiff (r->object_path, object_path) && - r->conn == conn) - { - DEBUG ("already exported at identical (connection, path), ignoring"); - return TRUE; - } - - CRITICAL ("%s %p has already been exported on %s (%p) at %s, cannot " - "export on %s (%p) at %s", - G_OBJECT_TYPE_NAME (object), object, - g_dbus_connection_get_unique_name (r->conn), r->conn, r->object_path, - g_dbus_connection_get_unique_name (conn), conn, object_path); - g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_BUSY, - "Already exported with different connection or object-path"); - return FALSE; - } - - /* FIXME: if @object is a GDBusObject or GDBusObjectManagerServer, - * export it that way instead? */ - - interfaces = g_type_interfaces (G_OBJECT_TYPE (object), &n); - - for (i = 0; i < n; i++) - { - GType iface = interfaces[i]; - const TpSvcInterfaceInfo *iinfo; - TpSvcInterfaceSkeleton *skeleton; - GError *inner_error = NULL; - - iinfo = tp_svc_interface_peek_dbus_interface_info (iface); - - if (iinfo == NULL) - { - DEBUG ("- %s is not a D-Bus interface", g_type_name (iface)); - continue; - } - - skeleton = _tp_svc_interface_skeleton_new (object, iface, iinfo); - - if (!g_dbus_interface_skeleton_export ( - G_DBUS_INTERFACE_SKELETON (skeleton), conn, object_path, - &inner_error)) - { - DEBUG ("cannot export %s %p skeleton %p as '%s': %s #%d: %s", - g_type_name (iface), object, skeleton, - iinfo->interface_info->name, - g_quark_to_string (inner_error->domain), inner_error->code, - inner_error->message); - g_object_unref (skeleton); - g_propagate_error (error, inner_error); - - /* roll back */ - tp_dbus_daemon_unregister_object (dbus_connection, object); - goto finally; - } - - r->skeletons = g_list_prepend (r->skeletons, skeleton); - - DEBUG ("- %s skeleton %p (wrapping %s %p)", - iinfo->interface_info->name, skeleton, g_type_name (iface), object); - } - - ret = TRUE; -finally: - g_free (interfaces); - return ret; -} - -/** - * tp_dbus_daemon_unregister_object: - * @dbus_connection: a #GDBusConnection - * @object: (type GObject.Object) (transfer none): an object previously exported - * with tp_dbus_daemon_register_object() - * - * Stop exporting @object on D-Bus. This is a convenience wrapper around - * dbus_g_connection_unregister_g_object(), and behaves similarly. - * - * Since: 0.11.3 - */ -void -tp_dbus_daemon_unregister_object (GDBusConnection *dbus_connection, - gpointer object) -{ - g_return_if_fail (G_IS_DBUS_CONNECTION (dbus_connection)); - g_return_if_fail (G_IS_OBJECT (object)); - - DEBUG ("%p", object); - - /* The free-function for the qdata, tp_dbus_daemon_registration_free(), will - * automatically unregister the object (if registered) */ - g_object_set_qdata (object, registration_quark (), NULL); -} diff --git a/telepathy-glib/dbus-daemon.h b/telepathy-glib/dbus-daemon.h deleted file mode 100644 index ff00fcb2a..000000000 --- a/telepathy-glib/dbus-daemon.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * dbus-daemon.h - Header for TpDBusDaemon - * - * Copyright (C) 2005-2009 Collabora Ltd. <http://www.collabora.co.uk/> - * Copyright (C) 2005-2009 Nokia Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __TELEPATHY_DBUS_DAEMON_H__ -#define __TELEPATHY_DBUS_DAEMON_H__ - -#ifndef __TP_IN_DBUS_H__ -#error dbus-daemon.h not to be used directly, #include <telepathy-glib/dbus.h> -#endif - -#include <telepathy-glib/defs.h> -#include <telepathy-glib/proxy.h> - -G_BEGIN_DECLS - -gboolean tp_dbus_daemon_request_name (GDBusConnection *dbus_connection, - const gchar *well_known_name, gboolean idempotent, GError **error); -gboolean tp_dbus_daemon_release_name (GDBusConnection *dbus_connection, - const gchar *well_known_name, GError **error); - -void tp_dbus_daemon_register_object (GDBusConnection *dbus_connection, - const gchar *object_path, gpointer object); -gboolean tp_dbus_daemon_try_register_object (GDBusConnection *dbus_connection, - const gchar *object_path, - gpointer object, - GError **error); -void tp_dbus_daemon_unregister_object (GDBusConnection *dbus_connection, - gpointer object); - -G_END_DECLS - -#endif diff --git a/telepathy-glib/dbus-internal.h b/telepathy-glib/dbus-internal.h index 9908af58a..0f4bf0091 100644 --- a/telepathy-glib/dbus-internal.h +++ b/telepathy-glib/dbus-internal.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS -gboolean _tp_dbus_daemon_get_name_owner (GDBusConnection *dbus_connection, +gboolean _tp_dbus_connection_get_name_owner (GDBusConnection *dbus_connection, gint timeout_ms, const gchar *well_known_name, gchar **unique_name, GError **error); diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c index 0bc7055e0..6538793b5 100644 --- a/telepathy-glib/dbus.c +++ b/telepathy-glib/dbus.c @@ -66,6 +66,8 @@ #include <telepathy-glib/errors.h> #include <telepathy-glib/gtypes.h> +#include <telepathy-glib/proxy.h> +#include <telepathy-glib/svc-interface-skeleton-internal.h> #include <telepathy-glib/util.h> #define DEBUG_FLAG TP_DEBUG_MISC @@ -1856,3 +1858,426 @@ tp_asv_dump (GHashTable *asv) g_debug ("}"); } + +/* for internal use (TpChannel, TpConnection _new convenience functions) */ +gboolean +_tp_dbus_connection_get_name_owner (GDBusConnection *dbus_connection, + gint timeout_ms, + const gchar *well_known_name, + gchar **unique_name, + GError **error) +{ + GVariant *tuple; + + g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + tuple = g_dbus_connection_call_sync (dbus_connection, + "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", + "GetNameOwner", g_variant_new ("(s)", well_known_name), + G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); + + if (tuple == NULL) + return FALSE; + + if (unique_name != NULL) + g_variant_get (tuple, "(s)", unique_name); + + g_variant_unref (tuple); + return TRUE; +} + +/** + * tp_dbus_connection_request_name: + * @dbus_connection: a #GDBusConnection + * @well_known_name: a well-known name to acquire + * @idempotent: whether to consider it to be a success if this process + * already owns the name + * @error: used to raise an error if %FALSE is returned + * + * Claim the given well-known name without queueing, allowing replacement + * or replacing an existing name-owner. This makes a synchronous call to the + * bus daemon. + * + * Returns: %TRUE if @well_known_name was claimed, or %FALSE and sets @error if + * an error occurred. + * + * Since: 0.7.30 + */ +gboolean +tp_dbus_connection_request_name (GDBusConnection *dbus_connection, + const gchar *well_known_name, + gboolean idempotent, + GError **error) +{ + GVariant *tuple; + guint32 result; + + g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); + g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name, + TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + DEBUG ("%s", well_known_name); + + tuple = g_dbus_connection_call_sync (dbus_connection, + "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", + "RequestName", + g_variant_new ("(su)", well_known_name, + (guint32) DBUS_NAME_FLAG_DO_NOT_QUEUE), + G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); + + if (tuple == NULL) + { + DEBUG ("- D-Bus error"); + return FALSE; + } + + g_variant_get (tuple, "(u)", &result); + g_variant_unref (tuple); + + switch (result) + { + case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: + DEBUG ("- acquired"); + return TRUE; + + case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: + DEBUG ("- already owned by us"); + + if (idempotent) + { + return TRUE; + } + else + { + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, + "Name '%s' already in use by this process", well_known_name); + return FALSE; + } + + case DBUS_REQUEST_NAME_REPLY_EXISTS: + case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: + DEBUG ("- already owned by someone else"); + /* the latter shouldn't actually happen since we said DO_NOT_QUEUE */ + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, + "Name '%s' already in use by another process", well_known_name); + return FALSE; + + default: + DEBUG ("- unexpected code %u", result); + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, + "RequestName('%s') returned %u and I don't know what that means", + well_known_name, result); + return FALSE; + } +} + +/** + * tp_dbus_connection_release_name: + * @dbus_connection: a #GDBusConnection + * @well_known_name: a well-known name owned by this process to release + * @error: used to raise an error if %FALSE is returned + * + * Release the given well-known name. This makes a synchronous call to the bus + * daemon. + * + * Returns: %TRUE if @well_known_name was released, or %FALSE and sets @error + * if an error occurred. + * + * Since: 0.7.30 + */ +gboolean +tp_dbus_connection_release_name (GDBusConnection *dbus_connection, + const gchar *well_known_name, + GError **error) +{ + guint32 result; + GVariant *tuple; + + g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); + g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name, + TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + DEBUG ("%s", well_known_name); + + tuple = g_dbus_connection_call_sync (dbus_connection, + "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", + "ReleaseName", g_variant_new ("(s)", well_known_name), + G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error); + + if (tuple == NULL) + { + DEBUG ("- D-Bus error"); + return FALSE; + } + + g_variant_get (tuple, "(u)", &result); + g_variant_unref (tuple); + + switch (result) + { + case DBUS_RELEASE_NAME_REPLY_RELEASED: + DEBUG ("- released"); + return TRUE; + + case DBUS_RELEASE_NAME_REPLY_NOT_OWNER: + DEBUG ("- not ours"); + g_set_error (error, TP_ERROR, TP_ERROR_NOT_YOURS, + "Name '%s' owned by another process", well_known_name); + return FALSE; + + case DBUS_RELEASE_NAME_REPLY_NON_EXISTENT: + DEBUG ("- not owned"); + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, + "Name '%s' not owned", well_known_name); + return FALSE; + + default: + DEBUG ("- unexpected code %u", result); + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, + "ReleaseName('%s') returned %u and I don't know what that means", + well_known_name, result); + return FALSE; + } +} + +typedef struct _Registration Registration; + +struct _Registration { + /* (transfer full) */ + GDBusConnection *conn; + /* (transfer full) */ + gchar *object_path; + /* (transfer full) */ + GList *skeletons; +}; + +static GQuark +registration_quark (void) +{ + static GQuark q = 0; + + if (G_UNLIKELY (q == 0)) + { + q = g_quark_from_static_string ("tp_dbus_connection_register_object"); + } + + return q; +} + +static void +tp_dbus_connection_registration_free (gpointer p) +{ + Registration *r = p; + GList *iter; + + DEBUG ("%s (r=%p)", r->object_path, r); + + for (iter = r->skeletons; iter != NULL; iter = iter->next) + { + DEBUG ("%p", iter->data); + g_assert (TP_IS_SVC_INTERFACE_SKELETON (iter->data)); + g_dbus_interface_skeleton_unexport (iter->data); + g_object_unref (iter->data); + } + + g_list_free (r->skeletons); + g_free (r->object_path); + g_clear_object (&r->conn); + g_slice_free (Registration, r); +} + +/** + * tp_dbus_connection_register_object: + * @dbus_connection: a #GDBusConnection + * @object_path: an object path + * @object: (type GObject.Object) (transfer none): an object to export + * + * Export @object at @object_path. Its `TpSvc` interfaces will all + * be exported. + * + * It is considered to be a programming error to register an object + * at a path where another object already exists. + * + * Since 0.UNRELEASED, as a simplification, exporting an object in this + * way at more than one location or on more than one bus is not allowed, + * and is also considered to be a programming error. + * However, redundantly re-exporting the same object at the same path + * on the same bus is allowed. + * + * Also since 0.UNRELEASED, this function must be called *before* taking any + * bus name whose presence is meant to correspond to the existence of this + * object. It is *not* sufficient to take the bus name within the same + * main-loop iteration as registering the object (even though that + * was sufficient under dbus-glib), because GDBus dispatches + * method calls in a separate thread. + */ +void +tp_dbus_connection_register_object (GDBusConnection *dbus_connection, + const gchar *object_path, + gpointer object) +{ + GError *error = NULL; + + if (!tp_dbus_connection_try_register_object (dbus_connection, object_path, + object, &error)) + { + CRITICAL ("Unable to register %s %p at %s:%s: %s #%d: %s", + G_OBJECT_TYPE_NAME (object), object, + g_dbus_connection_get_unique_name (dbus_connection), + object_path, + g_quark_to_string (error->domain), error->code, + error->message); + } +} + +/** + * tp_dbus_connection_try_register_object: + * @dbus_connection: a #GDBusConnection + * @object_path: an object path + * @object: (type GObject.Object) (transfer none): an object to export + * @error: used to raise %G_IO_ERROR_EXISTS if an object exists at that path + * + * The same as tp_dbus_connection_register_object(), except that it is not + * considered to be a programming error to register an object at a path + * where another object exists. + * + * Returns: %TRUE if the object is successfully registered + */ +gboolean +tp_dbus_connection_try_register_object (GDBusConnection *dbus_connection, + const gchar *object_path, + gpointer object, + GError **error) +{ + GDBusConnection *conn; + GType *interfaces; + guint n = 0; + guint i; + Registration *r; + gboolean ret = FALSE; + + g_return_val_if_fail (G_IS_DBUS_CONNECTION (dbus_connection), FALSE); + g_return_val_if_fail (tp_dbus_check_valid_object_path (object_path, error), + FALSE); + g_return_val_if_fail (G_IS_OBJECT (object), FALSE); + + conn = dbus_connection; + r = g_slice_new0 (Registration); + r->conn = g_object_ref (conn); + r->object_path = g_strdup (object_path); + r->skeletons = NULL; + + DEBUG ("%p (r=%p) on %s (%p) at %s", object, r, + g_dbus_connection_get_unique_name (conn), conn, object_path); + + if (!g_object_replace_qdata (object, registration_quark (), + NULL, /* if old value is NULL... */ + r, /* ... replace it with r... */ + tp_dbus_connection_registration_free, /* ... with this free-function... */ + NULL /* ... and don't retrieve the old free-function */ )) + { + DEBUG ("already exported, discarding %p", r); + tp_dbus_connection_registration_free (r); + + /* dbus-glib silently allowed duplicate registrations; to avoid + * breaking too much existing code, so must we. We don't allow + * registrations on different connections or at different object + * paths, though, in the hope that nobody actually does that. */ + + r = g_object_get_qdata (object, registration_quark ()); + + if (!tp_strdiff (r->object_path, object_path) && + r->conn == conn) + { + DEBUG ("already exported at identical (connection, path), ignoring"); + return TRUE; + } + + CRITICAL ("%s %p has already been exported on %s (%p) at %s, cannot " + "export on %s (%p) at %s", + G_OBJECT_TYPE_NAME (object), object, + g_dbus_connection_get_unique_name (r->conn), r->conn, r->object_path, + g_dbus_connection_get_unique_name (conn), conn, object_path); + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_BUSY, + "Already exported with different connection or object-path"); + return FALSE; + } + + /* FIXME: if @object is a GDBusObject or GDBusObjectManagerServer, + * export it that way instead? */ + + interfaces = g_type_interfaces (G_OBJECT_TYPE (object), &n); + + for (i = 0; i < n; i++) + { + GType iface = interfaces[i]; + const TpSvcInterfaceInfo *iinfo; + TpSvcInterfaceSkeleton *skeleton; + GError *inner_error = NULL; + + iinfo = tp_svc_interface_peek_dbus_interface_info (iface); + + if (iinfo == NULL) + { + DEBUG ("- %s is not a D-Bus interface", g_type_name (iface)); + continue; + } + + skeleton = _tp_svc_interface_skeleton_new (object, iface, iinfo); + + if (!g_dbus_interface_skeleton_export ( + G_DBUS_INTERFACE_SKELETON (skeleton), conn, object_path, + &inner_error)) + { + DEBUG ("cannot export %s %p skeleton %p as '%s': %s #%d: %s", + g_type_name (iface), object, skeleton, + iinfo->interface_info->name, + g_quark_to_string (inner_error->domain), inner_error->code, + inner_error->message); + g_object_unref (skeleton); + g_propagate_error (error, inner_error); + + /* roll back */ + tp_dbus_connection_unregister_object (dbus_connection, object); + goto finally; + } + + r->skeletons = g_list_prepend (r->skeletons, skeleton); + + DEBUG ("- %s skeleton %p (wrapping %s %p)", + iinfo->interface_info->name, skeleton, g_type_name (iface), object); + } + + ret = TRUE; +finally: + g_free (interfaces); + return ret; +} + +/** + * tp_dbus_connection_unregister_object: + * @dbus_connection: a #GDBusConnection + * @object: (type GObject.Object) (transfer none): an object previously exported + * with tp_dbus_connection_register_object() + * + * Stop exporting @object on D-Bus. This is a convenience wrapper around + * dbus_g_connection_unregister_g_object(), and behaves similarly. + * + * Since: 0.11.3 + */ +void +tp_dbus_connection_unregister_object (GDBusConnection *dbus_connection, + gpointer object) +{ + g_return_if_fail (G_IS_DBUS_CONNECTION (dbus_connection)); + g_return_if_fail (G_IS_OBJECT (object)); + + DEBUG ("%p", object); + + /* The free-function for the qdata, tp_dbus_connection_registration_free(), + * will automatically unregister the object (if registered) */ + g_object_set_qdata (object, registration_quark (), NULL); +} diff --git a/telepathy-glib/dbus.h b/telepathy-glib/dbus.h index d1ac97a58..835512c36 100644 --- a/telepathy-glib/dbus.h +++ b/telepathy-glib/dbus.h @@ -27,8 +27,9 @@ #define __TELEPATHY_DBUS_H__ #define __TP_IN_DBUS_H__ +#include <gio/gio.h> + #include <telepathy-glib/defs.h> -#include <telepathy-glib/dbus-daemon.h> #include <telepathy-glib/_gen/genums.h> @@ -134,6 +135,21 @@ tp_asv_get_strv (const GHashTable *asv, const gchar *key); void tp_asv_set_strv (GHashTable *asv, const gchar *key, gchar **value); void tp_asv_dump (GHashTable *asv); +gboolean tp_dbus_connection_request_name (GDBusConnection *dbus_connection, + const gchar *well_known_name, gboolean idempotent, GError **error); +gboolean tp_dbus_connection_release_name (GDBusConnection *dbus_connection, + const gchar *well_known_name, GError **error); + +void tp_dbus_connection_register_object (GDBusConnection *dbus_connection, + const gchar *object_path, gpointer object); +gboolean tp_dbus_connection_try_register_object ( + GDBusConnection *dbus_connection, + const gchar *object_path, + gpointer object, + GError **error); +void tp_dbus_connection_unregister_object (GDBusConnection *dbus_connection, + gpointer object); + G_END_DECLS #undef __TP_IN_DBUS_H__ diff --git a/telepathy-glib/debug-sender.c b/telepathy-glib/debug-sender.c index ba266323e..ddc6a9407 100644 --- a/telepathy-glib/debug-sender.c +++ b/telepathy-glib/debug-sender.c @@ -242,7 +242,7 @@ tp_debug_sender_constructed (GObject *object) if (self->priv->conn != NULL) { - tp_dbus_daemon_register_object (self->priv->conn, + tp_dbus_connection_register_object (self->priv->conn, TP_DEBUG_OBJECT_PATH, debug_sender); } } diff --git a/telepathy-glib/introspection.am b/telepathy-glib/introspection.am index 00fd42798..e8af51553 100644 --- a/telepathy-glib/introspection.am +++ b/telepathy-glib/introspection.am @@ -36,7 +36,6 @@ TelepathyGLib_1_gir_FILES = \ $(srcdir)/channel-group.c \ $(srcdir)/handle.c $(srcdir)/handle.h \ $(srcdir)/handle-channel-context.c $(srcdir)/handle-channel-context.h \ - $(srcdir)/dbus-daemon.c $(srcdir)/dbus-daemon.h \ $(srcdir)/interfaces.c \ $(srcdir)/intset.c $(srcdir)/intset.h \ $(srcdir)/dbus.c $(srcdir)/dbus.h \ diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi index 896b51511..349e5fc25 100644 --- a/telepathy-glib/versions/main-1.0.abi +++ b/telepathy-glib/versions/main-1.0.abi @@ -786,11 +786,11 @@ tp_dbus_check_valid_bus_name tp_dbus_check_valid_interface_name tp_dbus_check_valid_member_name tp_dbus_check_valid_object_path -tp_dbus_daemon_register_object -tp_dbus_daemon_release_name -tp_dbus_daemon_request_name -tp_dbus_daemon_try_register_object -tp_dbus_daemon_unregister_object +tp_dbus_connection_register_object +tp_dbus_connection_release_name +tp_dbus_connection_request_name +tp_dbus_connection_try_register_object +tp_dbus_connection_unregister_object tp_dbus_errors_quark tp_dbus_properties_mixin_class_init tp_dbus_properties_mixin_dup_all diff --git a/telepathy-logger/telepathy-logger.c b/telepathy-logger/telepathy-logger.c index 627db98d1..35d55a041 100644 --- a/telepathy-logger/telepathy-logger.c +++ b/telepathy-logger/telepathy-logger.c @@ -99,7 +99,7 @@ telepathy_logger_dbus_init (void) goto out; } - if (!tp_dbus_daemon_request_name (dbus_connection, + if (!tp_dbus_connection_request_name (dbus_connection, TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, FALSE, &error)) { g_critical ("Failed to acquire bus name %s: %s", @@ -108,7 +108,7 @@ telepathy_logger_dbus_init (void) } dbus_srv = _tpl_dbus_service_new (); - tp_dbus_daemon_register_object (dbus_connection, TPL_DBUS_SRV_OBJECT_PATH, + tp_dbus_connection_register_object (dbus_connection, TPL_DBUS_SRV_OBJECT_PATH, G_OBJECT (dbus_srv)); DEBUG ("TPL DBus service registered to: %s", diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index bac8f7f39..c04ef19ae 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -62,18 +62,18 @@ setup (Test *test, /* Claim AccountManager bus-name (needed as we're going to export an Account * object). */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); /* Create service-side Account object */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); /* Claim CD bus-name */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); @@ -91,7 +91,7 @@ setup (Test *test, "connection", test->base_connection, NULL); - tp_dbus_daemon_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, test->cd_service); } @@ -125,14 +125,14 @@ teardown (Test *test, g_clear_error (&test->error); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_object_unref (test->account_service); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); - tp_dbus_daemon_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c index 2b563f368..f892ba2ae 100644 --- a/tests/dbus/account-manager.c +++ b/tests/dbus/account-manager.c @@ -165,22 +165,22 @@ setup_service (Test *test, { setup (test, data); - g_assert (tp_dbus_daemon_request_name (test->dbus, + g_assert (tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error)); test->service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT_MANAGER, NULL); - tp_dbus_daemon_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, test->service); test->account1_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT1_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT1_PATH, test->account1_service); test->account2_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT2_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT2_PATH, test->account2_service); } @@ -216,14 +216,14 @@ teardown_service (Test *test, { script_start_with_deadline (test, 1000); g_assert ( - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error)); - tp_dbus_daemon_unregister_object (test->dbus, test->service); + tp_dbus_connection_unregister_object (test->dbus, test->service); g_object_unref (test->service); - tp_dbus_daemon_unregister_object (test->dbus, test->account1_service); + tp_dbus_connection_unregister_object (test->dbus, test->account1_service); g_object_unref (test->account1_service); - tp_dbus_daemon_unregister_object (test->dbus, test->account2_service); + tp_dbus_connection_unregister_object (test->dbus, test->account2_service); g_object_unref (test->account2_service); g_clear_object (&test->account1); @@ -485,7 +485,7 @@ register_service_action (gpointer script_data, { Test *test = (Test *) script_data; - tp_dbus_daemon_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, test->service); script_continue (test); @@ -547,7 +547,7 @@ static void test_prepare_destroyed (Test *test, gconstpointer data G_GNUC_UNUSED) { - tp_dbus_daemon_unregister_object (test->dbus, test->service); + tp_dbus_connection_unregister_object (test->dbus, test->service); test_prepare (test, data); script_append_action (test, assert_failed_action, NULL); script_append_action (test, register_service_action, NULL); diff --git a/tests/dbus/account-request.c b/tests/dbus/account-request.c index 807745f30..c2ad76558 100644 --- a/tests/dbus/account-request.c +++ b/tests/dbus/account-request.c @@ -42,12 +42,12 @@ setup (Test *test, g_assert (test->dbus != NULL); /* create the account manager service */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); test->am = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT_MANAGER, NULL); - tp_dbus_daemon_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH, test->am); /* and now the account manager proxy */ @@ -57,7 +57,7 @@ setup (Test *test, /* finally create the account service */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, + tp_dbus_connection_register_object (test->dbus, TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/lospolloshermanos", test->account_service); @@ -77,13 +77,13 @@ teardown (Test *test, /* It might have a GetAll() in-flight, so we have to wait */ tp_tests_await_last_unref (&test->account_manager); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); - tp_dbus_daemon_unregister_object (test->dbus, test->am); + tp_dbus_connection_unregister_object (test->dbus, test->am); tp_tests_assert_last_unref (&test->am); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); tp_tests_assert_last_unref (&test->account_service); g_clear_object (&test->dbus); diff --git a/tests/dbus/account.c b/tests/dbus/account.c index 2ce1de21c..cb78a6d90 100644 --- a/tests/dbus/account.c +++ b/tests/dbus/account.c @@ -130,12 +130,12 @@ setup_service (Test *test, { setup (test, data); - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); test->account_service = g_object_new (TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); tp_tests_create_and_connect_conn (TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -215,11 +215,11 @@ static void teardown_service (Test *test, gconstpointer data) { - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_clear_object (&test->account_service); tp_tests_connection_assert_disconnect_succeeds (test->conn1); diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c index 4ceb24c14..b149644d0 100644 --- a/tests/dbus/base-client.c +++ b/tests/dbus/base-client.c @@ -90,7 +90,7 @@ setup (Test *test, /* Claim AccountManager bus-name (needed as we're going to export an Account * object). */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); @@ -103,7 +103,7 @@ setup (Test *test, /* Create service-side Account object */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); /* Create client-side Client object */ @@ -177,7 +177,7 @@ setup (Test *test, test->cdo_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCH_OPERATION, NULL); - tp_dbus_daemon_register_object (test->dbus, CDO_PATH, test->cdo_service); + tp_dbus_connection_register_object (test->dbus, CDO_PATH, test->cdo_service); tp_tests_simple_channel_dispatch_operation_set_conn_path (test->cdo_service, tp_proxy_get_object_path (test->connection)); @@ -188,7 +188,7 @@ setup (Test *test, tp_tests_simple_channel_dispatch_operation_set_channel (test->cdo_service, test->text_chan); - g_assert (tp_dbus_daemon_request_name (test->dbus, + g_assert (tp_dbus_connection_request_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL)); /* Create and register CD */ @@ -197,7 +197,7 @@ setup (Test *test, "connection", test->base_connection, NULL); - tp_dbus_daemon_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, test->cd_service); } @@ -236,16 +236,16 @@ teardown (Test *test, g_object_unref (test->factory); - tp_dbus_daemon_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); g_object_unref (test->base_client); g_object_unref (test->client); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_object_unref (test->account_service); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/dbus/call-cancellation.c b/tests/dbus/call-cancellation.c index cb011510a..f4386f32c 100644 --- a/tests/dbus/call-cancellation.c +++ b/tests/dbus/call-cancellation.c @@ -199,7 +199,7 @@ setup (Fixture *f, f->cd_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCHER, NULL); - tp_dbus_daemon_register_object (dbus_connection, "/", f->cd_service); + tp_dbus_connection_register_object (dbus_connection, "/", f->cd_service); f->private_gdbus = tp_tests_get_private_bus (); g_assert (f->private_gdbus != NULL); diff --git a/tests/dbus/channel-dispatch-operation.c b/tests/dbus/channel-dispatch-operation.c index 98c910880..2f2e2e854 100644 --- a/tests/dbus/channel-dispatch-operation.c +++ b/tests/dbus/channel-dispatch-operation.c @@ -66,7 +66,7 @@ setup (Test *test, test->cdo_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCH_OPERATION, NULL); - tp_dbus_daemon_register_object (test->private_dbus, "/whatever", + tp_dbus_connection_register_object (test->private_dbus, "/whatever", test->cdo_service); } @@ -120,7 +120,7 @@ setup_services (Test *test, tp_tests_simple_channel_dispatch_operation_set_account_path (test->cdo_service, ACCOUNT_PATH); - g_assert (tp_dbus_daemon_request_name (test->private_dbus, + g_assert (tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL)); } @@ -134,12 +134,12 @@ teardown (Test *test, test->cdo = NULL; } - tp_dbus_daemon_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); if (test->private_dbus != NULL) { - tp_dbus_daemon_release_name (test->private_dbus, + tp_dbus_connection_release_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); @@ -214,7 +214,7 @@ test_new (Test *test, "/whatever", NULL, NULL); g_assert (test->cdo == NULL); - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -233,7 +233,7 @@ test_crash (Test *test, { gboolean ok; - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -242,7 +242,7 @@ test_crash (Test *test, g_assert (test->cdo != NULL); g_assert (tp_proxy_get_invalidated (test->cdo) == NULL); - tp_dbus_daemon_release_name (test->private_dbus, + tp_dbus_connection_release_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); tp_tests_proxy_run_until_dbus_queue_processed (test->cdo); @@ -266,7 +266,7 @@ test_finished (Test *test, { gboolean ok; - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c index a16e0cde7..5ed39d59d 100644 --- a/tests/dbus/channel-request.c +++ b/tests/dbus/channel-request.c @@ -91,7 +91,7 @@ setup (Test *test, test->cr_service = tp_tests_object_new_static_class (test_simple_cr_get_type (), NULL); - tp_dbus_daemon_register_object (test->private_dbus, "/whatever", + tp_dbus_connection_register_object (test->private_dbus, "/whatever", test->cr_service); } @@ -111,7 +111,7 @@ teardown (Test *test, if (test->private_dbus != NULL) { - tp_dbus_daemon_release_name (test->private_dbus, + tp_dbus_connection_release_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); g_dbus_connection_close_sync (test->private_dbus, NULL, NULL); @@ -171,7 +171,7 @@ test_new (Test *test, "/whatever", NULL, NULL); g_assert (test->cr == NULL); - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -189,7 +189,7 @@ test_crash (Test *test, { gboolean ok; - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -197,7 +197,7 @@ test_crash (Test *test, g_assert (test->cr != NULL); g_assert (tp_proxy_get_invalidated (test->cr) == NULL); - tp_dbus_daemon_release_name (test->private_dbus, + tp_dbus_connection_release_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); tp_tests_proxy_run_until_dbus_queue_processed (test->cr); @@ -239,7 +239,7 @@ test_succeeded (Test *test, gboolean ok; GHashTable *props; - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -279,7 +279,7 @@ test_failed (Test *test, { gboolean ok; - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -320,7 +320,7 @@ test_immutable_properties (Test *test, props = tp_asv_new ("badger", G_TYPE_UINT, 42, NULL); - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); @@ -361,7 +361,7 @@ test_properties (Test *test, TP_PROP_CHANNEL_REQUEST_HINTS, TP_HASH_TYPE_STRING_VARIANT_MAP, hints, NULL); - ok = tp_dbus_daemon_request_name (test->private_dbus, + ok = tp_dbus_connection_request_name (test->private_dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL); g_assert (ok); diff --git a/tests/dbus/cm.c b/tests/dbus/cm.c index 988da5a97..781fc6eb6 100644 --- a/tests/dbus/cm.c +++ b/tests/dbus/cm.c @@ -90,9 +90,9 @@ my_get_all (TpSvcDBusProperties *iface, cm->drop_name_on_get--; - tp_dbus_daemon_release_name (dbus, string->str, &error); + tp_dbus_connection_release_name (dbus, string->str, &error); g_assert_no_error (error); - tp_dbus_daemon_request_name (dbus, string->str, FALSE, &error); + tp_dbus_connection_request_name (dbus, string->str, FALSE, &error); g_assert_no_error (error); } diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c index c896fe644..771c59592 100644 --- a/tests/dbus/connection.c +++ b/tests/dbus/connection.c @@ -280,9 +280,9 @@ test_object_path (Test *test, "simple_protocol"); /* Register the same connection with an invalid object path */ - tp_dbus_daemon_unregister_object (test->dbus, test->service_conn); - tp_dbus_daemon_register_object (test->dbus, invalid_path, test->service_conn); - tp_dbus_daemon_request_name (test->dbus, invalid_name, FALSE, &error); + tp_dbus_connection_unregister_object (test->dbus, test->service_conn); + tp_dbus_connection_register_object (test->dbus, invalid_path, test->service_conn); + tp_dbus_connection_request_name (test->dbus, invalid_name, FALSE, &error); g_assert_no_error (error); /* Create a TpConnection for that path, it return invalidated connection */ @@ -292,8 +292,8 @@ test_object_path (Test *test, g_clear_error (&error); /* Put it back where it was meant to be so we can do teardown. */ - tp_dbus_daemon_unregister_object (test->dbus, test->service_conn); - tp_dbus_daemon_register_object (test->dbus, + tp_dbus_connection_unregister_object (test->dbus, test->service_conn); + tp_dbus_connection_register_object (test->dbus, tp_base_connection_get_object_path (test->service_conn_as_base), test->service_conn); } diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c index 35e36555a..44ba184d4 100644 --- a/tests/dbus/contacts.c +++ b/tests/dbus/contacts.c @@ -657,7 +657,7 @@ make_the_connection_disappear (Fixture *f) GError *error = NULL; gboolean ok; - tp_dbus_daemon_unregister_object ( + tp_dbus_connection_unregister_object ( tp_base_connection_get_dbus_connection (f->base_connection), f->base_connection); /* check that that worked */ @@ -677,7 +677,7 @@ put_the_connection_back (Fixture *f) GError *error = NULL; gboolean ok; - tp_dbus_daemon_register_object ( + tp_dbus_connection_register_object ( tp_base_connection_get_dbus_connection (f->base_connection), tp_base_connection_get_object_path (f->base_connection), f->base_connection); diff --git a/tests/dbus/disconnection.c b/tests/dbus/disconnection.c index a72f2c9a0..8cabfbb83 100644 --- a/tests/dbus/disconnection.c +++ b/tests/dbus/disconnection.c @@ -157,7 +157,7 @@ setup (Fixture *f, f->cd_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCHER, NULL); - tp_dbus_daemon_register_object (dbus_connection, "/", f->cd_service); + tp_dbus_connection_register_object (dbus_connection, "/", f->cd_service); f->private_gdbus = tp_tests_get_private_bus (); g_assert (f->private_gdbus != NULL); diff --git a/tests/dbus/properties.c b/tests/dbus/properties.c index 0bdb51326..6f3bbfd67 100644 --- a/tests/dbus/properties.c +++ b/tests/dbus/properties.c @@ -237,7 +237,7 @@ main (int argc, char **argv) dbus_connection = tp_tests_dbus_dup_or_die (); factory = tp_client_factory_dup (NULL); ctx.obj = tp_tests_object_new_static_class (TEST_TYPE_PROPERTIES, NULL); - tp_dbus_daemon_register_object (dbus_connection, "/", ctx.obj); + tp_dbus_connection_register_object (dbus_connection, "/", ctx.obj); /* Open a D-Bus connection to myself */ ctx.proxy = TP_PROXY (tp_tests_object_new_static_class (TP_TYPE_PROXY, diff --git a/tests/dbus/room-list.c b/tests/dbus/room-list.c index da9b30c01..bc14104c0 100644 --- a/tests/dbus/room-list.c +++ b/tests/dbus/room-list.c @@ -86,7 +86,7 @@ setup (Test *test, "me@test.com", &test->base_connection, &test->connection); /* Claim CD bus-name */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); @@ -96,7 +96,7 @@ setup (Test *test, "connection", test->base_connection, NULL); - tp_dbus_daemon_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, + tp_dbus_connection_register_object (test->dbus, TP_CHANNEL_DISPATCHER_OBJECT_PATH, test->cd_service); create_room_list (test, SERVER); @@ -109,7 +109,7 @@ teardown (Test *test, { g_clear_error (&test->error); - tp_dbus_daemon_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/dbus/simple-approver.c b/tests/dbus/simple-approver.c index 409a4226a..07db16719 100644 --- a/tests/dbus/simple-approver.c +++ b/tests/dbus/simple-approver.c @@ -67,14 +67,14 @@ setup (Test *test, /* Claim AccountManager bus-name (needed as we're going to export an Account * object). */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); /* Create service-side Account object */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); test->account_manager = tp_account_manager_dup (); @@ -121,7 +121,7 @@ setup (Test *test, test->cdo_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_CHANNEL_DISPATCH_OPERATION, NULL); - tp_dbus_daemon_register_object (test->dbus, CDO_PATH, test->cdo_service); + tp_dbus_connection_register_object (test->dbus, CDO_PATH, test->cdo_service); tp_tests_simple_channel_dispatch_operation_set_conn_path (test->cdo_service, tp_proxy_get_object_path (test->connection)); @@ -132,7 +132,7 @@ setup (Test *test, tp_tests_simple_channel_dispatch_operation_set_channel (test->cdo_service, test->text_chan); - g_assert (tp_dbus_daemon_request_name (test->dbus, + g_assert (tp_dbus_connection_request_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, FALSE, NULL)); } @@ -142,16 +142,16 @@ teardown (Test *test, { g_clear_error (&test->error); - tp_dbus_daemon_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_CHANNEL_DISPATCHER_BUS_NAME, NULL); g_object_unref (test->simple_approver); g_object_unref (test->client); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_object_unref (test->account_service); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/dbus/simple-handler.c b/tests/dbus/simple-handler.c index 0d3ede09b..c65d47ee2 100644 --- a/tests/dbus/simple-handler.c +++ b/tests/dbus/simple-handler.c @@ -62,14 +62,14 @@ setup (Test *test, /* Claim AccountManager bus-name (needed as we're going to export an Account * object). */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); /* Create service-side Account object */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); /* Create client-side Account object */ @@ -140,10 +140,10 @@ teardown (Test *test, g_object_unref (test->simple_handler); g_object_unref (test->client); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_object_unref (test->account_service); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/dbus/simple-observer.c b/tests/dbus/simple-observer.c index 467eb1e10..60bb5282b 100644 --- a/tests/dbus/simple-observer.c +++ b/tests/dbus/simple-observer.c @@ -61,14 +61,14 @@ setup (Test *test, /* Claim AccountManager bus-name (needed as we're going to export an Account * object). */ - tp_dbus_daemon_request_name (test->dbus, + tp_dbus_connection_request_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error); g_assert_no_error (test->error); /* Create service-side Account object */ test->account_service = tp_tests_object_new_static_class ( TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL); - tp_dbus_daemon_register_object (test->dbus, ACCOUNT_PATH, + tp_dbus_connection_register_object (test->dbus, ACCOUNT_PATH, test->account_service); /* Create client-side Account object */ @@ -115,10 +115,10 @@ teardown (Test *test, g_object_unref (test->simple_observer); g_object_unref (test->client); - tp_dbus_daemon_unregister_object (test->dbus, test->account_service); + tp_dbus_connection_unregister_object (test->dbus, test->account_service); g_object_unref (test->account_service); - tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error); g_assert_no_error (test->error); diff --git a/tests/lib/logger-test-helper.c b/tests/lib/logger-test-helper.c index 928e28345..ad8a11786 100644 --- a/tests/lib/logger-test-helper.c +++ b/tests/lib/logger-test-helper.c @@ -41,7 +41,7 @@ tpl_test_create_and_prepare_account (GDBusConnection *dbus, NULL); g_assert (*account_service != NULL); - tp_dbus_daemon_register_object (dbus, path, *account_service); + tp_dbus_connection_register_object (dbus, path, *account_service); *account = tp_client_factory_ensure_account (factory, path, NULL, &error); @@ -60,7 +60,7 @@ tpl_test_release_account (GDBusConnection *dbus, TpAccount *account, TpTestsSimpleAccount *account_service) { - tp_dbus_daemon_unregister_object (dbus, account_service); + tp_dbus_connection_unregister_object (dbus, account_service); tp_tests_assert_last_unref (&account_service); tp_tests_await_last_unref (&account); } diff --git a/tests/lib/simple-channel-dispatcher.c b/tests/lib/simple-channel-dispatcher.c index da159bf8e..afe62cb86 100644 --- a/tests/lib/simple-channel-dispatcher.c +++ b/tests/lib/simple-channel-dispatcher.c @@ -102,7 +102,7 @@ create_channel_request (TpTestsSimpleChannelDispatcher *self, dbus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_assert (dbus != NULL); - tp_dbus_daemon_register_object (dbus, path, chan_request); + tp_dbus_connection_register_object (dbus, path, chan_request); g_object_unref (dbus); diff --git a/tests/lib/tls-certificate.c b/tests/lib/tls-certificate.c index 0ebea7d3e..d4b4344f1 100644 --- a/tests/lib/tls-certificate.c +++ b/tests/lib/tls-certificate.c @@ -165,7 +165,7 @@ tp_tests_tls_certificate_constructed (GObject *object) chain_up (object); /* register the certificate on the bus */ - tp_dbus_daemon_register_object (self->priv->dbus_connection, + tp_dbus_connection_register_object (self->priv->dbus_connection, self->priv->object_path, self); } diff --git a/tests/logger/dbus/test-log-manager.c b/tests/logger/dbus/test-log-manager.c index 45434b393..9034dd028 100644 --- a/tests/logger/dbus/test-log-manager.c +++ b/tests/logger/dbus/test-log-manager.c @@ -57,11 +57,11 @@ teardown_service (TestCaseFixture* fixture, fixture->account = NULL; } - tp_dbus_daemon_unregister_object (fixture->dbus, fixture->account_service); + tp_dbus_connection_unregister_object (fixture->dbus, fixture->account_service); g_object_unref (fixture->account_service); fixture->account_service = NULL; - tp_dbus_daemon_release_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); @@ -128,7 +128,7 @@ setup_service (TestCaseFixture* fixture, fixture->dbus = tp_tests_dbus_dup_or_die (); g_assert (fixture->dbus != NULL); - tp_dbus_daemon_request_name (fixture->dbus, + tp_dbus_connection_request_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); g_assert_no_error (error); @@ -147,7 +147,7 @@ setup_service (TestCaseFixture* fixture, g_object_set_property (G_OBJECT (fixture->account_service), "parameters", boxed_params); - tp_dbus_daemon_register_object (fixture->dbus, account_path, + tp_dbus_connection_register_object (fixture->dbus, account_path, fixture->account_service); fixture->factory = _tpl_client_factory_dup (fixture->dbus); diff --git a/tests/logger/dbus/test-tpl-log-iter-pidgin.c b/tests/logger/dbus/test-tpl-log-iter-pidgin.c index 373685b99..8459ab1c4 100644 --- a/tests/logger/dbus/test-tpl-log-iter-pidgin.c +++ b/tests/logger/dbus/test-tpl-log-iter-pidgin.c @@ -64,7 +64,7 @@ setup (PidginTestCaseFixture* fixture, fixture->bus = tp_tests_dbus_dup_or_die (); g_assert (fixture->bus != NULL); - tp_dbus_daemon_request_name (fixture->bus, + tp_dbus_connection_request_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); @@ -85,7 +85,7 @@ setup (PidginTestCaseFixture* fixture, NULL); g_hash_table_unref (asv); - tp_dbus_daemon_register_object (fixture->bus, + tp_dbus_connection_register_object (fixture->bus, account_path, fixture->account_service); @@ -117,7 +117,7 @@ teardown (PidginTestCaseFixture *fixture, { GError *error = NULL; - tp_dbus_daemon_release_name (fixture->bus, + tp_dbus_connection_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); @@ -125,7 +125,7 @@ teardown (PidginTestCaseFixture *fixture, g_clear_object (&fixture->account); g_clear_object (&fixture->factory); - tp_dbus_daemon_unregister_object (fixture->bus, fixture->account_service); + tp_dbus_connection_unregister_object (fixture->bus, fixture->account_service); g_clear_object (&fixture->account_service); g_clear_object (&fixture->bus); diff --git a/tests/logger/dbus/test-tpl-log-iter-xml.c b/tests/logger/dbus/test-tpl-log-iter-xml.c index 58ccb4c02..2581fad57 100644 --- a/tests/logger/dbus/test-tpl-log-iter-xml.c +++ b/tests/logger/dbus/test-tpl-log-iter-xml.c @@ -44,7 +44,7 @@ setup (XmlTestCaseFixture* fixture, fixture->bus = tp_tests_dbus_dup_or_die (); g_assert (fixture->bus != NULL); - tp_dbus_daemon_request_name (fixture->bus, + tp_dbus_connection_request_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); @@ -65,7 +65,7 @@ teardown (XmlTestCaseFixture *fixture, { GError *error = NULL; - tp_dbus_daemon_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); diff --git a/tests/logger/dbus/test-tpl-log-store-pidgin.c b/tests/logger/dbus/test-tpl-log-store-pidgin.c index 857017529..175caadec 100644 --- a/tests/logger/dbus/test-tpl-log-store-pidgin.c +++ b/tests/logger/dbus/test-tpl-log-store-pidgin.c @@ -75,7 +75,7 @@ setup_service (PidginTestCaseFixture* fixture, fixture->dbus = tp_tests_dbus_dup_or_die (); g_assert (fixture->dbus != NULL); - tp_dbus_daemon_request_name (fixture->dbus, + tp_dbus_connection_request_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); g_assert_no_error (error); @@ -94,7 +94,7 @@ setup_service (PidginTestCaseFixture* fixture, g_object_set_property (G_OBJECT (fixture->account_service), "parameters", boxed_params); - tp_dbus_daemon_register_object (fixture->dbus, account_path, + tp_dbus_connection_register_object (fixture->dbus, account_path, fixture->account_service); fixture->factory = _tpl_client_factory_dup (fixture->dbus); @@ -169,10 +169,10 @@ teardown_service (PidginTestCaseFixture* fixture, if (fixture->account_manager != NULL) tp_tests_await_last_unref (&fixture->account_manager); - tp_dbus_daemon_unregister_object (fixture->dbus, fixture->account_service); + tp_dbus_connection_unregister_object (fixture->dbus, fixture->account_service); tp_tests_await_last_unref (&fixture->account_service); - tp_dbus_daemon_release_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (fixture->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); diff --git a/tests/logger/dbus/test-tpl-log-store-xml.c b/tests/logger/dbus/test-tpl-log-store-xml.c index a3543c9cd..88effed7a 100644 --- a/tests/logger/dbus/test-tpl-log-store-xml.c +++ b/tests/logger/dbus/test-tpl-log-store-xml.c @@ -49,7 +49,7 @@ setup (XmlTestCaseFixture* fixture, fixture->bus = tp_tests_dbus_dup_or_die (); g_assert (fixture->bus != NULL); - tp_dbus_daemon_request_name (fixture->bus, + tp_dbus_connection_request_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); @@ -97,7 +97,7 @@ teardown (XmlTestCaseFixture *fixture, tp_tests_assert_last_unref (&fixture->factory); - tp_dbus_daemon_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, + tp_dbus_connection_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); diff --git a/tests/logger/dbus/test-tpl-log-walker.c b/tests/logger/dbus/test-tpl-log-walker.c index 5c90c770b..759bedd93 100644 --- a/tests/logger/dbus/test-tpl-log-walker.c +++ b/tests/logger/dbus/test-tpl-log-walker.c @@ -66,7 +66,7 @@ setup (WalkerTestCaseFixture* fixture, fixture->bus = tp_tests_dbus_dup_or_die (); g_assert (fixture->bus != NULL); - tp_dbus_daemon_request_name (fixture->bus, + tp_dbus_connection_request_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &error); @@ -87,7 +87,7 @@ setup (WalkerTestCaseFixture* fixture, NULL); g_hash_table_unref (asv); - tp_dbus_daemon_register_object (fixture->bus, + tp_dbus_connection_register_object (fixture->bus, account_path, fixture->account_service); @@ -119,7 +119,7 @@ teardown (WalkerTestCaseFixture *fixture, { GError *error = NULL; - tp_dbus_daemon_release_name (fixture->bus, + tp_dbus_connection_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, &error); g_assert_no_error (error); @@ -127,7 +127,7 @@ teardown (WalkerTestCaseFixture *fixture, g_clear_object (&fixture->account); g_clear_object (&fixture->factory); - tp_dbus_daemon_unregister_object (fixture->bus, fixture->account_service); + tp_dbus_connection_unregister_object (fixture->bus, fixture->account_service); g_clear_object (&fixture->account_service); g_clear_object (&fixture->bus); |