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; } }
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; }; }