telepathy-glib: TpAccount: deprecate "connection-manager" and "protocol" and add "cm-name" and "protocol-name"

Xavier Claessens xclaesse at kemper.freedesktop.org
Fri Jun 29 06:10:33 PDT 2012


Module: telepathy-glib
Branch: master
Commit: d0335d2645f365834e313c086d0fe30ce7798d09
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=d0335d2645f365834e313c086d0fe30ce7798d09

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Thu Jun  7 17:10:39 2012 +0200

TpAccount: deprecate "connection-manager" and "protocol" and add "cm-name" and "protocol-name"

Otherwise we could assume they are returning TpConnectionManager/TpProtocol objects

---

 docs/reference/telepathy-glib-sections.txt |    2 +
 telepathy-glib/account.c                   |   78 ++++++++++++++++++++++++++++
 telepathy-glib/account.h                   |   12 ++++-
 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 e6e5b7d..75fa607 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 88f13d2..c58f434 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 0ca1dc0..88e32bc 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 f78ccf1..3fb54b4 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");



More information about the telepathy-commits mailing list