Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Replace StateSignal with Started & Halted
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkin committed Jun 5, 2017
1 parent 3fc612e commit 9af4df7
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions qubesdbus/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,30 @@ def __init__(self, bus, bus_name, bus_path, data):
bus=bus, bus_name=bus_name,
bus_path=bus_path)

@dbus.service.signal(
dbus_interface="org.qubes.DomainManager1.domains.Signals",
signature='s')
def StateSignal(self, name):
self.properties['state'] = name
@dbus.service.signal(dbus_interface="org.qubes.Domain")
def Started(self):
""" Signal emited when the domain is started """
pass

@dbus.service.signal(dbus_interface="org.qubes.Domain")
def Halted(self):
""" Signal emited when the domain is halted """
pass

@dbus.service.signal(dbus_interface='org.freedesktop.DBus.Properties',
signature="sa{sv}as")
def PropertiesChanged(self, interface, changed_properties,
invalidated=None):
''' This signal is emitted when a property changes.
''' # pylint: disable=unused-argument
# type: (str, Dict[dbus.String, Any], List[dbus.String]) -> None
if 'state' in changed_properties:
value = changed_properties['state']
if value == 'Running':
self.Started()
elif value == 'Halted':
self.Halted()
super().PropertiesChanged(interface, changed_properties, invalidated)

@dbus.service.signal(
dbus_interface="org.qubes.DomainManager1.domains.Signals",
Expand Down

0 comments on commit 9af4df7

Please sign in to comment.