banshee r4603 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod src/Dap/Banshee.Dap/Banshee.Dap



Author: gburt
Date: Wed Sep 24 19:44:49 2008
New Revision: 4603
URL: http://svn.gnome.org/viewvc/banshee?rev=4603&view=rev

Log:
2008-09-24  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs: Instead of
	calling QueueSync after every added or deleted track call it only in
	OnTracksAdded/Deleted and when not syncing.  Should fix bug with 'Syncing
	iPod' showing up every 10 songs (BGO #552543).  Shorten the timeout till
	the actual sync since we no longer rely on it being long enough we'll
	add/remove a song and push it back before it goes off.  Could probably get
	rid of it altogther.

	* src/Core/Banshee.Services/Banshee.Sources/Source.cs: Add
	AcceptsUserInputFromSource method that returns the same value as
	AcceptsInputFromSource.

	* src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: Override
	AccepsUserInputFromSource to base && CanAddTracks - which is set to false
	if the user shouldn't be able to drag tracks from a source to this one, if
	the destination is readonly, or a not-manually-managed dap, say.

	* src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs: Fix bug with sync
	not working because AcceptsInputFromSource was returning false because
	sync was enabled;  added another AcceptsUserInputFromSource that is used
	to turn on/off DnD from SourceView etc and that returns false still.

	* src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs: Make sure the file we're
	talking about transferring is exists.

	* src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs: Remove some logging.

	* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs: Don't
	hide the Status label iff it's ever been set to non-null/empty to avoid
	the height of the tile changing rapidly in some cases.

	* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs:
	Use new AccepsUserInputFromSource method.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
	Avoid NRE that was caught but spewed a lot of logging.

	* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs: Style fixes,
	and don't set the AddTrackJob status to empty between tracks because that
	causes a strange height-change flicker.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs
   trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
   trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
   trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
   trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	Wed Sep 24 19:44:49 2008
