[next] telepathy-mission-control: McdClientRegistry: stop having a TpDBusDaemon
Simon McVittie
smcv at kemper.freedesktop.org
Thu Apr 3 07:28:06 PDT 2014
Module: telepathy-mission-control
Branch: next
Commit: f369b2e82eec2da877d34195d9154db9d2a93787
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=f369b2e82eec2da877d34195d9154db9d2a93787
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Tue Apr 1 13:42:19 2014 +0100
McdClientRegistry: stop having a TpDBusDaemon
---
src/client-registry.c | 35 ++++++-----------------------------
src/client-registry.h | 3 +--
src/mcd-dispatch-operation.c | 9 +++++----
src/request.c | 3 ++-
4 files changed, 14 insertions(+), 36 deletions(-)
diff --git a/src/client-registry.c b/src/client-registry.c
index e50982f..28b6f99 100644
--- a/src/client-registry.c
+++ b/src/client-registry.c
@@ -36,8 +36,7 @@ G_DEFINE_TYPE (McdClientRegistry, _mcd_client_registry, G_TYPE_OBJECT)
enum
{
PROP_0,
- PROP_FACTORY,
- PROP_DBUS_DAEMON
+ PROP_FACTORY
};
enum
@@ -56,7 +55,6 @@ struct _McdClientRegistryPrivate
GHashTable *clients;
TpClientFactory *factory;
- TpDBusDaemon *dbus_daemon;
/* subscription to NameOwnerChanged */
guint noc_id;
@@ -358,8 +356,8 @@ mcd_client_registry_name_owner_changed_cb (GDBusConnection *conn,
static void
watch_clients (McdClientRegistry *self)
{
- TpDBusDaemon *dbus_daemon = self->priv->dbus_daemon;
- GDBusConnection *gconn = tp_proxy_get_dbus_connection (dbus_daemon);
+ GDBusConnection *gconn = tp_client_factory_get_dbus_connection (
+ self->priv->factory);
/* for simplicity we now hard-depend on D-Bus 1.6, which is in Debian 7,
* Ubuntu LTS, etc. */
@@ -382,7 +380,6 @@ mcd_client_registry_constructed (GObject *object)
chain_up (object);
g_return_if_fail (self->priv->factory != NULL);
- g_return_if_fail (self->priv->dbus_daemon != NULL);
DEBUG ("Starting to look for clients");
@@ -409,10 +406,7 @@ mcd_client_registry_set_property (GObject *object,
{
case PROP_FACTORY:
g_assert (self->priv->factory == NULL); /* it's construct-only */
- g_assert (self->priv->dbus_daemon == NULL);
self->priv->factory = TP_CLIENT_FACTORY (g_value_dup_object (value));
- self->priv->dbus_daemon =
- g_object_ref (tp_client_factory_get_dbus_daemon (self->priv->factory));
break;
default:
@@ -431,10 +425,6 @@ mcd_client_registry_get_property (GObject *object,
switch (prop_id)
{
- case PROP_DBUS_DAEMON:
- g_value_set_object (value, self->priv->dbus_daemon);
- break;
-
case PROP_FACTORY:
g_value_set_object (value, self->priv->factory);
break;
@@ -452,15 +442,14 @@ mcd_client_registry_dispose (GObject *object)
void (*chain_up) (GObject *) =
G_OBJECT_CLASS (_mcd_client_registry_parent_class)->dispose;
- if (self->priv->dbus_daemon != NULL && self->priv->noc_id != 0)
+ if (self->priv->factory != NULL && self->priv->noc_id != 0)
{
GDBusConnection *gconn =
- tp_proxy_get_dbus_connection (self->priv->dbus_daemon);
+ tp_client_factory_get_dbus_connection (self->priv->factory);
g_dbus_connection_signal_unsubscribe (gconn, self->priv->noc_id);
}
- tp_clear_object (&self->priv->dbus_daemon);
tp_clear_object (&self->priv->factory);
if (self->priv->clients != NULL)
@@ -493,11 +482,6 @@ _mcd_client_registry_class_init (McdClientRegistryClass *cls)
TP_TYPE_CLIENT_FACTORY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_DBUS_DAEMON,
- g_param_spec_object ("dbus-daemon", "D-Bus daemon", "D-Bus daemon",
- TP_TYPE_DBUS_DAEMON,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
signals[S_CLIENT_ADDED] = g_signal_new ("client-added",
G_OBJECT_CLASS_TYPE (cls),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
@@ -723,15 +707,8 @@ _mcd_client_registry_list_possible_handlers (McdClientRegistry *self,
return handlers;
}
-TpDBusDaemon *
-_mcd_client_registry_get_dbus_daemon (McdClientRegistry *self)
-{
- g_return_val_if_fail (MCD_IS_CLIENT_REGISTRY (self), NULL);
- return self->priv->dbus_daemon;
-}
-
TpClientFactory *
-mcd_client_registry_get_factory (McdClientRegistry *self)
+_mcd_client_registry_get_factory (McdClientRegistry *self)
{
g_return_val_if_fail (MCD_IS_CLIENT_REGISTRY (self), NULL);
return self->priv->factory;
diff --git a/src/client-registry.h b/src/client-registry.h
index abdb9a7..2a6275a 100644
--- a/src/client-registry.h
+++ b/src/client-registry.h
@@ -66,8 +66,7 @@ GType _mcd_client_registry_get_type (void);
G_GNUC_INTERNAL McdClientRegistry *_mcd_client_registry_new (
TpClientFactory *factory);
-TpDBusDaemon *_mcd_client_registry_get_dbus_daemon (McdClientRegistry *self);
-TpClientFactory *mcd_client_registry_get_factory (McdClientRegistry *self);
+TpClientFactory *_mcd_client_registry_get_factory (McdClientRegistry *self);
G_GNUC_INTERNAL McdClientProxy *_mcd_client_registry_lookup (
McdClientRegistry *self, const gchar *well_known_name);
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index afe4cda..3851502 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1107,15 +1107,16 @@ mcd_dispatch_operation_constructor (GType type, guint n_params,
* don't run) */
if (priv->needs_approval)
{
- TpDBusDaemon *dbus_daemon;
+ TpClientFactory *factory;
g_object_get (priv->client_registry,
- "dbus-daemon", &dbus_daemon,
+ "factory", &factory,
NULL);
- tp_dbus_daemon_register_object (dbus_daemon, priv->object_path,
+ tp_dbus_daemon_register_object (
+ tp_client_factory_get_dbus_daemon (factory), priv->object_path,
object);
- g_object_unref (dbus_daemon);
+ g_object_unref (factory);
}
priv->plugin_api = _mcd_plugin_dispatch_operation_new (operation);
diff --git a/src/request.c b/src/request.c
index 02d7198..6e9adef 100644
--- a/src/request.c
+++ b/src/request.c
@@ -132,7 +132,8 @@ _mcd_request_constructed (GObject *object)
g_return_if_fail (self->account != NULL);
g_return_if_fail (self->clients != NULL);
- self->dbus_daemon = _mcd_client_registry_get_dbus_daemon (self->clients);
+ self->dbus_daemon = tp_client_factory_get_dbus_daemon (
+ _mcd_client_registry_get_factory (self->clients));
tp_dbus_daemon_register_object (self->dbus_daemon, self->object_path, self);
}
More information about the telepathy-commits
mailing list