From 0662540a4b45c9d0cc087211adb81670e4f2fef3 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 14 Jul 2011 12:05:00 +0200 Subject: [PATCH] Ensure TpAccountManager, TpAccount and TpConnection always have a factory Propagate the factory Manager->Account->Connection and fallback to create an automatic factory in case they were not created through a factory. --- telepathy-glib/account-manager.c | 5 ++++- telepathy-glib/account.c | 6 ++++-- telepathy-glib/connection.c | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index 1feee6d..fa08c59 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -470,6 +470,8 @@ _tp_account_manager_constructed (GObject *object) g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); + _tp_proxy_ensure_factory (self, NULL); + tp_cli_account_manager_connect_to_account_validity_changed (self, _tp_account_manager_validity_changed_cb, NULL, NULL, G_OBJECT (self), NULL); @@ -912,7 +914,8 @@ tp_account_manager_ensure_account (TpAccountManager *manager, if (account != NULL) return account; - account = tp_account_new (tp_proxy_get_dbus_daemon (manager), path, &error); + account = tp_simple_client_factory_dup_account (tp_proxy_get_factory (manager), + path, &error); if (account == NULL) { DEBUG ("tp_account_new() failed: %s", error->message); diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index eb183f6..92d58cb 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -394,8 +394,8 @@ _tp_account_set_connection (TpAccount *account, if (tp_strdiff ("/", path)) { GError *error = NULL; - priv->connection = tp_connection_new (tp_proxy_get_dbus_daemon (account), - NULL, path, &error); + priv->connection = tp_simple_client_factory_dup_connection ( + tp_proxy_get_factory (account), path, &error); if (priv->connection == NULL) { @@ -849,6 +849,8 @@ _tp_account_constructed (GObject *object) g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL); + _tp_proxy_ensure_factory (self, NULL); + sc = tp_cli_account_connect_to_removed (self, _tp_account_removed_cb, NULL, NULL, NULL, &error); diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c index c157e5a..2fa6d22 100644 --- a/telepathy-glib/connection.c +++ b/telepathy-glib/connection.c @@ -1291,6 +1291,8 @@ tp_connection_constructor (GType type, TpConnection *self = TP_CONNECTION (object_class->constructor (type, n_params, params)); + _tp_proxy_ensure_factory (self, NULL); + /* Connect to my own StatusChanged signal. * The connection hasn't had a chance to become invalid yet, so we can * assume that this signal connection will work */ -- 1.7.4.1