telepathy-glib: TpContact: Deprecate _get_ functions returning a GList and replace them by _dup_
Xavier Claessens
xclaesse at kemper.freedesktop.org
Wed Sep 5 07:29:35 PDT 2012
Module: telepathy-glib
Branch: master
Commit: 8f9b57121072744bb57dd4aa801589e156048072
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=8f9b57121072744bb57dd4aa801589e156048072
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Wed Sep 5 11:15:00 2012 +0200
TpContact: Deprecate _get_ functions returning a GList and replace them by _dup_
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
---
docs/reference/telepathy-glib-sections.txt | 1 +
telepathy-glib/contact.c | 25 +++++++++++++++++++++++++
telepathy-glib/contact.h | 6 ++++++
3 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 7c91be2..a945622 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4992,6 +4992,7 @@ tp_contact_get_presence_type
tp_contact_get_location
tp_contact_get_capabilities
tp_contact_get_contact_info
+tp_contact_dup_contact_info
tp_contact_is_blocked
tp_contact_request_contact_info_async
tp_contact_request_contact_info_finish
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index 2827dec..ea2c178 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -609,6 +609,8 @@ tp_contact_get_capabilities (TpContact *self)
* a #GList of #TpContactInfoField, or %NULL if the feature is not yet
* prepared.
* Since: 0.11.7
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ * tp_contact_dup_contact_info() instead.
*/
GList *
tp_contact_get_contact_info (TpContact *self)
@@ -619,6 +621,29 @@ tp_contact_get_contact_info (TpContact *self)
}
/**
+ * tp_contact_dup_contact_info:
+ * @self: a #TpContact
+ *
+ * Returns a newly allocated #GList of contact's vCard fields. The list must be
+ * freed with tp_contact_info_list_free() after used.
+ *
+ * Same as the #TpContact:contact-info property.
+ *
+ * Returns: (element-type TelepathyGLib.ContactInfoField) (transfer full):
+ * a #GList of #TpContactInfoField, or %NULL if the feature is not yet
+ * prepared.
+ * Since: 0.UNRELEASED
+ */
+GList *
+tp_contact_dup_contact_info (TpContact *self)
+{
+ g_return_val_if_fail (TP_IS_CONTACT (self), NULL);
+
+ return _tp_g_list_copy_deep (self->priv->contact_info,
+ (GCopyFunc) tp_contact_info_field_copy, NULL);
+}
+
+/**
* tp_contact_get_subscribe_state:
* @self: a #TpContact
*
diff --git a/telepathy-glib/contact.h b/telepathy-glib/contact.h
index 56355d9..84b016b 100644
--- a/telepathy-glib/contact.h
+++ b/telepathy-glib/contact.h
@@ -106,7 +106,13 @@ GFile *tp_contact_get_avatar_file (TpContact *self);
const gchar *tp_contact_get_avatar_mime_type (TpContact *self);
/* TP_CONTACT_FEATURE_INFO */
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_0_20_FOR (tp_contact_dup_contact_info)
GList *tp_contact_get_contact_info (TpContact *self);
+#endif
+
+_TP_AVAILABLE_IN_0_20
+GList *tp_contact_dup_contact_info (TpContact *self);
void tp_contact_request_contact_info_async (TpContact *self,
GCancellable *cancellable, GAsyncReadyCallback callback,
More information about the telepathy-commits
mailing list