示例#1
0
        private void BuildContextMenu()
        {
            if (menu != null)
            {
                return;
            }

            menu = (Menu)interface_action_service.UIManager.GetWidget("/NotificationAreaIconMenu");
            menu.Show();

            for (int i = 0; i < menu.Children.Length; i++)
            {
                if (menu.Children[i].Name == "Previous")
                {
                    int j = i;
                    PlaybackRepeatActions repeat_group = interface_action_service.FindActionGroup("PlaybackRepeat")
                                                         as PlaybackRepeatActions;
                    if (repeat_group != null)
                    {
                        menu.Insert(repeat_group.CreateSubmenu(), i++ + 2);
                    }

                    PlaybackShuffleActions shuffle_group = interface_action_service.FindActionGroup("PlaybackShuffle")
                                                           as PlaybackShuffleActions;
                    if (shuffle_group != null)
                    {
                        menu.Insert(shuffle_group.CreateSubmenu(), i++ + 2);
                    }

                    if (j != i)
                    {
                        menu.Insert(new SeparatorMenuItem(), i++ + 2);
                    }

                    rating_menu_item            = new RatingMenuItem();
                    rating_menu_item.Activated += OnRatingChanged;
                    ToggleRatingMenuSensitive();
                    menu.Insert(rating_menu_item, i + 2);
                    break;
                }
            }
        }
示例#2
0
        public RepeatButton()
        {
            Child = new Image();

            _group   = Group;
            _actions = Actions;

            _group.Changed += OnGroupChanged;

            foreach (var act in _actions)
            {
                act.Activated += OnRadioActivated;

                if (act.Active)
                {
                    _(act);
                }
            }

            ShowAll();
        }
示例#3
0
        public PlaybackActions () : base ("Playback")
        {
            ImportantByDefault = false;

            Add (new ActionEntry [] {
                new ActionEntry ("PlayPauseAction", null,
                    Catalog.GetString ("_Play"), "space",
                    Catalog.GetString ("Play or pause the current item"), OnPlayPauseAction),

                new ActionEntry ("NextAction", null,
                    Catalog.GetString ("_Next"), "N",
                    Catalog.GetString ("Play the next item"), OnNextAction),

                new ActionEntry ("PreviousAction", null,
                    Catalog.GetString ("Pre_vious"), "B",
                    Catalog.GetString ("Play the previous item"), OnPreviousAction),

                new ActionEntry ("SeekToAction", null,
                    Catalog.GetString ("Seek _To..."), "T",
                    Catalog.GetString ("Seek to a specific location in current item"), OnSeekToAction),

                new ActionEntry ("JumpToPlayingTrackAction", null,
                    Catalog.GetString("_Jump to Playing Song"), "<control>J",
                    Catalog.GetString ("Jump to the currently playing item"), OnJumpToPlayingTrack),

                new ActionEntry ("RestartSongAction", null,
                    Catalog.GetString ("_Restart Song"), "R",
                    Catalog.GetString ("Restart the current item"), OnRestartSongAction)
            });

            Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("StopWhenFinishedAction", null,
                    Catalog.GetString ("_Stop When Finished"), "<Shift>space",
                    Catalog.GetString ("Stop playback after the current item finishes playing"),
                    OnStopWhenFinishedAction, false)
            });

            Actions.GlobalActions.Add (new ActionEntry [] {
                new ActionEntry ("PlaybackMenuAction", null,
                    Catalog.GetString ("_Playback"), null, null, null),
            });

            this["JumpToPlayingTrackAction"].Sensitive = false;
            this["RestartSongAction"].Sensitive = false;
            this["SeekToAction"].Sensitive = false;

            this["PlayPauseAction"].StockId = Gtk.Stock.MediaPlay;
            this["NextAction"].StockId = Gtk.Stock.MediaNext;
            this["PreviousAction"].StockId = Gtk.Stock.MediaPrevious;

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.Error |
                PlayerEvent.EndOfStream |
                PlayerEvent.StateChange);

            repeat_actions = new PlaybackRepeatActions (Actions);
            shuffle_actions = new PlaybackShuffleActions (Actions, this);
        }
示例#4
0
        void _(PlaybackRepeatActions actions)
        {
            Sensitive = actions.Sensitive;

            _(actions.Active);
        }