[hyena] ListView: Use StyleContext.Save and Restore instead of RemoveRegion



commit d206b19d476b565d400fe4c178010730695d8149
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Jun 14 18:31:31 2014 +0200

    ListView: Use StyleContext.Save and Restore instead of RemoveRegion
    
    It's clearer, and there's less risk of forgetting to reset something.

 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs 
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index f2671bc..c31c2bb 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -277,12 +277,13 @@ namespace Hyena.Data.Gui
             // 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];
+                StyleContext.Save ();
                 StyleContext.AddRegion ("column", RegionFlags.Sorted);
                 StyleContext.RenderBackground (cr,
                     list_rendering_alloc.X + col.X1 - HadjustmentValue,
                     header_rendering_alloc.Bottom + Theme.BorderWidth,
                     col.Width, list_rendering_alloc.Height + Theme.InnerBorderWidth * 2);
-                StyleContext.RemoveRegion ("column");
+                StyleContext.Restore ();
             }
 
             clip.Intersect (list_rendering_alloc);
@@ -322,14 +323,14 @@ namespace Hyena.Data.Gui
                         selected_focus_alloc = single_list_alloc;
                     }
                 } else {
+                    StyleContext.Save ();
                     StyleContext.AddClass ("cell");
                     if (rules_hint) { // TODO: check also 
gtk_widget_style_get(widget,"allow-rules",&allow_rules,NULL);
                         StyleContext.AddRegion ("row", ri % 2 != 0 ? RegionFlags.Odd : RegionFlags.Even);
                     }
                     StyleContext.RenderBackground (cr, single_list_alloc.X, single_list_alloc.Y,
                         single_list_alloc.Width, single_list_alloc.Height);
-                    StyleContext.RemoveRegion ("row");
-                    StyleContext.RemoveClass ("cell");
+                    StyleContext.Restore ();
 
                     PaintReorderLine (cr, ri, single_list_alloc);
 


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