telepathy-glib: TpConnection: Deprecate _get_self_handle()

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed May 2 05:13:30 PDT 2012


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

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed May  2 13:54:19 2012 +0200

TpConnection: Deprecate _get_self_handle()

New code should be using _get_self_contact()

---

 examples/client/inspect-contact.c |   28 ++++++++++------------------
 telepathy-glib/connection.c       |    6 ++++++
 telepathy-glib/connection.h       |    3 ++-
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/examples/client/inspect-contact.c b/examples/client/inspect-contact.c
index c1b6bb3..7c759bf 100644
--- a/examples/client/inspect-contact.c
+++ b/examples/client/inspect-contact.c
@@ -44,14 +44,12 @@ display_contact (TpContact *contact)
 }
 
 static void
-got_contacts_by_handle (TpConnection *connection,
-                        guint n_contacts,
-                        TpContact * const *contacts,
-                        guint n_invalid,
-                        const TpHandle *invalid,
-                        const GError *error,
-                        gpointer user_data,
-                        GObject *weak_object)
+contacts_upgraded_cb (TpConnection *connection,
+    guint n_contacts,
+    TpContact * const *contacts,
+    const GError *error,
+    gpointer user_data,
+    GObject *weak_object)
 {
   InspectContactData *data = user_data;
 
@@ -65,12 +63,6 @@ got_contacts_by_handle (TpConnection *connection,
         {
           display_contact (contacts[i]);
         }
-
-      for (i = 0; i < n_invalid; i++)
-        {
-          g_warning ("Invalid handle %u", invalid[i]);
-          data->exit_status = 1;
-        }
     }
   else
     {
@@ -151,12 +143,12 @@ connection_ready_cb (GObject *source,
 
   if (data->to_inspect == NULL)
     {
-      TpHandle self_handle = tp_connection_get_self_handle (connection);
+      TpContact *self_contact = tp_connection_get_self_contact (connection);
 
-      tp_connection_get_contacts_by_handle (connection,
-          1, &self_handle,
+      tp_connection_upgrade_contacts (connection,
+          1, &self_contact,
           G_N_ELEMENTS (features), features,
-          got_contacts_by_handle,
+          contacts_upgraded_cb,
           data, NULL, NULL);
     }
   else
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 6eb42a0..3a6f256 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -311,6 +311,8 @@ tp_connection_get_property (GObject *object,
 {
   TpConnection *self = TP_CONNECTION (object);
 
+  /* Deprecated properties uses deprecated getters */
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   switch (property_id)
     {
     case PROP_CONNECTION_MANAGER_NAME:
@@ -380,6 +382,7 @@ tp_connection_get_property (GObject *object,
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
     }
+  G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void
@@ -1781,6 +1784,8 @@ tp_connection_class_init (TpConnectionClass *klass)
    * To wait for a valid self-handle (and other properties), call
    * tp_proxy_prepare_async() with the feature
    * %TP_CONNECTION_FEATURE_CONNECTED.
+   *
+   * Deprecated: Use #TpConnection:self-contact instead.
    */
   param_spec = g_param_spec_uint ("self-handle", "Self handle",
       "The local user's Contact handle on this connection", 0, G_MAXUINT32,
@@ -2452,6 +2457,7 @@ _tp_connection_set_account (TpConnection *self,
  * Returns: the value of the TpConnection:self-handle property
  *
  * Since: 0.7.26
+ * Deprecated: Use tp_connection_get_self_handle() instead.
  */
 TpHandle
 tp_connection_get_self_handle (TpConnection *self)
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 68ceff6..10b5d9e 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -136,7 +136,8 @@ const gchar *tp_connection_get_connection_manager_name (TpConnection *self);
 
 const gchar *tp_connection_get_protocol_name (TpConnection *self);
 
-TpHandle tp_connection_get_self_handle (TpConnection *self);
+TpHandle tp_connection_get_self_handle (TpConnection *self)
+    _TP_GNUC_DEPRECATED_FOR (tp_connection_get_self_contact);
 TpContact *tp_connection_get_self_contact (TpConnection *self);
 
 TpCapabilities * tp_connection_get_capabilities (TpConnection *self);



More information about the telepathy-commits mailing list