← Back to team overview

do-plugins team mailing list archive

[Merge] lp:~crisoagf/do-plugins/rhythmbox-full-list into lp:do-plugins

 

Cristóvão Osório de Aragão Gomes Ferreira has proposed merging lp:~crisoagf/do-plugins/rhythmbox-full-list into lp:do-plugins.

Requested reviews:
  Do Plugins Team (do-plugins)

For more details, see:
https://code.launchpad.net/~crisoagf/do-plugins/rhythmbox-full-list/+merge/70800

Rhythmbox plugin now allows searching song titles as well.
-- 
https://code.launchpad.net/~crisoagf/do-plugins/rhythmbox-full-list/+merge/70800
Your team Do Plugins Team is requested to review the proposed merge of lp:~crisoagf/do-plugins/rhythmbox-full-list into lp:do-plugins.
=== modified file 'Rhythmbox/src/MusicItemSource.cs'
--- Rhythmbox/src/MusicItemSource.cs	2009-06-22 04:05:16 +0000
+++ Rhythmbox/src/MusicItemSource.cs	2011-08-08 22:36:04 +0000
@@ -34,6 +34,7 @@
 		List<Item> items;
 		List<AlbumMusicItem> albums;
 		List<ArtistMusicItem> artists;
+		List<SongMusicItem> songs;
 
 		public MusicItemSource ()
 		{
@@ -97,6 +98,10 @@
 				foreach (ArtistMusicItem artist in artists)
 					yield return artist;
 			}
+			else if (parent is BrowseSongsMusicItem) {
+				foreach (SongMusicItem song in songs)
+					yield return song;
+			}
 		}
 
 		public override void UpdateItems ()
@@ -110,11 +115,16 @@
 			// Add browse features.
 			items.Add (new BrowseAlbumsMusicItem ());
 			items.Add (new BrowseArtistsMusicItem ());
+			items.Add (new BrowseSongsMusicItem ());
 
 			// Add albums and artists.
 			Rhythmbox.LoadAlbumsAndArtists (out albums, out artists);
 			foreach (Item album in albums) items.Add (album);
 			foreach (Item artist in artists) items.Add (artist);
+			
+			//Add songs (May create too much objects)
+			Rhythmbox.LoadSongs (out songs);
+			foreach (Item song in songs) items.Add (song);
 		}
 	}
 }

=== modified file 'Rhythmbox/src/Rhythmbox.cs'
--- Rhythmbox/src/Rhythmbox.cs	2010-12-28 04:47:34 +0000
+++ Rhythmbox/src/Rhythmbox.cs	2011-08-08 22:36:04 +0000
@@ -82,6 +82,15 @@
 			albums_out.AddRange (albums.Values);
 			artists_out.AddRange (artists.Values);
 		}
+		
+		public static void LoadSongs (out List<SongMusicItem> songs_out)
+		{
+			songs_out = new List<SongMusicItem> ();
+			
+			foreach (SongMusicItem song in LoadAllSongs()) {
+				songs_out.Add(song);
+			}
+		}
 
 		public static IEnumerable<SongMusicItem> LoadSongsFor (MusicItem item)
 		{

=== modified file 'Rhythmbox/src/RhythmboxItems.cs'
--- Rhythmbox/src/RhythmboxItems.cs	2009-06-22 04:05:16 +0000
+++ Rhythmbox/src/RhythmboxItems.cs	2011-08-08 22:36:04 +0000
@@ -61,6 +61,15 @@
 		{
 		}
 	}
+	
+	class BrowseSongsMusicItem : BrowseMusicItem
+	{
+		public BrowseSongsMusicItem ():
+			base (AddinManager.CurrentLocalizer.GetString ("Browse Songs"), 
+				AddinManager.CurrentLocalizer.GetString ("Browse Rhythmbox Music"))
+		{
+		}
+	}
 
 	public class RhythmboxRunnableItem : Item, IRunnableItem
 	{