[banshee] TrackInfoDisplay: proper fix for not bold but invisible text (bgo#732838)



commit d3994e497842cb321c8f50f7c0c0af445f9e7c97
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Jul 16 20:16:50 2014 +0200

    TrackInfoDisplay: proper fix for not bold but invisible text (bgo#732838)
    
    OnStyleUpdated() was in charge of filling the color fields of
    TrackInfoDisplay class with values, but it could happen that
    these colors were retrieved before OnStyleUpdated() hadn't been
    run yet even once, which resulted in a black color, but all
    transparent (alpha=0). The way to fix it is make the colors be
    properties that query the proper value on demand if the value
    had not been set yet, or is resetted.
    
    Thanks to Bertrand Lorentz for the heads up about the hint of
    what was really going on badly.

 .../Banshee.Gui.Widgets/TrackInfoDisplay.cs        |   35 +++++++++++++++----
 1 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs 
b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
index 7ba287d..179ee3c 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
@@ -81,16 +81,34 @@ namespace Banshee.Gui.Widgets
                 = PixbufImageSurface.Create (IconThemeUtils.LoadIcon (MissingIconSizeRequest, 
MissingVideoIconName), true)); }
         }
 
-        protected virtual Cairo.Color BackgroundColor { get; set; }
+        private Cairo.Color? background_color;
+        protected virtual Cairo.Color BackgroundColor {
+            get {
+                if (!background_color.HasValue) {
+                    background_color = CairoExtensions.GdkRGBAToCairoColor (StyleContext.GetBackgroundColor 
(StateFlags.Normal));
+                }
+                return background_color.Value;
+            }
+        }
 
-        private Cairo.Color text_color;
+        private Cairo.Color? text_color;
         protected virtual Cairo.Color TextColor {
-            get { return text_color; }
+            get {
+                if (!text_color.HasValue) {
+                    text_color = CairoExtensions.GdkRGBAToCairoColor (StyleContext.GetColor 
(StateFlags.Normal));
+                }
+                return text_color.Value;
+            }
         }
 
-        private Cairo.Color text_light_color;
+        private Cairo.Color? text_light_color;
         protected virtual Cairo.Color TextLightColor {
-            get { return text_light_color; }
+            get {
+                if (!text_light_color.HasValue) {
+                    text_light_color = Hyena.Gui.Theming.GtkTheme.GetCairoTextMidColor (this);
+                }
+                return text_light_color.Value;
+            }
         }
 
         private TrackInfo current_track;
@@ -202,9 +220,10 @@ namespace Banshee.Gui.Widgets
         {
             base.OnStyleUpdated ();
 
-            text_color = CairoExtensions.GdkRGBAToCairoColor (StyleContext.GetColor (StateFlags.Normal));
-            BackgroundColor = CairoExtensions.GdkRGBAToCairoColor (StyleContext.GetBackgroundColor 
(StateFlags.Normal));
-            text_light_color = Hyena.Gui.Theming.GtkTheme.GetCairoTextMidColor (this);
+            // these will be refreshed to new values, on demand, via their properties
+            text_color = null;
+            background_color = null;
+            text_light_color = null;
 
             ResetMissingImages ();
 


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