summaryrefslogtreecommitdiff
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
parent1aeffdb74a1d7ce8b93587ded4f5a434cd1dfc06 (diff)
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>
-rw-r--r--configure.ac2
-rw-r--r--src/call-stream.c2
-rw-r--r--src/conn-location.c53
-rw-r--r--src/conn-mail-notif.c4
-rw-r--r--src/media-factory.c16
-rw-r--r--src/search-channel.c23
-rw-r--r--src/server-tls-manager.c14
7 files changed, 45 insertions, 69 deletions
diff --git a/configure.ac b/configure.ac
index aa8cc4d77..ee589bc1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,7 +228,7 @@ PKG_CHECK_MODULES(GLIB,
[glib-2.0 >= 2.32, gobject-2.0, gthread-2.0, gio-2.0])
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.32])
-AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_30, [Ignore post 2.30 deprecations])
+AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_32, [Ignore post 2.32 deprecations])
AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_32, [Prevent post 2.32 APIs])
AC_SUBST(GLIB_CFLAGS)
diff --git a/src/call-stream.c b/src/call-stream.c
index 1a28969af..4653ff626 100644
--- a/src/call-stream.c
+++ b/src/call-stream.c
@@ -101,7 +101,7 @@ get_stun_servers (GabbleCallStream *self)
WockyJingleFactory *jf;
GList *stun_servers;
- arr = g_ptr_array_new_with_free_func ((GDestroyNotify) g_value_array_free);
+ arr = g_ptr_array_new_with_free_func ((GDestroyNotify) tp_value_array_free);
jf = wocky_jingle_session_get_factory (self->priv->content->session);
stun_servers = wocky_jingle_info_get_stun_servers (
wocky_jingle_factory_get_jingle_info (jf));
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)
diff --git a/src/conn-mail-notif.c b/src/conn-mail-notif.c
index 0bc7169f8..afefdf7de 100644
--- a/src/conn-mail-notif.c
+++ b/src/conn-mail-notif.c
@@ -123,7 +123,7 @@ return_from_request_inbox_url (GabbleConnection *conn)
if (error == NULL)
{
- g_value_array_free (result);
+ tp_value_array_free (result);
g_ptr_array_unref (empty_array);
}
else
@@ -214,7 +214,7 @@ gabble_mail_notification_request_mail_url (
tp_svc_connection_interface_mail_notification_return_from_request_mail_url (
context, result);
- g_value_array_free (result);
+ tp_value_array_free (result);
g_ptr_array_unref (empty_array);
g_free (url);
}
diff --git a/src/media-factory.c b/src/media-factory.c
index 6a861498b..039f54911 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -768,7 +768,6 @@ gabble_media_factory_get_contact_caps (GabbleCapsChannelManager *manager,
{
MediaCapabilities typeflags =
_gabble_media_factory_caps_to_typeflags (caps);
- GValueArray *va;
const gchar * const *call_allowed;
typeflags &= (MEDIA_CAPABILITY_AUDIO |
@@ -811,16 +810,11 @@ gabble_media_factory_get_contact_caps (GabbleCapsChannelManager *manager,
}
/* Call channel */
- va = g_value_array_new (2);
- g_value_array_append (va, NULL);
- g_value_array_append (va, NULL);
- g_value_init (va->values + 0, TP_HASH_TYPE_CHANNEL_CLASS);
- g_value_init (va->values + 1, G_TYPE_STRV);
- g_value_take_boxed (va->values + 0,
- gabble_media_factory_call_channel_class ());
- g_value_set_static_boxed (va->values + 1, call_allowed);
-
- g_ptr_array_add (arr, va);
+ g_ptr_array_add (arr,
+ tp_value_array_build (2,
+ TP_HASH_TYPE_CHANNEL_CLASS, gabble_media_factory_call_channel_class (),
+ G_TYPE_STRV, call_allowed,
+ G_TYPE_INVALID));
}
static void
diff --git a/src/search-channel.c b/src/search-channel.c
index 0c253ba92..ab8a7d12d 100644
--- a/src/search-channel.c
+++ b/src/search-channel.c
@@ -519,26 +519,13 @@ static GValueArray *
make_field (const gchar *field_name,
gchar **values)
{
- GValueArray *field = g_value_array_new (3);
- GValue *value;
static const gchar **empty = { NULL };
- g_value_array_append (field, NULL);
- value = g_value_array_get_nth (field, 0);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_static_string (value, field_name);
-
- g_value_array_append (field, NULL);
- value = g_value_array_get_nth (field, 1);
- g_value_init (value, G_TYPE_STRV);
- g_value_set_static_boxed (value, empty);
-
- g_value_array_append (field, NULL);
- value = g_value_array_get_nth (field, 2);
- g_value_init (value, G_TYPE_STRV);
- g_value_set_boxed (value, values);
-
- return field;
+ return tp_value_array_build (3,
+ G_TYPE_STRING, field_name,
+ G_TYPE_STRV, empty,
+ G_TYPE_STRV, values,
+ G_TYPE_INVALID);
}
static gchar *
diff --git a/src/server-tls-manager.c b/src/server-tls-manager.c
index 4e961cdde..6a23c998a 100644
--- a/src/server-tls-manager.c
+++ b/src/server-tls-manager.c
@@ -556,7 +556,9 @@ gabble_server_tls_manager_get_rejection_details (GabbleServerTLSManager *self,
GabbleTLSCertificate *certificate;
GPtrArray *rejections;
GValueArray *rejection;
- TpTLSCertificateRejectReason tls_reason;
+ guint tls_reason;
+ const gchar *dbus_error_tmp;
+ GHashTable *details_tmp;
/* We probably want the rejection details of last completed operation */
g_return_if_fail (self->priv->completed_channels != NULL);
@@ -574,9 +576,13 @@ gabble_server_tls_manager_get_rejection_details (GabbleServerTLSManager *self,
rejection = g_ptr_array_index (rejections, 0);
- tls_reason = g_value_get_uint (g_value_array_get_nth (rejection, 0));
- *dbus_error = g_value_dup_string (g_value_array_get_nth (rejection, 1));
- *details = g_value_dup_boxed (g_value_array_get_nth (rejection, 2));
+ tp_value_array_unpack (rejection, 3,
+ &tls_reason,
+ &dbus_error_tmp,
+ &details_tmp);
+
+ *dbus_error = g_strdup (dbus_error_tmp);
+ *details = g_boxed_copy (TP_HASH_TYPE_STRING_VARIANT_MAP, details_tmp);
*reason = cert_reject_reason_to_conn_reason (tls_reason);