Commit 75f75992 authored by segfault's avatar segfault

Don't emit PropertiesChanged signal if values didn't actually change

parent a9218d7a
......@@ -263,10 +263,12 @@ class OnionService(DBusObject, metaclass=abc.ABCMeta):
def Status(self, value: str):
logger.info("Service %r new Status: %r", self.Name, value)
changed_properties = dict()
self._status = changed_properties["Status"] = value
if self._status != value:
self._status = changed_properties["Status"] = value
if self._transaction_status:
self._transaction_status = changed_properties["TransactionStatus"] = ""
self.emit_signal("org.freedesktop.DBus.Properties", "PropertiesChanged", changed_properties, "a{ss}")
if changed_properties:
self.emit_signal("org.freedesktop.DBus.Properties", "PropertiesChanged", changed_properties, "a{ss}")
@property
def TransactionStatus(self) -> str:
......@@ -274,6 +276,8 @@ class OnionService(DBusObject, metaclass=abc.ABCMeta):
@TransactionStatus.setter
def TransactionStatus(self, value):
if self._transaction_status == value:
return
logger.debug("Service %r new TransactionStatus: %r", self.Name, value)
self._transaction_status = value
self.emit_signal("org.freedesktop.DBus.Properties", "PropertiesChanged",
......@@ -285,7 +289,9 @@ class OnionService(DBusObject, metaclass=abc.ABCMeta):
@TransactionProgress.setter
def TransactionProgress(self, value: int):
logger.debug("Service %r TransactionProgress: %r", self.Name, value)
if self._transaction_progress == value:
return
logger.debug("Service %r new TransactionProgress: %r", self.Name, value)
self._transaction_progress = value
self.emit_signal("org.freedesktop.DBus.Properties", "PropertiesChanged",
{"TransactionProgress": self.TransactionProgress}, "a{si}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment