mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 21:02:06 -04:00
core/dbus: support Normalize for more dbus types
This commit is contained in:
@@ -49,12 +49,38 @@ func Normalize(v any) any {
|
||||
result[k] = Normalize(vv.Value())
|
||||
}
|
||||
return result
|
||||
case map[string]any:
|
||||
result := make(map[string]any)
|
||||
for k, vv := range val {
|
||||
result[k] = Normalize(vv)
|
||||
}
|
||||
return result
|
||||
case map[dbus.ObjectPath]map[string]map[string]dbus.Variant:
|
||||
result := make(map[string]any)
|
||||
for path, ifaces := range val {
|
||||
ifaceMap := make(map[string]any)
|
||||
for ifaceName, props := range ifaces {
|
||||
propMap := make(map[string]any)
|
||||
for propName, propVal := range props {
|
||||
propMap[propName] = Normalize(propVal.Value())
|
||||
}
|
||||
ifaceMap[ifaceName] = propMap
|
||||
}
|
||||
result[string(path)] = ifaceMap
|
||||
}
|
||||
return result
|
||||
case []any:
|
||||
result := make([]any, len(val))
|
||||
for i, item := range val {
|
||||
result[i] = Normalize(item)
|
||||
}
|
||||
return result
|
||||
case []dbus.Variant:
|
||||
result := make([]any, len(val))
|
||||
for i, item := range val {
|
||||
result[i] = Normalize(item.Value())
|
||||
}
|
||||
return result
|
||||
default:
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user