예제 #1
0
 void OnReloaded(object sender, EventArgs e)
 {
     for (int i = 0; i < TrackModel.Count; i++)
     {
         PodcastTrackInfo.From(TrackModel[i]);
     }
 }
 private void OnPodcastItemDownload(object sender, EventArgs e)
 {
     foreach (PodcastTrackInfo pi in PodcastTrackInfo.From(GetSelectedItems()))
     {
         pi.Enclosure.AsyncDownload();
     }
 }
예제 #3
0
 private void OnPodcastItemDownload(object sender, EventArgs e)
 {
     foreach (PodcastTrackInfo pi in PodcastTrackInfo.From(GetSelectedItems()))
     {
         Hyena.Log.DebugFormat("ItemDownload: {0}", pi.Enclosure.Url);
         pi.Enclosure.AsyncDownload();
     }
 }
        private void OnPodcastItemLink(object sender, EventArgs e)
        {
            PodcastTrackInfo track = PodcastTrackInfo.From(ActiveDbSource.TrackModel.FocusedItem);

            if (track != null && !String.IsNullOrEmpty(track.Item.Link))
            {
                Banshee.Web.Browser.Open(track.Item.Link);
            }
        }
예제 #5
0
파일: Grid.cs 프로젝트: thoja21/banshee-1
        public Grid()
        {
            var layout = new DataViewLayoutGrid()
            {
                Fill           = true,
                ChildAllocator = () => {
                    DataViewChildImage img = new DataViewChildImage();
                    return(new StackPanel()
                    {
                        Margin = new Thickness(5),
                        Width = 300,
                        Height = 125,
                        Spacing = 5,
                        Children =
                        {
                            new StackPanel()
                            {
                                Orientation = Orientation.Vertical,
                                Width = 90,
                                Spacing = 5,
                                Children =
                                {
                                    img,
                                    new ColumnCellPodcastStatusIndicator(null)
                                }
                            },
                            new TextBlock()
                            {
                                UseMarkup = true,
                                TextWrap = TextWrap.WordChar,
                                TextGenerator = o =>{
                                    var track = o as TrackInfo;
                                    if (track != null)
                                    {
                                        var episode = PodcastTrackInfo.From(track);
                                        if (episode != null)
                                        {
                                            return "<b>{0}</b>\n<small>{1}\n{2}</small>".FormatEscaped(
                                                track.DisplayTrackTitle, episode.PublishedDate.ToShortDateString(), episode.Description
                                                );
                                        }
                                    }
                                    return "";
                                }
                            }
                        },
                        // Render the prelight just on the cover art, but triggered by being anywhere over the album
                        PrelightRenderer = (cr, theme, size, o) => {
                            Prelight.Gradient(cr, theme, new Rect(img.ContentAllocation.X, img.ContentAllocation.Y, img.ImageSize, img.ImageSize), o);
                        }
                    });
                },
                View = this
            };

            ViewLayout = layout;
        }
 private void OnPodcastItemDeleteFile(object sender, EventArgs e)
 {
     foreach (PodcastTrackInfo pi in PodcastTrackInfo.From(GetSelectedItems()))
     {
         if (pi.Enclosure.LocalPath != null)
         {
             pi.Enclosure.DeleteFile();
         }
     }
 }
 private void OnEpisodePodcastProperties(object sender, EventArgs e)
 {
     foreach (PodcastTrackInfo pi in PodcastTrackInfo.From(GetSelectedItems()))
     {
         var feed = pi.Feed;
         if (feed != null)
         {
             new PodcastFeedPropertiesDialog(podcast_source, feed).Run();
         }
         break;
     }
 }
예제 #8
0
        public override void Render(CellContext context, StateType state, double cellWidth, double cellHeight)
        {
            PodcastTrackInfo podcast = PodcastTrackInfo.From(BoundTrack);

            if (podcast != null)
            {
                if (podcast.Activity == PodcastItemActivity.DownloadPending)
                {
                    context.Opaque = false;
                }
            }

            base.Render(context, state, cellWidth, cellHeight);
        }
