public void SetList()
        {
            List <Genre> genres = RadioSource.GetGenres();

            genre_map.Clear();
            tile_view.ClearWidgets();
            foreach (Genre genre in genres)
            {
                MenuTile tile = new MenuTile();
                tile.PrimaryText = genre.Title;
                genre_map.Add(genre.Title, genre);
                tile.SecondaryText     = genre.Description;
                tile.ButtonPressEvent += PlayGenre;
                tile_view.AddWidget(tile);
            }
            tile_view.ShowAll();
        }
Example #2
0
        public void Refresh()
        {
            tile_map.Clear();

            if (contacts_view == null)
            {
                contacts_view = new TileView(1);
            }

            if (contacts == null)
            {
                contacts = new TitledList(AddinManager.CurrentLocalizer.GetString("Contacts"));
                contacts.PackStart(contacts_view, true, true, 0);
                contacts_view.Show();

                contacts.StyleSet += delegate {
                    contacts_view.ModifyBg(StateType.Normal);
                    contacts_view.ModifyFg(StateType.Normal);
                };
            }

            while (main_box.Children.Length != 0)
            {
                main_box.Remove(main_box.Children[0]);
            }

            main_box.PackStart(contacts, false, false, 0);

            contacts_view.ClearWidgets();
            foreach (Connection conn in source.TelepathyService.GetActiveConnections())
            {
                AppendToList(conn);
            }

            ShowAll();
        }
