mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02:00
Handle NULL string properties in bindings
Admittely, we just handle them by failing the conversion...
This commit is contained in:
@@ -365,7 +365,9 @@ g_settings_set_mapping (const GValue *value,
|
|||||||
|
|
||||||
else if (G_VALUE_HOLDS_STRING (value))
|
else if (G_VALUE_HOLDS_STRING (value))
|
||||||
{
|
{
|
||||||
if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING))
|
if (g_value_get_string (value) == NULL)
|
||||||
|
return NULL;
|
||||||
|
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_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));
|
||||||
|
@@ -1233,9 +1233,9 @@ g_settings_binding_property_changed (GObject *object,
|
|||||||
* The binding uses the default GIO mapping functions to map
|
* The binding uses the default GIO mapping functions to map
|
||||||
* between the settings and property values. These functions
|
* between the settings and property values. These functions
|
||||||
* handle booleans, numeric types and string types in a
|
* handle booleans, numeric types and string types in a
|
||||||
* straightforward way. Use g_settings_bind_with_mapping()
|
* straightforward way. Use g_settings_bind_with_mapping() if
|
||||||
* if you need a custom mapping, or map between types that
|
* you need a custom mapping, or map between types that are not
|
||||||
* are not supported by the default mapping functions.
|
* supported by the default mapping functions.
|
||||||
*
|
*
|
||||||
* Unless the @flags include %G_SETTINGS_BIND_NO_SENSITIVITY, this
|
* Unless the @flags include %G_SETTINGS_BIND_NO_SENSITIVITY, this
|
||||||
* function also establishes a binding between the writability of
|
* function also establishes a binding between the writability of
|
||||||
|
@@ -672,7 +672,6 @@ G_DEFINE_TYPE (TestObject, test_object, G_TYPE_OBJECT)
|
|||||||
static void
|
static void
|
||||||
test_object_init (TestObject *object)
|
test_object_init (TestObject *object)
|
||||||
{
|
{
|
||||||
object->no_write_prop = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user