[banshee/a11y: 3/27] [a11y] Factored out header left click.



commit 0f9fb2bfda2dbcce2ac288ff9d45ce22acf5485c
Author: Eitan Isaacson <eitan ascender com>
Date:   Wed Sep 30 09:41:59 2009 -0700

    [a11y] Factored out header left click.

 .../Hyena.Data.Gui/ListView/ListView_Header.cs     |   28 ++++++++++++++++++++
 .../ListView/ListView_Interaction.cs               |   28 ++-----------------
 2 files changed, 31 insertions(+), 25 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index ef150bd..a7e08c4 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
@@ -245,6 +245,34 @@ namespace Hyena.Data.Gui
             UpdateAdjustments ();
             QueueDraw ();
         }
+        protected virtual void OnColumnLeftClicked (Column clickedColumn)
+        {
+            if (Model is ISortable && clickedColumn is ISortableColumn) {
+                    ISortableColumn sort_column = clickedColumn as ISortableColumn;
+                    ISortable sortable = Model as ISortable;
+
+                    // Change the sort-type with every click
+                    switch (sort_column.SortType) {
+                        case SortType.Ascending:    sort_column.SortType = SortType.Descending; break;
+                        case SortType.Descending:   sort_column.SortType = SortType.None; break;
+                        case SortType.None:         sort_column.SortType = SortType.Ascending; break;
+                    }
+
+                    // If we're switching to a different column or we aren't reorderable and the type is None, sort Ascending
+                    if (sort_column != ColumnController.SortColumn || (!IsEverReorderable && sort_column.SortType == SortType.None)) {
+                        sort_column.SortType = SortType.Ascending;
+                    }
+
+                    sortable.Sort (sort_column);
+                    ColumnController.SortColumn = sort_column;
+                    IsReorderable = sortable.SortColumn == null || sortable.SortColumn.SortType == SortType.None;
+
+                    Model.Reload ();
+                    RecalculateColumnSizes ();
+                    RegenerateColumnCache ();
+                    InvalidateHeader ();
+            }
+        }
         
         protected virtual void OnColumnRightClicked (Column clickedColumn, int x, int y)
         {
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 355fb16..589b781 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -493,31 +493,9 @@ namespace Hyena.Data.Gui
         {
             if (pressed_column_index >= 0 && pressed_column_index < column_cache.Length) {
                 Column column = column_cache[pressed_column_index].Column;
-                if (column != null && Model is ISortable && column is ISortableColumn) {
-                    ISortableColumn sort_column = column as ISortableColumn;
-                    ISortable sortable = Model as ISortable;
-
-                    // Change the sort-type with every click
-                    switch (sort_column.SortType) {
-                        case SortType.Ascending:    sort_column.SortType = SortType.Descending; break;
-                        case SortType.Descending:   sort_column.SortType = SortType.None; break;
-                        case SortType.None:         sort_column.SortType = SortType.Ascending; break;
-                    }
-
-                    // If we're switching to a different column or we aren't reorderable and the type is None, sort Ascending
-                    if (sort_column != ColumnController.SortColumn || (!IsEverReorderable && sort_column.SortType == SortType.None)) {
-                        sort_column.SortType = SortType.Ascending;
-                    }
-
-                    sortable.Sort (sort_column);
-                    ColumnController.SortColumn = sort_column;
-                    IsReorderable = sortable.SortColumn == null || sortable.SortColumn.SortType == SortType.None;
-
-                    Model.Reload ();
-                    RecalculateColumnSizes ();
-                    RegenerateColumnCache ();
-                    InvalidateHeader ();
-                }
+                Selection.FocusedColumnIndex = pressed_column_index;
+                if (column != null)
+                    OnColumnLeftClicked (column);
                 
                 pressed_column_index = -1;
                 return true;



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