banshee r3125 - in branches/banshee/stable: . src/Dap/Banshee.Dap.Mtp



Author: gburt
Date: Thu Jan 31 23:06:53 2008
New Revision: 3125
URL: http://svn.gnome.org/viewvc/banshee?rev=3125&view=rev

Log:
2008-01-31  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap.Mtp/AlbumSet.cs: Return a progress float between
	each cover art delete/save.

	* src/Dap/Banshee.Dap.Mtp/MtpDap.cs: Use bilinear scaling, allow
	cancelling, and display cover art sync progress.


Modified:
   branches/banshee/stable/ChangeLog
   branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/AlbumSet.cs
   branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs

Modified: branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/AlbumSet.cs
==============================================================================
--- branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/AlbumSet.cs	(original)
+++ branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/AlbumSet.cs	Thu Jan 31 23:06:53 2008
@@ -82,10 +82,13 @@
         }*/
 
         private const int MAX_THUMB_WIDTH = 170;
-        public void Save ()
+        public IEnumerable<double> Save ()
         {
+            double total = old_list.Count + new_list.Count;
+            double current = 0;
             foreach (Album album in old_list) {
                 album.Remove ();
+                yield return (current++ / total);
             }
 
             foreach (Album album in new_list) {
@@ -95,7 +98,7 @@
                         Gdk.Pixbuf pic = new Gdk.Pixbuf (cover_art_file);
 
                         int new_h = pic.Height * MAX_THUMB_WIDTH / pic.Width;
-                        Gdk.Pixbuf scaled = pic.ScaleSimple (MAX_THUMB_WIDTH, new_h, InterpType.Hyper);
+                        Gdk.Pixbuf scaled = pic.ScaleSimple (MAX_THUMB_WIDTH, new_h, InterpType.Bilinear);
 
                         byte [] bytes = scaled.SaveToBuffer ("jpeg");
                         album.Save (bytes, (uint)scaled.Width, (uint)scaled.Height);
@@ -103,6 +106,7 @@
                         pic.Dispose ();
                     }
                 }
+                yield return (current++ / total);
             }
 
             tracks.Clear ();

Modified: branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs
==============================================================================
--- branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs	(original)
+++ branches/banshee/stable/src/Dap/Banshee.Dap.Mtp/MtpDap.cs	Thu Jan 31 23:06:53 2008
@@ -203,7 +203,7 @@
                 Reload ();
             }
 
-			CanCancelSave = false;
+			CanCancelSave = true;
 			return InitializeResult.Valid;
 		}
 
@@ -435,12 +435,15 @@
 				UploadTracks ();
 
                 if (supports_jpegs) {
-                    AlbumSet album_set = new AlbumSet (device);
                     UpdateSaveProgress (sync_title, Catalog.GetString ("Syncing album art"), 0);
+                    AlbumSet album_set = new AlbumSet (device);
                     foreach (MtpDapTrackInfo track in all_tracks) {
                         album_set.Ref (track);
                     }
-                    album_set.Save ();
+
+                    foreach (double percent in album_set.Save ()) {
+                        UpdateSaveProgress (sync_title, Catalog.GetString ("Syncing album art"), percent);
+                    }
                 }
 			} catch (Exception e) {
 				LogCore.Instance.PushWarning (String.Format (



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