GVariant: improve bytestring support

- add G_VARIANT_TYPE_BYTESTRING, _BYTESTRING_ARRAY, _STRING_ARRAY

 - remove g_variant_{new,get}_byte_array functions

 - add g_variant_{new,get,dup}_bytestring{,_array} functions

 - remove undocumented support for deserialising arrays of objectpaths
   or signature strngs using g_variant_get_strv()

 - add and document new format strings '^ay', '^&ay', '^aay' and '^a&ay'

 - update GApplication to use the new API

 - update GSettings binding code to use the new API

 - add tests
This commit is contained in:
Ryan Lortie
2010-07-07 10:37:16 -04:00
parent 2d2a321a4b
commit d9e90c3894
13 changed files with 851 additions and 290 deletions

View File

@@ -1006,7 +1006,7 @@ test_simple_binding (void)
g_object_set (obj, "string", "non-unicode:\315", NULL);
value = g_settings_get_value (settings, "chararray");
g_assert_cmpstr (g_variant_get_byte_array (value, NULL), ==, "non-unicode:\315");
g_assert_cmpstr (g_variant_get_bytestring (value), ==, "non-unicode:\315");
g_variant_unref (value);
g_settings_bind (settings, "double", obj, "double", G_SETTINGS_BIND_DEFAULT);

View File

@@ -41,11 +41,11 @@ on_app_activated (GApplication *application,
while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
{
const char *activate_cwd;
gsize *len;
if (strcmp (key, "cwd") != 0)
continue;
activate_cwd = g_variant_get_byte_array (value, &len);
activate_cwd = g_variant_get_bytestring (value);
g_assert_cmpstr (cwd, ==, activate_cwd);
g_variant_unref (value);
}