Skip to content

Commit

Permalink
Fix setting repeat status from MPRIS
Browse files Browse the repository at this point in the history
Property change notification was not sent.

Issue: #21

Signed-off-by: Jiří Janoušek <[email protected]>
  • Loading branch information
jiri-janousek committed Sep 13, 2018
1 parent 31ff673 commit 2429dd7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/nuvolakit-runner/components/mpris/MPRISPlayer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class MPRISPlayer : GLib.Object {
position = player.track_position;
_volume = player.volume;
playback_status = map_playback_state();
loop_status = map_repeat_state_to_string();
_loop_status = map_repeat_state_to_string(player.repeat);
pending_update = new HashTable<string, Variant>(str_hash, str_equal);
can_go_next = player.can_go_next;
can_go_previous = player.can_go_previous;
Expand All @@ -50,9 +50,8 @@ public class MPRISPlayer : GLib.Object {
public string loop_status {
get { return _loop_status;}
set {
_loop_status = value;
if (_loop_status != map_repeat_state_to_string()) {
player.change_repeat(map_repeat_state_to_enum());
if (value != map_repeat_state_to_string(player.repeat)) {
player.change_repeat(map_repeat_state_to_enum(value));
}
}
}
Expand Down Expand Up @@ -170,7 +169,7 @@ public class MPRISPlayer : GLib.Object {
}
break;
case "repeat":
unowned string repeat = map_repeat_state_to_string();
unowned string repeat = map_repeat_state_to_string(player.repeat);
if (_loop_status == repeat) {
return;
}
Expand Down Expand Up @@ -282,8 +281,8 @@ public class MPRISPlayer : GLib.Object {
}
}

private unowned string map_repeat_state_to_string() {
switch (player.repeat) {
private static unowned string map_repeat_state_to_string(PlaybackRepeat repeat) {
switch (repeat) {
case PlaybackRepeat.TRACK:
return "Track";
case PlaybackRepeat.PLAYLIST:
Expand All @@ -293,8 +292,8 @@ public class MPRISPlayer : GLib.Object {
}
}

private PlaybackRepeat map_repeat_state_to_enum() {
switch (_loop_status) {
private static PlaybackRepeat map_repeat_state_to_enum(string repeat) {
switch (repeat) {
case "Track":
return PlaybackRepeat.TRACK;
case "Playlist":
Expand Down

0 comments on commit 2429dd7

Please sign in to comment.