[next] telepathy-glib: TpConnection: deprecate connection-manager-name and add cm-name

Xavier Claessens xclaesse at kemper.freedesktop.org
Fri Jun 29 06:37:52 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 5763dc9c9bce465c7cffbfa29a6403496363f70f
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=5763dc9c9bce465c7cffbfa29a6403496363f70f

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

TpConnection: deprecate connection-manager-name and add cm-name

This is to be consistent with TpProtocol naming.

---

 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/connection.c                |   40 +++++++++++++++++++++++++++-
 telepathy-glib/connection.h                |    6 ++++
 telepathy-glib/contact.c                   |    2 +-
 tests/dbus/connection.c                    |    6 ++--
 5 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index be3ad0c..e6e5b7d 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4205,6 +4205,7 @@ tp_connection_disconnect_finish
 tp_connection_get_account
 tp_connection_get_status
 tp_connection_get_connection_manager_name
+tp_connection_get_cm_name
 tp_connection_get_protocol_name
 tp_connection_get_self_contact
 tp_connection_get_self_handle
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 011ae74..f818c99 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -267,6 +267,7 @@ enum
   PROP_STATUS = 1,
   PROP_STATUS_REASON,
   PROP_CONNECTION_MANAGER_NAME,
+  PROP_CM_NAME,
   PROP_PROTOCOL_NAME,
   PROP_CONNECTION_READY,
   PROP_SELF_CONTACT,
@@ -319,6 +320,9 @@ tp_connection_get_property (GObject *object,
     case PROP_CONNECTION_MANAGER_NAME:
       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_NAME:
       g_value_set_string (value, self->priv->proto_name);
       break;
@@ -1762,7 +1766,7 @@ tp_connection_class_init (TpConnectionClass *klass)
    * This connection's connection manager name.
    *
    * Since: 0.13.16
-   *
+   * Deprecated: Use #TpConnection:cm-name instead.
    */
   g_object_class_install_property (object_class, PROP_CONNECTION_MANAGER_NAME,
       g_param_spec_string ("connection-manager-name",
@@ -1772,6 +1776,20 @@ tp_connection_class_init (TpConnectionClass *klass)
           G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
 
   /**
+   * TpConnection:cm-name:
+   *
+   * This connection'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 name",
+          "The connection's connection manager name",
+          NULL,
+          G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+
+  /**
    * TpConnection:protocol-name:
    *
    * The connection's machine-readable protocol name, such as "jabber",
@@ -2528,6 +2546,7 @@ tp_connection_get_status (TpConnection *self,
  * Returns: the same as the #TpConnection:connection-manager-name property
  *
  * Since: 0.13.16
+ * Deprecated: Use tp_connection_get_cm_name() instead.
  *
  */
 const gchar *
@@ -2539,6 +2558,25 @@ tp_connection_get_connection_manager_name (TpConnection *self)
 }
 
 /**
+ * tp_connection_get_cm_name:
+ * @self: a #TpConnection
+ *
+ * <!-- -->
+ *
+ * Returns: the same as the #TpConnection:cm-name property
+ *
+ * Since: 0.UNRELEASED
+ *
+ */
+const gchar *
+tp_connection_get_cm_name (TpConnection *self)
+{
+    g_return_val_if_fail (TP_IS_CONNECTION (self), NULL);
+
+    return self->priv->cm_name;
+}
+
+/**
  * tp_connection_get_protocol_name:
  * @self: a #TpConnection
  *
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index cfc605f..ad501a7 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -149,7 +149,13 @@ TpAccount *tp_connection_get_account (TpConnection *self);
 TpConnectionStatus tp_connection_get_status (TpConnection *self,
     TpConnectionStatusReason *reason);
 
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_UNRELEASED_FOR (tp_connection_get_cm_name)
 const gchar *tp_connection_get_connection_manager_name (TpConnection *self);
+#endif
+
+_TP_AVAILABLE_IN_UNRELEASED
+const gchar *tp_connection_get_cm_name (TpConnection *self);
 
 const gchar *tp_connection_get_protocol_name (TpConnection *self);
 
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index b7d2b73..abdc0a1 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -2639,7 +2639,7 @@ build_avatar_filename (TpConnection *connection,
   token_escaped = tp_escape_as_identifier (avatar_token);
   dir = g_build_filename (g_get_user_cache_dir (),
       "telepathy", "avatars",
-      tp_connection_get_connection_manager_name (connection),
+      tp_connection_get_cm_name (connection),
       tp_connection_get_protocol_name (connection),
       NULL);
 
diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c
index f9f34d0..0d26311 100644
--- a/tests/dbus/connection.c
+++ b/tests/dbus/connection.c
@@ -224,13 +224,13 @@ test_prepare (Test *test,
   g_assert_cmpint (tp_connection_get_status (test->conn, NULL), ==,
       TP_CONNECTION_STATUS_DISCONNECTED);
 
-  g_assert_cmpstr (tp_connection_get_connection_manager_name (test->conn), ==,
+  g_assert_cmpstr (tp_connection_get_cm_name (test->conn), ==,
           "simple");
   g_assert_cmpstr (tp_connection_get_protocol_name (test->conn), ==,
           "simple-protocol");
 
   g_object_get (test->conn,
-      "connection-manager-name", &cm_name,
+      "cm-name", &cm_name,
       "protocol-name", &protocol_name,
       NULL);
   g_assert_cmpstr (cm_name, ==, "simple");
@@ -409,7 +409,7 @@ test_object_path (Test *test,
   g_assert_no_error (error);
 
   tp_tests_proxy_run_until_prepared (test->conn, NULL);
-  g_assert_cmpstr (tp_connection_get_connection_manager_name (test->conn), ==,
+  g_assert_cmpstr (tp_connection_get_cm_name (test->conn), ==,
       "simple");
   g_assert_cmpstr (tp_connection_get_protocol_name (test->conn), ==,
       "simple-protocol");



More information about the telepathy-commits mailing list