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



Author: abock
Date: Wed Jun  4 15:44:59 2008
New Revision: 4107
URL: http://svn.gnome.org/viewvc/banshee?rev=4107&view=rev

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

    * src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs:
    When the widget is created and the engine is in the paused state,
    synthesize an engine iterate event so the correct state is reflected
    in the slider and label (BGO #536564)

    * src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:
    Implement OnSizeRequested to properly do size requisitioning (BGO #536564)

    * src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.cs:
    Updated to reflect small API change



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs
   trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs
   trunk/banshee/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/TrackInfoPopup.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	Wed Jun  4 15:44:59 2008
@@ -44,10 +44,7 @@
     {
         private SeekSlider seek_slider;
         private StreamPositionLabel stream_position_label;
-        public StreamPositionLabel Label {
-            get { return stream_position_label; }
-        }
-
+    
         public ConnectedSeekSlider () : this (SeekSliderLayout.Vertical)
         {
         }
@@ -68,6 +65,12 @@
             ServiceManager.PlayerEngine.TrackIntercept += OnTrackIntercept;
             
             seek_slider.SeekRequested += OnSeekRequested;
+            
+            // Initialize the display if we're paused since we won't get any
+            // events or state change until something actually happens (BGO #536564)
+            if (ServiceManager.PlayerEngine.CurrentState == PlayerState.Paused) {
+                OnPlayerEngineTick ();
+            }
         }
 
         public void Disconnect ()

Modified: trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs	Wed Jun  4 15:44:59 2008
@@ -47,6 +47,7 @@
             
             this.seekRange = seekRange;
             this.seekRange.ValueChanged += OnSliderUpdated;
+            
         }
         
         protected override void OnRealized ()
@@ -62,15 +63,25 @@
             if (layout != null) {
                 layout.Dispose ();
             }
+            
             layout = new Pango.Layout (PangoContext);
             layout.FontDescription = PangoContext.FontDescription.Copy ();
             layout.Ellipsize = Pango.EllipsizeMode.None;
+        }
+        
+        protected override void OnSizeRequested (ref Gtk.Requisition requisition)
+        {
+            if (!IsRealized || layout == null) {
+                return;
+            }
             
-            layout.SetMarkup (String.Format (format_string, "W"));
+            EnsureStyle ();
             
             int width, height;
             layout.GetPixelSize (out width, out height);
-            HeightRequest = height;
+            
+            requisition.Width = width;
+            requisition.Height = height;
         }
         
         protected override bool OnExposeEvent (Gdk.EventExpose evnt)
@@ -96,12 +107,8 @@
             int width, height;
             layout.GetPixelSize (out width, out height);
             
-            if (width > Allocation.Width) {
-                WidthRequest = width;
-            }
-            
             int x = Allocation.X + ((Allocation.Width - width) / 2);
-            int y = Allocation.Y + ((Allocation.Height - HeightRequest) / 2);
+            int y = Allocation.Y + ((Allocation.Height - height) / 2);
             Gdk.Rectangle rect = evnt.Area;
             
             if (render_bar) {
@@ -141,7 +148,7 @@
         private void UpdateLabel (string text)
         {
             layout.SetMarkup (String.Format (format_string, GLib.Markup.EscapeText (text)));
-            QueueDraw ();
+            QueueResize ();
         }
         
         private static string FormatDuration (long time)

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 15:44:59 2008
@@ -56,7 +56,7 @@
             header.SetSizeRequest (320, 64);
             
             seek_slider = new ConnectedSeekSlider (SeekSliderLayout.Horizontal);
-            seek_slider.Label.FormatString = "<small>{0}</small>";
+            seek_slider.StreamPositionLabel.FormatString = "<small>{0}</small>";
             seek_slider.LeftPadding = 0;
             seek_slider.RightPadding = 0;
 
@@ -73,7 +73,7 @@
             base.Dispose ();
         }
         
-        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
+        protected override bool OnExposeEvent (Gdk.EventExpose evnt)
         {
             Gtk.Style.PaintFlatBox (Style, GdkWindow, StateType.Normal, ShadowType.Out, evnt.Area, this, "tooltip", 
                 0, 0, Allocation.Width, Allocation.Height);



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