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