banshee r4255 - in trunk/banshee: . src/Core/Banshee.Widgets/Banshee.Widgets



Author: abock
Date: Fri Jul 25 20:47:40 2008
New Revision: 4255
URL: http://svn.gnome.org/viewvc/banshee?rev=4255&view=rev

Log:
2008-07-25  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:
    Prevent crash when switching to mini-mode in a paused state; ensure stream
    position label's layout is rebuilt when the theme changes to account for
    any potential font size change (BGO #541102)



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs

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	Fri Jul 25 20:47:40 2008
@@ -47,13 +47,11 @@
             
             this.seekRange = seekRange;
             this.seekRange.ValueChanged += OnSliderUpdated;
-            
         }
         
         protected override void OnRealized ()
         {
             base.OnRealized ();
-            
             BuildLayouts ();
             UpdateLabel ();
         }
@@ -69,6 +67,20 @@
             layout.Ellipsize = Pango.EllipsizeMode.None;
         }
         
+        private bool first_style_set = false;
+        
+        protected override void OnStyleSet (Style old_style)
+        {
+            base.OnStyleSet (old_style);
+            
+            if (first_style_set) {
+                BuildLayouts ();
+                UpdateLabel ();
+            }
+            
+            first_style_set = true;
+        }
+        
         protected override void OnSizeRequested (ref Gtk.Requisition requisition)
         {
             if (!IsRealized || layout == null) {
@@ -130,6 +142,10 @@
 
         private void UpdateLabel ()
         {
+            if (!IsRealized || layout == null) {
+                return;
+            }
+            
             if (is_buffering) {
                 double progress = buffering_progress * 100.0;
                 UpdateLabel (String.Format ("{0}: {1}%", Catalog.GetString("Buffering"), progress.ToString ("0.0")));
@@ -147,6 +163,10 @@
         
         private void UpdateLabel (string text)
         {
+            if (!IsRealized || layout == null) {
+                return;
+            }
+            
             layout.SetMarkup (String.Format (format_string, GLib.Markup.EscapeText (text)));
             QueueResize ();
         }



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