[gnome-music/wip/mschraal/repeat-mode-keybindings-3-30] window: Make repeat keys set state



commit 8d8cfaace9a0a2366b11aef0d32540761a4b35c1
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 while using keyboard shortcuts.
    
    This solution is a workaround for repeat-mode/gsettings 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 c1440d91..b1cd36ae 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -321,14 +321,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]