Пример #1
0
        public InternetRadioSource () : base (Catalog.GetString ("Radio"), Catalog.GetString ("Radio"), "internet-radio", 52)
        {
            Properties.SetString ("Icon.Name", "radio");
            TypeUniqueId = "internet-radio";
            IsLocal = false;

            AfterInitialized ();

            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
            uia_service.GlobalActions.Add (
                new ActionEntry ("AddRadioStationAction", Stock.Add,
                    Catalog.GetString ("Add Station"), null,
                    Catalog.GetString ("Add a new Internet Radio station or playlist"),
                    OnAddStation)
            );
            uia_service.GlobalActions["AddRadioStationAction"].IsImportant = false;

            ui_id = uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");

            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set<System.Reflection.Assembly> ("ActiveSourceUIResource.Assembly", typeof(InternetRadioSource).Assembly);

            Properties.SetString ("GtkActionPath", "/InternetRadioContextMenu");

            Properties.Set<bool> ("Nereid.SourceContentsPropagate", true);
            Properties.Set<ISourceContents> ("Nereid.SourceContents", new LazyLoadSourceContents<InternetRadioSourceContents> ());

            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search your stations"));
            Properties.SetString ("TrackEditorActionLabel", Catalog.GetString ("Edit Station"));
            Properties.Set<InvokeHandler> ("TrackEditorActionHandler", delegate {
                var track_actions = ServiceManager.Get<InterfaceActionService> ().TrackActions;
                var tracks = track_actions.SelectedTracks;
                if (tracks == null || tracks.Count <= 0) {
                    return;
                }

                foreach (var track in tracks) {
                    var station_track = track as DatabaseTrackInfo;
                    if (station_track != null) {
                        EditStation (station_track);
                        return;
                    }
                }
            });

            Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
                <column-controller>
                  <!--<column modify-default=""IndicatorColumn"">
                    <renderer type=""Banshee.Podcasting.Gui.ColumnCellPodcastStatusIndicator"" />
                  </column>-->
                  <add-default column=""IndicatorColumn"" />
                  <add-default column=""GenreColumn"" />
                  <column modify-default=""GenreColumn"">
                    <visible>false</visible>
                  </column>
                  <add-default column=""TitleColumn"" />
                  <column modify-default=""TitleColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                  <add-default column=""ArtistColumn"" />
                  <column modify-default=""ArtistColumn"">
                    <title>{1}</title>
                    <long-title>{1}</long-title>
                  </column>
                  <add-default column=""CommentColumn"" />
                  <column modify-default=""CommentColumn"">
                    <title>{2}</title>
                    <long-title>{2}</long-title>
                  </column>
                  <add-default column=""RatingColumn"" />
                  <add-default column=""PlayCountColumn"" />
                  <add-default column=""LastPlayedColumn"" />
                  <add-default column=""LastSkippedColumn"" />
                  <add-default column=""DateAddedColumn"" />
                  <add-default column=""UriColumn"" />
                  <sort-column direction=""asc"">genre</sort-column>
                </column-controller>",
                Catalog.GetString ("Station"),
                Catalog.GetString ("Creator"),
                Catalog.GetString ("Description")
            ));

            ServiceManager.PlayerEngine.TrackIntercept += OnPlayerEngineTrackIntercept;
            //ServiceManager.PlayerEngine.ConnectEvent (OnTrackInfoUpdated, Banshee.MediaEngine.PlayerEvent.TrackInfoUpdated);

            TrackEqualHandler = delegate (DatabaseTrackInfo a, TrackInfo b) {
                RadioTrackInfo radio_track = b as RadioTrackInfo;
                return radio_track != null && DatabaseTrackInfo.TrackEqual (
                    radio_track.ParentTrack as DatabaseTrackInfo, a);
            };

            var migrator = new XspfMigrator (this);
            if (migrator.Migrate () | migrator.LoadDefaults ()) {
                Reload ();
            }
        }
