aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-27 11:56:20 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-27 12:09:34 +0900
commit51e84ba8a52bcd06f544ace45f3fecb9396881ab (patch)
tree7ee4950a0eea0867a7380b4eeabc3ff00bea8c02 /internal/system
parent7df9d8d01dadcb05396d278aba11afc2ab4a2328 (diff)
system/dbus: compare sealed value by string
Stringer method of dbus.Proxy returns a string representation of its args stream when sealed. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system')
-rw-r--r--internal/system/dbus.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/system/dbus.go b/internal/system/dbus.go
index 7c003e4e..349963c4 100644
--- a/internal/system/dbus.go
+++ b/internal/system/dbus.go
@@ -12,6 +12,14 @@ var (
ErrDBusConfig = errors.New("dbus config not supplied")
)
+func (sys *I) MustProxyDBus(sessionPath string, session *dbus.Config, systemPath string, system *dbus.Config) *I {
+ if err := sys.ProxyDBus(session, system, sessionPath, systemPath); err != nil {
+ panic(err.Error())
+ } else {
+ return sys
+ }
+}
+
func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath string) error {
d := new(DBus)
@@ -144,7 +152,9 @@ func (d *DBus) revert(_ *I, _ *Criteria) error {
func (d *DBus) Is(o Op) bool {
d0, ok := o.(*DBus)
- return ok && d0 != nil && *d == *d0
+ return ok && d0 != nil &&
+ ((d.proxy == nil && d0.proxy == nil) ||
+ (d.proxy != nil && d0.proxy != nil && d.proxy.String() == d0.proxy.String()))
}
func (d *DBus) Path() string {