SetProperty calls org.freedesktop.DBus.Properties.Set on the given object. The property name must be given in interface.member notation. Panics if v is not a valid Variant type.
(p string, v any)
| 153 | // object. The property name must be given in interface.member notation. |
| 154 | // Panics if v is not a valid Variant type. |
| 155 | func (o *Object) SetProperty(p string, v any) error { |
| 156 | // v might already be a variant... |
| 157 | variant, ok := v.(Variant) |
| 158 | if !ok { |
| 159 | // Otherwise, make it into one. |
| 160 | variant = MakeVariant(v) |
| 161 | } |
| 162 | idx := strings.LastIndex(p, ".") |
| 163 | if idx == -1 || idx+1 == len(p) { |
| 164 | return errors.New("dbus: invalid property " + p) |
| 165 | } |
| 166 | |
| 167 | iface := p[:idx] |
| 168 | prop := p[idx+1:] |
| 169 | |
| 170 | return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, variant).Err |
| 171 | } |
| 172 | |
| 173 | // Destination returns the destination that calls on (o *Object) are sent to. |
| 174 | func (o *Object) Destination() string { |
nothing calls this directly
no test coverage detected