Exemple #1
0
        private void BuildSeekSlider(SeekSliderLayout layout)
        {
            seek_slider           = new SeekSlider();
            stream_position_label = new StreamPositionLabel(seek_slider);

            Box box;

            if (layout == SeekSliderLayout.Horizontal)
            {
                box         = new HBox();
                box.Spacing = 5;
                stream_position_label.FormatString = "<b>{0}</b>";
            }
            else
            {
                box = new VBox();
            }

            seek_slider.SetSizeRequest(125, -1);

            box.PackStart(seek_slider, true, true, 0);
            box.PackStart(stream_position_label, false, false, 0);

            box.ShowAll();

            Add(box);
        }
Exemple #2
0
        private void BuildSeekSlider(SeekSliderLayout layout)
        {
            var hbox = new HBox()
            {
                Spacing = 2
            };

            seek_slider           = new SeekSlider();
            stream_position_label = new StreamPositionLabel(seek_slider);

            if (layout == SeekSliderLayout.Horizontal)
            {
                box         = new HBox();
                box.Spacing = 5;
                stream_position_label.FormatString = "<b>{0}</b>";
            }
            else
            {
                box = new VBox();
            }

            seek_slider.SetSizeRequest(175, -1);

            box.PackStart(seek_slider, false, false, 0);
            box.PackStart(stream_position_label, true, true, 0);

            hbox.PackStart(box, true, true, 0);

            grabber = new Hyena.Widgets.GrabHandle()
            {
                NoShowAll = true
            };
            grabber.ControlWidthOf(seek_slider, 125, 1024, true);

            hbox.PackStart(grabber, true, true, 0);
            hbox.ShowAll();
            Resizable = false;

            Add(hbox);
        }
        public MiniMode() : base(Branding.ApplicationLongName)
        {
            default_main_window = InterfaceElements.MainWindow;

            glade = new Glade.XML(null, "minimode.glade", "MiniModeWindow", null);
            glade.Autoconnect(this);

            Widget child = glade["mini_mode_contents"];

            (child.Parent as Container).Remove(child);
            Add(child);
            BorderWidth = 12;
            Resizable   = false;

            IconThemeUtils.SetWindowIcon(this);
            DeleteEvent += delegate {
                Globals.ActionManager["QuitAction"].Activate();
            };

            // Playback Buttons
            ActionButton previous_button = new ActionButton(Globals.ActionManager["PreviousAction"]);

            previous_button.LabelVisible = false;
            previous_button.Padding      = 1;

            ActionButton next_button = new ActionButton(Globals.ActionManager["NextAction"]);

            next_button.LabelVisible = false;
            next_button.Padding      = 1;

            ActionButton playpause_button = new ActionButton(Globals.ActionManager["PlayPauseAction"]);

            playpause_button.LabelVisible = false;
            playpause_button.Padding      = 1;

            PlaybackBox.PackStart(previous_button, false, false, 0);
            PlaybackBox.PackStart(playpause_button, false, false, 0);
            PlaybackBox.PackStart(next_button, false, false, 0);
            PlaybackBox.ShowAll();

            // Seek Slider/Position Label
            seek_slider = new SeekSlider();
            seek_slider.SetSizeRequest(125, -1);
            seek_slider.SeekRequested += delegate {
                PlayerEngineCore.Position = (uint)seek_slider.Value;
            };

            stream_position_label = new StreamPositionLabel(seek_slider);

            SeekContainer.PackStart(seek_slider, false, false, 0);
            SeekContainer.PackStart(stream_position_label, false, false, 0);
            SeekContainer.ShowAll();

            // Volume button
            volume_button = new VolumeButton();
            VolumeContainer.PackStart(volume_button, false, false, 0);
            volume_button.Show();
            volume_button.VolumeChanged += delegate(int volume) {
                PlayerEngineCore.Volume = (ushort)volume;
                PlayerEngineCore.VolumeSchema.Set(volume);
            };

            // Cover
            cover_art_thumbnail = new CoverArtThumbnail(90);
            Gdk.Pixbuf default_pixbuf = Banshee.Base.Branding.DefaultCoverArt;
            cover_art_thumbnail.NoArtworkPixbuf = default_pixbuf;
            CoverBox.PackStart(cover_art_thumbnail, false, false, 0);

            // Source combobox
            source_combo_box = new SourceComboBox();
            SourceBox.PackStart(source_combo_box, true, true, 0);
            source_combo_box.ShowAll();

            // Repeat/Shuffle buttons
            MultiStateToggleButton shuffle_toggle_button = new MultiStateToggleButton();

            shuffle_toggle_button.AddState(typeof(ShuffleDisabledToggleState),
                                           Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.AddState(typeof(ShuffleEnabledToggleState),
                                           Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.Relief    = ReliefStyle.None;
            shuffle_toggle_button.ShowLabel = false;
            try {
                shuffle_toggle_button.ActiveStateIndex = PlayerWindowSchema.PlaybackShuffle.Get() ? 1 : 0;
            } catch {
                shuffle_toggle_button.ActiveStateIndex = 0;
            }
            shuffle_toggle_button.ShowAll();

            MultiStateToggleButton repeat_toggle_button = new MultiStateToggleButton();

            repeat_toggle_button.AddState(typeof(RepeatNoneToggleState),
                                          Globals.ActionManager["RepeatNoneAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatAllToggleState),
                                          Globals.ActionManager["RepeatAllAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatSingleToggleState),
                                          Globals.ActionManager["RepeatSingleAction"] as ToggleAction);
            repeat_toggle_button.Relief    = ReliefStyle.None;
            repeat_toggle_button.ShowLabel = false;
            try {
                repeat_toggle_button.ActiveStateIndex = (int)PlayerWindowSchema.PlaybackRepeat.Get();
            } catch {
                repeat_toggle_button.ActiveStateIndex = 0;
            }
            repeat_toggle_button.ShowAll();

            LowerButtonsBox.PackEnd(repeat_toggle_button, false, false, 0);
            LowerButtonsBox.PackEnd(shuffle_toggle_button, false, false, 0);
            LowerButtonsBox.ShowAll();

            // Tooltips
            toolTips = new Tooltips();

            SetTip(previous_button, Catalog.GetString("Play previous song"));
            SetTip(playpause_button, Catalog.GetString("Play/pause current song"));
            SetTip(next_button, Catalog.GetString("Play next song"));
            SetTip(fullmode_button, Catalog.GetString("Switch back to full mode"));
            SetTip(volume_button, Catalog.GetString("Adjust volume"));
            SetTip(repeat_toggle_button, Catalog.GetString("Change repeat playback mode"));
            SetTip(shuffle_toggle_button, Catalog.GetString("Toggle shuffle playback mode"));

            // Hook up everything
            PlayerEngineCore.EventChanged += OnPlayerEngineEventChanged;
            PlayerEngineCore.StateChanged += OnPlayerEngineStateChanged;

            SetHeightLimit();
        }
Exemple #4
0
        public MiniMode()
        {
            glade = new Glade.XML(null, "minimode.glade", "MiniModeWindow", "banshee");
            glade.Autoconnect(this);
            if (MiniModeWindow == null)
            {
                throw new Exception(); // This propagate Glade errors to Banshee's plugin framework
            }
            IconThemeUtils.SetWindowIcon(MiniModeWindow);
            MiniModeWindow.DeleteEvent += delegate {
                PlayerCore.UserInterface.Quit();
            };

            // Playback Buttons
            ActionButton previous_button = new ActionButton(Globals.ActionManager["PreviousAction"]);

            previous_button.LabelVisible = false;
            previous_button.Padding      = 1;

            ActionButton next_button = new ActionButton(Globals.ActionManager["NextAction"]);

            next_button.LabelVisible = false;
            next_button.Padding      = 1;

            ActionButton playpause_button = new ActionButton(Globals.ActionManager["PlayPauseAction"]);

            playpause_button.LabelVisible = false;
            playpause_button.Padding      = 1;

            PlaybackBox.PackStart(previous_button, false, false, 0);
            PlaybackBox.PackStart(playpause_button, false, false, 0);
            PlaybackBox.PackStart(next_button, false, false, 0);
            PlaybackBox.ShowAll();

            // Seek Slider/Position Label
            seek_slider = new SeekSlider();
            seek_slider.SetSizeRequest(125, -1);
            seek_slider.SeekRequested += delegate {
                PlayerEngineCore.Position = (uint)seek_slider.Value;
            };

            stream_position_label = new StreamPositionLabel(seek_slider);

            SeekContainer.PackStart(seek_slider, false, false, 0);
            SeekContainer.PackStart(stream_position_label, false, false, 0);
            SeekContainer.ShowAll();

            // Volume button
            volumeButton = new VolumeButton();
            VolumeContainer.PackStart(volumeButton, false, false, 0);
            volumeButton.Show();
            volumeButton.VolumeChanged += delegate(int volume) {
                PlayerEngineCore.Volume = (ushort)volume;
                Globals.Configuration.Set(GConfKeys.Volume, volume);
            };

            // Cover
            coverArtThumbnail = new CoverArtThumbnail(90);
            Gdk.Pixbuf default_pixbuf = Banshee.Base.IconThemeUtils.LoadIcon("audio-x-generic", 128);
            if (default_pixbuf == null)
            {
                default_pixbuf = new Gdk.Pixbuf(System.Reflection.Assembly.GetEntryAssembly(), "banshee-logo.png");
            }
            coverArtThumbnail.NoArtworkPixbuf = default_pixbuf;
            CoverBox.PackStart(coverArtThumbnail, false, false, 0);

            // Source combobox
            sourceComboBox = new SourceComboBox();
            SourceBox.PackStart(sourceComboBox, true, true, 0);
            sourceComboBox.ShowAll();

            // Repeat/Shuffle buttons
            MultiStateToggleButton shuffle_toggle_button = new MultiStateToggleButton();

            shuffle_toggle_button.AddState(typeof(ShuffleDisabledToggleState),
                                           Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.AddState(typeof(ShuffleEnabledToggleState),
                                           Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.Relief    = ReliefStyle.None;
            shuffle_toggle_button.ShowLabel = false;
            shuffle_toggle_button.ShowAll();

            MultiStateToggleButton repeat_toggle_button = new MultiStateToggleButton();

            repeat_toggle_button.AddState(typeof(RepeatNoneToggleState),
                                          Globals.ActionManager["RepeatNoneAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatAllToggleState),
                                          Globals.ActionManager["RepeatAllAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatSingleToggleState),
                                          Globals.ActionManager["RepeatSingleAction"] as ToggleAction);
            repeat_toggle_button.Relief    = ReliefStyle.None;
            repeat_toggle_button.ShowLabel = false;
            repeat_toggle_button.ShowAll();


            LowerButtonsBox.PackEnd(repeat_toggle_button, false, false, 0);
            LowerButtonsBox.PackEnd(shuffle_toggle_button, false, false, 0);
            LowerButtonsBox.ShowAll();

            // Hook up everything
            PlayerEngineCore.EventChanged += OnPlayerEngineEventChanged;
            PlayerEngineCore.StateChanged += OnPlayerEngineStateChanged;
        }