element: add property special case for float

This commit is contained in:
Stéphane Cerveau 2024-01-03 13:52:04 +01:00
parent d3005335b8
commit 3aded523c2

View file

@ -163,8 +163,15 @@ impl ElementInfo {
} else if value.type_().is_a(glib::Type::FLAGS) {
let value = value.get::<Vec<&glib::FlagsValue>>().unwrap();
let flags = value.iter().copied().fold(0, |acc, val| acc | val.value());
Ok(flags.to_string())
} else if value.type_().is_a(glib::Type::F64) || value.type_().is_a(glib::Type::F32) {
let value = value
.transform::<String>()
.expect("Unable to transform to string")
.get::<String>()
.unwrap()
.replace(',', ".");
Ok(value)
} else {
let value = value
.transform::<String>()