banshee r4729 - in trunk/banshee: . src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue



Author: gburt
Date: Fri Oct 24 01:27:56 2008
New Revision: 4729
URL: http://svn.gnome.org/viewvc/banshee?rev=4729&view=rev

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

	* src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
	* src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/IPlayQueue.cs: Patch
	from Alex Launi and myself adding the ability to prepend a track to the
	Play Queue (BGO #557526).



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/IPlayQueue.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/IPlayQueue.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/IPlayQueue.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/IPlayQueue.cs	Fri Oct 24 01:27:56 2008
@@ -35,5 +35,6 @@
     public interface IPlayQueue
     {
         void EnqueueUri (string uri);
+        void EnqueueUri (string uri, bool prepend);
     }
 }

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	Fri Oct 24 01:27:56 2008
@@ -108,11 +108,21 @@
 
         public void EnqueueUri (string uri)
         {
+            EnqueueUri (uri, false);
+        }
+
+        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);
+                }
+
                 HyenaSqliteCommand insert_command = new HyenaSqliteCommand (String.Format (
-                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID) VALUES ({0}, ?)", DbId));
+                    @"INSERT INTO CorePlaylistEntries (PlaylistID, TrackID, ViewOrder) VALUES ({0}, ?, {1})", DbId, prepend ? 0 : MaxViewOrder));
                 ServiceManager.DbConnection.Execute (insert_command, track_id);
+
                 Reload ();
                 NotifyUser ();
             }



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