[next] telepathy-glib: Move tp_asv_to_vardict, tp_asv_from_vardict to dbus library

Simon McVittie smcv at kemper.freedesktop.org
Thu Apr 3 12:39:36 PDT 2014


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Mar 31 15:09:57 2014 +0100

Move tp_asv_to_vardict, tp_asv_from_vardict to dbus library

These functions should be useless in a post-dbus-glib environment.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=76855
Reviewed-by: Xavier Claessens

---

 telepathy-glib/account-channel-request.c  |    1 +
 telepathy-glib/asv.c                      |   61 +++++++++++++++++++++++++++++
 telepathy-glib/asv.h                      |    4 ++
 telepathy-glib/automatic-client-factory.c |    1 +
 telepathy-glib/channel-request.c          |    1 +
 telepathy-glib/client-factory.c           |    1 +
 telepathy-glib/svc-interface-skeleton.c   |    1 +
 telepathy-glib/variant-util.c             |   45 ---------------------
 telepathy-glib/variant-util.h             |    4 --
 telepathy-glib/versions/dbus-1.0.abi      |    2 +
 telepathy-glib/versions/main-1.0.abi      |    2 -
 tests/dbus/dbus-tube.c                    |    1 +
 tests/dbus/file-transfer-channel.c        |    1 +
 tests/dbus/stream-tube.c                  |    1 +
 14 files changed, 75 insertions(+), 51 deletions(-)

diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c
index a28b437..c0f9a75 100644
--- a/telepathy-glib/account-channel-request.c
+++ b/telepathy-glib/account-channel-request.c
@@ -78,6 +78,7 @@
 
 #include <dbus/dbus-glib.h>
 
+#include <telepathy-glib/asv.h>
 #include "telepathy-glib/base-client-internal.h"
 #include <telepathy-glib/channel-dispatcher.h>
 #include <telepathy-glib/channel-request.h>
diff --git a/telepathy-glib/asv.c b/telepathy-glib/asv.c
index dcd325f..44ab2d3 100644
--- a/telepathy-glib/asv.c
+++ b/telepathy-glib/asv.c
@@ -29,6 +29,7 @@
 
 #include <dbus/dbus-glib.h>
 
+#include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/sliced-gvalue.h>
 
 /* this is the core library, we don't have debug infrastructure yet */
