summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 13:10:07 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-07 18:29:43 +0100
commitceb93f3a041a6b4577edee93f79c2a9d48e40d29 (patch)
tree4b4d509f4437761bc8b90f45b6f8528c53059c60
parented8e81088842597b902b98171871d04130ac3f90 (diff)
TpChannel:channel-properties: change type to GVariant
It's still a GHashTable internally, because lots of subclasses still rely on that.
-rw-r--r--telepathy-glib/automatic-client-factory-internal.h10
-rw-r--r--telepathy-glib/automatic-client-factory.c8
-rw-r--r--telepathy-glib/call-channel.c2
-rw-r--r--telepathy-glib/channel.c32
-rw-r--r--telepathy-glib/client-factory-internal.h2
-rw-r--r--telepathy-glib/client-factory.c7
-rw-r--r--telepathy-glib/dbus-tube-channel.c2
-rw-r--r--telepathy-glib/file-transfer-channel.c2
-rw-r--r--telepathy-glib/stream-tube-channel.c2
-rw-r--r--telepathy-glib/text-channel.c2
-rw-r--r--telepathy-logger/call-channel-internal.h2
-rw-r--r--telepathy-logger/call-channel.c2
-rw-r--r--telepathy-logger/client-factory.c9
-rw-r--r--telepathy-logger/text-channel-internal.h2
-rw-r--r--telepathy-logger/text-channel.c2
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 94c5b1ce6..2a0527da9 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 19f20575a..c84873df7 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 e607fb1aa..a80632c4b 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 2ad2689f9..f2451aa83 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 f62ad7a68..43d04ddaf 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 eda138d38..416161e69 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 ca89327ad..60dc2c013 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 20b109f9b..effe49cea 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 99a712241..0e7b5ce41 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 bf571ad58..6903c9aff 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 dec30a11d..2473256d0 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 c9796e8db..3ea50f89f 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 948d6bd7e..318482fdb 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 c27005684..92a16e081 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 ea67a61ca..d6a2ac022 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;