banshee r4598 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Gui



Author: abock
Date: Tue Sep 23 22:23:41 2008
New Revision: 4598
URL: http://svn.gnome.org/viewvc/banshee?rev=4598&view=rev

Log:
2008-09-23  Aaron Bockover  <abock gnome org>

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs:
    Removed the old Style override that didn't even work and caused theme
    change breakage

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
    Use the new and working AdaptGtkRcStyle utility

    * src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs: Implement
    AdaptGtkRcStyle utility to look up colors through GtkRc and adapt
    them to a given widget




Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	Tue Sep 23 22:23:41 2008
@@ -53,8 +53,18 @@
             get { return theme; }
         }
         
+        private bool changing_style = false;
+        
         protected override void OnStyleSet (Style old_style)
         {
+            if (changing_style) {
+                return;
+            }
+            
+            changing_style = true;
+            GtkUtilities.AdaptGtkRcStyle (this, typeof (TreeView));
+            changing_style = false;
+            
             base.OnStyleSet (old_style);
             RecomputeRowHeight = true;
             theme = new GtkTheme (this);

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs	Tue Sep 23 22:23:41 2008
@@ -76,8 +76,6 @@
             event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
             event_window.UserData = Handle;
             
-            Style = Gtk.Rc.GetStyleByPaths (Settings, "*.GtkTreeView", "*.GtkTreeView", GType);
-            
             OnDragSourceSet ();
             MoveResize (Allocation);
             

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/GtkUtilities.cs	Tue Sep 23 22:23:41 2008
@@ -115,6 +115,25 @@
             return color;
         }
         
+        public static void AdaptGtkRcStyle (Widget adaptee, Type adapter) 
+        {
+            GLib.GType type = (GLib.GType)adapter;
+            string path = String.Format ("*.{0}", type);
+            AdaptGtkRcStyle (adaptee, type, path, path);
+        }
+        
+        public static void AdaptGtkRcStyle (Widget adaptee, GLib.GType adapter, string widgetPath, string classPath)
+        {
+            Style style = Gtk.Rc.GetStyleByPaths (adaptee.Settings, widgetPath, classPath, adapter);
+
+            foreach (StateType state in Enum.GetValues (typeof (StateType))) {
+                adaptee.ModifyBase (state, style.Base (state));
+                adaptee.ModifyBg (state, style.Background (state));
+                adaptee.ModifyFg (state, style.Foreground (state));
+                adaptee.ModifyText (state, style.Text (state));
+            }
+        }
+        
         public static T StyleGetProperty<T> (Widget widget, string property, T default_value)
         {
             object result = widget.StyleGetProperty (property);



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