private void UpdateActions() { // Clear out the old options foreach (string id in shuffle_modes.Values) { Remove(String.Format("Shuffle_{0}", id)); } shuffle_modes.Clear(); var radio_group = new RadioActionEntry [shuffler.RandomModes.Count]; int i = 0; // Add all the shuffle options foreach (var random_by in shuffler.RandomModes) { string action_name = String.Format("Shuffle_{0}", random_by.Id); int id = shuffle_modes.Count; shuffle_modes[id] = random_by.Id; radio_group[i++] = new RadioActionEntry( action_name, null, random_by.Label, null, random_by.Description, id); } Add(radio_group, 0, OnActionChanged); // Set the icons foreach (var random_by in shuffler.RandomModes) { this[String.Format("Shuffle_{0}", random_by.Id)].IconName = random_by.IconName ?? "media-playlist-shuffle"; } this[shuffle_off_action].StockId = Gtk.Stock.MediaNext; var action = this[ConfigIdToActionName(ShuffleMode.Get())]; if (action is RadioAction) { Active = (RadioAction)action; } else { Active = (RadioAction)this[shuffle_off_action]; } Active.Activate(); OnChanged(); }
public PlaybackRepeatActions(InterfaceActionService actionService) : base(actionService, "PlaybackRepeat") { actionService.AddActionGroup(this); Add(new ActionEntry [] { new ActionEntry("RepeatMenuAction", null, Catalog.GetString("Repeat"), null, Catalog.GetString("Repeat"), null) }); Add(new RadioActionEntry [] { new RadioActionEntry("RepeatNoneAction", null, Catalog.GetString("Repeat _Off"), null, Catalog.GetString("Do not repeat playlist"), (int)PlaybackRepeatMode.None), new RadioActionEntry("RepeatAllAction", null, Catalog.GetString("Repeat _All"), null, Catalog.GetString("Play all songs before repeating playlist"), (int)PlaybackRepeatMode.RepeatAll), new RadioActionEntry("RepeatSingleAction", null, Catalog.GetString("Repeat Singl_e"), null, Catalog.GetString("Repeat the current playing song"), (int)PlaybackRepeatMode.RepeatSingle) }, 0, OnActionChanged); this["RepeatNoneAction"].IconName = "media-repeat-none"; this["RepeatAllAction"].IconName = "media-repeat-all"; this["RepeatSingleAction"].IconName = "media-repeat-single"; ServiceManager.PlaybackController.RepeatModeChanged += OnRepeatModeChanged; ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged; Gtk.Action action = this[ConfigIdToActionName(RepeatMode.Get())]; if (action is RadioAction) { active_action = (RadioAction)action; } else { Active = (RadioAction)this["RepeatNoneAction"]; } Active.Activate(); }
public PlaybackShuffleActions(InterfaceActionService actionService, PlaybackActions playbackActions) : base(actionService, "PlaybackShuffle") { playback_actions = playbackActions; Actions.AddActionGroup(this); Add(new ActionEntry [] { new ActionEntry("ShuffleMenuAction", null, Catalog.GetString("Shuffle"), null, Catalog.GetString("Shuffle"), null) }); Add(new RadioActionEntry [] { new RadioActionEntry("ShuffleOffAction", null, Catalog.GetString("Shuffle _Off"), null, Catalog.GetString("Do not shuffle playlist"), (int)PlaybackShuffleMode.Linear), new RadioActionEntry("ShuffleSongAction", null, Catalog.GetString("Shuffle by _Song"), null, Catalog.GetString("Play songs randomly from the playlist"), (int)PlaybackShuffleMode.Song), new RadioActionEntry("ShuffleArtistAction", null, Catalog.GetString("Shuffle by A_rtist"), null, Catalog.GetString("Play all songs by an artist, then randomly choose another artist"), (int)PlaybackShuffleMode.Artist), new RadioActionEntry("ShuffleAlbumAction", null, Catalog.GetString("Shuffle by A_lbum"), null, Catalog.GetString("Play all songs from an album, then randomly choose another album"), (int)PlaybackShuffleMode.Album), new RadioActionEntry("ShuffleRatingAction", null, Catalog.GetString("Shuffle by _Rating"), null, Catalog.GetString("Play songs randomly, prefer higher rated songs"), (int)PlaybackShuffleMode.Rating), new RadioActionEntry("ShuffleScoreAction", null, Catalog.GetString("Shuffle by S_core"), null, Catalog.GetString("Play songs randomly, prefer higher scored songs"), (int)PlaybackShuffleMode.Score) }, 0, OnActionChanged); this["ShuffleOffAction"].StockId = Gtk.Stock.MediaNext; this["ShuffleSongAction"].IconName = "media-playlist-shuffle"; this["ShuffleArtistAction"].IconName = "media-playlist-shuffle"; this["ShuffleAlbumAction"].IconName = "media-playlist-shuffle"; this["ShuffleRatingAction"].IconName = "media-playlist-shuffle"; this["ShuffleScoreAction"].IconName = "media-playlist-shuffle"; ServiceManager.PlaybackController.ShuffleModeChanged += OnShuffleModeChanged; ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged; Gtk.Action action = this[ConfigIdToActionName(ShuffleMode.Get())]; if (action is RadioAction) { active_action = (RadioAction)action; } else { Active = (RadioAction)this["ShuffleOffAction"]; } Active.Activate(); }