[banshee] [DatabaseSource] Improve NeedsReloadWhenFieldChanged code



commit c9153eb41793c1cb6b5408d945d89cd9e9bb723f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Dec 2 18:35:20 2009 -0800

    [DatabaseSource] Improve NeedsReloadWhenFieldChanged code

 .../Banshee.Sources/DatabaseSource.cs              |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs b/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
index 23c8f2c..6227f11 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
@@ -188,21 +188,25 @@ namespace Banshee.Sources
                 return true;
 
             // If it's the artist or album name, then we care, since it affects the browser
+            // FIXME this should be based on what filters (aka browsers) are active.  InternetRadio,
+            // for example, has only a Genre filter.
             if (field == Banshee.Query.BansheeQuery.ArtistField || field == Banshee.Query.BansheeQuery.AlbumField) {
                 return true;
             }
 
-            ISortableColumn sort_column = (TrackModel is DatabaseTrackListModel)
-                ? (TrackModel as DatabaseTrackListModel).SortColumn : null;
+            if (DatabaseTrackModel == null) {
+                Log.Error ("DatabaseTrackModel should not be null in DatabaseSource.NeedsReloadWhenFieldChanged");
+                return false;
+            }
 
             // If it's the field we're sorting by, then yes, we care
+            var sort_column = DatabaseTrackModel.SortColumn;
             if (sort_column != null && sort_column.Field == field) {
                 return true;
             }
 
             // Make sure the query isn't dependent on this field
-            QueryNode query = (TrackModel is DatabaseTrackListModel)
-                ? (TrackModel as DatabaseTrackListModel).Query : null;
+            QueryNode query = DatabaseTrackModel.Query;
             if (query != null) {
                 if (query != last_query) {
                     query_fields = new List<QueryField> (query.GetFields ());



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