diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-14 13:45:45 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-20 16:56:56 +0000 |
commit | 8ae7472cfdd0b88718c73749d48d03fc2643f290 (patch) | |
tree | ecaa0a0b77e2043a9f581c3315e0a2caf8a91e82 /telepathy-glib/protocol.c | |
parent | 05f741275590cfff37cddf71232778e0a6c30182 (diff) | |
download | telepathy-glib-8ae7472cfdd0b88718c73749d48d03fc2643f290.tar.gz |
Parse arrays of object path in .manager files, for completeness
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'telepathy-glib/protocol.c')
-rw-r--r-- | telepathy-glib/protocol.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c index a7cd74dbb..00b24c74a 100644 --- a/telepathy-glib/protocol.c +++ b/telepathy-glib/protocol.c @@ -1,6 +1,6 @@ /* TpProtocol * - * Copyright © 2010 Collabora Ltd. + * Copyright © 2010-2012 Collabora Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1082,6 +1082,10 @@ init_gvalue_from_dbus_sig (const gchar *sig, g_value_init (value, G_TYPE_STRV); return TRUE; + case 'o': + g_value_init (value, TP_ARRAY_TYPE_OBJECT_PATH_LIST); + return TRUE; + case 'y': g_value_init (value, DBUS_TYPE_G_UCHAR_ARRAY); return TRUE; @@ -1261,6 +1265,43 @@ parse_default_value (GValue *value, return TRUE; } + + case 'o': + { + gsize len = 0; + GStrv strv = g_key_file_get_string_list (file, group, key, &len, + &error); + gchar **iter; + GPtrArray *arr; + + if (error != NULL) + { + g_error_free (error); + return FALSE; + } + + for (iter = strv; iter != NULL && *iter != NULL; iter++) + { + if (!g_variant_is_object_path (*iter)) + { + g_strfreev (strv); + return FALSE; + } + } + + arr = g_ptr_array_sized_new (len); + + for (iter = strv; iter != NULL && *iter != NULL; iter++) + { + /* transfer ownership */ + g_ptr_array_add (arr, *iter); + } + + g_free (strv); + g_value_take_boxed (value, arr); + + return TRUE; + } } } |