[banshee/a11y: 1/27] [a11y] Renamed FocusedIndex to FocusedRowIndex.



commit 0ddbc98718b6b62bc9c98fda76ec73199ee7aabd
Author: Eitan Isaacson <eitan ascender com>
Date:   Wed Sep 30 09:38:26 2009 -0700

    [a11y] Renamed FocusedIndex to FocusedRowIndex.

 .../Banshee.Collection.Gui/BaseTrackListView.cs    |    2 +-
 .../Banshee.Gui/PlaybackActions.cs                 |    2 +-
 .../Banshee.Podcasting.Gui/PodcastActions.cs       |    2 +-
 .../ListView/ListView_Interaction.cs               |   30 ++++++++++----------
 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |    4 +-
 src/Libraries/Hyena/Hyena.Collections/Selection.cs |   16 +++++++---
 .../Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs    |    8 ++--
 src/Libraries/Hyena/Hyena.Data/BaseListModel.cs    |    2 +-
 8 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
index fb52f7e..8804009 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
@@ -141,7 +141,7 @@ namespace Banshee.Collection.Gui
 
             Selection.Clear (false);
             Selection.QuietSelect (current_index);
-            Selection.FocusedIndex = current_index;
+            Selection.FocusedRowIndex = current_index;
 
             if (old_index == -1 || IsRowVisible (old_index)) {
                 CenterOn (current_index);
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
index ae35070..9014cc3 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackActions.cs
@@ -259,7 +259,7 @@ namespace Banshee.Gui
                         ServiceManager.SourceManager.SetActiveSource (src);
                         track_src.TrackModel.Selection.Clear (false);
                         track_src.TrackModel.Selection.Select (i);
-                        track_src.TrackModel.Selection.FocusedIndex = i;
+                        track_src.TrackModel.Selection.FocusedRowIndex = i;
                         track_list.CenterOn (i);
                         track_list.GrabFocus ();
                     }
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
index 1a137e1..c307e63 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastActions.cs
@@ -535,7 +535,7 @@ namespace Banshee.Podcasting.Gui
                     int new_i = ActiveDbSource.TrackModel.IndexOf (new_selection_track);
                     if (new_i != -1) {
                         ActiveDbSource.TrackModel.Selection.Clear (false);
-                        ActiveDbSource.TrackModel.Selection.FocusedIndex = new_i;
+                        ActiveDbSource.TrackModel.Selection.FocusedRowIndex = new_i;
                         ActiveDbSource.TrackModel.Selection.Select (new_i);
                     }
                 }
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 1b44fee..355fb16 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
@@ -73,10 +73,10 @@ namespace Hyena.Data.Gui
             if (Model == null) {
                 return true;
             }
