diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-06-07 17:10:39 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-06-29 15:02:58 +0200 |
commit | d0335d2645f365834e313c086d0fe30ce7798d09 (patch) | |
tree | 1732c71171a84cd05d33daccdc673c61c00a23f5 | |
parent | 5763dc9c9bce465c7cffbfa29a6403496363f70f (diff) |
TpAccount: deprecate "connection-manager" and "protocol" and add "cm-name" and "protocol-name"
Otherwise we could assume they are returning TpConnectionManager/TpProtocol objects
-rw-r--r-- | docs/reference/telepathy-glib-sections.txt | 2 | ||||
-rw-r--r-- | telepathy-glib/account.c | 78 | ||||
-rw-r--r-- | telepathy-glib/account.h | 12 | ||||
-rw-r--r-- | tests/dbus/account.c | 8 |
4 files changed, 95 insertions, 5 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index e6e5b7d25..75fa60718 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -5154,7 +5154,9 @@ tp_account_get_connection tp_account_ensure_connection tp_account_get_display_name tp_account_get_connection_manager +tp_account_get_cm_name tp_account_get_protocol +tp_account_get_protocol_name tp_account_get_icon_name tp_account_get_service tp_account_set_enabled_async diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index 88f13d2e3..c58f43490 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -159,7 +159,9 @@ enum { PROP_CONNECTION, PROP_DISPLAY_NAME, PROP_CONNECTION_MANAGER, + PROP_CM_NAME, PROP_PROTOCOL, + PROP_PROTOCOL_NAME, PROP_ICON_NAME, PROP_CONNECT_AUTOMATICALLY, PROP_HAS_BEEN_ONLINE, @@ -1104,9 +1106,15 @@ _tp_account_get_property (GObject *object, case PROP_CONNECTION_MANAGER: g_value_set_string (value, self->priv->cm_name); break; + case PROP_CM_NAME: + g_value_set_string (value, self->priv->cm_name); + break; case PROP_PROTOCOL: g_value_set_string (value, self->priv->proto_name); break; + case PROP_PROTOCOL_NAME: + g_value_set_string (value, self->priv->proto_name); + break; case PROP_ICON_NAME: g_value_set_string (value, self->priv->icon_name); break; @@ -1523,6 +1531,7 @@ tp_account_class_init (TpAccountClass *klass) * The account's connection manager name. * * Since: 0.9.0 + * Deprecated: Use #TpAccount:cm-name instead. */ g_object_class_install_property (object_class, PROP_CONNECTION_MANAGER, g_param_spec_string ("connection-manager", @@ -1539,6 +1548,7 @@ tp_account_class_init (TpAccountClass *klass) * Telepathy D-Bus Interface Specification. * * Since: 0.9.0 + * Deprecated: Use #TpAccount:protocol-name instead. */ g_object_class_install_property (object_class, PROP_PROTOCOL, g_param_spec_string ("protocol", @@ -1548,6 +1558,36 @@ tp_account_class_init (TpAccountClass *klass) G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); /** + * TpAccount:cm-name: + * + * The account's connection manager name. + * + * Since: 0.UNRELEASED + */ + g_object_class_install_property (object_class, PROP_CM_NAME, + g_param_spec_string ("cm-name", + "Connection manager", + "The account's connection manager name", + NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); + + /** + * TpAccount:protocol-name: + * + * The account's machine-readable protocol name, such as "jabber", "msn" or + * "local-xmpp". Recommended names for most protocols can be found in the + * Telepathy D-Bus Interface Specification. + * + * Since: 0.UNRELEASED + */ + g_object_class_install_property (object_class, PROP_PROTOCOL_NAME, + g_param_spec_string ("protocol-name", + "Protocol", + "The account's protocol name", + NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); + + /** * TpAccount:service: * * A machine-readable name identifying a specific service to which this @@ -2283,6 +2323,7 @@ tp_account_is_valid (TpAccount *account) * Returns: the same as the #TpAccount:connection-manager property * * Since: 0.9.0 + * Deprecated: Use tp_account_get_cm_name() instead. */ const gchar * tp_account_get_connection_manager (TpAccount *account) @@ -2301,6 +2342,7 @@ tp_account_get_connection_manager (TpAccount *account) * Returns: the same as the #TpAccount:protocol property * * Since: 0.9.0 + * Deprecated: Use tp_account_get_cm_name() instead. */ const gchar * tp_account_get_protocol (TpAccount *account) @@ -2311,6 +2353,42 @@ tp_account_get_protocol (TpAccount *account) } /** + * tp_account_get_cm_name: + * @account: a #TpAccount + * + * <!-- --> + * + * Returns: the same as the #TpAccount:cm-name property + * + * Since: 0.UNRELEASED + */ +const gchar * +tp_account_get_cm_name (TpAccount *account) +{ + g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); + + return account->priv->cm_name; +} + +/** + * tp_account_get_protocol_name: + * @account: a #TpAccount + * + * <!-- --> + * + * Returns: the same as the #TpAccount:protocol-name property + * + * Since: 0.UNRELEASED + */ +const gchar * +tp_account_get_protocol_name (TpAccount *account) +{ + g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); + + return account->priv->proto_name; +} + +/** * tp_account_get_service: * @self: an account * diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h index 0ca1dc0f2..88e32bc52 100644 --- a/telepathy-glib/account.h +++ b/telepathy-glib/account.h @@ -108,9 +108,19 @@ TpConnection *tp_account_ensure_connection (TpAccount *account, const gchar *tp_account_get_display_name (TpAccount *account); +#ifndef TP_DISABLE_DEPRECATED +_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_account_get_cm_name) const gchar *tp_account_get_connection_manager (TpAccount *account); - +_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_account_get_protocol_name) const gchar *tp_account_get_protocol (TpAccount *account); +#endif + +_TP_AVAILABLE_IN_UNRELEASED +const gchar *tp_account_get_cm_name (TpAccount *account); + +_TP_AVAILABLE_IN_UNRELEASED +const gchar *tp_account_get_protocol_name (TpAccount *account); + const gchar *tp_account_get_service (TpAccount *self); const gchar *tp_account_get_icon_name (TpAccount *account); diff --git a/tests/dbus/account.c b/tests/dbus/account.c index f78ccf143..3fb54b4b7 100644 --- a/tests/dbus/account.c +++ b/tests/dbus/account.c @@ -409,11 +409,11 @@ test_prepare_success (Test *test, g_assert_cmpuint (GPOINTER_TO_UINT (details), ==, 666); /* the CM and protocol come from the object path */ - g_assert_cmpstr (tp_account_get_connection_manager (test->account), + g_assert_cmpstr (tp_account_get_cm_name (test->account), ==, "what"); - assert_strprop (test->account, "connection-manager", "what"); - g_assert_cmpstr (tp_account_get_protocol (test->account), ==, "ev"); - assert_strprop (test->account, "protocol", "ev"); + assert_strprop (test->account, "cm-name", "what"); + g_assert_cmpstr (tp_account_get_protocol_name (test->account), ==, "ev"); + assert_strprop (test->account, "protocol-name", "ev"); /* the icon name in SimpleAccount is "", so we guess based on the protocol */ g_assert_cmpstr (tp_account_get_icon_name (test->account), ==, "im-ev"); |