banshee r3037 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.MediaEngine src/Core/Nereid/Nereid



Author: abock
Date: Sun Jan 27 03:19:18 2008
New Revision: 3037
URL: http://svn.gnome.org/viewvc/banshee?rev=3037&view=rev

Log:
2008-01-26  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.Services/Banshee.MediaEngine/IPlaybackController.cs:
    * src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs:
    Added First method to play the first song in the source

    * src/Core/Nereid/Nereid/PlayerInterface.cs: When a source view row
    is activated, make it the playback source and begin playing the first
    track from it



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlaybackController.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs
   trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlaybackController.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlaybackController.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/IPlaybackController.cs	Sun Jan 27 03:19:18 2008
@@ -40,6 +40,7 @@
     {
         event PlaybackControllerStoppedHandler Stopped;
     
+        void First ();
         void Next ();
         void Previous ();
         

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.MediaEngine/PlaybackControllerService.cs	Sun Jan 27 03:19:18 2008
@@ -112,6 +112,13 @@
             }       
         }
         
+        public void First ()
+        {
+            if (Source.Count > 0) {
+                player_engine.OpenPlay (Source.TrackModel[0]);
+            }
+        }
+        
         public void Next ()
         {
             TrackInfo tmp_track = CurrentTrack;

Modified: trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs	Sun Jan 27 03:19:18 2008
@@ -238,16 +238,15 @@
             };
             
             composite_view.TrackView.RowActivated += delegate (object o, RowActivatedArgs<TrackInfo> args) {
-                // Set the source from which to play to the current source since
-                // the user manually began playback from this source
-                Source source = ServiceManager.SourceManager.ActiveSource;
-                if (source is ITrackModelSource) {
-                    ServiceManager.PlaybackController.Source = (ITrackModelSource)source;
-                }
-                
+                SetPlaybackControllerSource (ServiceManager.SourceManager.ActiveSource);
                 ServiceManager.PlayerEngine.OpenPlay (args.RowValue);
             };
 
+            source_view.RowActivated += delegate {
+                SetPlaybackControllerSource (ServiceManager.SourceManager.ActiveSource);
+                ServiceManager.PlaybackController.First ();
+            };
+            
             header_toolbar.ExposeEvent += OnHeaderToolbarExposeEvent;
         }
         
@@ -448,6 +447,21 @@
 
 #endregion
 
+#region Helper Functions
+
+        private void SetPlaybackControllerSource (Source source)
+        {
+            // Set the source from which to play to the current source since
+            // the user manually began playback from this source
+            if (!(source is ITrackModelSource)) {
+                source = ServiceManager.SourceManager.DefaultSource;
+            }
+            
+            ServiceManager.PlaybackController.Source = (ITrackModelSource)source;    
+        }
+
+#endregion
+
         string IService.ServiceName {
             get { return "NereidPlayerInterface"; }
         }



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