[banshee/a11y] [a11y] Notify cell accessibles when they are redrawn, indicator cells emit visible-data-changed



commit 2f75ffa3ed65c4244baa89d1ffcb6501d4a3f068
Author: Eitan Isaacson <eitan ascender com>
Date:   Mon Oct 12 12:06:08 2009 -0700

    [a11y] Notify cell accessibles when they are redrawn, indicator cells emit visible-data-changed

 .../ColumnCellStatusIndicator.cs                   |   15 ++++++++++++++-
 .../Accessibility/ColumnCellAccessible.cs          |    4 ++++
 .../Accessibility/ICellAccessibleParent.cs         |    1 +
 .../Accessibility/ListViewAccessible.cs            |   13 +++++++++++++
 .../Hyena.Data.Gui/ListView/ListView_Accessible.cs |    5 +++++
 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |    2 ++
 6 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
index 00f68a3..06579ff 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellStatusIndicator.cs
@@ -44,8 +44,21 @@ namespace Banshee.Collection.Gui
 {
     class ColumnCellStatusIndicatorAccessible : ColumnCellAccessible, Atk.ImageImplementor
     {
+        private string image_description;
+
         public ColumnCellStatusIndicatorAccessible (object bound_object, ColumnCellStatusIndicator cell, ICellAccessibleParent parent) : base (bound_object, cell as ColumnCell, parent)
         {
+            image_description = cell.GetTextAlternative (bound_object);
+        }
+
+        public override void Redrawn ()
+        {
+            string new_image_description = cell.GetTextAlternative (bound_object);
+
+            if (image_description != new_image_description)
+                GLib.Signal.Emit (this, "visible-data-changed");
+
+            image_description = new_image_description;
         }
 
         public string ImageLocale { get { return null; } }
@@ -65,7 +78,7 @@ namespace Banshee.Collection.Gui
 
         public string ImageDescription {
             get {
-                return cell.GetTextAlternative (bound_object);
+                return image_description;
             }
         }
 
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
index 40cbdb7..da2975a 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ColumnCellAccessible.cs
@@ -138,5 +138,9 @@ namespace Hyena.Data.Gui.Accessibility
         {
             return 0;
         }
+
+        public virtual void Redrawn ()
+        {
+        }
     }
 }
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
index 0ddc773..da4a29e 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ICellAccessibleParent.cs
@@ -39,5 +39,6 @@ namespace Hyena.Data.Gui.Accessibility
         bool IsCellSelected (ColumnCellAccessible cell);
         void InvokeColumnHeaderMenu (ColumnCellAccessible column);
         void ClickColumnHeader (ColumnCellAccessible column);
+        void CellRedrawn (int column, int row);
     }
 }
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 0a1524f..80d8f9b 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Accessibility/ListViewAccessible.cs
@@ -217,6 +217,19 @@ namespace Hyena.Data.Gui.Accessibility
             list_view.ClickColumnHeader (GetCellIndex (cell));
         }
 
+        public void CellRedrawn (int column, int row)
+        {
+            int index;
+            if (row >= 0)
+                index = row * n_columns + column + n_columns;
+            else
+                index = column;
+
+            if (cell_cache.ContainsKey (index)) {
+                cell_cache[index].Redrawn();
+            }
+        }
+
         #endregion
     }
 }
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
index f307c52..3b054af 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Accessible.cs
@@ -141,6 +141,11 @@ namespace Hyena.Data.Gui
             OnColumnLeftClicked (col);
         }
 
+        private void AccessibleCellRedrawn (int column, int row)
+        {
+            ((ICellAccessibleParent) Accessible).CellRedrawn (column, row);
+        }
+
     }
 
     internal class ListViewAccessibleFactory<T> : Atk.ObjectFactory
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 7acf88d..e9aef57 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -386,6 +386,8 @@ namespace Hyena.Data.Gui
             cell_context.Opaque = opaque;
             cell.Render (cell_context, dragging ? StateType.Normal : state, area.Width, area.Height);
             cairo_context.Restore ();
+
+            AccessibleCellRedrawn (column_index, row_index);
         }
         
         private void PaintDraggingColumn (Rectangle clip)



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