[hyena] Fix ListView a11y crasher



commit 362868d5b6ff13cf8eb4f0931a70c9560062ba41
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.

 src/Hyena/Hyena.Collections/SelectionProxy.cs |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/Hyena/Hyena.Collections/SelectionProxy.cs b/src/Hyena/Hyena.Collections/SelectionProxy.cs
index 6441e69..812fd54 100644
--- a/src/Hyena/Hyena.Collections/SelectionProxy.cs
+++ b/src/Hyena/Hyena.Collections/SelectionProxy.cs
@@ -36,6 +36,7 @@ namespace Hyena.Collections
 
         public event EventHandler Changed;
         public event EventHandler SelectionChanged;
+        public event EventHandler FocusChanged;
 
         public Selection Selection {
             get { return selection; }
@@ -43,13 +44,17 @@ namespace Hyena.Collections
                 if (selection == value)
                     return;
 
-                if (selection != null)
+                if (selection != null) {
                     selection.Changed -= HandleSelectionChanged;
+                    selection.FocusChanged -= HandleSelectionFocusChanged;
+                }
 
                 selection = value;
 
-                if (selection != null)
+                if (selection != null) {
                     selection.Changed += HandleSelectionChanged;
+                    selection.FocusChanged += HandleSelectionFocusChanged;
+                }
 
                 OnSelectionChanged ();
             }
@@ -63,6 +68,14 @@ namespace Hyena.Collections
             }
         }
 
+        protected virtual void OnFocusChanged ()
+        {
+            EventHandler handler = FocusChanged;
+            if (handler != null) {
+                handler (selection, EventArgs.Empty);
+            }
+        }
+
         protected virtual void OnSelectionChanged ()
         {
             EventHandler handler = SelectionChanged;
@@ -75,5 +88,10 @@ namespace Hyena.Collections
         {
             OnChanged ();
         }
+
+        private void HandleSelectionFocusChanged (object o, EventArgs args)
+        {
+            OnFocusChanged ();
+        }
     }
 }



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