예제 #1
0
 private void UpdateCoverArtDisplay()
 {
     if (ShowCoverArt.Get())
     {
         if (cover_art_display == null && source_box != null)
         {
             cover_art_display = new CoverArtDisplay()
             {
                 Visible = true
             };
             source_box.SizeAllocated                += OnSourceBoxSizeAllocated;
             cover_art_display.HeightRequest          = SourceViewWidth.Get();
             source_box.PackStart(cover_art_container = TrackInfoDisplay.GetEditable(cover_art_display), false, false, 4);
             source_box.ShowAll();
         }
     }
     else if (cover_art_display != null)
     {
         cover_art_display.Hide();
         source_box.Remove(cover_art_container);
         source_box.SizeAllocated -= OnSourceBoxSizeAllocated;
         cover_art_display.Dispose();
         cover_art_display = null;
     }
 }
예제 #2
0
        protected override void ConnectEvents()
        {
            base.ConnectEvents();

            // Service events
            ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
            ServiceManager.SourceManager.SourceUpdated       += OnSourceUpdated;

            ActionService.TrackActions ["SearchForSameArtistAction"].Activated += OnProgrammaticSearch;
            ActionService.TrackActions ["SearchForSameAlbumAction"].Activated  += OnProgrammaticSearch;

            (ActionService.ViewActions ["ShowCoverArtAction"] as Gtk.ToggleAction).Active = ShowCoverArt.Get();
            ActionService.ViewActions ["ShowCoverArtAction"].Activated += (o, a) => {
                ShowCoverArt.Set((o as Gtk.ToggleAction).Active);
                UpdateCoverArtDisplay();
            };

            // UI events
            view_container.SearchEntry.Changed += OnSearchEntryChanged;
            views_pane.SizeRequested           += delegate {
                SourceViewWidth.Set(views_pane.Position);
            };

            source_view.RowActivated += delegate {
                Source source  = ServiceManager.SourceManager.ActiveSource;
                var    handler = source.Properties.Get <System.Action> ("ActivationAction");
                if (handler != null)
                {
                    handler();
                }
                else if (source is ITrackModelSource)
                {
                    ServiceManager.PlaybackController.NextSource = (ITrackModelSource)source;
                    // Allow changing the play source without stopping the current song by
                    // holding ctrl when activating a source. After the song is done, playback will
                    // continue from the new source.
                    if (GtkUtilities.NoImportantModifiersAreSet(Gdk.ModifierType.ControlMask))
                    {
                        ServiceManager.PlaybackController.Next();
                    }
                }
            };

            if (!PlatformDetection.IsMeeGo)
            {
                header_toolbar.ExposeEvent += OnToolbarExposeEvent;
            }
        }
예제 #3
0
 void CoverArt()
 {
     if (ShowCoverArt.Get())
     {
         _cover_art.Child = new CoverArtDisplay();
         _cover_art.Child.Show();
         _cover_art.Show();
     }
     else if (null != _cover_art.Child)
     {
         var widget = _cover_art.Child;
         _cover_art.Remove(_cover_art.Child);
         _cover_art.Hide();
         widget.Dispose();
     }
 }
예제 #4
0
        protected override void ConnectEvents()
        {
            base.ConnectEvents();

            ActionService.SourceActions.SourceView = this;

            ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
            ServiceManager.SourceManager.SourceUpdated       += OnSourceUpdated;

            _view_container.SearchEntry.Changed += (o, x) => {
                var source = ServiceManager.SourceManager.ActiveSource;
                if (source == null)
                {
                    return;
                }

                source.FilterType  = (TrackFilterType)_view_container.SearchEntry.ActiveFilterID;
                source.FilterQuery = _view_container.SearchEntry.Query;
            };

            _source_view.RowActivated += (o, x) => {
                Source source  = ServiceManager.SourceManager.ActiveSource;
                var    handler = source.Properties.Get <System.Action> ("ActivationAction");
                if (handler != null)
                {
                    handler();
                }
                else if (source is ITrackModelSource)
                {
                    ServiceManager.PlaybackController.NextSource = (ITrackModelSource)source;
                    ServiceManager.PlaybackController.Next();
                }
            };

            ((ToggleAction)ActionService.ViewActions ["ShowCoverArtAction"]).Active = ShowCoverArt.Get();
            ActionService.ViewActions ["ShowCoverArtAction"].Activated += (o, a) => {
                ShowCoverArt.Set((o as Gtk.ToggleAction).Active);

                CoverArt();
            };

            _source_box.Parent.SizeAllocated += (o, x) => {
                _cover_art.HeightRequest = _source_box.Allocation.Width;
            };
        }