Пример #2
0
        public InternetRadioSource() : base(Catalog.GetString("Radio"), Catalog.GetString("Radio"), "internet-radio", 52)
        {
            Properties.SetString("Icon.Name", "radio");
            TypeUniqueId = "internet-radio";
            IsLocal      = false;

            AfterInitialized();

            InterfaceActionService uia_service = ServiceManager.Get <InterfaceActionService> ();

            uia_service.GlobalActions.Add(
                new ActionEntry("AddRadioStationAction", Stock.Add,
                                Catalog.GetString("Add Station"), null,
                                Catalog.GetString("Add a new Internet Radio station or playlist"),
                                OnAddStation)
                );
            uia_service.GlobalActions["AddRadioStationAction"].IsImportant = false;

            ui_id = uia_service.UIManager.AddUiFromResource("GlobalUI.xml");

            Properties.SetString("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set <bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set <System.Reflection.Assembly> ("ActiveSourceUIResource.Assembly", typeof(InternetRadioSource).Assembly);

            Properties.SetString("GtkActionPath", "/InternetRadioContextMenu");

            Properties.Set <bool> ("Nereid.SourceContentsPropagate", true);
            Properties.Set <ISourceContents> ("Nereid.SourceContents", new LazyLoadSourceContents <InternetRadioSourceContents> ());

            Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search your stations"));
            Properties.SetString("TrackEditorActionLabel", Catalog.GetString("Edit Station"));
            Properties.Set <InvokeHandler> ("TrackEditorActionHandler", delegate {
                var track_actions = ServiceManager.Get <InterfaceActionService> ().TrackActions;
                var tracks        = track_actions.SelectedTracks;
                if (tracks == null || tracks.Count <= 0)
                {
                    return;
                }

                foreach (var track in tracks)
                {
                    var station_track = track as DatabaseTrackInfo;
                    if (station_track != null)
                    {
                        EditStation(station_track);
                        return;
                    }
                }
            });

            Properties.SetString("TrackView.ColumnControllerXml", String.Format(@"
                <column-controller>
                  <!--<column modify-default=""IndicatorColumn"">
                    <renderer type=""Banshee.Podcasting.Gui.ColumnCellPodcastStatusIndicator"" />
                  </column>-->
                  <add-default column=""IndicatorColumn"" />
                  <add-default column=""GenreColumn"" />
                  <column modify-default=""GenreColumn"">
                    <visible>false</visible>
                  </column>
                  <add-default column=""TitleColumn"" />
                  <column modify-default=""TitleColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                  <add-default column=""ArtistColumn"" />
                  <column modify-default=""ArtistColumn"">
                    <title>{1}</title>
                    <long-title>{1}</long-title>
                  </column>
                  <add-default column=""CommentColumn"" />
                  <column modify-default=""CommentColumn"">
                    <title>{2}</title>
                    <long-title>{2}</long-title>
                  </column>
                  <add-default column=""RatingColumn"" />
                  <add-default column=""PlayCountColumn"" />
                  <add-default column=""LastPlayedColumn"" />
                  <add-default column=""LastSkippedColumn"" />
                  <add-default column=""DateAddedColumn"" />
                  <add-default column=""UriColumn"" />
                  <sort-column direction=""asc"">genre</sort-column>
                </column-controller>",
                                                                                Catalog.GetString("Station"),
                                                                                Catalog.GetString("Creator"),
                                                                                Catalog.GetString("Description")
                                                                                ));

            ServiceManager.PlayerEngine.TrackIntercept += OnPlayerEngineTrackIntercept;
            //ServiceManager.PlayerEngine.ConnectEvent (OnTrackInfoUpdated, Banshee.MediaEngine.PlayerEvent.TrackInfoUpdated);

            TrackEqualHandler = delegate(DatabaseTrackInfo a, TrackInfo b) {
                RadioTrackInfo radio_track = b as RadioTrackInfo;
                return(radio_track != null && DatabaseTrackInfo.TrackEqual(
                           radio_track.ParentTrack as DatabaseTrackInfo, a));
            };

            var migrator = new XspfMigrator(this);

            if (migrator.Migrate() | migrator.LoadDefaults())
            {
                Reload();
            }
        }