Commit 5e6e7cba authored by Allison Karlitskaya's avatar Allison Karlitskaya

GVariant: add bind map for strings to byte arrays

parent a52b6f7d
......@@ -369,6 +369,8 @@ g_settings_set_mapping (const GValue *value,
return NULL;
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING))
return g_variant_new_string (g_value_get_string (value));
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE ("ay")))
return g_variant_new_byte_array (g_value_get_string (value), -1);
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_OBJECT_PATH))
return g_variant_new_object_path (g_value_get_string (value));
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_SIGNATURE))
......@@ -427,6 +429,11 @@ g_settings_get_mapping (GValue *value,
g_value_set_string (value, g_variant_get_string (variant, NULL));
return TRUE;
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE ("ay")))
g_value_set_string (value, g_variant_get_byte_array (variant, NULL));
return TRUE;
g_critical ("No GSettings bind handler for type \"%s\".",
g_variant_get_type_string (variant));
......@@ -460,6 +467,7 @@ g_settings_mapping_is_compatible (GType gvalue_type,
g_variant_type_equal (variant_type, G_VARIANT_TYPE_DOUBLE));
else if (gvalue_type == G_TYPE_STRING)
ok = (g_variant_type_equal (variant_type, G_VARIANT_TYPE_STRING) ||
g_variant_type_equal (variant_type, G_VARIANT_TYPE ("ay")) ||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_OBJECT_PATH) ||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_SIGNATURE));
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment