[next] telepathy-glib: account: merge dup_storage_specific_information_vardict to get_storage_specific_information

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Thu Feb 13 17:00:31 CET 2014


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

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Feb 10 18:35:24 2014 +0100

account: merge dup_storage_specific_information_vardict to get_storage_specific_information

---

 .../telepathy-glib/telepathy-glib-sections.txt     |    6 +-
 telepathy-glib/account.c                           |   81 +++-----------------
 telepathy-glib/account.h                           |   10 +--
 tests/dbus/account.c                               |   22 +-----
 4 files changed, 17 insertions(+), 102 deletions(-)

diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index 9cffa4e..b1f4ad4 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -4045,10 +4045,8 @@ TP_ACCOUNT_FEATURE_STORAGE
 tp_account_get_storage_provider
 tp_account_get_storage_identifier
 tp_account_get_storage_restrictions
-tp_account_get_storage_specific_information_async
-tp_account_get_storage_specific_information_finish
-tp_account_dup_storage_specific_information_vardict_async
-tp_account_dup_storage_specific_information_vardict_finish
+tp_account_dup_storage_specific_information_async
+tp_account_dup_storage_specific_information_finish
 <SUBSECTION Private>
 tp_account_get_feature_quark_core
 tp_account_get_feature_quark_connection
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 1dc4b93..1cfae39 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -3848,18 +3848,18 @@ _tp_account_get_storage_specific_information_cb (TpProxy *self,
     }
   else
     {
+      GHashTable *asv = g_value_get_boxed (value);
+
       g_simple_async_result_set_op_res_gpointer (result,
-          g_value_dup_boxed (value),
-          (GDestroyNotify) g_hash_table_unref);
+          _tp_asv_to_vardict (asv), (GDestroyNotify) g_variant_unref);
     }
 
   g_simple_async_result_complete (result);
   g_object_unref (result);
 }
 
-/* FIXME: in Telepathy 1.0, remove this */
 /**
- * tp_account_get_storage_specific_information_async:
+ * tp_account_dup_storage_specific_information_async:
  * @self: a #TpAccount
  * @callback: a callback to call when the request is satisfied
  * @user_data: data to pass to @callback
@@ -3868,13 +3868,11 @@ _tp_account_get_storage_specific_information_cb (TpProxy *self,
  * property (part of the Account.Interface.Storage interface).
  *
  * When the operation is finished, @callback will be called. You must then
- * call tp_account_get_storage_specific_information_finish() to get the
+ * call tp_account_dup_storage_specific_information_finish() to get the
  * result of the request.
- *
- * Since: 0.13.2
  */
 void
