[next] telepathy-glib: TpDispatchOperation: Deprecate _borrow_ functions and replace them by _get_

Xavier Claessens xclaesse at kemper.freedesktop.org
Fri Sep 7 12:08:57 PDT 2012


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

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed Sep  5 11:15:00 2012 +0200

TpDispatchOperation: Deprecate _borrow_ functions and replace them by _get_

New transfer and naming policy has been discussed in
https://bugs.freedesktop.org/show_bug.cgi?id=39189 and is
documented there: http://telepathy.freedesktop.org/wiki/Style/TelepathyGLib

There is intentionally no tp_dispatch_operation_get_immutable_properties()
since those are internal implementation detail. Individual property getters
should be enough.

---

 docs/reference/telepathy-glib-sections.txt  |    4 +
 examples/client/approver.c                  |    2 +-
 telepathy-glib/channel-dispatch-operation.c |   92 +++++++++++++++++++++++++++
 telepathy-glib/channel-dispatch-operation.h |   23 +++++++
 4 files changed, 120 insertions(+), 1 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 528e945..ef74c09 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -5456,6 +5456,10 @@ tp_channel_dispatch_operation_borrow_channels
 tp_channel_dispatch_operation_borrow_connection
 tp_channel_dispatch_operation_borrow_immutable_properties
 tp_channel_dispatch_operation_borrow_possible_handlers
+tp_channel_dispatch_operation_get_account
+tp_channel_dispatch_operation_get_channels
+tp_channel_dispatch_operation_get_connection
+tp_channel_dispatch_operation_get_possible_handlers
 tp_channel_dispatch_operation_handle_with_async
 tp_channel_dispatch_operation_handle_with_finish
 tp_channel_dispatch_operation_handle_with_time_async
diff --git a/examples/client/approver.c b/examples/client/approver.c
index d92ee34..800f197 100644
--- a/examples/client/approver.c
+++ b/examples/client/approver.c
@@ -93,7 +93,7 @@ add_dispatch_operation_cb (TpSimpleApprover *self,
           tp_channel_get_identifier (channel));
     }
 
