[Pkg-telepathy-commits] [telepathy-glib-1] 125/212: TpChannel:channel-properties: change type to GVariant

Simon McVittie smcv at debian.org
Wed May 14 12:09:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib-1.

commit d7a8163baa6aabbfc1d3643f9f3ae1cb71b5aa0b
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Apr 7 13:10:07 2014 +0100

    TpChannel:channel-properties: change type to GVariant
    
    It's still a GHashTable internally, because lots of subclasses still
    rely on that.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77139
    Reviewed-by: Xavier Claessens
---
 telepathy-glib/automatic-client-factory-internal.h | 10 +++----
 telepathy-glib/automatic-client-factory.c          |  8 ++----
 telepathy-glib/call-channel.c                      |  2 +-
 telepathy-glib/channel.c                           | 32 +++++++++++++++-------
 telepathy-glib/client-factory-internal.h           |  2 +-
 telepathy-glib/client-factory.c                    |  7 ++---
 telepathy-glib/dbus-tube-channel.c                 |  2 +-
 telepathy-glib/file-transfer-channel.c             |  2 +-
 telepathy-glib/stream-tube-channel.c               |  2 +-
 telepathy-glib/text-channel.c                      |  2 +-
 telepathy-logger/call-channel-internal.h           |  2 +-
 telepathy-logger/call-channel.c                    |  2 +-
 telepathy-logger/client-factory.c                  |  9 ++----
 telepathy-logger/text-channel-internal.h           |  2 +-
 telepathy-logger/text-channel.c                    |  2 +-
 15 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/telepathy-glib/automatic-client-factory-internal.h b/telepathy-glib/automatic-client-factory-internal.h
index 94c5b1c..2a0527d 100644
--- a/telepathy-glib/automatic-client-factory-internal.h
+++ b/telepathy-glib/automatic-client-factory-internal.h
@@ -29,31 +29,31 @@ G_BEGIN_DECLS
 TpTextChannel *_tp_text_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 TpStreamTubeChannel *_tp_stream_tube_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 TpDBusTubeChannel *_tp_dbus_tube_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 TpFileTransferChannel *_tp_file_transfer_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 TpCallChannel *_tp_call_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 G_END_DECLS
