banshee r4112 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: abock
Date: Wed Jun  4 19:09:00 2008
New Revision: 4112
URL: http://svn.gnome.org/viewvc/banshee?rev=4112&view=rev

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

    * src/Clients/Nereid/Nereid/PlayerInterface.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListViewBase.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs:
    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs:
    A pretty disgusting hack that forces the style of our source view
    GtkTreeView into our custom ListView widget so at least the ListView
    will end up with the same color set as the GtkTreeView; this is a
    giant and ugly hack that works around a pretty serious bug in some of
    Ubuntu's themes where the selection background color is different for
    GtkTreeView widgets than for other widgets causing inconsistency and
    usability issues when reading text on the darker background (BGO #534731);
    https://bugs.launchpad.net/ubuntu/+source/human-theme/+bug/237261

    The only reason I opted to work around this downstream bug was that some
    users reported it difficult to read text due to the contrast issue, so
    I view this as a usability problem more than a cosmetic one.




Added:
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListViewBase.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
   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.mdp
   trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am

Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	Wed Jun  4 19:09:00 2008
@@ -172,6 +172,7 @@
             view_container = new ViewContainer ();
             
             source_view = new SourceView ();
+            ListViewBase.TreeViewStyleAdapter = source_view;
             composite_view = new CompositeTrackSourceContents ();
             
             Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow ();

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs	Wed Jun  4 19:09:00 2008
@@ -28,7 +28,7 @@
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : Gtk.Widget, IListView<T>
+    public partial class ListView<T> : ListViewBase, IListView<T>
     {
         public ListView ()
         {

Added: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListViewBase.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListViewBase.cs	Wed Jun  4 19:09:00 2008
@@ -0,0 +1,82 @@
+//
+// ListViewBase.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Gtk;
+
+namespace Hyena.Data.Gui
+{
+    public class ListViewBase : Widget
+    {
+        private static TreeView tree_view;
+        public static TreeView TreeViewStyleAdapter {
+            get { return tree_view; }
+            set { tree_view = value; }
+        }
+        
+        public ListViewBase ()
+        {
+            if (TreeViewStyleAdapter != null) {
+                TreeViewStyleAdapter.StyleSet += OnTreeViewStyleAdapterStyleSet;
+            }
+        }
+        
+        public override void Dispose ()
+        {
+            if (TreeViewStyleAdapter != null) {
+                TreeViewStyleAdapter.StyleSet -= OnTreeViewStyleAdapterStyleSet;
+            }
+            
+            base.Dispose ();
+        }
+        
+        protected override void OnRealized ()
+        {
+            base.OnRealized ();
+            AdaptTreeViewStyle (TreeViewStyleAdapter);
+        }
+
+        private void OnTreeViewStyleAdapterStyleSet (object o, StyleSetArgs args)
+        {
+            AdaptTreeViewStyle (TreeViewStyleAdapter);
+        }
+        
+        public void AdaptTreeViewStyle (TreeView treeView)
+        {
+            if (treeView == null || !treeView.IsRealized) {
+                return;
+            }
+            
+            foreach (StateType state in Enum.GetValues (typeof (StateType))) {
+                ModifyBg (state, treeView.Style.Background (state));
+                ModifyFg (state, treeView.Style.Foreground (state));
+                ModifyBase (state, treeView.Style.Base (state));
+            }
+        }
+    }
+}

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs	Wed Jun  4 19:09:00 2008
@@ -43,7 +43,7 @@
                 (uint)TargetType.ModelSelection);
     }
     
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         private static TargetEntry [] drag_drop_dest_entries = new TargetEntry [] {
             ListViewDragDropTarget.ModelSelection

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	Wed Jun  4 19:09:00 2008
@@ -33,7 +33,7 @@
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         internal struct CachedColumn
         {

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	Wed Jun  4 19:09:00 2008
@@ -35,7 +35,7 @@
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         private Adjustment vadjustment;
         public Adjustment Vadjustment {

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	Wed Jun  4 19:09:00 2008
@@ -33,7 +33,7 @@
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         public void SetModel (IListModel<T> model)
         {

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	Wed Jun  4 19:09:00 2008
@@ -40,7 +40,7 @@
 {
     public delegate int ListViewRowHeightHandler (Widget widget);
 
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         private Cairo.Context cairo_context;
         private CellContext cell_context;

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	Wed Jun  4 19:09:00 2008
@@ -34,7 +34,7 @@
 
 namespace Hyena.Data.Gui
 {
-    public partial class ListView<T> : Widget
+    public partial class ListView<T> : ListViewBase
     {
         private Rectangle list_rendering_alloc;
         private Rectangle header_rendering_alloc;

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp	Wed Jun  4 19:09:00 2008
@@ -82,6 +82,7 @@
     <File name="Hyena.Widgets/RatingMenuItem.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.Widgets/ComplexMenuItem.cs" subtype="Code" buildaction="Compile" />
     <File name="Hyena.Gui/RatingRenderer.cs" subtype="Code" buildaction="Compile" />
+    <File name="Hyena.Data.Gui/ListView/ListViewBase.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am	Wed Jun  4 19:09:00 2008
@@ -21,6 +21,7 @@
 	Hyena.Data.Gui/ListView/ListView_Model.cs \
 	Hyena.Data.Gui/ListView/ListView_Rendering.cs \
 	Hyena.Data.Gui/ListView/ListView_Windowing.cs \
+	Hyena.Data.Gui/ListView/ListViewBase.cs \
 	Hyena.Data.Gui/ListViewTestModule.cs \
 	Hyena.Data.Gui/ObjectListView.cs \
 	Hyena.Data.Gui/RowActivatedHandler.cs \



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