banshee r4764 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue



Author: abock
Date: Tue Oct 28 01:01:22 2008
New Revision: 4764
URL: http://svn.gnome.org/viewvc/banshee?rev=4764&view=rev

Log:
2008-10-27  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs:
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/HelpPage.cs:
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ITrackEditorPage.cs:
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs:
    Removed Changed, not needed

    * src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
    Add EnqueueTrack, generalize the other Enqueue methods to use EnqueueId



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/HelpPage.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ITrackEditorPage.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs

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	Tue Oct 28 01:01:22 2008
@@ -41,11 +41,6 @@
         public delegate string FieldLabelClosure (EditorTrackInfo track, Widget widget);
         public delegate void FieldValueClosure (EditorTrackInfo track, Widget widget);
 
-        #pragma warning disable 0067
-        // FIXME: This is to mute gmcs: https://bugzilla.novell.com/show_bug.cgi?id=360455
-        public event EventHandler Changed;
-        #pragma warning restore 0067
-        
         private TrackEditorDialog dialog;
         protected TrackEditorDialog Dialog {
             get { return dialog; }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/HelpPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/HelpPage.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/HelpPage.cs	Tue Oct 28 01:01:22 2008
@@ -36,9 +36,7 @@
     {
         private Box tab_widget;
         private TrackEditorDialog dialog;
-        
-        public event EventHandler Changed;
-        
+               
         public HelpPage () : base (0.5f, 0.5f, 0.0f, 0.0f)
         {
             Image help = new Image ();

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ITrackEditorPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ITrackEditorPage.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ITrackEditorPage.cs	Tue Oct 28 01:01:22 2008
@@ -33,9 +33,7 @@
 namespace Banshee.Gui.TrackEditor
 {
     public interface ITrackEditorPage
-    {
-        event EventHandler Changed;
-        
+    {       
         void Initialize (TrackEditorDialog dialog);
         void LoadTrack (EditorTrackInfo track);
         

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/StatisticsPage.cs	Tue Oct 28 01:01:22 2008
@@ -39,8 +39,6 @@
         private ListStore model;
         private TreeView view;
         
-        public event EventHandler Changed;
-
         public StatisticsPage ()
         {
             ShadowType = ShadowType.In;

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	Tue Oct 28 01:01:22 2008
@@ -27,6 +27,7 @@
 //
 
 using System;
+using System.Linq;
 
 using Mono.Unix;
 
@@ -113,19 +114,36 @@
 
         public void EnqueueUri (string uri, bool prepend)
         {
-            int track_id = LibrarySource.GetTrackIdForUri (uri);
-            if (track_id > 0) {
-                if (prepend) {
-                    ServiceManager.DbConnection.Execute ("UPDATE CorePlaylistEntries SET ViewOrder = ViewOrder + 1 WHERE PlaylistID = ?", DbId);
-                }
+            EnqueueId (LibrarySource.GetTrackIdForUri (uri), prepend);
+        }
+        
+        public void EnqueueTrack (TrackInfo track, bool prepend)
+        {
+            DatabaseTrackInfo db_track = track as DatabaseTrackInfo;
+            if (db_track != null) {
+                EnqueueId (db_track.TrackId, prepend);
+            } else {
+                EnqueueUri (track.Uri.AbsoluteUri, prepend);
+            }
+        }
+        
+        private void EnqueueId (int trackId, bool prepend)
+        {
+            if (trackId <= 0) {
+                return;
+            }
+            
+            if (prepend) {
+                ServiceManager.DbConnection.Execute ("UPDATE CorePlaylistEntries SET ViewOrder = ViewOrder + 1 WHERE PlaylistID = ?", DbId);
+            }
 
-                HyenaSqliteCommand insert_command = new HyenaSqliteCommand (String.Format (
-                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID, ViewOrder) VALUES ({0}, ?, {1})", DbId, prepend ? 0 : MaxViewOrder));
-                ServiceManager.DbConnection.Execute (insert_command, track_id);
+            HyenaSqliteCommand insert_command = new HyenaSqliteCommand (String.Format (
+                @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID, ViewOrder) VALUES ({0}, ?, {1})", 
+                    DbId, prepend ? 0 : MaxViewOrder));
+            ServiceManager.DbConnection.Execute (insert_command, trackId);
 
-                Reload ();
-                NotifyUser ();
-            }
+            Reload ();
+            NotifyUser ();
         }
         
         IDBusExportable IDBusExportable.Parent {



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