summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-01 13:42:19 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-01 14:02:21 +0100
commitf369b2e82eec2da877d34195d9154db9d2a93787 (patch)
tree35476149b86b253bebca825f51cbf9e4f4433ea4
parente0cdd15284aa3ae187f761ab52b3afa1fe48c89c (diff)
McdClientRegistry: stop having a TpDBusDaemon
-rw-r--r--src/client-registry.c35
-rw-r--r--src/client-registry.h3
-rw-r--r--src/mcd-dispatch-operation.c9
-rw-r--r--src/request.c3
4 files changed, 14 insertions, 36 deletions
diff --git a/src/client-registry.c b/src/client-registry.c
index e50982fe..28b6f997 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 abdb9a71..2a6275a2 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 afe4cda3..3851502c 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 02d7198b..6e9adef2 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);
}