Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application: store repeat state in an Action #318

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ namespace Audience {
public const string ACTION_NEXT = "action-next";
public const string ACTION_PLAY_PAUSE = "action-play-pause";
public const string ACTION_PREVIOUS = "action-previous";
public const string ACTION_REPEAT = "action-repeat";

private const ActionEntry[] ACTION_ENTRIES = {
{ ACTION_PLAY_PAUSE, action_play_pause, null, "false" },
{ ACTION_NEXT, action_next },
{ ACTION_REPEAT, null, null, "false"},
{ ACTION_PREVIOUS, action_previous }
};

Expand Down
9 changes: 0 additions & 9 deletions src/Widgets/Player/BottomBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ public class Audience.Widgets.BottomBar : Gtk.Revealer {
}
}

public bool repeat {
get {
return playlist_popover.rep.active;
}
set {
playlist_popover.rep.active = value;
}
}

public BottomBar (ClutterGst.Playback playback) {
play_button = new Gtk.Button.from_icon_name ("media-playback-start-symbolic", Gtk.IconSize.BUTTON) {
action_name = App.ACTION_PREFIX + App.ACTION_PLAY_PAUSE,
Expand Down
3 changes: 2 additions & 1 deletion src/Widgets/Player/PlayerPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ namespace Audience {
Idle.add (() => {
playback.progress = 0;
if (!get_playlist_widget ().next ()) {
if (bottom_bar.repeat) {
var repeat_action = Application.get_default ().lookup_action (Audience.App.ACTION_REPEAT);
if (repeat_action.get_state ().get_boolean ()) {
string file = get_playlist_widget ().get_first_item ().get_uri ();
((Audience.Window) App.get_instance ().active_window).open_files ({ File.new_for_uri (file) });
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/Player/PlaylistPopover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

public class Audience.Widgets.PlaylistPopover : Gtk.Popover {
public Playlist playlist { get; private set; }
public Gtk.ToggleButton rep { get; private set; }

private Gtk.Button dvd;
private const int HEIGHT_OFFSET = 300;
Expand All @@ -36,7 +35,8 @@ public class Audience.Widgets.PlaylistPopover : Gtk.Popover {
var clear_playlist_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", Gtk.IconSize.BUTTON);
clear_playlist_button.tooltip_text = _("Clear Playlist");

rep = new Gtk.ToggleButton () {
var rep = new Gtk.ToggleButton () {
action_name = App.ACTION_PREFIX + App.ACTION_REPEAT,
image = new Gtk.Image.from_icon_name ("media-playlist-no-repeat-symbolic", Gtk.IconSize.BUTTON),
tooltip_text = _("Enable Repeat")
};
Expand Down