예제 #1
0
            public void SetList (LastfmData<RecentTrack> tracks)
            {
                tile_view.ClearWidgets ();

                foreach (RecentTrack track in tracks) {
                    MenuTile tile = new MenuTile ();
                    widget_track_map [tile] = track;
                    tile.PrimaryText = track.Name;
                    tile.SecondaryText = track.Artist;
                    tile.ButtonPressEvent += OnTileActivated;

                    // Unfortunately the recently loved list doesn't include what album the song is on
                    if (!String.IsNullOrEmpty (track.Album)) {
                        AlbumInfo album = new AlbumInfo (track.Album);
                        album.ArtistName = track.Artist;

                        Gdk.Pixbuf pb = artwork_manager == null ? null : artwork_manager.LookupScalePixbuf (album.ArtworkId, 40);
                        if (pb != null) {
                            tile.Pixbuf = pb;
                        }
                    }

                    tile_view.AddNumberedWidget (tile);
                }

                tile_view.ShowAll ();
            }
 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 ();
 }
예제 #3
0
            // TODO generalize this
            public void SetList (LastfmData<UserTopArtist> artists)
            {
                tile_view.ClearWidgets ();

                foreach (UserTopArtist artist in artists) {
                    MenuTile tile = new MenuTile ();
                    tile.PrimaryText = artist.Name;
                    tile.SecondaryText = String.Format (Catalog.GetString ("{0} plays"), artist.PlayCount);
                    tile_view.AddNumberedWidget (tile);
                }

                tile_view.ShowAll ();
            }
예제 #4
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);
            }
        }