[banshee] [MeeGoTheme] new MeeGo theming, custom SourceView



commit 0e4c07a6c0bc364a3ab313f68f786dacbdfb43de
Author: Aaron Bockover <abockover novell com>
Date:   Sun May 2 16:26:46 2010 -0400

    [MeeGoTheme] new MeeGo theming, custom SourceView
    
    Load the MeeGoTheme as a PostInitializeGtk extension so that the MeeGo
    theme is loaded before the main Nereid client comes up.

 .../Banshee.MeeGo/Banshee.MeeGo.addin.xml          |    4 +
 .../Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs      |    2 -
 .../Banshee.MeeGo/Banshee.MeeGo/MeeGoTheme.cs      |   79 ++++++++++++++++++-
 3 files changed, 78 insertions(+), 7 deletions(-)
---
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
index b1f97e7..1b39701 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
@@ -18,5 +18,9 @@
   <Extension path="/Banshee/ServiceManager/Service">
     <Service class="Banshee.MeeGo.MeeGoService"/>
   </Extension>
+
+  <Extension path="/Banshee/ThickClient/GtkBaseClient/PostInitializeGtk">
+    <PostInitializeGtk class="Banshee.MeeGo.MeeGoThemeLoader"/>
+  </Extension>
    
 </Addin>
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
index 13685fd..7d428fd 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
@@ -52,8 +52,6 @@ namespace Banshee.MeeGo
 
             Instance = this;
 
-            Hyena.Gui.Theming.ThemeEngine.SetCurrentTheme<MeeGoTheme> ();
-
             var timer = Log.DebugTimerStart ();
 
             try {
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoTheme.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoTheme.cs
index 957858a..a9db73c 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoTheme.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoTheme.cs
@@ -34,19 +34,41 @@ using Hyena.Gui.Theming;
 
 namespace Banshee.MeeGo
 {
+    public class MeeGoThemeLoader
+    {
+        public MeeGoThemeLoader ()
+        {
+            Hyena.Gui.Theming.ThemeEngine.SetCurrentTheme<MeeGoTheme> ();
+        }
+    }
+
     public class MeeGoTheme : GtkTheme
     {
         public MeeGoTheme (Widget widget) : base (widget)
         {
         }
 
-        private bool IsPanelWidget {
-            get { return Widget != null && Widget.Name.StartsWith ("meego-panel"); }
-        }
+        private bool IsSourceViewWidget;
+        private bool IsPanelWidget;
+        private bool IsRoundedFrameWidget;
 
         public override void PushContext ()
         {
-            PushContext (new ThemeContext () { Radius = 3 });
+            IsPanelWidget = Widget != null && Widget.Name.StartsWith ("meego-panel");
+            IsSourceViewWidget = Widget is Banshee.Sources.Gui.SourceView;
+            IsRoundedFrameWidget = Widget is Hyena.Widgets.RoundedFrame;
+
+            PushContext (new ThemeContext () {
+                Radius = IsRoundedFrameWidget || IsSourceViewWidget ? 0 : 3,
+                ToplevelBorderCollapse = true
+            });
+        }
+
+        protected override void OnColorsRefreshed ()
+        {
+            base.OnColorsRefreshed ();
+            TextMidColor = CairoExtensions.ColorShade (Colors.GetWidgetColor (
+                GtkColorClass.Background, StateType.Selected), 0.85);
         }
 
         public override void DrawFrameBackground (Cairo.Context cr, Gdk.Rectangle alloc,
@@ -59,9 +81,22 @@ namespace Banshee.MeeGo
 
         public override void DrawFrameBorder (Cairo.Context cr, Gdk.Rectangle alloc)
         {
-            if (!IsPanelWidget) {
+            if (IsPanelWidget) {
+                return;
+            } else if (!IsSourceViewWidget) {
                 base.DrawFrameBorder (cr, alloc);
+                return;
             }
+
+            cr.Color = TextMidColor;
+            cr.LineWidth = 1.0;
+            cr.Antialias = Cairo.Antialias.None;
+
+            cr.MoveTo (alloc.Right - 1, alloc.Top);
+            cr.LineTo (alloc.Right - 1, alloc.Bottom);
+            cr.Stroke ();
+
+            cr.Antialias = Cairo.Antialias.Default;
         }
 
         public override void DrawFrameBorderFocused (Cairo.Context cr, Gdk.Rectangle alloc)
@@ -70,6 +105,40 @@ namespace Banshee.MeeGo
                 base.DrawFrameBorderFocused (cr, alloc);
             }
         }
+
+        public override void DrawRowSelection (Cairo.Context cr, int x, int y, int width, int height,
+            bool filled, bool stroked, Cairo.Color color, CairoCorners corners)
+        {
+            if (!IsSourceViewWidget) {
+                base.DrawRowSelection (cr, x, y, width, height, filled,
+                    stroked, color, corners);
+                return;
+            }
+
+            y -= 1;
+            x -= 1;
+            width += 1;
+            height += 1;
+
+            base.DrawRowSelection (cr, x, y, width, height,
+                filled, false, color, corners);
+
+            if (stroked) {
+                cr.Color = CairoExtensions.ColorShade (color, 0.85);
+                cr.LineWidth = 1.0;
+                cr.Antialias = Cairo.Antialias.None;
+
+                cr.MoveTo (x, y);
+                cr.LineTo (x + width, y);
+                cr.Stroke ();
+
+                cr.MoveTo (x, y + height);
+                cr.LineTo (x + width, y + height);
+                cr.Stroke ();
+
+                cr.Antialias = Cairo.Antialias.Default;
+            }
+        }
     }
 }
 



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