[hyena] Fix ListView a11y crasher



commit 912eabdff02f468990ce21f31492d0ccba1dea5e
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sun Apr 25 16:01:48 2010 -0700

    Fix ListView a11y crasher
    
    ListViewAccessible wasn't setup to support the fact that a ListView's
    model (and therefore its Selection) can change over time (bgo#615892).
    This patch was based on one from Sandy Armstrong.

 .../Accessibility/ListViewAccessible.cs            |    4 ++--
 .../ListView/ListView_Interaction.cs               |    2 +-
 .../Hyena.Data.Gui/ListView/ListView_Model.cs      |    6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs b/src/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
index dc2f8c9..035b762 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
@@ -54,10 +54,10 @@ namespace Hyena.Data.Gui.Accessibility
             cell_cache = new Dictionary<int, ColumnCellAccessible> ();
 
             list_view.ModelChanged += (o, a) => OnModelChanged ();
-            list_view.Model.Reloaded += (o, a) => OnModelChanged ();
+            list_view.ModelReloaded += (o, a) => OnModelChanged ();
             OnModelChanged ();
 
-            list_view.Selection.FocusChanged += OnSelectionFocusChanged;
+            list_view.SelectionProxy.FocusChanged += OnSelectionFocusChanged;
             list_view.ActiveColumnChanged += OnSelectionFocusChanged;
 
             ListViewAccessible_Selection ();
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 74454c0..58c12a0 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -82,7 +82,7 @@ namespace Hyena.Data.Gui
         }
 
         public Selection Selection {
-            get { return model.Selection; }
+            get { return model == null ? null : model.Selection; }
         }
 
         private int HadjustmentValue {
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
index 47255d3..9570702 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
@@ -37,6 +37,7 @@ namespace Hyena.Data.Gui
     {
         #pragma warning disable 0067
         public event EventHandler ModelChanged;
+        public event EventHandler ModelReloaded;
         #pragma warning restore 0067
 
         public void SetModel (IListModel<T> model)
@@ -128,6 +129,11 @@ namespace Hyena.Data.Gui
         private void OnModelReloadedHandler (object o, EventArgs args)
         {
             OnModelReloaded ();
+
+            var handler = ModelReloaded;
+            if (handler != null) {
+                handler (this, EventArgs.Empty);
+            }
         }
 
         private void OnColumnControllerUpdatedHandler (object o, EventArgs args)



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