@@ -64,6 +65,66 @@
  */
 
 /**
+ * tp_asv_to_vardict: (skip)
+ * @asv: a #TP_HASH_TYPE_STRING_VARIANT_MAP
+ *
+ * Convert a #TP_HASH_TYPE_STRING_VARIANT_MAP to a #GVariant of type
+ * %G_VARIANT_TYPE_VARDICT
+ *
+ * Returns: a new floating #GVariant of type %G_VARIANT_TYPE_VARDICT
+ **/
+GVariant *
+tp_asv_to_vardict (const GHashTable *asv)
+{
+  /* This open-codes _tp_boxed_to_variant() because that's in the main
+   * library, and this is in the dbus library. */
+  GValue v = G_VALUE_INIT;
+  GVariant *ret;
+
+  g_return_val_if_fail (asv != NULL, NULL);
+
+  g_value_init (&v, TP_HASH_TYPE_STRING_VARIANT_MAP);
+  g_value_set_boxed (&v, asv);
+
+  ret = dbus_g_value_build_g_variant (&v);
+  g_return_val_if_fail (g_variant_is_of_type (ret, G_VARIANT_TYPE_VARDICT),
+      NULL);
+
+  g_value_unset (&v);
+
+  return ret;
+}
+
+/**
+ * tp_asv_from_vardict: (skip)
+ * @variant: a #GVariant of type %G_VARIANT_TYPE_VARDICT
+ *
+ * Convert a #GVariant of type %G_VARIANT_TYPE_VARDICT to a
+ * #TP_HASH_TYPE_STRING_VARIANT_MAP
+ *
+ * Returns: (transfer full): a newly created #GHashTable of
+ * type #TP_HASH_TYPE_STRING_VARIANT_MAP
+ **/
+GHashTable *
+tp_asv_from_vardict (GVariant *variant)
+{
+  GValue v = G_VALUE_INIT;
+  GHashTable *result;
+
+  g_return_val_if_fail (variant != NULL, NULL);
+  g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_VARDICT),
+      NULL);
+
+  dbus_g_value_parse_g_variant (variant, &v);
+  g_assert (G_VALUE_HOLDS (&v, TP_HASH_TYPE_STRING_VARIANT_MAP));
+
+  result = g_value_dup_boxed (&v);
+
+  g_value_unset (&v);
+  return result;
+}
+
+/**
  * tp_asv_size: (skip)
  * @asv: a GHashTable
  *
diff --git a/telepathy-glib/asv.h b/telepathy-glib/asv.h
index 7d93722..a9e4c38 100644
--- a/telepathy-glib/asv.h
+++ b/telepathy-glib/asv.h
@@ -30,6 +30,10 @@
 
 G_BEGIN_DECLS
 
+GVariant * tp_asv_to_vardict (const GHashTable *asv);
+
+GHashTable * tp_asv_from_vardict (GVariant *variant);
+
 #define tp_asv_size(asv) _tp_asv_size_inline (asv)
 
 static inline guint
diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c
index 167067c..19f2057 100644
--- a/telepathy-glib/automatic-client-factory.c
+++ b/telepathy-glib/automatic-client-factory.c
@@ -106,6 +106,7 @@
 
 #include "telepathy-glib/automatic-client-factory.h"
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
 
diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c
index 68b4c7f..ad42898 100644
--- a/telepathy-glib/channel-request.c
+++ b/telepathy-glib/channel-request.c
@@ -24,6 +24,7 @@
 #include "telepathy-glib/channel-request.h"
 
 #include <telepathy-glib/account-manager.h>
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/channel.h>
 #include <telepathy-glib/cli-misc.h>
 #include <telepathy-glib/connection.h>
diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c
index 617f40e..0fb1d15 100644
--- a/telepathy-glib/client-factory.c
+++ b/telepathy-glib/client-factory.c
@@ -125,6 +125,7 @@
 
 #include "telepathy-glib/client-factory.h"
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/automatic-client-factory.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
diff --git a/telepathy-glib/svc-interface-skeleton.c b/telepathy-glib/svc-interface-skeleton.c
index 547a360..d4dbb5c 100644
--- a/telepathy-glib/svc-interface-skeleton.c
+++ b/telepathy-glib/svc-interface-skeleton.c
@@ -21,6 +21,7 @@
 
 #include <dbus/dbus-glib.h>
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/dbus-properties-mixin.h>
 #include <telepathy-glib/variant-util.h>
 
diff --git a/telepathy-glib/variant-util.c b/telepathy-glib/variant-util.c
index 8c78298..b17766e 100644
--- a/telepathy-glib/variant-util.c
+++ b/telepathy-glib/variant-util.c
@@ -51,22 +51,6 @@
 #define DEBUG_FLAG TP_DEBUG_MISC
 #include "debug-internal.h"
 
-/**
- * tp_asv_to_vardict: (skip)
- * @asv: a #TP_HASH_TYPE_STRING_VARIANT_MAP
- *
- * Convert a #TP_HASH_TYPE_STRING_VARIANT_MAP to a #GVariant of type
- * %G_VARIANT_TYPE_VARDICT
- *
- * Returns: a new floating #GVariant of type %G_VARIANT_TYPE_VARDICT
- **/
-GVariant *
-tp_asv_to_vardict (const GHashTable *asv)
-{
-  return _tp_boxed_to_variant (TP_HASH_TYPE_STRING_VARIANT_MAP, "a{sv}",
-      (gpointer) asv);
-}
-
 GVariant *
 _tp_boxed_to_variant (GType gtype,
     const gchar *variant_type,
@@ -89,35 +73,6 @@ _tp_boxed_to_variant (GType gtype,
 }
 
 /**
- * tp_asv_from_vardict: (skip)
- * @variant: a #GVariant of type %G_VARIANT_TYPE_VARDICT
- *
- * Convert a #GVariant of type %G_VARIANT_TYPE_VARDICT to a
- * #TP_HASH_TYPE_STRING_VARIANT_MAP
- *
- * Returns: (transfer full): a newly created #GHashTable of
- * type #TP_HASH_TYPE_STRING_VARIANT_MAP
- **/
-GHashTable *
-tp_asv_from_vardict (GVariant *variant)
-{
-  GValue v = G_VALUE_INIT;
-  GHashTable *result;
-
-  g_return_val_if_fail (variant != NULL, NULL);
-  g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_VARDICT),
-      NULL);
-
-  dbus_g_value_parse_g_variant (variant, &v);
-  g_assert (G_VALUE_HOLDS (&v, TP_HASH_TYPE_STRING_VARIANT_MAP));
-
-  result = g_value_dup_boxed (&v);
-
-  g_value_unset (&v);
-  return result;
-}
-
-/**
  * tp_variant_type_classify:
  * @type: a #GVariantType
  *
diff --git a/telepathy-glib/variant-util.h b/telepathy-glib/variant-util.h
index e3181d4..306754e 100644
--- a/telepathy-glib/variant-util.h
+++ b/telepathy-glib/variant-util.h
@@ -35,10 +35,6 @@ GVariantClass tp_variant_type_classify (const GVariantType *type);
 GVariant *tp_variant_convert (GVariant *variant,
     const GVariantType *type);
 
-GVariant * tp_asv_to_vardict (const GHashTable *asv);
-
-GHashTable * tp_asv_from_vardict (GVariant *variant);
-
 gboolean tp_vardict_has_key (GVariant *variant,
     const gchar *key);
 
diff --git a/telepathy-glib/versions/dbus-1.0.abi b/telepathy-glib/versions/dbus-1.0.abi
index 8e57705..6f5c671 100644
--- a/telepathy-glib/versions/dbus-1.0.abi
+++ b/telepathy-glib/versions/dbus-1.0.abi
@@ -3,6 +3,7 @@ Extends: -
 Release: 1.0
 
 tp_asv_dump
+tp_asv_from_vardict
 tp_asv_get_boolean
 tp_asv_get_boxed
 tp_asv_get_bytes
@@ -34,6 +35,7 @@ tp_asv_take_boxed
 tp_asv_take_bytes
 tp_asv_take_object_path
 tp_asv_take_string
+tp_asv_to_vardict
 tp_cli_account_call_reconnect
 tp_cli_account_call_remove
 tp_cli_account_call_update_parameters
diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi
index 901b318..ec93de4 100644
--- a/telepathy-glib/versions/main-1.0.abi
+++ b/telepathy-glib/versions/main-1.0.abi
@@ -134,8 +134,6 @@ tp_add_dispatch_operation_context_fail
 tp_add_dispatch_operation_context_get_type
 tp_address_g_variant_from_g_socket_address
 tp_address_variant_from_g_socket_address
-tp_asv_from_vardict
-tp_asv_to_vardict
 tp_automatic_client_factory_get_type
 tp_automatic_client_factory_new
 tp_avatar_requirements_copy
diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c
index 169a29f..1c24867 100644
--- a/tests/dbus/dbus-tube.c
+++ b/tests/dbus/dbus-tube.c
@@ -11,6 +11,7 @@
 
 #include <string.h>
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/dbus-tube-channel.h>
 #include <telepathy-glib/debug.h>
 #include <telepathy-glib/defs.h>
diff --git a/tests/dbus/file-transfer-channel.c b/tests/dbus/file-transfer-channel.c
index 9b47339..cd56b1e 100644
--- a/tests/dbus/file-transfer-channel.c
+++ b/tests/dbus/file-transfer-channel.c
@@ -13,6 +13,7 @@
 #include <glib.h>
 #include <string.h>
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/file-transfer-channel.h>
 #include <telepathy-glib/debug.h>
 #include <telepathy-glib/defs.h>
diff --git a/tests/dbus/stream-tube.c b/tests/dbus/stream-tube.c
index 4669051..a384297 100644
--- a/tests/dbus/stream-tube.c
+++ b/tests/dbus/stream-tube.c
@@ -11,6 +11,7 @@
 
 #include <string.h>
 
+#include <telepathy-glib/asv.h>
 #include <telepathy-glib/stream-tube-channel.h>
 #include <telepathy-glib/debug.h>
 #include <telepathy-glib/defs.h>



More information about the telepathy-commits mailing list