banshee r3316 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea



Author: ahixon
Date: Sun Feb 24 03:52:17 2008
New Revision: 3316
URL: http://svn.gnome.org/viewvc/banshee?rev=3316&view=rev

Log:
2008-02-23  Alexander Hixon  <hixon alexander mediati org>
    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs:
    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs:
      Added LinearProgress hotness.
    
    * src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs: Fixed a bug
      where the user would change tracks while a track was mid-way through being buffered,
      and the first track's buffering result would cover up the song duration/progress
      information.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs
   trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs
   trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs	Sun Feb 24 03:52:17 2008
@@ -96,6 +96,7 @@
                     OnPlayerEngineTick ();
                     break;
                 case PlayerEngineEvent.StartOfStream:
+                    stream_position_label.IsBuffering = false;
                     seek_slider.CanSeek = true;
                     break;
                 case PlayerEngineEvent.Buffering:

Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs	Sun Feb 24 03:52:17 2008
@@ -42,7 +42,10 @@
         private uint position;
         private uint duration;
         private TrackInfoDisplay header;
-        private HBox header_box = new HBox ();
+        private VBox header_box = new VBox ();
+        
+        private Label position_label;
+        private LinearProgress linear_progress;
     
         public TrackInfoPopup () : base (Gtk.WindowType.Popup)
         {
@@ -50,10 +53,34 @@
             AppPaintable = true;
             Resizable = false;
             
+            // Position label and linear progress bar
+            HBox position_box = new HBox ();
+            position_box.Spacing = 10;
+            
+            position_label = new Label ();
+            position_label.Xalign = 0.0f;
+            position_label.Ypad = 5;
+            position_label.Yalign = 1.0f;
+            position_label.ModifyFg (StateType.Normal, this.Style.Base(StateType.Active));
+            
+            VBox progress_box = new VBox ();
+            linear_progress = new LinearProgress ();
+            progress_box.PackStart (linear_progress, true, true, 6);
+            
+            position_box.PackStart (position_label, false, false, 6);
+            position_box.PackStart (progress_box, true, true, 6);
+            
             header = new TrackInfoDisplay ();
-            header.SetSizeRequest (300, 46);
-            header_box.PackStart (header, true, true, 0);
+            header.SetSizeRequest (320, 64);
+            
+            Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
+            alignment.Add (header);
+            alignment.Show ();
+            
+            header_box.PackStart (alignment, true, true, 0);
+            header_box.PackStart (position_box, false, false, 0);
             header.Show ();
+            position_box.ShowAll ();
             
             Add (header_box);
             header_box.Show ();
@@ -71,5 +98,26 @@
                 0, 0, Allocation.Width, Allocation.Height);
             return base.OnExposeEvent (evnt);
         }
+        
+        private void UpdatePosition()
+        {
+            linear_progress.Fraction = (double)position / (double)duration;
+            position_label.Markup = String.Format("<small>{0} of {1}</small>",
+                    DateTimeUtil.FormatDuration(position), DateTimeUtil.FormatDuration(duration)); 
+        }
+        
+        public uint Duration {
+            set {
+                duration = value;
+                UpdatePosition();
+            }
+        }
+        
+        public uint Position {
+            set {
+                position = value;
+                UpdatePosition();
+            }
+        }
     }
 }

Modified: trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs	Sun Feb 24 03:52:17 2008
@@ -113,6 +113,7 @@
             
             popup = new TrackInfoPopup ();
             PositionPopup ();
+            
             popup.Show ();
         }
         
@@ -214,6 +215,18 @@
         public void PlayerEngineEventChanged (PlayerEngineEventArgs args) 
         {
             switch (args.Event) {
+                case PlayerEngineEvent.Iterate:
+                    if (popup != null) {
+                        if (ServiceManager.PlayerEngine.CurrentTrack != null) {
+                            popup.Duration = (uint)ServiceManager.PlayerEngine.CurrentTrack.Duration.TotalSeconds;
+                            popup.Position = ServiceManager.PlayerEngine.Position / 1000;
+                        } else {
+                            popup.Duration = 0;
+                            popup.Position = 0;
+                        }
+                    }
+                    
+                    break;
                 case PlayerEngineEvent.StartOfStream:
                     can_show_popup = true;
                     break;



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