[next] telepathy-glib: Remove tp_account_manager_ensure_account
Simon McVittie
smcv at kemper.freedesktop.org
Thu May 3 07:34:43 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 4e1028a987b4f582abd3101dcd15f7d3c4e29155
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=4e1028a987b4f582abd3101dcd15f7d3c4e29155
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu May 3 13:57:20 2012 +0100
Remove tp_account_manager_ensure_account
---
docs/reference/telepathy-glib-sections.txt | 1 -
telepathy-glib/account-manager.c | 58 ----------------------------
telepathy-glib/account-manager.h | 6 ---
tests/dbus/account-manager.c | 19 ++++++---
tests/dbus/simple-approver.c | 7 ++-
5 files changed, 16 insertions(+), 75 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 25937b3..971c49e 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4087,7 +4087,6 @@ tp_account_manager_set_default
tp_account_manager_dup
tp_account_manager_create_account_async
tp_account_manager_create_account_finish
-tp_account_manager_ensure_account
tp_account_manager_get_usable_accounts
tp_account_manager_get_most_available_presence
tp_account_manager_set_all_requested_presences
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
index c1cc87a..a2c3899 100644
--- a/telepathy-glib/account-manager.c
+++ b/telepathy-glib/account-manager.c
@@ -1006,64 +1006,6 @@ insert_account (TpAccountManager *self,
}
/**
- * tp_account_manager_ensure_account:
- * @manager: a #TpAccountManager
- * @path: the object path for an account
- *
- * Lookup an account in the account manager @manager. If the desired account
- * has already been ensured then the same object will be returned, otherwise
- * it will create a new #TpAccount and add it to @manager. As a result, if
- * @manager thinks that the account doesn't exist, this will still add it to
- * @manager to avoid races. Note that the returned #TpAccount is not guaranteed
- * to be ready on return.
- *
- * The caller must keep a ref to the returned object using g_object_ref() if
- * it is to be kept.
- *
- * Returns: (transfer none): a new #TpAccount at @path, or %NULL if @path is
- * not a valid account path.
- *
- * Since: 0.9.0
- * Deprecated: New code should use tp_client_factory_ensure_account()
- * instead.
- */
-TpAccount *
-tp_account_manager_ensure_account (TpAccountManager *self,
- const gchar *path)
-{
- TpAccount *account;
- GError *error = NULL;
-
- g_return_val_if_fail (TP_IS_ACCOUNT_MANAGER (self), NULL);
- g_return_val_if_fail (path != NULL, NULL);
-
- account = g_hash_table_lookup (self->priv->legacy_accounts, path);
- if (account != NULL)
- return account;
-
- account = tp_client_factory_ensure_account (
- tp_proxy_get_factory (self), path, NULL, &error);
- if (account == NULL)
- {
- DEBUG ("failed to create account: %s", error->message);
- g_clear_error (&error);
- return NULL;
- }
-
- /* We don't want to insert in self->priv->accounts random accounts we
- * don't even know if they are usable. For compatibility we can't return a ref,
- * so keep them into a legacy table */
- g_hash_table_insert (self->priv->legacy_accounts, g_strdup (path),
- account);
- tp_g_signal_connect_object (account, "invalidated",
- G_CALLBACK (legacy_account_invalidated_cb), self, 0);
-
- tp_proxy_prepare_async (account, NULL, NULL, NULL);
-
- return account;
-}
-
-/**
* tp_account_manager_get_usable_accounts:
* @manager: a #TpAccountManager
*
diff --git a/telepathy-glib/account-manager.h b/telepathy-glib/account-manager.h
index 1b5b830..4c43de9 100644
--- a/telepathy-glib/account-manager.h
+++ b/telepathy-glib/account-manager.h
@@ -82,12 +82,6 @@ TpAccountManager *tp_account_manager_dup (void) G_GNUC_WARN_UNUSED_RESULT;
void tp_account_manager_init_known_interfaces (void);
-#ifndef TP_DISABLE_DEPRECATED
-_TP_DEPRECATED_IN_0_16_FOR (tp_client_factory_ensure_account)
-TpAccount *tp_account_manager_ensure_account (TpAccountManager *manager,
- const gchar *path);
-#endif
-
GList *tp_account_manager_get_usable_accounts (TpAccountManager *manager)
G_GNUC_WARN_UNUSED_RESULT;
diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c
index ffad18f..75dc2a1 100644
--- a/tests/dbus/account-manager.c
+++ b/tests/dbus/account-manager.c
@@ -413,9 +413,10 @@ ensure_action (gpointer script_data,
g_assert (test != NULL);
g_assert (test->am != NULL);
g_assert (tp_proxy_is_prepared (test->am, TP_ACCOUNT_MANAGER_FEATURE_CORE));
- test->account = tp_account_manager_ensure_account (test->am,
- path);
- g_object_ref (test->account);
+ test->account = tp_client_factory_ensure_account (
+ tp_proxy_get_factory (test->am), path, NULL, &test->error);
+ g_assert_no_error (test->error);
+ g_assert (TP_IS_ACCOUNT (test->account));
script_continue (script_data);
}
@@ -563,11 +564,15 @@ create_tp_accounts (gpointer script_data,
{
Test *test = (Test *) script_data;
- test->account1 = tp_account_manager_ensure_account (test->am, ACCOUNT1_PATH);
- g_object_ref (test->account1);
+ test->account1 = tp_client_factory_ensure_account (
+ tp_proxy_get_factory (test->am), ACCOUNT1_PATH, NULL, &test->error);
+ g_assert_no_error (test->error);
+ g_assert (TP_IS_ACCOUNT (test->account1));
- test->account2 = tp_account_manager_ensure_account (test->am, ACCOUNT2_PATH);
- g_object_ref (test->account2);
+ test->account2 = tp_client_factory_ensure_account (
+ tp_proxy_get_factory (test->am), ACCOUNT2_PATH, NULL, &test->error);
+ g_assert_no_error (test->error);
+ g_assert (TP_IS_ACCOUNT (test->account2));
script_continue (test);
}
diff --git a/tests/dbus/simple-approver.c b/tests/dbus/simple-approver.c
index 5e9e534..bd75b55 100644
--- a/tests/dbus/simple-approver.c
+++ b/tests/dbus/simple-approver.c
@@ -77,10 +77,11 @@ setup (Test *test,
g_assert (test->account_manager != NULL);
/* Create client-side Account object */
- test->account = tp_account_manager_ensure_account (test->account_manager,
- ACCOUNT_PATH);
+ test->account = tp_client_factory_ensure_account (
+ tp_proxy_get_factory (test->account_manager), ACCOUNT_PATH, NULL,
+ &test->error);
+ g_assert_no_error (test->error);
g_assert (test->account != NULL);
- g_object_ref (test->account);
/* Create (service and client sides) connection objects */
tp_tests_create_and_connect_conn (TP_TESTS_TYPE_CONTACTS_CONNECTION,
More information about the telepathy-commits
mailing list