summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-22 16:57:16 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-22 17:27:24 +0100
commit3b9b239c077637a60013b6824fe94c575747d5f1 (patch)
treec424294610c55c4078ff6cdc8569e2ed1d164d01
parent37877bd0e9ab71ba54fa9960b4e3d8c3c5368e3a (diff)
Use GVariantDict for fill_contact_attributes()gdbus-object
-rw-r--r--src/connection-contact-info.c16
-rw-r--r--src/connection-contact-info.h2
-rw-r--r--src/connection.c41
3 files changed, 31 insertions, 28 deletions
diff --git a/src/connection-contact-info.c b/src/connection-contact-info.c
index dc160a59..d4716538 100644
--- a/src/connection-contact-info.c
+++ b/src/connection-contact-info.c
@@ -188,7 +188,7 @@ salut_conn_contact_info_fill_contact_attributes (
SalutConnection *self,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes)
+ GVariantDict *attributes)
{
if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1))
{
@@ -218,10 +218,16 @@ salut_conn_contact_info_fill_contact_attributes (
}
if (contact_info != NULL)
- tp_contact_attribute_map_take_sliced_gvalue (attributes,
- handle, TP_TOKEN_CONNECTION_INTERFACE_CONTACT_INFO1_INFO,
- tp_g_value_slice_new_take_boxed (
- TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info));
+ {
+ GValue value = G_VALUE_INIT;
+
+ g_value_init (&value, TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST);
+ g_value_take_boxed (&value, contact_info);
+ g_variant_dict_insert_value (attributes,
+ TP_TOKEN_CONNECTION_INTERFACE_CONTACT_INFO1_INFO,
+ dbus_g_value_build_g_variant (&value));
+ g_value_unset (&value);
+ }
g_object_unref (contact_manager);
return TRUE;
diff --git a/src/connection-contact-info.h b/src/connection-contact-info.h
index 63446fd6..ddad370b 100644
--- a/src/connection-contact-info.h
+++ b/src/connection-contact-info.h
@@ -37,6 +37,6 @@ gboolean salut_conn_contact_info_fill_contact_attributes (
SalutConnection *self,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes);
+ GVariantDict *attributes);
#endif // SALUT_CONNECTION_CONTACT_INFO_H
diff --git a/src/connection.c b/src/connection.c
index 63675fa8..79678a63 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -607,7 +607,7 @@ salut_connection_get_implemented_interfaces (void)
static void salut_connection_fill_contact_attributes (TpBaseConnection *base,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes);
+ GVariantDict *attributes);
static void
salut_connection_class_init (SalutConnectionClass *salut_connection_class)
@@ -1169,16 +1169,16 @@ static gboolean
salut_connection_aliasing_fill_contact_attributes (SalutConnection *self,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes)
+ GVariantDict *attributes)
{
if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ALIASING1))
{
- GValue *val = tp_g_value_slice_new (G_TYPE_STRING);
+ const gchar *alias = salut_connection_get_alias (self, handle);
- g_value_set_string (val, salut_connection_get_alias (self, handle));
-
- tp_contact_attribute_map_take_sliced_gvalue (attributes, handle,
- TP_TOKEN_CONNECTION_INTERFACE_ALIASING1_ALIAS, val);
+ g_assert (alias != NULL);
+ g_variant_dict_insert_value (attributes,
+ TP_TOKEN_CONNECTION_INTERFACE_ALIASING1_ALIAS,
+ g_variant_new_string (alias));
return TRUE;
}
@@ -1236,7 +1236,7 @@ static gboolean
conn_contact_capabilities_fill_contact_attributes (SalutConnection *self,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes)
+ GVariantDict *attributes)
{
if (!tp_strdiff (dbus_interface,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1))
@@ -1247,14 +1247,14 @@ conn_contact_capabilities_fill_contact_attributes (SalutConnection *self,
if (array->len > 0)
{
- GValue *val = tp_g_value_slice_new (
- TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST);
+ GValue value = G_VALUE_INIT;
- g_value_take_boxed (val, array);
- tp_contact_attribute_map_take_sliced_gvalue (attributes,
- handle,
+ g_value_init (&value, TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST);
+ g_value_take_boxed (&value, array);
+ g_variant_dict_insert_value (attributes,
TP_TOKEN_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1_CAPABILITIES,
- val);
+ dbus_g_value_build_g_variant (&value));
+ g_value_unset (&value);
}
else
{
@@ -1457,7 +1457,7 @@ static gboolean
salut_connection_avatars_fill_contact_attributes (SalutConnection *self,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes)
+ GVariantDict *attributes)
{
if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_AVATARS1))
{
@@ -1488,12 +1488,9 @@ salut_connection_avatars_fill_contact_attributes (SalutConnection *self,
if (token != NULL)
{
- GValue *val = tp_g_value_slice_new (G_TYPE_STRING);
-
- g_value_take_string (val, token);
-
- tp_contact_attribute_map_take_sliced_gvalue (attributes, handle,
- TP_TOKEN_CONNECTION_INTERFACE_AVATARS1_TOKEN, val);
+ g_variant_dict_insert_value (attributes,
+ TP_TOKEN_CONNECTION_INTERFACE_AVATARS1_TOKEN,
+ g_variant_new_string (token));
}
return TRUE;
@@ -2502,7 +2499,7 @@ static void
salut_connection_fill_contact_attributes (TpBaseConnection *base,
const gchar *dbus_interface,
TpHandle handle,
- TpContactAttributeMap *attributes)
+ GVariantDict *attributes)
{
SalutConnection *self = SALUT_CONNECTION (base);