banshee r4645 - in trunk/banshee: . src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor



Author: gburt
Date: Thu Oct  2 22:23:10 2008
New Revision: 4645
URL: http://svn.gnome.org/viewvc/banshee?rev=4645&view=rev

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

	* src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs: Don't
	assume a slot has a Label or a LabelClosure.

	* src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs: 
	Instead of creating the Is Compilation checkbox here and setting that as
	the label for Album Artist, move it and its logic into a dedicated
	AlbumArtistEntry widget.  Net effect is you can now sync the Is
	Compilation checkbox and the Album Artist value via the single sync
	button.

	* src/Core/Banshee.ThickClient/Makefile.am:
	* src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj:
	* src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs:
	New editor widget that has a checkbox and a text entry.  Add tooltips to
	the checkbox and entry to explain what these values are.

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
	Add *Field properties for actually loading/saving field values from/to the
	database - avoiding the checks and such that happen when you use the
	AlbumTitle et al setters.  Based on patch from Benoit Boissinot, remove
	the restrictions on setting the AlbumArtist based on IsCompilation to avoid
	race condition with whether the IsCompilation bool was set true before
	trying to set the AlbumArtist value (BGO #554723).

	* src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs: Also based on 
	the same patch from Benoit, is IsCompilation is false, in the AlbumArtist
	getter always return ArtistName, otherwise return the value of the album
	artist or Various Artists if its not set.



Added:
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/CompositeUserJob.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
   trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am

Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs	Thu Oct  2 22:23:10 2008
@@ -200,7 +200,7 @@
 
         [Exportable]
         public virtual string AlbumArtist {
-            get { return album_artist ?? (IsCompilation ? Catalog.GetString ("Various Artists") : ArtistName); }
+            get { return IsCompilation ? album_artist ?? Catalog.GetString ("Various Artists") : ArtistName; }
             set { album_artist = value; }
         }
         

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	Thu Oct  2 22:23:10 2008
@@ -215,6 +215,11 @@
         }
 
         [VirtualDatabaseColumn ("Name", "CoreArtists", "ArtistID", "ArtistID")]
+        protected string ArtistNameField {
+            get { return ArtistName; }
+            set { base.ArtistName = value; }
+        }
+
         public override string ArtistName {
             get { return base.ArtistName; }
             set {
@@ -222,16 +227,17 @@
                 if (value == null)
                     return;
 
-                if (!IsCompilation) {
-                    AlbumArtist = value;
-                }
-
                 base.ArtistName = value;
                 artist_changed = artist_changed != null;
             }
         }
 
         [VirtualDatabaseColumn ("Title", "CoreAlbums", "AlbumID", "AlbumID")]