-tp_account_get_storage_specific_information_async (TpAccount *self,
+tp_account_dup_storage_specific_information_async (TpAccount *self,
     GAsyncReadyCallback callback,
     gpointer user_data)
 {
@@ -3883,89 +3881,32 @@ tp_account_get_storage_specific_information_async (TpAccount *self,
   g_return_if_fail (TP_IS_ACCOUNT (self));
 
   result = g_simple_async_result_new (G_OBJECT (self),
-      callback, user_data, tp_account_get_storage_specific_information_async);
+      callback, user_data, tp_account_dup_storage_specific_information_async);
 
   tp_cli_dbus_properties_call_get (self, -1,
       TP_IFACE_ACCOUNT_INTERFACE_STORAGE1, "StorageSpecificInformation",
       _tp_account_get_storage_specific_information_cb, result, NULL, NULL);
 }
 
-/* FIXME: in Telepathy 1.0, rename to ...get_storage_specific_information... */
-/**
- * tp_account_dup_storage_specific_information_vardict_async:
- * @self: a #TpAccount
- * @callback: a callback to call when the request is satisfied
- * @user_data: data to pass to @callback
- *
- * Makes an asynchronous request of @self's StorageSpecificInformation
- * property (part of the Account.Interface.Storage interface).
- *
- * When the operation is finished, @callback will be called. You must then
- * call tp_account_dup_storage_specific_information_vardict_finish() to get the
- * result of the request.
- *
- * Since: 0.17.6
- */
-void
-tp_account_dup_storage_specific_information_vardict_async (TpAccount *self,
-    GAsyncReadyCallback callback,
-    gpointer user_data)
-{
-  /* we share an implementation */
-  tp_account_get_storage_specific_information_async (self, callback,
-      user_data);
-}
-
-/* FIXME: in Telepathy 1.0, remove this */
 /**
- * tp_account_get_storage_specific_information_finish:
+ * tp_account_dup_storage_specific_information_finish:
  * @self: a #TpAccount
  * @result: a #GAsyncResult
  * @error: a #GError to fill
  *
  * Retrieve the value of the request begun with
- * tp_account_get_storage_specific_information_async().
- *
- * Beware that the returned value is only valid until @result is freed.
- * Copy it with g_hash_table_ref() if you need to keep it for longer.
- *
- * Returns: (element-type utf8 GObject.Value) (transfer none): a #GHashTable
- *  of strings to GValues representing the D-Bus type a{sv}.
- *
- * Since: 0.13.2
- */
-GHashTable *
-tp_account_get_storage_specific_information_finish (TpAccount *self,
-    GAsyncResult *result,
-    GError **error)
-{
-  _tp_implement_finish_return_copy_pointer (self,
-      tp_account_get_storage_specific_information_async, /* do not copy */);
-}
-
-/* FIXME: in Telepathy 1.0, rename to ...get_storage_specific_information... */
-/**
- * tp_account_dup_storage_specific_information_vardict_finish:
- * @self: a #TpAccount
- * @result: a #GAsyncResult
- * @error: a #GError to fill
- *
- * Retrieve the value of the request begun with
- * tp_account_dup_storage_specific_information_vardict_async().
+ * tp_account_dup_storage_specific_information_async().
  *
  * Returns: (transfer full): a map from strings to variants,
  *  of type %G_VARIANT_TYPE_VARDICT
- *
- * Since: 0.17.6
  */
 GVariant *
-tp_account_dup_storage_specific_information_vardict_finish (TpAccount *self,
+tp_account_dup_storage_specific_information_finish (TpAccount *self,
     GAsyncResult *result,
     GError **error)
 {
-  /* we share the source tag with the non-vardict version */
   _tp_implement_finish_return_copy_pointer (self,
-      tp_account_get_storage_specific_information_async, _tp_asv_to_vardict);
+      tp_account_dup_storage_specific_information_async, g_variant_ref);
 }
 
 static void
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
index 719fc0a..01b336a 100644
--- a/telepathy-glib/account.h
+++ b/telepathy-glib/account.h
@@ -244,17 +244,11 @@ 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);
 TpStorageRestrictionFlags tp_account_get_storage_restrictions (TpAccount *self);
-void tp_account_get_storage_specific_information_async (TpAccount *self,
-    GAsyncReadyCallback callback, gpointer user_data);
-GHashTable *tp_account_get_storage_specific_information_finish (TpAccount *self,
-    GAsyncResult *result, GError **error);
-_TP_AVAILABLE_IN_0_18
-void tp_account_dup_storage_specific_information_vardict_async (
+void tp_account_dup_storage_specific_information_async (
     TpAccount *self,
     GAsyncReadyCallback callback,
     gpointer user_data);
-_TP_AVAILABLE_IN_0_18
-GVariant *tp_account_dup_storage_specific_information_vardict_finish (
+GVariant *tp_account_dup_storage_specific_information_finish (
     TpAccount *self,
     GAsyncResult *result,
     GError **error);
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index 93e1fe3..256ecaf 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -508,7 +508,6 @@ test_storage (Test *test,
 {
   GQuark account_features[] = { TP_ACCOUNT_FEATURE_STORAGE, 0 };
   GVariant *gvariant;
-  GHashTable *info;
   GError *error = NULL;
   gboolean found;
   gint32 i;
@@ -571,28 +570,11 @@ test_storage (Test *test,
       TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS);
 
   /* request the StorageSpecificProperties hash */
-  tp_account_get_storage_specific_information_async (test->account,
+  tp_account_dup_storage_specific_information_async (test->account,
       tp_tests_result_ready_cb, &test->result);
   tp_tests_run_until_result (&test->result);
 
-  info = tp_account_get_storage_specific_information_finish (
-      test->account, test->result, &error);
-  g_assert_no_error (error);
-
-  g_assert_cmpuint (g_hash_table_size (info), ==, 3);
-
-  g_assert_cmpint (tp_asv_get_int32 (info, "one", NULL), ==, 1);
-  g_assert_cmpuint (tp_asv_get_uint32 (info, "two", NULL), ==, 2);
-  g_assert_cmpstr (tp_asv_get_string (info, "marco"), ==, "polo");
-
-  tp_clear_object (&test->result);
-
-  /* the same, but with 100% more GVariant */
-  tp_account_dup_storage_specific_information_vardict_async (test->account,
-      tp_tests_result_ready_cb, &test->result);
-  tp_tests_run_until_result (&test->result);
-
-  gvariant = tp_account_dup_storage_specific_information_vardict_finish (
+  gvariant = tp_account_dup_storage_specific_information_finish (
       test->account, test->result, &error);
   g_assert_no_error (error);
 



More information about the telepathy-commits mailing list