-  possible_handlers = tp_channel_dispatch_operation_borrow_possible_handlers (
+  possible_handlers = tp_channel_dispatch_operation_get_possible_handlers (
       cdo);
   if (possible_handlers[0] == NULL)
     {
diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c
index 1c26b81..1793e4b 100644
--- a/telepathy-glib/channel-dispatch-operation.c
+++ b/telepathy-glib/channel-dispatch-operation.c
@@ -977,6 +977,8 @@ tp_channel_dispatch_operation_get_feature_quark_core (void)
  * Returns: (transfer none): the value of #TpChannelDispatchOperation:connection
  *
  * Since: 0.11.5
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ *  tp_channel_dispatch_operation_get_connection() instead.
  */
 TpConnection *
 tp_channel_dispatch_operation_borrow_connection (
@@ -996,6 +998,8 @@ tp_channel_dispatch_operation_borrow_connection (
  * Returns: (transfer none): the value of #TpChannelDispatchOperation:account
  *
  * Since: 0.11.5
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ *  tp_channel_dispatch_operation_get_account() instead.
  */
 TpAccount *
 tp_channel_dispatch_operation_borrow_account (
@@ -1016,6 +1020,8 @@ tp_channel_dispatch_operation_borrow_account (
  * Returns: (transfer none): the value of #TpChannelDispatchOperation:channels
  *
  * Since: 0.11.5
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ *  tp_channel_dispatch_operation_get_channels() instead.
  */
 GPtrArray *
 tp_channel_dispatch_operation_borrow_channels (
@@ -1037,6 +1043,8 @@ tp_channel_dispatch_operation_borrow_channels (
  * #TpChannelDispatchOperation:possible-handlers
  *
  * Since: 0.11.5
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ *  tp_channel_dispatch_operation_get_possible_handlers() instead.
  */
 GStrv
 tp_channel_dispatch_operation_borrow_possible_handlers (
@@ -1057,6 +1065,11 @@ tp_channel_dispatch_operation_borrow_possible_handlers (
  * #TpChannelDispatchOperation:cdo-properties
  *
  * Since: 0.11.5
+ * Deprecated: Since 0.UNRELEASED. New code should use individual property
+ *  getters like tp_channel_dispatch_operation_get_connection(),
+ *  tp_channel_dispatch_operation_get_account(),
+ *  tp_channel_dispatch_operation_get_channels(), or
+ *  tp_channel_dispatch_operation_get_possible_handlers() instead.
  */
 GHashTable *
 tp_channel_dispatch_operation_borrow_immutable_properties (
@@ -1065,6 +1078,85 @@ tp_channel_dispatch_operation_borrow_immutable_properties (
   return self->priv->immutable_properties;
 }
 
+/**
+ * tp_channel_dispatch_operation_get_connection: (skip)
+ * @self: a #TpChannelDispatchOperation
+ *
+ * Returns the #TpConnection of this ChannelDispatchOperation.
+ * The returned pointer is only valid while @self is valid - reference
+ * it with g_object_ref() if needed.
+ *
+ * Returns: (transfer none): the value of #TpChannelDispatchOperation:connection
+ *
+ * Since: 0.UNRELEASED
+ */
+TpConnection *
+tp_channel_dispatch_operation_get_connection (
+    TpChannelDispatchOperation *self)
+{
+  return self->priv->connection;
+}
+
+/**
+ * tp_channel_dispatch_operation_get_account: (skip)
+ * @self: a #TpChannelDispatchOperation
+ *
+ * Returns the #TpAccount of this ChannelDispatchOperation.
+ * The returned pointer is only valid while @self is valid - reference
+ * it with g_object_ref() if needed.
+ *
+ * Returns: (transfer none): the value of #TpChannelDispatchOperation:account
+ *
+ * Since: 0.UNRELEASED
+ */
+TpAccount *
+tp_channel_dispatch_operation_get_account (
+    TpChannelDispatchOperation *self)
+{
+  return self->priv->account;
+}
+
+/**
+ * tp_channel_dispatch_operation_get_channels: (skip)
+ * @self: a #TpChannelDispatchOperation
+ *
+ * Returns a #GPtrArray containing the #TpChannel of this
+ * ChannelDispatchOperation.
+ * The returned array and its #TpChannel are only valid while @self is
+ * valid - copy array and reference channels with g_object_ref() if needed.
+ *
+ * Returns: (transfer none): the value of #TpChannelDispatchOperation:channels
+ *
+ * Since: 0.UNRELEASED
+ */
+GPtrArray *
+tp_channel_dispatch_operation_get_channels (
+    TpChannelDispatchOperation *self)
+{
+  return self->priv->channels;
+}
+
+/**
+ * tp_channel_dispatch_operation_get_possible_handlers: (skip)
+ * @self: a #TpChannelDispatchOperation
+ *
+ * Returns a #GStrv containing the possible handlers of this
+ * ChannelDispatchOperation.
+ * The returned array and its strings are only valid while @self is
+ * valid - copy it with g_strdupv if needed.
+ *
+ * Returns: (transfer none): the value of
+ * #TpChannelDispatchOperation:possible-handlers
+ *
+ * Since: 0.UNRELEASED
+ */
+GStrv
+tp_channel_dispatch_operation_get_possible_handlers (
+    TpChannelDispatchOperation *self)
+{
+  return self->priv->possible_handlers;
+}
+
 static void
 handle_with_cb (TpChannelDispatchOperation *self,
     const GError *error,
diff --git a/telepathy-glib/channel-dispatch-operation.h b/telepathy-glib/channel-dispatch-operation.h
index 074e4dc..d7be9d4 100644
--- a/telepathy-glib/channel-dispatch-operation.h
+++ b/telepathy-glib/channel-dispatch-operation.h
@@ -87,20 +87,43 @@ void tp_channel_dispatch_operation_init_known_interfaces (void);
 
 GQuark tp_channel_dispatch_operation_get_feature_quark_core (void) G_GNUC_CONST;
 
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_0_20_FOR(tp_channel_dispatch_operation_get_connection)
 TpConnection * tp_channel_dispatch_operation_borrow_connection (
     TpChannelDispatchOperation *self);
 
+_TP_DEPRECATED_IN_0_20_FOR(tp_channel_dispatch_operation_get_account)
 TpAccount * tp_channel_dispatch_operation_borrow_account (
     TpChannelDispatchOperation *self);
 
+_TP_DEPRECATED_IN_0_20_FOR(tp_channel_dispatch_operation_get_channels)
 GPtrArray * tp_channel_dispatch_operation_borrow_channels (
     TpChannelDispatchOperation *self);
 
+_TP_DEPRECATED_IN_0_20_FOR(tp_channel_dispatch_operation_get_possible_handlers)
 GStrv tp_channel_dispatch_operation_borrow_possible_handlers (
     TpChannelDispatchOperation *self);
 
+_TP_DEPRECATED_IN_0_20
 GHashTable * tp_channel_dispatch_operation_borrow_immutable_properties (
     TpChannelDispatchOperation *self);
+#endif
+
+_TP_AVAILABLE_IN_0_20
+TpConnection * tp_channel_dispatch_operation_get_connection (
+    TpChannelDispatchOperation *self);
+
+_TP_AVAILABLE_IN_0_20
+TpAccount * tp_channel_dispatch_operation_get_account (
+    TpChannelDispatchOperation *self);
+
+_TP_AVAILABLE_IN_0_20
+GPtrArray * tp_channel_dispatch_operation_get_channels (
+    TpChannelDispatchOperation *self);
+
+_TP_AVAILABLE_IN_0_20
+GStrv tp_channel_dispatch_operation_get_possible_handlers (
+    TpChannelDispatchOperation *self);
 
 void tp_channel_dispatch_operation_handle_with_async (
     TpChannelDispatchOperation *self,



More information about the telepathy-commits mailing list