From 0c2e4121af9af8fe8541c94f72afae1675650921 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 19 Feb 2019 12:40:17 +1000 Subject: [PATCH] tools: sync ratbagd from piper Signed-off-by: Peter Hutterer --- tools/ratbagd.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/ratbagd.py b/tools/ratbagd.py index 76f6938e..520bede4 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -148,11 +148,16 @@ class _RatbagdDBus(GObject.GObject): raise RatbagdUnavailable("No one currently owns {}".format(ratbag1)) self._proxy.connect("g-properties-changed", self._on_properties_changed) + self._proxy.connect("g-signal", self._on_signal_received) def _on_properties_changed(self, proxy, changed_props, invalidated_props): # Implement this in derived classes to respond to property changes. pass + def _on_signal_received(self, proxy, sender_name, signal_name, parameters): + # Implement this in derived classes to respond to signals. + pass + def _find_object_with_path(self, iterable, object_path): # Find the index of an object in an iterable that whose object path # matches the given object path. @@ -328,6 +333,8 @@ class RatbagdDevice(_RatbagdDBus): __gsignals__ = { "active-profile-changed": (GObject.SignalFlags.RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + "resync": + (GObject.SignalFlags.RUN_FIRST, None, ()), } def __init__(self, object_path): @@ -340,6 +347,10 @@ class RatbagdDevice(_RatbagdDBus): for profile in self._profiles: profile.connect("notify::is-active", self._on_active_profile_changed) + def _on_signal_received(self, proxy, sender_name, signal_name, parameters): + if signal_name == "Resync": + self.emit("resync") + def _on_active_profile_changed(self, profile, pspec): if profile.is_active: self.emit("active-profile-changed", self._profiles[profile.index])