[next] telepathy-glib: Remove deprecated tp_account_ensure_connection() and tp_account_parse_object_path()
Xavier Claessens
xclaesse at kemper.freedesktop.org
Thu May 31 05:49:36 PDT 2012
Module: telepathy-glib
Branch: next
Commit: d3450bb3de50a273404257b3c8cb9320ad786355
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=d3450bb3de50a273404257b3c8cb9320ad786355
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Thu May 31 14:40:22 2012 +0200
Remove deprecated tp_account_ensure_connection() and tp_account_parse_object_path()
---
docs/reference/telepathy-glib-sections.txt | 2 -
telepathy-glib/account.c | 89 ++++------------------------
telepathy-glib/account.h | 11 ----
tests/dbus/account.c | 51 +++++++---------
4 files changed, 34 insertions(+), 119 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index faf29ed..4390851 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -3966,10 +3966,8 @@ TpAccount
TpAccountClass
tp_account_new
tp_account_init_known_interfaces
-tp_account_parse_object_path
tp_account_get_path_suffix
tp_account_get_connection
-tp_account_ensure_connection
tp_account_get_display_name
tp_account_get_connection_manager
tp_account_get_protocol
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 9a88681..c30e885 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -1014,6 +1014,13 @@ _tp_account_got_all_cb (TpProxy *proxy,
_tp_account_update (self, properties);
}
+static gboolean
+_tp_account_parse_object_path (const gchar *object_path,
+ gchar **cm,
+ gchar **protocol,
+ gchar **account_id,
+ GError **error);
+
static void
_tp_account_constructed (GObject *object)
{
@@ -1040,10 +1047,8 @@ _tp_account_constructed (GObject *object)
g_error_free (error);
}
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- tp_account_parse_object_path (tp_proxy_get_object_path (self),
+ _tp_account_parse_object_path (tp_proxy_get_object_path (self),
&(priv->cm_name), &(priv->proto_name), NULL, NULL);
- G_GNUC_END_IGNORE_DEPRECATIONS
priv->icon_name = g_strdup_printf ("im-%s", priv->proto_name);
priv->service = g_strdup (priv->proto_name);
@@ -2097,10 +2102,8 @@ _tp_account_new_with_factory (TpClientFactory *factory,
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- if (!tp_account_parse_object_path (object_path, NULL, NULL, NULL, error))
+ if (!_tp_account_parse_object_path (object_path, NULL, NULL, NULL, error))
return NULL;
- G_GNUC_END_IGNORE_DEPRECATIONS
self = TP_ACCOUNT (g_object_new (TP_TYPE_ACCOUNT,
"dbus-daemon", bus_daemon,
@@ -2163,49 +2166,6 @@ tp_account_get_connection (TpAccount *account)
}
/**
- * tp_account_ensure_connection:
- * @account: a #TpAccount
- * @path: the path to connection object for #TpAccount
- *
- * Set the connection of the account by specifying the connection object path.
- * This function does not return a new ref and it is not guaranteed that the
- * returned #TpConnection object is ready.
- *
- * The use-case for this function is in a HandleChannels callback and you
- * already know the object path for the connection, so you can let @account
- * create its #TpConnection and return it for use.
- *
- * Returns: (transfer none): the connection of the account, or %NULL if either
- * the object path @path is invalid or it is the null-value "/"
- *
- * Since: 0.9.0
- * Deprecated: New code should use tp_client_factory_ensure_connection()
- * instead.
- **/
-TpConnection *
-tp_account_ensure_connection (TpAccount *account,
- const gchar *path)
-{
- TpAccountPrivate *priv;
-
- g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
-
- priv = account->priv;
-
- /* double-check that the object path is valid */
- if (!tp_dbus_check_valid_object_path (path, NULL))
- return NULL;
-
- /* Should be a full object path, not the special "/" value */
- if (!tp_strdiff (path, "/"))
- return NULL;
-
- _tp_account_set_connection (account, path);
-
- return priv->connection;
-}
-
-/**
* tp_account_get_path_suffix:
* @account: a #TpAccount
*
@@ -3492,35 +3452,8 @@ set_or_free (gchar **target,
g_free (source);
}
-/**
- * tp_account_parse_object_path:
- * @object_path: a Telepathy Account's object path
- * @cm: (out) (transfer full): location at which to store the account's
- * connection manager's name
- * @protocol: (out) (transfer full): location at which to store the account's
- * protocol
- * @account_id: (out) (transfer full): location at which to store the account's
- * unique identifier
- * @error: location at which to return an error
- *
- * Validates and parses a Telepathy Account's object path, extracting the
- * connection manager's name, the protocol, and the account's unique identifier
- * from the path. This includes replacing underscores with hyphens in the
- * protocol name, as defined in the Account specification.
- *
- * Any of the out parameters may be %NULL if not needed. If %TRUE is returned,
- * the caller is responsible for freeing the strings stored in any non-%NULL
- * out parameters, using g_free().
- *
- * Returns: %TRUE if @object_path was successfully parsed; %FALSE and sets
- * @error otherwise.
- *
- * Since: 0.9.0
- * Deprecated: Use tp_account_get_protocol() and
- * tp_account_get_connection_manager() instead.
- */
-gboolean
-tp_account_parse_object_path (const gchar *object_path,
+static gboolean
+_tp_account_parse_object_path (const gchar *object_path,
gchar **cm,
gchar **protocol,
gchar **account_id,
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
index 9aafd1e..b5c859f 100644
--- a/telepathy-glib/account.h
+++ b/telepathy-glib/account.h
@@ -85,23 +85,12 @@ GQuark tp_account_get_feature_quark_addressing (void) G_GNUC_CONST;
TpAccount *tp_account_new (TpDBusDaemon *bus_daemon, const gchar *object_path,
GError **error) G_GNUC_WARN_UNUSED_RESULT;
-#ifndef TP_DISABLE_DEPRECATED
-_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_account_get_protocol)
-gboolean tp_account_parse_object_path (const gchar *object_path,
- gchar **cm, gchar **protocol, gchar **account_id, GError **error);
-#endif
const gchar *tp_account_get_path_suffix (TpAccount *account);
void tp_account_init_known_interfaces (void);
TpConnection *tp_account_get_connection (TpAccount *account);
-#ifndef TP_DISABLE_DEPRECATED
-_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_client_factory_ensure_connection)
-TpConnection *tp_account_ensure_connection (TpAccount *account,
- const gchar *path);
-#endif
-
const gchar *tp_account_get_display_name (TpAccount *account);
const gchar *tp_account_get_connection_manager (TpAccount *account);
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index 5e164c4..3a48d46 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -28,12 +28,23 @@
static void
test_parse_failure (gconstpointer test_data)
{
+ const gchar *object_path = test_data;
+ TpClientFactory *factory;
+ TpAccount *account;
GError *error = NULL;
- g_assert (!tp_account_parse_object_path (test_data, NULL, NULL, NULL,
- &error));
+ if (!g_variant_is_object_path (object_path))
+ return;
+
+ factory = tp_client_factory_new (NULL);
+ account = tp_client_factory_ensure_account (factory, object_path, NULL,
+ &error);
+
+ g_assert (account == NULL);
g_assert (error != NULL);
+
g_error_free (error);
+ g_object_unref (factory);
}
typedef struct {
@@ -63,20 +74,20 @@ static void
test_parse_success (gconstpointer test_data)
{
TestParseData *t = (TestParseData *) test_data;
- gchar *cm, *protocol, *account_id;
+ TpClientFactory *factory;
+ TpAccount *account;
GError *error = NULL;
- g_assert (tp_account_parse_object_path (t->path, &cm, &protocol, &account_id,
- &error));
- g_assert_no_error (error);
- g_assert_cmpstr (cm, ==, t->cm);
- g_assert_cmpstr (protocol, ==, t->protocol);
- g_assert_cmpstr (account_id, ==, t->account_id);
+ factory = tp_client_factory_new (NULL);
+ account = tp_client_factory_ensure_account (factory, t->path, NULL, &error);
- g_free (cm);
- g_free (protocol);
- g_free (account_id);
+ g_assert (account != NULL);
+ g_assert_no_error (error);
+ g_assert_cmpstr (tp_account_get_connection_manager (account), ==, t->cm);
+ g_assert_cmpstr (tp_account_get_protocol (account), ==, t->protocol);
+ g_object_unref (account);
+ g_object_unref (factory);
g_slice_free (TestParseData, t);
}
@@ -734,13 +745,6 @@ test_connection (Test *test,
g_assert_cmpstr (tp_account_get_detailed_error (test->account, NULL), ==,
TP_ERROR_STR_CANCELLED);
- /* ensure the same connection - no change notification */
-
- test_set_up_account_notify (test);
- conn = tp_account_ensure_connection (test->account, conn1_path);
- g_assert_cmpstr (tp_proxy_get_object_path (conn), ==, conn1_path);
- g_assert_cmpuint (test_get_times_notified (test, "connection"), ==, 0);
-
/* a no-op "change" */
test_set_up_account_notify (test);
@@ -858,15 +862,6 @@ test_connection (Test *test,
g_assert_cmpint (u, ==, 15);
g_variant_unref (details_v);
- /* staple on a Connection (this is intended for use in e.g. observers,
- * if they're told about a Connection that the Account hasn't told them
- * about yet) */
-
- test_set_up_account_notify (test);
- conn = tp_account_ensure_connection (test->account, conn1_path);
- g_assert_cmpstr (tp_proxy_get_object_path (conn), ==, conn1_path);
- g_assert_cmpuint (test_get_times_notified (test, "connection"), ==, 1);
-
g_hash_table_unref (change);
}
More information about the telepathy-commits
mailing list