[next] telepathy-glib: account: dup the storage identifier
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Mon Feb 17 16:06:15 CET 2014
Module: telepathy-glib
Branch: next
Commit: dac5005befa407ef12e04b9a2671cfd8b05d0310
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=dac5005befa407ef12e04b9a2671cfd8b05d0310
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Mon Feb 17 15:27:44 2014 +0100
account: dup the storage identifier
GVariant's API are generally (transfer full).
---
docs/reference/telepathy-glib/telepathy-glib-sections.txt | 2 +-
telepathy-glib/account.c | 13 ++++++++-----
telepathy-glib/account.h | 2 +-
tests/dbus/account.c | 11 ++++++-----
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index b1f4ad4..21b2937 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -4043,7 +4043,7 @@ tp_account_set_uri_scheme_association_finish
<SUBSECTION>
TP_ACCOUNT_FEATURE_STORAGE
tp_account_get_storage_provider
-tp_account_get_storage_identifier
+tp_account_dup_storage_identifier
tp_account_get_storage_restrictions
tp_account_dup_storage_specific_information_async
tp_account_dup_storage_specific_information_finish
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 1cfae39..f22e965 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -3797,20 +3797,23 @@ tp_account_get_storage_provider (TpAccount *self)
}
/**
- * tp_account_get_storage_identifier:
+ * tp_account_dup_storage_identifier:
* @self: a #TpAccount
*
* <!-- -->
*
- * Returns: (transfer none): the same as the #TpAccount:storage-identifier
+ * Returns: (transfer full): the same as the #TpAccount:storage-identifier
* property
*/
-const GVariant *
-tp_account_get_storage_identifier (TpAccount *self)
+GVariant *
+tp_account_dup_storage_identifier (TpAccount *self)
{
g_return_val_if_fail (TP_IS_ACCOUNT (self), NULL);
- return self->priv->storage_identifier;
+ if (self->priv->storage_identifier == NULL)
+ return NULL;
+
+ return g_variant_ref (self->priv->storage_identifier);
}
/**
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
index 01b336a..6fa1d32 100644
--- a/telepathy-glib/account.h
+++ b/telepathy-glib/account.h
@@ -242,7 +242,7 @@ gboolean tp_account_set_avatar_finish (TpAccount *self,
gboolean tp_account_get_changing_presence (TpAccount *self);
const gchar *tp_account_get_storage_provider (TpAccount *self);
-const GVariant *tp_account_get_storage_identifier (TpAccount *self);
+GVariant * tp_account_dup_storage_identifier (TpAccount *self);
TpStorageRestrictionFlags tp_account_get_storage_restrictions (TpAccount *self);
void tp_account_dup_storage_specific_information_async (
TpAccount *self,
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index 256ecaf..d27e9ad 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -527,12 +527,12 @@ test_storage (Test *test,
g_assert_cmpstr (tp_account_get_storage_provider (test->account), ==,
NULL);
assert_strprop (test->account, "storage-provider", NULL);
- g_assert (tp_account_get_storage_identifier (test->account) == NULL);
+ g_assert (tp_account_dup_storage_identifier (test->account) == NULL);
g_object_get (test->account,
"storage-identifier", &gvariant,
NULL);
g_assert (gvariant == NULL);
- g_assert (tp_account_get_storage_identifier (test->account) == NULL);
+ g_assert (tp_account_dup_storage_identifier (test->account) == NULL);
g_object_get (test->account,
"storage-identifier", &gvariant,
NULL);
@@ -552,9 +552,10 @@ test_storage (Test *test,
assert_strprop (test->account, "storage-provider",
"im.telepathy.v1.glib.test");
- g_assert_cmpstr (
- g_variant_get_string ((GVariant *) tp_account_get_storage_identifier (
- test->account), NULL), ==, "unique-identifier");
+ gvariant = tp_account_dup_storage_identifier (test->account);
+ g_assert_cmpstr (g_variant_get_string (gvariant, NULL), ==,
+ "unique-identifier");
+ g_variant_unref (gvariant);
g_object_get (test->account,
"storage-identifier", &gvariant,
NULL);
More information about the telepathy-commits
mailing list