mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -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 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) {
|
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())
|
result[k] = Normalize(vv.Value())
|
||||||
}
|
}
|
||||||
return result
|
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:
|
case []any:
|
||||||
result := make([]any, len(val))
|
result := make([]any, len(val))
|
||||||
for i, item := range val {
|
for i, item := range val {
|
||||||
result[i] = Normalize(item)
|
result[i] = Normalize(item)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
case []dbus.Variant:
|
||||||
|
result := make([]any, len(val))
|
||||||
|
for i, item := range val {
|
||||||
|
result[i] = Normalize(item.Value())
|
||||||
|
}
|
||||||
|
return result
|
||||||
default:
|
default:
|
||||||
return v
|
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 {
|
CachingImage {
|
||||||
id: thumbnailImage
|
id: thumbnailImage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -456,13 +465,7 @@ Item {
|
|||||||
maskEnabled: true
|
maskEnabled: true
|
||||||
maskThresholdMin: 0.5
|
maskThresholdMin: 0.5
|
||||||
maskSpreadAtMin: 1.0
|
maskSpreadAtMin: 1.0
|
||||||
maskSource: ShaderEffectSource {
|
maskSource: maskRect
|
||||||
sourceItem: Rectangle {
|
|
||||||
width: thumbnailImage.width
|
|
||||||
height: thumbnailImage.height
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user