@@ -305,7 +305,7 @@
         [DatabaseColumn ("Uri")]
         protected string UriField {
             get {
-                if (uri_fields_dirty) {
+                if (uri_fields_dirty && Uri != null) {
                     PrimarySource.UriToFields (Uri, out uri_type, out uri_field);
                     uri_fields_dirty = false;
                 }
@@ -322,7 +322,7 @@
         [DatabaseColumn ("UriType")]
         protected TrackUriType UriType {
             get {
-                if (uri_fields_dirty) {
+                if (uri_fields_dirty && Uri != null) {
                     PrimarySource.UriToFields (Uri, out uri_type, out uri_field);
                     uri_fields_dirty = false;
                 }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	Wed Sep 24 19:44:49 2008
@@ -276,6 +276,11 @@
         {
             return CanAddTracks && source != this;
         }
+
+        public override bool AcceptsUserInputFromSource (Source source)
+        {
+            return base.AcceptsUserInputFromSource (source) && CanAddTracks;
+        }
                 
         public override bool HasViewableTrackProperties {
             get { return true; }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs	Wed Sep 24 19:44:49 2008
@@ -531,8 +531,9 @@
         
         public override bool AddAllTracks (Source source)
         {
-            if (!AcceptsInputFromSource (source) || source.Count == 0)
+            if (!AcceptsInputFromSource (source) || source.Count == 0) {
                 return false;
+            }
             
             DatabaseTrackListModel model = (source as ITrackModelSource).TrackModel as DatabaseTrackListModel;
             CachedList<DatabaseTrackInfo> cached_list = CachedList<DatabaseTrackInfo>.CreateFromModel (model);
@@ -602,19 +603,20 @@
                     finished = true;
                     add_track_job = null;
                 } else {
-                    add_track_job.Status = String.Empty;
                     if (add_track_job.Completed % 10 == 0)
                         notify = true;
                 }
             }
 
+            if (finished) {
+                is_adding = false;
+            }
+
             if (notify || finished) {
-                Banshee.Base.ThreadAssist.ProxyToMain (delegate {
-                    OnTracksAdded ();
-    
-                if (finished)
-                    OnUserNotifyUpdated ();
-                });
+                OnTracksAdded ();
+                if (finished) {
+                    Banshee.Base.ThreadAssist.ProxyToMain (OnUserNotifyUpdated);
+                }
             }
         }
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs	Wed Sep 24 19:44:49 2008
@@ -153,6 +153,11 @@
         {
             return false;
         }
+
+        public virtual bool AcceptsUserInputFromSource (Source source)
+        {
+            return AcceptsInputFromSource (source);
+        }
         
         public virtual void MergeSourceInput (Source source, SourceMergeType mergeType)
         {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTile.cs	Wed Sep 24 19:44:49 2008
@@ -169,7 +169,8 @@
             }
             title = new_title;
         }
-        
+
+        private bool never_had_status = true;
         private void UpdateFromJob ()
         {
             ThreadAssist.AssertInMainThread ();
@@ -184,11 +185,14 @@
             }
             
             if (status != job.Status) {
-                if (String.IsNullOrEmpty (job.Status)) {
+                // If we've ever had the status in this job, don't hide it b/c that'll make
+                // the tile change width, possibly repeatedly and annoyingly
+                if (String.IsNullOrEmpty (job.Status) && never_had_status) {
                     status_label.Hide ();
                 } else {
-                    status_label.Markup = String.Format ("<small>{0}</small>", GLib.Markup.EscapeText (job.Status));
-                    TooltipSetter.Set (tooltips, status_label, job.Status);
+                    never_had_status = false;
+                    status_label.Markup = String.Format ("<small>{0}</small>", GLib.Markup.EscapeText (job.Status ?? String.Empty));
+                    TooltipSetter.Set (tooltips, status_label, job.Status ?? String.Empty);
                     status_label.Show ();
                 }
                 status = job.Status;

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView_DragAndDrop.cs	Wed Sep 24 19:44:49 2008
@@ -96,7 +96,7 @@
 
             ShowNewPlaylistUnder (parent_source, active_source);
 
-            if (!drop_source.AcceptsInputFromSource (active_source)) {
+            if (!drop_source.AcceptsUserInputFromSource (active_source)) {
                 Gdk.Drag.Status (context, 0, time);
                 return true;
             }
@@ -125,7 +125,7 @@
             }
 
             NewPlaylistSource.SetParentSource (parent);
-            if (!NewPlaylistSource.AcceptsInputFromSource (active)) {
+            if (!NewPlaylistSource.AcceptsUserInputFromSource (active)) {
                 NewPlaylistSource.SetParentSource (new_playlist_parent);
                 return;
             }

Modified: trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodSource.cs	Wed Sep 24 19:44:49 2008
@@ -380,6 +380,22 @@
 
 #region Syncing
 
+        protected override void OnTracksAdded ()
+        {
+            if (!IsAdding && tracks_to_add.Count > 0 && !Sync.Syncing) {
+                QueueSync ();
+            }
+            base.OnTracksAdded ();
+        }
+
+        protected override void OnTracksDeleted ()
+        {
+            if (!IsDeleting && tracks_to_remove.Count > 0 && !Sync.Syncing) {
+                QueueSync ();
+            }
+            base.OnTracksDeleted ();
+        }
+        
         private Queue<IpodTrackInfo> tracks_to_add = new Queue<IpodTrackInfo> ();
         private Queue<IpodTrackInfo> tracks_to_remove = new Queue<IpodTrackInfo> ();
         
@@ -414,7 +430,6 @@
                 IpodTrackInfo ipod_track = tracks_map[track.TrackId];
                 if (ipod_track != null) {
                     tracks_to_remove.Enqueue (ipod_track);
-                    QueueSync ();
                 }
             }
         }
@@ -432,8 +447,6 @@
                 ipod_track.Save (false);
             
                 tracks_to_add.Enqueue (ipod_track);
-                
-                QueueSync ();
             }
         }
 
@@ -452,7 +465,7 @@
                     Application.IdleTimeoutRemove (sync_timeout_id);
                 }
                 
-                sync_timeout_id = Application.RunTimeout (1000, PerformSync);
+                sync_timeout_id = Application.RunTimeout (150, PerformSync);
             }
         }
         

Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapLibrarySync.cs	Wed Sep 24 19:44:49 2008
@@ -200,7 +200,6 @@
                 }
 
                 if (to_add.Count > 0) {
-                    Log.DebugFormat ("adding {0} items to {1}", to_add.Count, library.Name);
                     sync.Dap.AddAllTracks (to_add);
                 }
 

Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs	Wed Sep 24 19:44:49 2008
@@ -300,7 +300,7 @@
         private void AttemptToAddTrackToDevice (DatabaseTrackInfo track, SafeUri fromUri)
         {
             // Ensure there's enough space
-            if (BytesAvailable - Banshee.IO.File.GetSize (fromUri) >= 0) {
+            if (Banshee.IO.File.Exists (fromUri) && BytesAvailable - Banshee.IO.File.GetSize (fromUri) >= 0) {
                 // Ensure it's not already on the device
                 if (ServiceManager.DbConnection.Query<int> (track_on_dap_query, DbId, track.MetadataHash) == 0) {
                     AddTrackToDevice (track, fromUri);

Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs	Wed Sep 24 19:44:49 2008
@@ -121,7 +121,7 @@
 
         public override bool AcceptsInputFromSource (Source source)
         {
-            return (source is DatabaseSource) && this != source.Parent && CanAddTracks;
+            return (source is DatabaseSource) && this != source.Parent && !IsReadOnly;
         }
 
         private bool syncing = false;



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