summaryrefslogtreecommitdiff
path: root/src/conn-location.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-01 14:38:38 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-04 12:14:29 +0000
commit6d577b4ffbb499070625eda4a4cdef471d0a9b0d (patch)
tree6e9764f912b0e7a891fc150012e3cb58f5d4c425 /src/conn-location.c
parent1aeffdb74a1d7ce8b93587ded4f5a434cd1dfc06 (diff)
downloadtelepathy-gabble-6d577b4ffbb499070625eda4a4cdef471d0a9b0d.tar.gz
Use non-deprecated GValueArray functions
This works around GValueArray being deprecated in GLib, but still part of dbus-glib-derived APIs. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26609 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'src/conn-location.c')
-rw-r--r--src/conn-location.c53
1 files changed, 21 insertions, 32 deletions
diff --git a/src/conn-location.c b/src/conn-location.c
index ae78d68be..b51196641 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -439,28 +439,21 @@ conn_location_properties_getter (GObject *object,
}
else if (!tp_strdiff (g_quark_to_string (name), "LocationAccessControl"))
{
- GValueArray *access_control = g_value_array_new (2);
- GValue type = {0,};
- GValue variant = {0,};
- GValue *allocated_value;
-
- /* G_TYPE_UINT is the D-Bus type of TpRichPresenceAccessControlType */
- g_value_init (&type, G_TYPE_UINT);
- g_value_set_uint (&type,
- TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST);
- g_value_array_append (access_control, &type);
- g_value_unset (&type);
-
- g_value_init (&variant, G_TYPE_VALUE);
+ GValueArray *access_control;
+ GValue dummy = G_VALUE_INIT;
+
/* For Publish_List, the variant isn't used, so we set a dummy value,
* (guint) 0 */
- allocated_value = tp_g_value_slice_new (G_TYPE_UINT);
- g_value_set_uint (allocated_value, 0);
- g_value_set_boxed (&variant, allocated_value);
- g_value_array_append (access_control, &variant);
- g_value_unset (&variant);
- tp_g_value_slice_free (allocated_value);
+ g_value_init (&dummy, G_TYPE_UINT);
+ g_value_set_uint (&dummy, 0);
+
+ access_control = tp_value_array_build (2,
+ G_TYPE_UINT,
+ (guint) TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST,
+ G_TYPE_VALUE, &dummy,
+ G_TYPE_INVALID);
+ g_value_unset (&dummy);
g_value_take_boxed (value, access_control);
}
else if (name == g_quark_from_static_string ("SupportedLocationFeatures"))
@@ -486,9 +479,9 @@ conn_location_properties_setter (GObject *object,
gpointer setter_data,
GError **error)
{
- GValueArray *access_control;
- GValue *access_control_type_value;
- TpRichPresenceAccessControlType access_control_type;
+ guint access_control_type;
+ GValue *access_control_argument;
+
g_return_val_if_fail (interface ==
TP_IFACE_QUARK_CONNECTION_INTERFACE_LOCATION, FALSE);
@@ -496,17 +489,13 @@ conn_location_properties_setter (GObject *object,
* already checked this. */
g_assert (name == g_quark_from_static_string ("LocationAccessControl"));
- access_control = g_value_get_boxed (value);
-
- /* TpDBusPropertiesMixin already checked this */
- g_assert (access_control->n_values == 2);
-
- access_control_type_value = g_value_array_get_nth (access_control, 0);
-
- /* TpDBusPropertiesMixin already checked this */
- g_assert (G_VALUE_TYPE (access_control_type_value) == G_TYPE_UINT);
+ /* TpDBusPropertiesMixin already checked that it was a (uv). */
+ g_assert (G_VALUE_HOLDS (value,
+ TP_STRUCT_TYPE_RICH_PRESENCE_ACCESS_CONTROL));
- access_control_type = g_value_get_uint (access_control_type_value);
+ tp_value_array_unpack (g_value_get_boxed (value), 2,
+ &access_control_type,
+ &access_control_argument);
if (access_control_type !=
TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST)