banshee r4411 - in branches/banshee/abock: . src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor



Author: abock
Date: Wed Aug 20 23:50:03 2008
New Revision: 4411
URL: http://svn.gnome.org/viewvc/banshee?rev=4411&view=rev

Log:
2008-08-20  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs:
    Hook up field syncing
    
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorTrackInfo.cs:
    Support setting the index of the track in editor speak

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs:
    Split LoadTrack and GetTrack, provide ForeachNonCurrentTrack method



Modified:
   branches/banshee/abock/ChangeLog
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorTrackInfo.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorTrackInfo.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorTrackInfo.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorTrackInfo.cs	Wed Aug 20 23:50:03 2008
@@ -40,6 +40,18 @@
             TrackInfo.ExportableMerge (source_track, this);
         }
         
+        private int editor_index;
+        public int EditorIndex {
+            get { return editor_index; }
+            set { editor_index = value; }
+        }
+        
+        private int editor_count;
+        public int EditorCount {
+            get { return editor_count; }
+            set { editor_count = value; }
+        }
+        
         private TrackInfo source_track;
         public TrackInfo SourceTrack {
             get { return source_track; }

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	Wed Aug 20 23:50:03 2008
@@ -117,6 +117,11 @@
             slot.WriteClosure = writeClosure;
             if (MultipleTracks && (options & FieldOptions.NoSync) == 0) {
                 slot.SyncButton = EditorUtilities.CreateSyncButton ();
+                slot.SyncButton.Clicked += delegate {
+                    dialog.ForeachNonCurrentTrack (delegate (EditorTrackInfo track) {
+                        slot.WriteClosure (track, slot.Field);
+                    });
+                };
             }
             
             field_slots.Add (slot);

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs	Wed Aug 20 23:50:03 2008
@@ -44,6 +44,8 @@
 {
     public class TrackEditorDialog : BansheeDialog
     {
+        public delegate void EditorTrackOperationClosure (EditorTrackInfo track);
+    
         private VBox main_vbox;
     
         private Frame header_image_frame;
@@ -219,19 +221,12 @@
         
         private void LoadTrackToEditor ()
         {
-            TrackInfo current_track = GetTrack (current_track_index);
-            EditorTrackInfo editor_track = null;
-            
-            if (current_track == null) {
-                // Something bad happened here
+            TrackInfo current_track = null;
+            EditorTrackInfo editor_track = LoadTrack (current_track_index, out current_track);
+            if (editor_track == null) {
                 return;
             }
             
-            if (!edit_map.TryGetValue (current_track, out editor_track)) {
-                editor_track = new EditorTrackInfo (current_track);
-                edit_map.Add (current_track, editor_track);
-            }
-            
             // Update the Header
             header_title_label.Text = current_track.DisplayTrackTitle;
             header_artist_label.Text = current_track.DisplayArtistName;
@@ -259,6 +254,46 @@
             }
         }
         
+        public void ForeachNonCurrentTrack (EditorTrackOperationClosure closure)
+        {
+            for (int i = 0; i < TrackCount; i++) {
+                if (i == current_track_index) {
+                    continue;
+                }
+                
+                EditorTrackInfo track = LoadTrack (i);
+                if (track != null) {
+                    closure (track);
+                }
+            }
+        }
+        
+        public EditorTrackInfo LoadTrack (int index)
+        {
+            TrackInfo source_track;
+            return LoadTrack (index, out source_track);
+        }
+        
+        private EditorTrackInfo LoadTrack (int index, out TrackInfo sourceTrack)
+        {
+            sourceTrack = GetTrack (index);
+            EditorTrackInfo editor_track = null;
+            
+            if (sourceTrack == null) {
+                // Something bad happened here
+                return null;
+            }
+            
+            if (!edit_map.TryGetValue (sourceTrack, out editor_track)) {
+                editor_track = new EditorTrackInfo (sourceTrack);
+                editor_track.EditorIndex = index;
+                editor_track.EditorCount = TrackCount;
+                edit_map.Add (sourceTrack, editor_track);
+            }
+            
+            return editor_track;
+        }
+        
         private TrackInfo GetTrack (int index)
         {
             return db_selection != null ? db_selection[index] : memory_selection[index];



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