banshee r4102 - in trunk/banshee: . src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea



Author: abock
Date: Wed Jun  4 00:08:54 2008
New Revision: 4102
URL: http://svn.gnome.org/viewvc/banshee?rev=4102&view=rev

Log:
2008-06-03  Aaron Bockover  <abock gnome org>

    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs:
    Remove the Iterate event from the event mask
    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs:
    Do not update the popup since now all of its children do their own
    state/event handling

    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs:
    Removed a bunch of crappy legacy code for showing the position/duration
    via the label and progress bar; replaced with our standard
    SeekSlider widget in horizontal mode (BGO #536396)



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.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/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs	Wed Jun  4 00:08:54 2008
@@ -157,8 +157,7 @@
                 }
             }
 
-            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, 
-               PlayerEvent.Iterate |
+            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.StartOfStream |
                PlayerEvent.EndOfStream |
                PlayerEvent.TrackInfoUpdated |

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	Wed Jun  4 00:08:54 2008
@@ -39,13 +39,8 @@
 {
     public class TrackInfoPopup : Gtk.Window
     {
-        private uint position;
-        private uint duration;
         private TrackInfoDisplay header;
-        private VBox header_box = new VBox ();
-        
-        private Label position_label;
-        private LinearProgress linear_progress;
+        private ConnectedSeekSlider seek_slider;
     
         public TrackInfoPopup () : base (Gtk.WindowType.Popup)
         {
@@ -54,22 +49,7 @@
             Resizable = false;
             TypeHint = Gdk.WindowTypeHint.Notification;
             
-            // 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);
+            VBox box = new VBox ();
             
             header = new TrackInfoDisplay ();
             header.SetSizeRequest (320, 64);
@@ -77,15 +57,13 @@
             Alignment alignment = new Alignment (1.0f, 1.0f, 0.0f, 0.0f);
             alignment.SetPadding (6, 3, 6, 3);
             alignment.Add (header);
-            alignment.Show ();
+            box.PackStart (alignment, true, true, 0);
             
-            header_box.PackStart (alignment, true, true, 0);
-            header_box.PackStart (position_box, false, false, 0);
-            header.Show ();
-            position_box.ShowAll ();
+            seek_slider = new ConnectedSeekSlider (SeekSliderLayout.Horizontal);
+            box.PackStart (seek_slider, false, false, 0);
             
-            Add (header_box);
-            header_box.Show ();
+            Add (box);
+            box.ShowAll ();
         }
         
         public override void Dispose ()
@@ -100,26 +78,5 @@
                 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	Wed Jun  4 00:08:54 2008
@@ -205,19 +205,7 @@
             
             popup = new TrackInfoPopup ();
             PositionPopup ();
-            
-            // Get initial track progress information.
-            if (ServiceManager.PlayerEngine.CurrentTrack != null) {
-                popup.Duration = (uint)ServiceManager.PlayerEngine.CurrentTrack.Duration.TotalSeconds;
-                // Minus one second because PlayerEngine is weird and adds +1 sec if we're paused.
-                // If we're unpaused, the TrackInfoPopup should fix itself to the real value 
-                // before it displays properly, anyway. It's a win-win! :)
-                popup.Position = (ServiceManager.PlayerEngine.Position / 1000) - 1;
-            } else {
-                popup.Duration = 0;
-                popup.Position = 0;
-            }
-            
+
             popup.Show ();
         }
         
@@ -319,18 +307,6 @@
         public void OnPlayerEvent (PlayerEventArgs args)
         {
             switch (args.Event) {
-                case PlayerEvent.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 PlayerEvent.StartOfStream:
                     can_show_popup = true;
                     break;



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