-        
+
             int row_limit;
             if (relative_row < 0) {
-                if (Selection.FocusedIndex == -1) {
+                if (Selection.FocusedRowIndex == -1) {
                     return false;
                 }
                 
@@ -85,11 +85,11 @@ namespace Hyena.Data.Gui
                 row_limit = Model.Count - 1;
             }
 
-            if (Selection.FocusedIndex == row_limit) {
+            if (Selection.FocusedRowIndex == row_limit) {
                 return true;
             }
             
-            int row_index = Math.Min (Model.Count - 1, Math.Max (0, Selection.FocusedIndex + relative_row));
+            int row_index = Math.Min (Model.Count - 1, Math.Max (0, Selection.FocusedRowIndex + relative_row));
 
             if (Selection != null) {
                 if ((modifier & Gdk.ModifierType.ControlMask) != 0) {
@@ -100,10 +100,10 @@ namespace Hyena.Data.Gui
                     // Otherwise, select the new row and scroll etc as necessary.
                     if (relative_row * relative_row != 1) {
                         Selection.SelectFromFirst (row_index, true);
-                    } else if (Selection.Contains (Selection.FocusedIndex)) {
+                    } else if (Selection.Contains (Selection.FocusedRowIndex)) {
                         Selection.SelectFromFirst (row_index, true);
                     } else {
-                        Selection.Select (Selection.FocusedIndex);
+                        Selection.Select (Selection.FocusedRowIndex);
                         return true;
                     }
                 } else {
@@ -121,10 +121,10 @@ namespace Hyena.Data.Gui
                     ScrollTo (y_at_row + RowHeight - (vadjustment.PageSize));
                 }
             } else if (vadjustment != null) {
-                ScrollTo (vadjustment.Value + ((row_index - Selection.FocusedIndex) * RowHeight));
+                ScrollTo (vadjustment.Value + ((row_index - Selection.FocusedRowIndex) * RowHeight));
             }
 
-            Selection.FocusedIndex = row_index;
+            Selection.FocusedRowIndex = row_index;
             InvalidateList ();
             return true;
         }
@@ -194,8 +194,8 @@ namespace Hyena.Data.Gui
                     break;
                 
                 case Gdk.Key.space:
-                    if (Selection != null && Selection.FocusedIndex != 1) {
-                        Selection.ToggleSelect (Selection.FocusedIndex);
+                    if (Selection != null && Selection.FocusedRowIndex != 1) {
+                        Selection.ToggleSelect (Selection.FocusedRowIndex);
                         handled = true;
                     }
                     break;
@@ -210,9 +210,9 @@ namespace Hyena.Data.Gui
         
         protected bool ActivateSelection ()
         {
-            if (Selection != null && Selection.FocusedIndex != -1) {
+            if (Selection != null && Selection.FocusedRowIndex != -1) {
                 Selection.Clear (false);
-                Selection.Select (Selection.FocusedIndex);
+                Selection.Select (Selection.FocusedRowIndex);
                 OnRowActivated ();
                 return true;
             }
@@ -664,10 +664,10 @@ namespace Hyena.Data.Gui
         
         protected virtual void OnRowActivated ()
         {
-            if (Selection.FocusedIndex != -1) {
+            if (Selection.FocusedRowIndex != -1) {
                 RowActivatedHandler<T> handler = RowActivated;
                 if (handler != null) {
-                    handler (this, new RowActivatedArgs<T> (Selection.FocusedIndex, model[Selection.FocusedIndex]));
+                    handler (this, new RowActivatedArgs<T> (Selection.FocusedRowIndex, model[Selection.FocusedRowIndex]));
                 }
             }
         }
@@ -705,7 +705,7 @@ namespace Hyena.Data.Gui
 
         private void FocusRow (int index)
         {
-            Selection.FocusedIndex = index;
+            Selection.FocusedRowIndex = index;
         }
 
 #endregion
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 d4c424e..5aa9e8d 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
@@ -238,7 +238,7 @@ namespace Hyena.Data.Gui
                     selection_height += single_list_alloc.Height;
                     selected_rows.Add (ri);
                     
-                    if (Selection.FocusedIndex == ri) {
+                    if (Selection.FocusedRowIndex == ri) {
                         selected_focus_alloc = single_list_alloc;
                     }
                 } else {
@@ -249,7 +249,7 @@ namespace Hyena.Data.Gui
                     
                     PaintReorderLine (ri, single_list_alloc);
                     
-                    if (Selection != null && Selection.FocusedIndex == ri && !Selection.Contains (ri) && HasFocus) {
+                    if (Selection != null && Selection.FocusedRowIndex == ri && !Selection.Contains (ri) && HasFocus) {
                         CairoCorners corners = CairoCorners.All;
                         
                         if (Selection.Contains (ri - 1)) {
diff --git a/src/Libraries/Hyena/Hyena.Collections/Selection.cs b/src/Libraries/Hyena/Hyena.Collections/Selection.cs
index 75768dd..178a9a8 100644
--- a/src/Libraries/Hyena/Hyena.Collections/Selection.cs
+++ b/src/Libraries/Hyena/Hyena.Collections/Selection.cs
@@ -52,17 +52,23 @@ namespace Hyena.Collections
         RangeCollection ranges = new RangeCollection ();
         private int max_index;
         private int first_selected_index;
-        private int focused_index = -1;
+        private int focused_row_index = -1;
         
         public event EventHandler Changed;
+        public event EventHandler FocusRowChanged;
         
         public Selection ()
         {
         }
-        
-        public int FocusedIndex {
-            get { return focused_index; }
-            set { focused_index = value; }
+
+        public int FocusedRowIndex {
+            get { return focused_row_index; }
+            set {
+                    focused_row_index = value;
+                    EventHandler handler = FocusRowChanged;
+                    if (handler != null)
+                        handler (this, EventArgs.Empty);
+                }
         }
 
         protected virtual void OnChanged ()
diff --git a/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs b/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
index 9698461..e334609 100644
--- a/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
+++ b/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
@@ -310,10 +310,10 @@ namespace Hyena.Data.Sqlite
                 connection.Execute (delete_selection_command);
                 saved_selection = true;
                 
-                if (!has_select_all_item && model.Selection.FocusedIndex != -1) {
-                    T item = GetValue (model.Selection.FocusedIndex);
+                if (!has_select_all_item && model.Selection.FocusedRowIndex != -1) {
+                    T item = GetValue (model.Selection.FocusedRowIndex);
                     if (item != null) {
-                        saved_focus_item = GetValue (model.Selection.FocusedIndex);
+                        saved_focus_item = GetValue (model.Selection.FocusedRowIndex);
                     }
                 }
 
@@ -359,7 +359,7 @@ namespace Hyena.Data.Sqlite
                     long i = IndexOf (saved_focus_item);
                     if (i != -1) {
                         // TODO get rid of int cast
-                        model.Selection.FocusedIndex = (int)i;
+                        model.Selection.FocusedRowIndex = (int)i;
                     }
                 }
                 saved_selection = false;
diff --git a/src/Libraries/Hyena/Hyena.Data/BaseListModel.cs b/src/Libraries/Hyena/Hyena.Data/BaseListModel.cs
index 4066059..3e9bd16 100644
--- a/src/Libraries/Hyena/Hyena.Data/BaseListModel.cs
+++ b/src/Libraries/Hyena/Hyena.Data/BaseListModel.cs
@@ -85,7 +85,7 @@ namespace Hyena.Data
         }
         
         public T FocusedItem {
-            get { return Selection.FocusedIndex == -1 ? default(T) : this[Selection.FocusedIndex]; }
+            get { return Selection.FocusedRowIndex == -1 ? default(T) : this[Selection.FocusedRowIndex]; }
         }
 
         private bool can_reorder = false;



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