diff --git a/telepathy-glib/automatic-client-factory.c b/telepathy-glib/automatic-client-factory.c
index 19f2057..c84873d 100644
--- a/telepathy-glib/automatic-client-factory.c
+++ b/telepathy-glib/automatic-client-factory.c
@@ -129,7 +129,7 @@ typedef TpChannel *(*NewFunc) (
     TpClientFactory *client,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *properties,
+    GVariant *properties,
     GError **error);
 
 typedef struct {
@@ -203,8 +203,6 @@ create_channel_impl (TpClientFactory *self,
 
   for (m = channel_type_mapping; m->channel_type != NULL; m++)
     {
-      GHashTable *asv;
-
       if (tp_strdiff (chan_type, m->channel_type))
         continue;
 
@@ -212,9 +210,7 @@ create_channel_impl (TpClientFactory *self,
           !m->check_properties (object_path, properties))
         break;
 
-      asv = tp_asv_from_vardict (properties);
-      channel = m->new_func (self, conn, object_path, asv, error);
-      g_hash_table_unref (asv);
+      channel = m->new_func (self, conn, object_path, properties, error);
       break;
     }
 
diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
index e607fb1..a80632c 100644
--- a/telepathy-glib/call-channel.c
+++ b/telepathy-glib/call-channel.c
@@ -1150,7 +1150,7 @@ TpCallChannel *
 _tp_call_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index 2ad2689..f2451aa 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -23,6 +23,8 @@
 
 #include "telepathy-glib/channel-internal.h"
 
+#include <dbus/dbus-glib.h>
+
 #include <telepathy-glib/asv.h>
 #include <telepathy-glib/channel-iface.h>
 #include <telepathy-glib/cli-channel.h>
@@ -409,7 +411,8 @@ tp_channel_get_property (GObject *object,
       g_value_set_string (value, tp_channel_get_identifier (self));
       break;
     case PROP_CHANNEL_PROPERTIES:
-      g_value_set_boxed (value, self->priv->channel_properties);
+      g_value_take_variant (value,
+          tp_channel_dup_immutable_properties (self));
       break;
     case PROP_GROUP_FLAGS:
       g_value_set_uint (value, self->priv->group_flags);
@@ -536,14 +539,21 @@ tp_channel_set_property (GObject *object,
 
     case PROP_CHANNEL_PROPERTIES:
         {
-          GHashTable *asv = g_value_get_boxed (value);
-          gboolean valid;
+          GVariant *vardict;
+
+          vardict = g_value_get_variant (value);
 
           /* default value at construct time is NULL, we need to ignore that */
-          if (asv != NULL)
+          if (vardict != NULL)
             {
+              GValue inner_value = G_VALUE_INIT;
+              GHashTable *asv;
+              gboolean valid;
               guint u;
 
+              dbus_g_value_parse_g_variant (vardict, &inner_value);
+              asv = g_value_get_boxed (&inner_value);
+
               /* no need to emit GObject::notify for any of these since this
                * can only happen at construct time, before anyone has
                * connected to it */
@@ -572,6 +582,8 @@ tp_channel_set_property (GObject *object,
                   tp_asv_get_boxed (self->priv->channel_properties,
                       TP_PROP_CHANNEL_INTERFACES,
                       G_TYPE_STRV));
+
+              g_value_unset (&inner_value);
             }
         }
       break;
@@ -1208,8 +1220,8 @@ tp_channel_class_init (TpChannelClass *klass)
    * TpChannel:channel-properties:
    *
    * The immutable D-Bus properties of this channel, represented by a
-   * #GHashTable where the keys are D-Bus interface name + "." + property
-   * name, and the values are #GValue instances.
+   * %G_VARIANT_TYPE_VARDICT where the keys are
+   * D-Bus interface name + "." + property name.
    *
    * Read-only except during construction. If this is not provided
    * during construction, a reasonable (but possibly incomplete) version
@@ -1217,10 +1229,10 @@ tp_channel_class_init (TpChannelClass *klass)
    * property repeatedly may yield progressively more complete values until
    * tp_proxy_prepare_async() has finished preparing %TP_CHANNEL_FEATURE_CORE.
    */
-  param_spec = g_param_spec_boxed ("channel-properties",
+  param_spec = g_param_spec_variant ("channel-properties",
       "Immutable D-Bus properties",
-      "A map D-Bus interface + \".\" + property name => GValue",
-      TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP,
+      "A map D-Bus interface + \".\" + property name => variant",
+      G_VARIANT_TYPE_VARDICT, NULL,
       G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_CHANNEL_PROPERTIES,
       param_spec);
@@ -1440,7 +1452,7 @@ TpChannel *
 _tp_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   TpChannel *ret = NULL;
diff --git a/telepathy-glib/client-factory-internal.h b/telepathy-glib/client-factory-internal.h
index f62ad7a..43d04dd 100644
--- a/telepathy-glib/client-factory-internal.h
+++ b/telepathy-glib/client-factory-internal.h
@@ -53,7 +53,7 @@ TpConnection *_tp_connection_new (TpClientFactory *factory,
 TpChannel *_tp_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error);
 
 TpChannelRequest *_tp_channel_request_new (
diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c
index eda138d..416161e 100644
--- a/telepathy-glib/client-factory.c
+++ b/telepathy-glib/client-factory.c
@@ -246,13 +246,10 @@ create_channel_impl (TpClientFactory *self,
     GError **error)
 {
   TpChannel *channel;
-  GHashTable *props;
 
-  props = tp_asv_from_vardict (immutable_properties);
-
-  channel = _tp_channel_new (self, conn, object_path, props, error);
+  channel = _tp_channel_new (self, conn, object_path, immutable_properties,
+      error);
 
-  g_hash_table_unref (props);
   return channel;
 }
 
diff --git a/telepathy-glib/dbus-tube-channel.c b/telepathy-glib/dbus-tube-channel.c
index ca89327..60dc2c0 100644
--- a/telepathy-glib/dbus-tube-channel.c
+++ b/telepathy-glib/dbus-tube-channel.c
@@ -457,7 +457,7 @@ TpDBusTubeChannel *
 _tp_dbus_tube_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
diff --git a/telepathy-glib/file-transfer-channel.c b/telepathy-glib/file-transfer-channel.c
index 20b109f..effe49c 100644
--- a/telepathy-glib/file-transfer-channel.c
+++ b/telepathy-glib/file-transfer-channel.c
@@ -1044,7 +1044,7 @@ TpFileTransferChannel *
 _tp_file_transfer_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index 99a7122..0e7b5ce 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -494,7 +494,7 @@ TpStreamTubeChannel *
 _tp_stream_tube_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
diff --git a/telepathy-glib/text-channel.c b/telepathy-glib/text-channel.c
index bf571ad..6903c9a 100644
--- a/telepathy-glib/text-channel.c
+++ b/telepathy-glib/text-channel.c
@@ -1113,7 +1113,7 @@ TpTextChannel *
 _tp_text_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *immutable_properties,
+    GVariant *immutable_properties,
     GError **error)
 {
   g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
diff --git a/telepathy-logger/call-channel-internal.h b/telepathy-logger/call-channel-internal.h
index dec30a1..2473256 100644
--- a/telepathy-logger/call-channel-internal.h
+++ b/telepathy-logger/call-channel-internal.h
@@ -65,7 +65,7 @@ GType _tpl_call_channel_get_type (void);
 TplCallChannel * _tpl_call_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *tp_chan_props,
+    GVariant *tp_chan_props,
     GError **error);
 
 G_END_DECLS
diff --git a/telepathy-logger/call-channel.c b/telepathy-logger/call-channel.c
index c9796e8..3ea50f8 100644
--- a/telepathy-logger/call-channel.c
+++ b/telepathy-logger/call-channel.c
@@ -442,7 +442,7 @@ TplCallChannel *
 _tpl_call_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *tp_chan_props,
+    GVariant *tp_chan_props,
     GError **error)
 {
   TplCallChannel *self;
diff --git a/telepathy-logger/client-factory.c b/telepathy-logger/client-factory.c
index 948d6bd..318482f 100644
--- a/telepathy-logger/client-factory.c
+++ b/telepathy-logger/client-factory.c
@@ -40,21 +40,19 @@ create_channel_impl (TpClientFactory *self,
     GError **error)
 {
   const gchar *chan_type;
-  GHashTable *asv;
   TpChannel *channel;
 
-  asv = tp_asv_from_vardict (properties);
-  chan_type = tp_asv_get_string (asv, TP_PROP_CHANNEL_CHANNEL_TYPE);
+  chan_type = tp_vardict_get_string (properties, TP_PROP_CHANNEL_CHANNEL_TYPE);
 
   if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_TEXT))
     {
       channel = (TpChannel *) _tpl_text_channel_new (self, conn,
-          object_path, asv, error);
+          object_path, properties, error);
     }
   else if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_CALL1))
     {
       channel = (TpChannel *) _tpl_call_channel_new (self, conn,
-          object_path, asv, error);
+          object_path, properties, error);
     }
   else
     {
@@ -62,7 +60,6 @@ create_channel_impl (TpClientFactory *self,
           error);
     }
 
-  g_hash_table_unref (asv);
   return channel;
 }
 
diff --git a/telepathy-logger/text-channel-internal.h b/telepathy-logger/text-channel-internal.h
index c270056..92a16e0 100644
--- a/telepathy-logger/text-channel-internal.h
+++ b/telepathy-logger/text-channel-internal.h
@@ -71,7 +71,7 @@ GType _tpl_text_channel_get_type (void);
 TplTextChannel * _tpl_text_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *tp_chan_props,
+    GVariant *tp_chan_props,
     GError **error);
 
 G_END_DECLS
diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c
index ea67a61..d6a2ac0 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -715,7 +715,7 @@ TplTextChannel *
 _tpl_text_channel_new (TpClientFactory *factory,
     TpConnection *conn,
     const gchar *object_path,
-    const GHashTable *tp_chan_props,
+    GVariant *tp_chan_props,
     GError **error)
 {
   TplTextChannel *self;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib-1.git



More information about the Pkg-telepathy-commits mailing list