mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
GVariant: add bind map for strings to byte arrays
This commit is contained in:
parent
a52b6f7df2
commit
5e6e7cbadf
@ -369,6 +369,8 @@ g_settings_set_mapping (const GValue *value,
|
|||||||
return NULL;
|
return NULL;
|
||||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING))
|
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING))
|
||||||
return g_variant_new_string (g_value_get_string (value));
|
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))
|
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_OBJECT_PATH))
|
||||||
return g_variant_new_object_path (g_value_get_string (value));
|
return g_variant_new_object_path (g_value_get_string (value));
|
||||||
else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_SIGNATURE))
|
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));
|
g_value_set_string (value, g_variant_get_string (variant, NULL));
|
||||||
return TRUE;
|
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_critical ("No GSettings bind handler for type \"%s\".",
|
||||||
g_variant_get_type_string (variant));
|
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));
|
g_variant_type_equal (variant_type, G_VARIANT_TYPE_DOUBLE));
|
||||||
else if (gvalue_type == G_TYPE_STRING)
|
else if (gvalue_type == G_TYPE_STRING)
|
||||||
ok = (g_variant_type_equal (variant_type, G_VARIANT_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_OBJECT_PATH) ||
|
||||||
g_variant_type_equal (variant_type, G_VARIANT_TYPE_SIGNATURE));
|
g_variant_type_equal (variant_type, G_VARIANT_TYPE_SIGNATURE));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user