banshee r3703 - in trunk/banshee: . src/Extensions/Banshee.Daap/Banshee.Daap



Author: ahixon
Date: Mon Apr  7 07:22:27 2008
New Revision: 3703
URL: http://svn.gnome.org/viewvc/banshee?rev=3703&view=rev

Log:
2008-04-07  Alexander Hixon  <hixon alexander mediati org>

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs: Only show the
	DAAP container source if we actually have any shares available, otherwise
	don't spam the source list.

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs:
	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs: Make
	sure elements are actually in the list before we do any operations on
	them.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapPlaylistSource.cs	Mon Apr  7 07:22:27 2008
@@ -55,7 +55,9 @@
             Properties.SetString ("Icon.Name", "source-playlist");
             
             foreach (Track track in playlist.Tracks) {
-                track_model.Add (parent.TrackMap [track.Id]);
+                if (parent.TrackMap.ContainsKey (track.Id)) {
+                    track_model.Add (parent.TrackMap [track.Id]);
+                }
             }
         }
         

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs	Mon Apr  7 07:22:27 2008
@@ -51,7 +51,6 @@
             // plugin is enabled, just no child sources yet.
             source_map = new Dictionary<string, DaapSource> ();
             container = new DaapContainerSource ();
-            ServiceManager.SourceManager.AddSource (container);
             
             // Now start looking for services.
             // We do this after creating the source because if we do it before
@@ -87,6 +86,10 @@
             DaapSource source = new DaapSource (args.Service);
             string key = String.Format ("{0}:{1}", args.Service.Name, args.Service.Port);
             
+            if (source_map.Count == 0) {
+                ServiceManager.SourceManager.AddSource (container);
+            }
+            
             if (source_map.ContainsKey (key)) {
                 // Received new connection info for service
                 container.RemoveChildSource (source_map [key]);
@@ -107,6 +110,10 @@
             source.Disconnect (true);
             container.RemoveChildSource (source);
             source_map.Remove (key);
+            
+            if (source_map.Count == 0) {
+                ServiceManager.SourceManager.RemoveSource (container);
+            }
         }
         
         string IService.ServiceName {

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs	Mon Apr  7 07:22:27 2008
@@ -274,7 +274,9 @@
             DaapTrackInfo track = new DaapTrackInfo (args.Track, this);
             track.Save ();
             
-            daap_track_map.Add (args.Track.Id, track);
+            if (!daap_track_map.ContainsKey (args.Track.Id)) {
+                daap_track_map.Add (args.Track.Id, track);
+            }
             
             Reload ();
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]