Пример #1
0
        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();
        }