// --------------------------------------------------------------- //

        private void RenderSimilarArtists()
        {
            foreach (Widget artist in artists_widgets_list)
            {
                similar_artists_view.AddWidget(artist);
            }
        }
예제 #2
0
        private void AppendToList(Connection conn)
        {
            if (conn == null || conn.Roster == null)
            {
                return;
            }

            foreach (Contact contact in conn.Roster.GetAllContacts())
            {
                if (contact == null || contact.Avatar == null)
                {
                    continue;
                }

                MenuTile tile = new MenuTile();
                tile.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                    int main_width, main_height = 0;
                    main_box.GetSizeRequest(out main_width, out main_height);

                    tile.WidthRequest = main_width;
                };

                tile.PrimaryText   = contact.Name;
                tile.SecondaryText = String.IsNullOrEmpty(contact.StatusMessage) ? contact.Status.ToString() : contact.StatusMessage;

                Avatar avatar = contact.Avatar;
                if (avatar.State == AvatarState.Loaded)
                {
                    tile.Pixbuf = new Gdk.Pixbuf(avatar.Image);
                    avatar.Clear(false);
                }
                else
                {
                    tile_map.Add(contact, tile);

                    avatar.Loaded += delegate(object sender, AvatarStateEventArgs e) {
                        Avatar a = sender as Avatar;
                        if (a != null && tile_map.ContainsKey(a.Contact))
                        {
                            if (e.State == AvatarState.Loaded)
                            {
                                tile_map[a.Contact].Pixbuf = new Gdk.Pixbuf(a.Image);
                                a.Clear(false);

                                main_box.QueueDraw();
                            }

                            tile_map.Remove(a.Contact);
                        }
                    };

                    avatar.Load();
                }

                contacts_view.AddWidget(tile);
            }
        }
        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();
        }
예제 #4
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);
            });
        }
예제 #5
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);
            });
        }