[hyena] ListView: carry out a TODO in ListView_Rendering::PaintList()



commit 13fa671f49a382f0947f8fe106011267b1d89407
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Mon Aug 5 22:42:25 2013 +0200

    ListView: carry out a TODO in ListView_Rendering::PaintList()
    
    The PaintList() method is huge, so the recommendation in the TODO to
    factor out (extract method) this if{} block is a good one. This
    way, adding a descriptive method make us not need the comment anymore.
    
    Splitting the if() condition in two is also a bit more readable.

 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |   24 +++++++++++++------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs 
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index dd0cca8..51355a3 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -265,20 +265,28 @@ namespace Hyena.Data.Gui
 
 #region List Rendering
 
+        void RenderDarkBackgroundInSortedColumn ()
+        {
+            if (pressed_column_is_dragging && pressed_column_index == sort_column_index) {
+                return;
+            }
+
+            CachedColumn col = column_cache [sort_column_index];
+            Theme.DrawRowRule (cairo_context,
+                               list_rendering_alloc.X + col.X1 - HadjustmentValue,
+                               header_rendering_alloc.Bottom + Theme.BorderWidth,
+                               col.Width,
+                               list_rendering_alloc.Height + Theme.InnerBorderWidth * 2);
+        }
+
         private void PaintList (Rectangle clip)
         {
             if (ChildSize.Height <= 0) {
                 return;
             }
 
-            // TODO factor this out?
-            // Render the sort effect to the GdkWindow.
-            if (sort_column_index != -1 && (!pressed_column_is_dragging || pressed_column_index != 
sort_column_index)) {
-                CachedColumn col = column_cache[sort_column_index];
-                Theme.DrawRowRule (cairo_context,
-                    list_rendering_alloc.X + col.X1 - HadjustmentValue,
-                    header_rendering_alloc.Bottom + Theme.BorderWidth,
-                    col.Width, list_rendering_alloc.Height + Theme.InnerBorderWidth * 2);
+            if (sort_column_index != -1) {
+                RenderDarkBackgroundInSortedColumn ();
             }
 
             clip.Intersect (list_rendering_alloc);


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