+        protected string AlbumTitleField {
+            get { return AlbumTitle; }
+            set { base.AlbumTitle = value; }
+        }
+
         public override string AlbumTitle {
             get { return base.AlbumTitle; }
             set {
@@ -245,15 +251,14 @@
         }
 
         [VirtualDatabaseColumn ("ArtistName", "CoreAlbums", "AlbumID", "AlbumID")]
+        protected string AlbumArtistField {
+            get { return AlbumArtist; }
+            set { base.AlbumArtist = value; }
+        }
+
         public override string AlbumArtist {
             get { return base.AlbumArtist; }
             set {
-                // Can't set the AlbumArtist if not a compilation, b/c its implicitly kept
-                // the same as the Track Artist
-                if (!IsCompilation) {
-                    return;
-                }
-
                 value = CleanseString (value, AlbumArtist);
                 if (value == null)
                     return;
@@ -264,6 +269,11 @@
         }
         
         [VirtualDatabaseColumn ("IsCompilation", "CoreAlbums", "AlbumID", "AlbumID")]
+        protected bool IsCompilationField {
+            get { return IsCompilation; }
+            set { base.IsCompilation = value; }
+        }
+
         public override bool IsCompilation {
             get { return base.IsCompilation; }
             set {

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/CompositeUserJob.cs
==============================================================================

Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/AlbumArtistEntry.cs	Thu Oct  2 22:23:10 2008
@@ -0,0 +1,90 @@
+//
+// AlbumArtistEntry.cs
+//
+// Authors:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+using Mono.Unix;
+
+using Gtk;
+
+namespace Banshee.Gui.TrackEditor
+{
+    public class AlbumArtistEntry : VBox, IEditorField
+    {
+        public event EventHandler Changed;
+
+        private CheckButton enable_compilation = new CheckButton ();
+        private TextEntry entry = new TextEntry ();
+        private object tooltip_host = Hyena.Gui.TooltipSetter.CreateHost ();
+        
+        public AlbumArtistEntry () : base ()
+        {
+            enable_compilation.Label = Catalog.GetString ("Compilation Album Artist:");
+
+            Hyena.Gui.TooltipSetter.Set (tooltip_host, enable_compilation,
+                Catalog.GetString ("Check this if this track is part of an album with tracks by various artists"));
+            Hyena.Gui.TooltipSetter.Set (tooltip_host, entry,
+                Catalog.GetString ("This value will affect how this album is sorted; if you enter 'Various Artists' then the album will located with other albums that start with 'V'."));
+
+            PackStart (enable_compilation, false, false, 0);
+            PackStart (entry, false, false, 0);
+            ShowAll ();
+
+            enable_compilation.Toggled += OnChanged;
+            entry.Changed += OnChanged;
+            UpdateSensitivities ();
+        }
+
+        public bool IsCompilation {
+            get { return enable_compilation.Active; }
+            set {
+                enable_compilation.Active = value;
+                UpdateSensitivities ();
+            }
+        }
+
+        public string Text {
+            get { return entry.Text; }
+            set { entry.Text = value ?? String.Empty; }
+        }   
+
+        private void OnChanged (object o, EventArgs args)
+        {
+            UpdateSensitivities ();
+            EventHandler handler = Changed;
+            if (handler != null) {
+                handler (this, EventArgs.Empty);
+            }
+        }
+
+        private void UpdateSensitivities ()
+        {
+            entry.Sensitive = IsCompilation;
+        }
+    }
+}

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	Thu Oct  2 22:23:10 2008
@@ -36,7 +36,6 @@
 {
     public class BasicTrackDetailsPage : FieldPage, ITrackEditorPage
     {
-        private CheckButton enable_compilation = new CheckButton ();
         
         public int Order {
             get { return 10; }
@@ -49,8 +48,6 @@
         public override void LoadTrack (EditorTrackInfo track)
         {
             base.LoadTrack (track);
-            enable_compilation.Active = track.IsCompilation;
-            OnEnableCompilationToggled (enable_compilation, EventArgs.Empty);
         }
 
         protected override void AddFields ()
@@ -81,15 +78,19 @@
                 delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.ArtistName; },
                 delegate (EditorTrackInfo track, Widget widget) { track.ArtistName = ((TextEntry)widget).Text; }
             );
-            
-            enable_compilation.Toggled += OnEnableCompilationToggled;
-            AddField (left, enable_compilation, new TextEntry (), null,
-                delegate (EditorTrackInfo track, Widget widget) { 
-                    ((CheckButton)widget).Label = Catalog.GetString ("Album Artist (part of a compilation):"); 
-                    return null; 
+
+            AddField (left, null, new AlbumArtistEntry (),
+                Catalog.GetString ("Set all compilation album artists to these values"), null,
+                delegate (EditorTrackInfo track, Widget widget) {
+                    AlbumArtistEntry entry = widget as AlbumArtistEntry;
+                    entry.IsCompilation = track.IsCompilation;
+                    entry.Text = track.AlbumArtist;
                 },
-                delegate (EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.AlbumArtist; },
-                delegate (EditorTrackInfo track, Widget widget) { track.AlbumArtist = ((TextEntry)widget).Text; }
+                delegate (EditorTrackInfo track, Widget widget) {
+                    AlbumArtistEntry entry = widget as AlbumArtistEntry;
+                    track.IsCompilation = entry.IsCompilation;
+                    track.AlbumArtist = entry.Text;
+                }
             );
             
             AddField (left, new TextEntry (), 
@@ -141,7 +142,6 @@
             );
             
             Label year_label = EditorUtilities.CreateLabel (null);
-            enable_compilation.SizeAllocated += delegate { year_label.HeightRequest = enable_compilation.Allocation.Height; };
             AddField (right, year_label, new SpinButtonEntry (1000, 3000, 1), 
                 Catalog.GetString ("Set all years to this value"),
                 delegate { return Catalog.GetString ("Year:"); },
@@ -155,23 +155,8 @@
                 delegate { return Catalog.GetString ("Rating:"); },
                 delegate (EditorTrackInfo track, Widget widget) { ((RatingEntry)widget).Value = track.Rating; },
                 delegate (EditorTrackInfo track, Widget widget) { track.Rating = ((RatingEntry)widget).Value; },
-                FieldOptions.Shrink
+                FieldOptions.Shrink | FieldOptions.NoSync
             );
         }
-        
-        private void OnEnableCompilationToggled (object o, EventArgs args)
-        {
-            CheckButton check = (CheckButton)o;
-            
-            if (CurrentTrack != null) {
-                CurrentTrack.IsCompilation = check.Active;
-            }
-            
-            foreach (Widget child in ((Container)check.Parent).Children) {
-                if (child != check) {
-                    child.Sensitive = check.Active;
-                }
-            }
-        }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	Thu Oct  2 22:23:10 2008
@@ -178,10 +178,12 @@
                     AttachOptions.Fill, 
                     AttachOptions.Fill, 0, 0);
             }
-            
-            table.Attach (label, 0, table.NColumns, 0, 1,
-                AttachOptions.Fill | AttachOptions.Expand, 
-                AttachOptions.Fill, 0, 0);
+
+            if (label != null) {
+                table.Attach (label, 0, table.NColumns, 0, 1,
+                    AttachOptions.Fill | AttachOptions.Expand, 
+                    AttachOptions.Fill, 0, 0);
+            }
                 
             table.ShowAll ();
             
@@ -209,10 +211,10 @@
         
         private void UpdateLabel (EditorTrackInfo track, FieldSlot slot)
         {
-            string value = slot.LabelClosure (track, slot.Label);
             Label label = slot.Label as Label;
-            if (value != null && label != null) {
-                label.Text = value;
+            if (label != null && slot.LabelClosure != null) {
+                string value = slot.LabelClosure (track, slot.Label);
+                label.Text = value ?? String.Empty;
             }
         }
     }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	Thu Oct  2 22:23:10 2008
@@ -215,6 +215,7 @@
     <Compile Include="Banshee.Collection.Gui\ColumnCellTrackNumber.cs" />
     <Compile Include="Banshee.Collection.Gui\ColumnCellDiscAndCount.cs" />
     <Compile Include="Banshee.Collection.Gui\ColumnCellLocation.cs" />
+    <Compile Include="Banshee.Gui.TrackEditor\AlbumArtistEntry.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	Thu Oct  2 22:23:10 2008
@@ -51,6 +51,7 @@
 	Banshee.Gui.DragDrop/DragDropList.cs \
 	Banshee.Gui.DragDrop/DragDropTarget.cs \
 	Banshee.Gui.DragDrop/DragDropUtilities.cs \
+	Banshee.Gui.TrackEditor/AlbumArtistEntry.cs \
 	Banshee.Gui.TrackEditor/BasicTrackDetailsPage.cs \
 	Banshee.Gui.TrackEditor/EditorEntryUndoAdapter.cs \
 	Banshee.Gui.TrackEditor/EditorMode.cs \



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