Example #3
0
        private void UpdateForArtist(string artist_name, LastfmData <SimilarArtist> similar_artists,
                                     LastfmData <ArtistTopAlbum> top_albums, LastfmData <ArtistTopTrack> top_tracks)
        {
            Banshee.Base.ThreadAssist.ProxyToMain(delegate {
                album_box.Title = String.Format(album_title_format, artist);
                track_box.Title = String.Format(track_title_format, artist);

                similar_artists_view.ClearWidgets();
                ClearBox(album_list);
                ClearBox(track_list);

                // Similar Artists
                for (int i = 0; i < Math.Min(20, similar_artists.Count); i++)
                {
                    SimilarArtistTile tile = new SimilarArtistTile(similar_artists[i]);
                    tile.ShowAll();
                    similar_artists_view.AddWidget(tile);
                }

                if (similar_artists.Count > 0)
                {
                    no_artists_pane.Hide();
                    similar_artists_view_sw.ShowAll();
                }
                else
                {
                    similar_artists_view_sw.Hide();
                    no_artists_pane.ShowAll();
                }

                for (int i = 0; i < Math.Min(5, top_albums.Count); i++)
                {
                    ArtistTopAlbum album = top_albums[i];
                    Button album_button  = new Button();
                    album_button.Relief  = ReliefStyle.None;

                    Label label = new Label();
                    label.ModifyFg(StateType.Normal, Style.Text(StateType.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign    = 0;
                    label.Markup    = String.Format("{0}. {1}", i + 1, GLib.Markup.EscapeText(album.Name));
                    album_button.Add(label);

                    album_button.Clicked += delegate {
                        Banshee.Web.Browser.Open(album.Url);
                    };
                    album_list.PackStart(album_button, false, true, 0);
                }
                album_box.ShowAll();

                for (int i = 0; i < Math.Min(5, top_tracks.Count); i++)
                {
                    ArtistTopTrack track = top_tracks[i];
                    Button track_button  = new Button();
                    track_button.Relief  = ReliefStyle.None;

                    HBox box = new HBox();

                    Label label = new Label();
                    label.ModifyFg(StateType.Normal, Style.Text(StateType.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign    = 0;
                    label.Markup    = String.Format("{0}. {1}", i + 1, GLib.Markup.EscapeText(track.Name));

                    /*if(node.SelectSingleNode("track_id") != null) {
                     *  box.PackEnd(new Image(now_playing_arrow), false, false, 0);
                     *  track_button.Clicked += delegate {
                     *      //PlayerEngineCore.OpenPlay(Globals.Library.GetTrack(
                     *          //Convert.ToInt32(node.SelectSingleNode("track_id").InnerText)));
                     *  };
                     * } else {*/
                    track_button.Clicked += delegate {
                        Banshee.Web.Browser.Open(track.Url);
                    };
                    //}

                    box.PackStart(label, true, true, 0);
                    track_button.Add(box);
                    track_list.PackStart(track_button, false, true, 0);
                }
                track_box.ShowAll();

                ready      = true;
                refreshing = false;
                context_page.SetState(Banshee.ContextPane.ContextState.Loaded);
            });
        }
Example #4
0
        private void UpdateForQuery(Feed <Video> video_feed)
        {
            int  result_display_count = 0;
            var  tiles = new List <YouTubeTileData> ();
            bool cleanup;

            if (video_feed.TotalResults > 0)
            {
                cleanup = !showing_results;

                foreach (Video entry in video_feed.Entries)
                {
                    // Don't include videos that are not live
                    if (entry.IsDraft)
                    {
                        continue;
                    }
                    else if (result_display_count++ < max_results_display)
                    {
                        tiles.Add(new YouTubeTileData(entry));
                    }
                }

                showing_results = true;
            }
            else
            {
                Log.Debug("YouTube: No videos found");
                cleanup         = showing_results;
                showing_results = false;
            }

            ThreadAssist.BlockingProxyToMain(delegate {
                results_tv.ClearWidgets();

                if (showing_results)
                {
                    if (cleanup)
                    {
                        Remove(no_results_label);
                        Add(results_tv);
                        ShowAll();
                    }

                    foreach (YouTubeTileData tile in tiles)
                    {
                        results_tv.AddWidget(new YouTubeTile(tile));
                    }
                    results_tv.ShowAll();
                }
                else if (cleanup)
                {
                    Remove(results_tv);
                    Add(no_results_label);
                    ShowAll();
                }

                ready      = true;
                refreshing = false;
                yt_context_page.SetState(Banshee.ContextPane.ContextState.Loaded);
            });
        }
        private void RenderRecommendationData(string artist, XmlNodeList artistsXmlList,
                                              XmlNodeList tracksXmlList, XmlNodeList albumsXmlList)
        {
            // Wipe the old recommendations here, we keep them around in case
            // where the the artist is the same as the last song.

            similar_artists_view.ClearWidgets();

            foreach (Widget child in tracks_items_box.Children)
            {
                tracks_items_box.Remove(child);
            }

            foreach (Widget child in albums_items_box.Children)
            {
                albums_items_box.Remove(child);
            }

            // Display recommendations and artist information
            current_artist       = artist;
            tracks_header.Markup = "<b>" + String.Format(Catalog.GetString("Top Tracks by {0}"),
                                                         GLib.Markup.EscapeText(artist)) + "</b>";
            albums_header.Markup = "<b>" + String.Format(Catalog.GetString("Top Albums by {0}"),
                                                         GLib.Markup.EscapeText(artist)) + "</b>";

            artists_widgets_list.Clear();

            ShowAll();

            if (artistsXmlList != null && artistsXmlList.Count > 0)
            {
                for (int i = 0; i < artistsXmlList.Count && i < NUM_MAX_ARTISTS; i++)
                {
                    artists_widgets_list.Add(RenderSimilarArtist(artistsXmlList[i]));
                }

                RenderSimilarArtists();
                no_artists_pane.Hide();
                similar_artists_view_sw.ShowAll();
            }
            else
            {
                similar_artists_view_sw.Hide();
                no_artists_pane.ShowAll();
            }

            if (tracksXmlList != null)
            {
                for (int i = 0; i < tracksXmlList.Count && i < NUM_TRACKS; i++)
                {
                    tracks_items_box.PackStart(RenderTrack(tracksXmlList[i], i + 1), false, true, 0);
                }

                tracks_items_box.ShowAll();
            }

            if (albumsXmlList != null)
            {
                for (int i = 0; i < albumsXmlList.Count && i < NUM_ALBUMS; i++)
                {
                    albums_items_box.PackStart(RenderAlbum(albumsXmlList[i], i + 1), false, true, 0);
                }

                albums_items_box.ShowAll();
            }
        }