[banshee/grid] [grid] allow BANSHEE_DISABLE_GRID on AlbumListView



commit c28bbb69d2c70ac4a070596ccaa3b9009b6f8532
Author: Aaron Bockover <abockover novell com>
Date:   Wed Mar 10 14:26:44 2010 -0800

    [grid] allow BANSHEE_DISABLE_GRID on AlbumListView
    
    If BANSHEE_DISABLE_GRID is set in the environment, the AlbumListView
    will render using the old list layout.

 .../Banshee.Collection.Gui/AlbumListView.cs        |   22 ++++++++++++++++---
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
index 1827402..d1919dd 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
@@ -40,16 +40,30 @@ namespace Banshee.Collection.Gui
 {
     public class AlbumListView : TrackFilterListView<AlbumInfo>
     {
+        private ColumnCellAlbum renderer;
+
         public AlbumListView () : base ()
         {
-            ViewLayout = new DataViewLayoutGrid () {
-                ChildAllocator = () => new DataViewChildAlbum (),
-                View = this
-            };
+            if (!String.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BANSHEE_DISABLE_GRID"))) {
+                column_controller.Add (new Column ("Album", renderer = new ColumnCellAlbum (), 1.0));
+                ColumnController = column_controller;
+            } else {
+                ViewLayout = new DataViewLayoutGrid () {
+                    ChildAllocator = () => new DataViewChildAlbum (),
+                    View = this
+                };
+            }
 
             ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.TrackInfoUpdated);
         }
 
+        protected override Gdk.Size OnMeasureChild ()
+        {
+            return ViewLayout != null
+                ? base.OnMeasureChild ()
+                : new Gdk.Size (0, renderer.ComputeRowHeight (this));
+        }
+
         private void OnPlayerEvent (PlayerEventArgs args)
         {
             // TODO: a) Figure out if the track that changed is actually in view



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