[banshee] [ListView] Work around grid related a11y crashes



commit aee089450a6b4912376c7fbc776437673ace96d2
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed May 12 18:50:14 2010 -0700

    [ListView] Work around grid related a11y crashes

 .../Accessibility/ListViewAccessible.cs            |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
index 035b762..a9ba835 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
@@ -96,6 +96,10 @@ namespace Hyena.Data.Gui.Accessibility
                 return cell_cache[index];
             }
 
+            // FIXME workaround to prevent crashing on Grid ListViews
+            if (list_view.ColumnController == null)
+                return null;
+
             var columns = list_view.ColumnController.Where (c => c.Visible);
 
             if (index - n_columns < 0) {
@@ -134,7 +138,10 @@ namespace Hyena.Data.Gui.Accessibility
 
         private void OnSelectionFocusChanged (object o, EventArgs a)
         {
-            GLib.Signal.Emit (this, "active-descendant-changed", ActiveCell.Handle);
+            var cell = ActiveCell;
+            if (cell != null) {
+                GLib.Signal.Emit (this, "active-descendant-changed", cell.Handle);
+            }
         }
 
         private Atk.Object ActiveCell {
@@ -147,7 +154,11 @@ namespace Hyena.Data.Gui.Accessibility
         }
 
         private int n_columns {
-            get { return list_view.ColumnController.Count (c => c.Visible); }
+            get {
+                return list_view.ColumnController != null
+                    ? list_view.ColumnController.Count (c => c.Visible)
+                    : 1;
+            }
         }
 
         private int n_rows {



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