mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 16:32:50 -05:00
core/dbus: support Normalize for more dbus types
This commit is contained in:
@@ -65,7 +65,7 @@ func (m *Manager) Call(bus, dest, path, iface, method string, args []any) (*Call
|
||||
return nil, fmt.Errorf("dbus call failed: %w", call.Err)
|
||||
}
|
||||
|
||||
return &CallResult{Values: call.Body}, nil
|
||||
return &CallResult{Values: dbusutil.NormalizeSlice(call.Body)}, nil
|
||||
}
|
||||
|
||||
func (m *Manager) GetProperty(bus, dest, path, iface, property string) (*PropertyResult, error) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -445,6 +445,15 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: maskRect
|
||||
width: thumbnailImage.width
|
||||
height: thumbnailImage.height
|
||||
radius: Theme.cornerRadius
|
||||
visible: false
|
||||
layer.enabled: true
|
||||
}
|
||||
|
||||
CachingImage {
|
||||
id: thumbnailImage
|
||||
anchors.fill: parent
|
||||
@@ -456,13 +465,7 @@ Item {
|
||||
maskEnabled: true
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1.0
|
||||
maskSource: ShaderEffectSource {
|
||||
sourceItem: Rectangle {
|
||||
width: thumbnailImage.width
|
||||
height: thumbnailImage.height
|
||||
radius: Theme.cornerRadius
|
||||
}
|
||||
}
|
||||
maskSource: maskRect
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user