1
0
forked from drath/libratbag

tools: sync ratbagd from piper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-02-19 12:40:17 +10:00
parent 107a649e08
commit 0c2e4121af

View File

@@ -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])