[gnome-music/wip/jfelder/player-repeatmode-fix] window: Make repeat keys set state



commit cd1b6d55116927481bb3b7c3eed349827558aa85
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Sep 20 17:09:48 2018 +0200

    window: Make repeat keys set state
    
    The repeat keybindings did not set the actual state, so the gsetting did
    not get altered.
    Set the action state as well on keys.
    
    This solution is a workaround for repeat-mode interaction until a cleaner
    rewrite comes along.
    
    Fixes !274

 gnomemusic/window.py | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index d6449d3d..41fea737 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -314,14 +314,20 @@ class Window(Gtk.ApplicationWindow):
             if keyval == Gdk.KEY_r:
                 if self._player.props.repeat_mode == RepeatMode.SONG:
                     self._player.props.repeat_mode = RepeatMode.NONE
+                    repeat_state = GLib.Variant("s", ("none"))
                 else:
                     self._player.props.repeat_mode = RepeatMode.SONG
+                    repeat_state = GLib.Variant("s", ("song"))
+                self.lookup_action('repeat').change_state(repeat_state)
             # Toggle shuffle on Ctrl + S
             if keyval == Gdk.KEY_s:
                 if self._player.props.repeat_mode == RepeatMode.SHUFFLE:
                     self._player.props.repeat_mode = RepeatMode.NONE
+                    repeat_state = GLib.Variant("s", ("none"))
                 else:
                     self._player.props.repeat_mode = RepeatMode.SHUFFLE
+                    repeat_state = GLib.Variant("s", ("shuffle"))
+                self.lookup_action('repeat').change_state(repeat_state)
         # Ctrl+Shift+<KEY>
         elif modifiers == shift_ctrl_mask:
             if keyval == Gdk.KEY_A:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]