events: fix D-Bus proxy by introspecting before use

Major skill issue on my behalf. Passing `None` as the introspection
XML to `get_proxy_object()` skips interface generation...

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iebccb4d7ef68a406c05f2b3dec4732f66a6a6964
This commit is contained in:
raf 2026-04-07 19:24:34 +03:00
commit d13884e949
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -31,15 +31,19 @@ class PoweroffEvent(Event):
bus = await MessageBus(bus_type=BusType.SYSTEM).connect()
try:
introspection = await bus.introspect(
"org.freedesktop.login1",
"/org/freedesktop/login1",
)
proxy = bus.get_proxy_object(
"org.freedesktop.login1",
"/org/freedesktop/login1",
None,
introspection,
)
manager = proxy.get_interface("org.freedesktop.login1.Manager")
await manager.call_power_off(False)
finally:
await bus.disconnect()
bus.disconnect()
class EventRegistry: