[banshee] [ListView] Render/adjustment fixes on null model



commit 4921a9a1535deaa92528e6bf37237ca7c11c5232
Author: Aaron Bockover <abockover novell com>
Date:   Mon Mar 29 13:15:19 2010 -0400

    [ListView] Render/adjustment fixes on null model
    
    Redraw the whole view when the model is set to null, and add a new
    property that allows skipping all rendering when the model is null,
    including the skipping borders/frame.
    
    Ensure vertical adjustment is set to 0 when model is set to null.

 .../ListView/ListView_Interaction.cs               |    4 ++++
 .../Hyena.Data.Gui/ListView/ListView_Model.cs      |    2 ++
 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |    6 ++++++
 3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index d66feb0..74454c0 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -938,6 +938,10 @@ namespace Hyena.Data.Gui
                 if (vadjustment.Value + vadjustment.PageSize > vadjustment.Upper) {
                     vadjustment.Value = vadjustment.Upper - vadjustment.PageSize;
                 }
+            } else if (vadjustment != null) {
+                // model is null
+                vadjustment.Upper = 0;
+                vadjustment.Lower = 0;
             }
 
             if (hadjustment != null) {
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
index 60409fd..47255d3 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
@@ -91,6 +91,8 @@ namespace Hyena.Data.Gui
         private void RefreshViewForModel (double? vpos)
         {
             if (Model == null) {
+                UpdateAdjustments ();
+                QueueDraw ();
                 return;
             }
 
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 2883132..05511c2 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -54,6 +54,8 @@ namespace Hyena.Data.Gui
             get { return theme; }
         }
 
+        public bool DoNotRenderNullModel { get; set; }
+
         private bool changing_style = false;
 
         protected override void OnStyleSet (Style old_style)
@@ -92,6 +94,10 @@ namespace Hyena.Data.Gui
 
         protected override bool OnExposeEvent (EventExpose evnt)
         {
+            if (DoNotRenderNullModel && Model == null) {
+                return true;
+            }
+
             var damage = new Rectangle ();
             foreach (Rectangle rect in evnt.Region.GetRectangles ()) {
                 damage = damage.Union (rect);



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