[banshee] [Podcasts] Fix issue with PodcastFeedView rendering



commit a6f27e51413da04e3182aa1469d2be10c15cecc7
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Mar 10 21:31:01 2010 -0800

    [Podcasts] Fix issue with PodcastFeedView rendering

 .../Banshee.Collection.Gui/ColumnCellAlbum.cs      |    2 +-
 .../Banshee.Podcasting.Gui/ColumnCellPodcast.cs    |   26 ++++++++++++++++++++
 .../Banshee.Podcasting.Gui/PodcastFeedView.cs      |    4 ++-
 3 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
index 716fad0..2d0108c 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
@@ -149,7 +149,7 @@ namespace Banshee.Collection.Gui
             PangoCairoHelper.ShowLayout (context.Context, layout);
         }
 
-        public int ComputeRowHeight (Widget widget)
+        public virtual int ComputeRowHeight (Widget widget)
         {
             int height;
             int text_w, text_h;
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs
index d898fa2..7f94010 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/ColumnCellPodcast.cs
@@ -143,5 +143,31 @@ namespace Banshee.Podcasting.Gui
             context.Context.Color = text_color;
             PangoCairoHelper.ShowLayout (context.Context, layout);
         }
+
+        public override int ComputeRowHeight (Widget widget)
+        {
+            int height;
+            int text_w, text_h;
+
+            Pango.Layout layout = new Pango.Layout (widget.PangoContext);
+            layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
+
+            layout.FontDescription.Weight = Pango.Weight.Bold;
+            layout.SetText ("W");
+            layout.GetPixelSize (out text_w, out text_h);
+            height = text_h;
+
+            layout.FontDescription.Weight = Pango.Weight.Normal;
+            layout.FontDescription.Size = (int)(layout.FontDescription.Size * Pango.Scale.Small);
+            layout.FontDescription.Style = Pango.Style.Italic;
+            layout.SetText ("W");
+            layout.GetPixelSize (out text_w, out text_h);
+            height += text_h;
+
+            layout.FontDescription.Dispose ();
+            layout.Dispose ();
+
+            return (height < image_size ? image_size : height) + 6;
+        }
     }
 }
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastFeedView.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastFeedView.cs
index f16724f..d9414a0 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastFeedView.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastFeedView.cs
@@ -68,7 +68,9 @@ namespace Banshee.Podcasting.Gui
 
         protected override Gdk.Size OnMeasureChild ()
         {
-            return renderer.Measure (this);
+            return ViewLayout != null
+                ? base.OnMeasureChild ()
+                : new Gdk.Size (0, renderer.ComputeRowHeight (this));
         }
     }
 



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