banshee r4646 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod



Author: gburt
Date: Fri Oct  3 16:37:00 2008
New Revision: 4646
URL: http://svn.gnome.org/viewvc/banshee?rev=4646&view=rev

Log:
2008-10-03  Gabriel Burt  <gabriel burt gmail com>

	* src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs: Optimize
	cover art setting so that we only create a Pixbuf of the track's cover art
	if it's not already set.

	* src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs:
	Reconnect the height of the year label to the height of the album artist
	label, and make the minimum for the year entry 0 not 1000 so that for
	tracks without a year set, it shows up as 0 not 1000.

	* src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs:
	Expose the LabelWidget (the checkbox, actually) so the year label's height
	can be set off it.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs
   trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs	Fri Oct  3 16:37:00 2008
@@ -60,6 +60,10 @@
             UpdateSensitivities ();
         }
 
+        public Widget LabelWidget {
+            get { return enable_compilation; }
+        }
+
         public bool IsCompilation {
             get { return enable_compilation.Active; }
             set {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs	Fri Oct  3 16:37:00 2008
@@ -79,7 +79,8 @@
                 delegate (EditorTrackInfo track, Widget widget) { track.ArtistName = ((TextEntry)widget).Text; }
             );
 
-            AddField (left, null, new AlbumArtistEntry (),
+            AlbumArtistEntry album_artist_entry = new AlbumArtistEntry ();
+            AddField (left, null, album_artist_entry,
                 Catalog.GetString ("Set all compilation album artists to these values"), null,
                 delegate (EditorTrackInfo track, Widget widget) {
                     AlbumArtistEntry entry = widget as AlbumArtistEntry;
@@ -142,7 +143,10 @@
             );
             
             Label year_label = EditorUtilities.CreateLabel (null);
-            AddField (right, year_label, new SpinButtonEntry (1000, 3000, 1), 
+            album_artist_entry.LabelWidget.SizeAllocated += delegate { year_label.HeightRequest = album_artist_entry.LabelWidget.Allocation.Height; };
+            SpinButtonEntry year_entry = new SpinButtonEntry (0, 3000, 1);
+            year_entry.Numeric = true;
+            AddField (right, year_label, year_entry,
                 Catalog.GetString ("Set all years to this value"),
                 delegate { return Catalog.GetString ("Year:"); },
                 delegate (EditorTrackInfo track, Widget widget) { ((SpinButtonEntry)widget).Value = track.Year; },

Modified: trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs	Fri Oct  3 16:37:00 2008
@@ -225,7 +225,7 @@
                 //track.RememberPosition = true;
                 //track.NotPlayedMark = track.PlayCount == 0;
             }
-            
+
             if (HasAttribute (TrackMediaAttributes.VideoStream)) {
                 if (HasAttribute (TrackMediaAttributes.Podcast)) {
                     track.Type = IPod.MediaType.VideoPodcast;
@@ -257,27 +257,27 @@
         
         // FIXME: No reason for this to use GdkPixbuf - the file is on disk already in 
         // the artwork cache as a JPEG, so just shove the bytes from disk into the track
-        
         public static void SetIpodCoverArt (IPod.Device device, IPod.Track track, string path)
         {
             try {
-                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (path);
+                Gdk.Pixbuf pixbuf = null;
+                foreach (IPod.ArtworkFormat format in device.LookupArtworkFormats (IPod.ArtworkUsage.Cover)) {
+                    if (!track.HasCoverArt (format)) {
+                        // Lazily load the pixbuf
+                        if (pixbuf == null) {
+                            pixbuf = new Gdk.Pixbuf (path);
+                        }
+                        
+                        track.SetCoverArt (format, IPod.ArtworkHelpers.ToBytes (format, pixbuf));
+                    }
+                }
+                
                 if (pixbuf != null) {
-                    SetIpodCoverArt (device, track, IPod.ArtworkUsage.Cover, pixbuf);
                     pixbuf.Dispose ();
                 }
             } catch (Exception e) {
                 Log.Exception (String.Format ("Failed to set cover art on iPod from {0}", path), e);
             }
         }
-
-        private static void SetIpodCoverArt (IPod.Device device, IPod.Track track, IPod.ArtworkUsage usage, Gdk.Pixbuf pixbuf)
-        {
-            foreach (IPod.ArtworkFormat format in device.LookupArtworkFormats (usage)) {
-                if (!track.HasCoverArt (format)) {
-                    track.SetCoverArt (format, IPod.ArtworkHelpers.ToBytes (format, pixbuf));
-                }
-            }
-        }
     }
 }



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