[banshee] AppleDeviceSource: use progressUpdaters for all sync operations



commit 0e46a489f9f4b0e2cd62242bbb7274c8eada18fb
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Sat Sep 29 17:42:57 2012 +0100

    AppleDeviceSource: use progressUpdaters for all sync operations
    
    It is better to have UI feedback to the user in all sync operations
    no matter how small their time window might be in normal situations,
    just in case there are scenarios in which they may take longer, as
    reported in https://bugzilla.gnome.org/show_bug.cgi?id=679260#c25.

 .../Banshee.Dap.AppleDevice/AppleDeviceSource.cs   |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
index c43d159..612c191 100644
--- a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
+++ b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceSource.cs
@@ -570,7 +570,7 @@ namespace Banshee.Dap.AppleDevice
 
             SyncTracksToAdd (progressUpdater);
 
-            SyncTracksToUpdate ();
+            SyncTracksToUpdate (progressUpdater);
 
             SyncTracksToRemove (progressUpdater);
 
@@ -611,8 +611,10 @@ namespace Banshee.Dap.AppleDevice
             }
         }
 
-        void SyncTracksToUpdate ()
+        void SyncTracksToUpdate (UserJob progressUpdater)
         {
+            string message = Catalog.GetString ("Updating metadata in track {0} of {1}");
+            int total = tracks_to_update.Count;
             while (tracks_to_update.Count > 0) {
                 AppleDeviceTrackInfo track = null;
                 lock (sync_mutex) {
@@ -620,6 +622,8 @@ namespace Banshee.Dap.AppleDevice
                 }
 
                 try {
+                    UpdateProgress (progressUpdater, message, total - tracks_to_update.Count, total);
+
                     track.CommitToIpod (MediaDatabase);
                 } catch (Exception e) {
                     Log.Exception ("Cannot save track to iPod", e);
@@ -654,13 +658,16 @@ namespace Banshee.Dap.AppleDevice
                 }
             }
 
-            SyncRemovalOfInvalidTracks ();
+            SyncRemovalOfInvalidTracks (progressUpdater);
         }
 
-        void SyncRemovalOfInvalidTracks ()
+        void SyncRemovalOfInvalidTracks (UserJob progressUpdater)
         {
+            string message = Catalog.GetString ("Cleaning up, removing invalid track {0} of {1}");
+            int total = invalid_tracks_in_device.Count;
             while (invalid_tracks_in_device.Count > 0) {
                 try {
+                    UpdateProgress (progressUpdater, message, total - invalid_tracks_in_device.Count, total);
                     DeleteTrack (invalid_tracks_in_device.Dequeue (), false);
                 } catch (Exception e) {
                     Log.Exception ("Cannot remove invalid track from iPod", e);



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