mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
avoid errors on accelerator use
This commit is contained in:
parent
7d3a440ac1
commit
784a62cee2
@ -3316,6 +3316,7 @@ class MPDActionGroup(Gio.SimpleActionGroup):
|
||||
self.add_action(action)
|
||||
|
||||
# connect
|
||||
self._client.emitter.connect("state", self._on_state)
|
||||
self._client.emitter.connect("disconnected", self._on_disconnected)
|
||||
self._client.emitter.connect("reconnected", self._on_reconnected)
|
||||
|
||||
@ -3355,6 +3356,11 @@ class MPDActionGroup(Gio.SimpleActionGroup):
|
||||
def _on_consume(self, action, param):
|
||||
self._client.wrapped_call("toggle_option", "consume")
|
||||
|
||||
def _on_state(self, emitter, state):
|
||||
state_dict={"play": True, "pause": True, "stop": False}
|
||||
for action in ("next","prev","seek-forward","seek-backward"):
|
||||
self.lookup_action(action).set_enabled(state_dict[state])
|
||||
|
||||
def _on_disconnected(self, *args):
|
||||
for action in self._simple_actions_data:
|
||||
self.lookup_action(action).set_enabled(False)
|
||||
|
Loading…
Reference in New Issue
Block a user