[next] telepathy-glib: TpContactSearchResult: Deprecate _get_ functions returning a GList and replace them by _dup_

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


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

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

TpContactSearchResult: 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-search-result.c     |   23 +++++++++++++++++++++++
 telepathy-glib/contact-search-result.h     |    7 +++++++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index def0c15..d0f8cb9 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4828,6 +4828,7 @@ TpContactSearchResult
 TpContactSearchResultClass
 tp_contact_search_result_get_field
 tp_contact_search_result_get_fields
+tp_contact_search_result_dup_fields
 tp_contact_search_result_get_identifier
 <SUBSECTION Standard>
 tp_contact_search_result_get_type
diff --git a/telepathy-glib/contact-search-result.c b/telepathy-glib/contact-search-result.c
index c3e7ac3..9f5d6a0 100644
--- a/telepathy-glib/contact-search-result.c
+++ b/telepathy-glib/contact-search-result.c
@@ -29,6 +29,7 @@
 
 #define DEBUG_FLAG TP_DEBUG_CHANNEL
 #include "telepathy-glib/debug-internal.h"
+#include "telepathy-glib/util-internal.h"
 
 #include "_gen/telepathy-interfaces.h"
 
@@ -250,6 +251,8 @@ tp_contact_search_result_get_field (TpContactSearchResult *self,
  * Returns: (transfer container) (element-type TelepathyGLib.ContactInfoField):
  *  a #GList of #TpContactInfoField for the specified contact. You should free
  *  it when you're done with g_list_free().
+ * Deprecated: Since 0.UNRELEASED. New code should use
+ *  tp_contact_search_result_dup_fields() instead.
  */
 GList *
 tp_contact_search_result_get_fields (TpContactSearchResult *self)
@@ -258,3 +261,23 @@ tp_contact_search_result_get_fields (TpContactSearchResult *self)
 
   return g_list_copy (self->priv->fields);
 }
+
+/**
+ * tp_contact_search_result_dup_fields:
+ * @self: a search result
+ *
+ * <!-- -->
+ *
+ * Returns: (transfer full) (element-type TelepathyGLib.ContactInfoField):
+ *  a #GList of #TpContactInfoField for the specified contact. You should free
+ *  it when you're done with tp_contact_info_list_free().
+ * Since: 0.UNRELEASED
+ */
+GList *
+tp_contact_search_result_dup_fields (TpContactSearchResult *self)
+{
+  g_return_val_if_fail (TP_IS_CONTACT_SEARCH_RESULT (self), NULL);
+
+  return _tp_g_list_copy_deep (self->priv->fields,
+      (GCopyFunc) tp_contact_info_field_copy, NULL);
+}
diff --git a/telepathy-glib/contact-search-result.h b/telepathy-glib/contact-search-result.h
index 4e94602..e24c9d3 100644
--- a/telepathy-glib/contact-search-result.h
+++ b/telepathy-glib/contact-search-result.h
@@ -70,7 +70,14 @@ GType tp_contact_search_result_get_type (void);
 const gchar *tp_contact_search_result_get_identifier (TpContactSearchResult *self);
 TpContactInfoField *tp_contact_search_result_get_field (TpContactSearchResult *self,
     const gchar *field);
+
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_0_20_FOR (tp_contact_search_result_dup_fields)
 GList *tp_contact_search_result_get_fields (TpContactSearchResult *self);
+#endif
+
+_TP_AVAILABLE_IN_0_20
+GList *tp_contact_search_result_dup_fields (TpContactSearchResult *self);
 
 G_END_DECLS
 



More information about the telepathy-commits mailing list