public CompositeTrackSourceContents() : base("albumartist")
        {
            if (ServiceManager.Contains("InterfaceActionService"))
            {
                action_service = ServiceManager.Get <InterfaceActionService> ();

                if (action_service.FindActionGroup("BrowserConfiguration") == null)
                {
                    configure_browser_actions = new ActionGroup("BrowserConfiguration");

                    configure_browser_actions.Add(new ActionEntry [] {
                        new ActionEntry("BrowserContentMenuAction", null,
                                        Catalog.GetString("Browser Content"), null,
                                        Catalog.GetString("Configure the filters available in the browser"), null)
                    });

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowArtistFilterAction", null,
                                              Catalog.GetString("Show Artist Filter"), null,
                                              Catalog.GetString("Show a list of artists to filter by"), null, ArtistFilterVisible.Get())
                    });

                    configure_browser_actions.Add(new RadioActionEntry [] {
                        new RadioActionEntry("ShowTrackArtistFilterAction", null,
                                             Catalog.GetString("Show all Artists"), null,
                                             Catalog.GetString("Show all artists in the artist filter"), 0),

                        new RadioActionEntry("ShowAlbumArtistFilterAction", null,
                                             Catalog.GetString("Show Album Artists"), null,
                                             Catalog.GetString("Show only album artists, not artists with only single tracks"), 1),
                    }, ArtistFilterType.Get().Equals("artist") ? 0 : 1, null);

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowGenreFilterAction", null,
                                              Catalog.GetString("Show Genre Filter"), null,
                                              Catalog.GetString("Show a list of genres to filter by"), null, GenreFilterVisible.Get())
                    });

                    configure_browser_actions.Add(new ToggleActionEntry [] {
                        new ToggleActionEntry("ShowYearFilterAction", null,
                                              Catalog.GetString("Show Year Filter"), null,
                                              Catalog.GetString("Show a list of years to filter by"), null, YearFilterVisible.Get())
                    });

                    action_service.AddActionGroup(configure_browser_actions);
                    action_service.UIManager.AddUiFromString(menu_xml);
                }

                action_service.FindAction("BrowserConfiguration.ShowArtistFilterAction").Activated += OnArtistFilterVisibilityChanged;
                action_service.FindAction("BrowserConfiguration.ShowGenreFilterAction").Activated  += OnGenreFilterChanged;;
                action_service.FindAction("BrowserConfiguration.ShowYearFilterAction").Activated   += OnYearFilterChanged;;

                var artist_filter_action      = action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction") as RadioAction;
                var albumartist_filter_action = action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction") as RadioAction;
                artist_filter_action.Changed       += OnArtistFilterChanged;
                artist_filter_action.Sensitive      = ArtistFilterVisible.Get();
                albumartist_filter_action.Changed  += OnArtistFilterChanged;
                albumartist_filter_action.Sensitive = ArtistFilterVisible.Get();
            }
        }
        private void OnArtistFilterVisibilityChanged(object o, EventArgs args)
        {
            ToggleAction action = (ToggleAction)o;

            ClearFilterSelections();

            ArtistFilterVisible.Set(action.Active);

            if (artist_view != null && artist_view.Parent != null)
            {
                artist_view.Parent.Visible = ArtistFilterVisible.Get();
            }
            else if (albumartist_view != null && albumartist_view.Parent != null)
            {
                albumartist_view.Parent.Visible = ArtistFilterVisible.Get();
            }

            action_service.FindAction("BrowserConfiguration.ShowTrackArtistFilterAction").Sensitive = ArtistFilterVisible.Get();
            action_service.FindAction("BrowserConfiguration.ShowAlbumArtistFilterAction").Sensitive = ArtistFilterVisible.Get();
        }
コード例 #3
0
        protected override void OnShown()
        {
            base.OnShown();

            ParentVisible(genre_view, GenreFilterVisible.Get());

            switch (ArtistFilterType.Get())
            {
            case "artist":
                ParentVisible(artist_view, ArtistFilterVisible.Get());
                ParentVisible(albumartist_view, false);
                break;

            case "albumartist":
                ParentVisible(albumartist_view, ArtistFilterVisible.Get());
                ParentVisible(artist_view, false);
                break;
            }

            ParentVisible(year_view, YearFilterVisible.Get());
        }
        protected override void InitializeViews()
        {
            SetupMainView(track_view = new TrackListView());

            SetupFilterView(genre_view = new QueryFilterView <string> (Catalog.GetString("Not Set")));
            Widget genre_view_widget = (Widget)genre_view;

            genre_view_widget.Parent.Shown += delegate {
                genre_view_widget.Parent.Visible = GenreFilterVisible.Get();
            };

            if (ArtistFilterType.Get().Equals("artist"))
            {
                SetupFilterView(artist_view = new ArtistListView());
                artist_view.Parent.Shown   += delegate {
                    artist_view.Parent.Visible = ArtistFilterVisible.Get();
                };
                albumartist_view = new ArtistListView();
            }
            else
            {
                SetupFilterView(albumartist_view = new ArtistListView());
                albumartist_view.Parent.Shown   += delegate {
                    albumartist_view.Parent.Visible = ArtistFilterVisible.Get();
                };
                artist_view = new ArtistListView();
            }

            SetupFilterView(year_view = new YearListView());
            Widget year_view_widget = (Widget)year_view;

            year_view_widget.Parent.Shown += delegate {
                year_view_widget.Parent.Visible = YearFilterVisible.Get();
            };

            SetupFilterView(album_view = new AlbumListView());
        }