Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;

            // 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;
                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();
                    }
                }
            };

            header_toolbar.ExposeEvent += OnToolbarExposeEvent;
        }
Ejemplo n.º 3
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;
            }
        }