예제 #9
0
        public PodcastPropertiesDialog(DatabaseTrackInfo track)
        {
            PodcastTrackInfo pi = PodcastTrackInfo.From(track);

            if (pi == null)
            {
                throw new ArgumentNullException("pi");
            }

            this.pi = pi;

            Title = track.TrackTitle;
            BuildWindow();
            //IconThemeUtils.SetWindowIcon (this);
        }
        private void MarkPodcastItemSelection(bool markRead)
        {
            TrackInfo new_selection_track = ActiveDbSource.TrackModel [ActiveDbSource.TrackModel.Selection.LastIndex + 1];

            PodcastService.IgnoreItemChanges = true;

            bool any = false;

            foreach (PodcastTrackInfo track in PodcastTrackInfo.From(GetSelectedItems()))
            {
                if (track.Item.IsRead != markRead)
                {
                    track.Item.IsRead = markRead;
                    track.Item.Save();

                    if (track.Item.IsRead ^ track.Track.PlayCount > 0)
                    {
                        track.Track.PlayCount = track.Item.IsRead ? 1 : 0;
                        track.Track.Save(false);
                    }
                    any = true;
                }
            }

            PodcastService.IgnoreItemChanges = false;

            if (any)
            {
                ActiveDbSource.Reload();

                // If we just removed all of the selected items from our view, we should select the
                // item after the last removed item
                if (ActiveDbSource.TrackModel.Selection.Count == 0 && new_selection_track != null)
                {
                    int new_i = ActiveDbSource.TrackModel.IndexOf(new_selection_track);
                    if (new_i != -1)
                    {
                        ActiveDbSource.TrackModel.Selection.Clear(false);
                        ActiveDbSource.TrackModel.Selection.FocusedIndex = new_i;
                        ActiveDbSource.TrackModel.Selection.Select(new_i);
                    }
                }
            }
        }
예제 #11
0
        protected override int GetIconIndex(TrackInfo track)
        {
            PodcastTrackInfo podcast = PodcastTrackInfo.From(track);

            if (track == null)
            {
                return(-1);
            }

            switch (podcast.Activity)
            {
            case PodcastItemActivity.Downloading:
            case PodcastItemActivity.DownloadPending:
                return(base.PixbufCount + 0);

            default:
                return(podcast.IsDownloaded ? base.PixbufCount + 1 : -1);
            }
        }
예제 #12
0
        public void LoadTrack(EditorTrackInfo track)
        {
            BorderWidth = 2;

            PodcastTrackInfo info = PodcastTrackInfo.From(track.SourceTrack);

            if (info == null)
            {
                Hide();
                return;
            }

            podcast.Markup     = SetInfo(Catalog.GetString("Podcast"), track.SourceTrack.AlbumTitle);
            author.Markup      = SetInfo(Catalog.GetString("Author"), track.SourceTrack.ArtistName);
            published.Markup   = SetInfo(Catalog.GetString("Published"), info.PublishedDate.ToLongDateString());
            description.Markup = SetInfo(Catalog.GetString("Description"), info.Description);
            // IsDownloaded
            // IsNew
            Show();
        }
예제 #13
0
        protected override int GetIconIndex(TrackInfo track)
        {
            int i = -1;
            PodcastTrackInfo podcast = PodcastTrackInfo.From(track);

            if (track != null)
            {
                switch (podcast.Activity)
                {
                case PodcastItemActivity.Downloading:
                case PodcastItemActivity.DownloadPending:
                    i = base.PixbufCount + 0;
                    break;

                default:
                    i = podcast.IsDownloaded ? base.PixbufCount + 1 : -1;
                    break;
                }
            }

            return(i);
        }
예제 #14
0
 private string GetTrackArtworkId(DatabaseTrackInfo track)
 {
     return(PodcastService.ArtworkIdFor(PodcastTrackInfo.From(track).Feed));
 }