banshee r4223 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database



Author: gburt
Date: Sun Jul 20 18:15:32 2008
New Revision: 4223
URL: http://svn.gnome.org/viewvc/banshee?rev=4223&view=rev

Log:
2008-07-20  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseFilterListModel.cs:
	Fix bug where if a filter model (eg artist or album browser) had zero
	items in it (just the All Albums item), it wouldn't filter the view, so
	that if you had an artist selected and searched for a string that didn't
	match, the artist filter would be cleared and the search ran against all
	artists - not what you'd expect.  So this fixed that bug, but it should be
	improved more by remembering and restoring the last filter selection
	before the zero items query, so that when you back out your search you'll
	still have that artist (or albums, etc) selected.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseFilterListModel.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseFilterListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseFilterListModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseFilterListModel.cs	Sun Jul 20 18:15:32 2008
@@ -121,15 +121,20 @@
         {
             string filter = null;
             
-            ModelHelper.BuildIdFilter<object> (GetSelectedObjects (), FilterColumn, null,
-                delegate (object item) {
-                    if (item != select_all_item) {
-                        return ItemToFilterValue (item);
-                    }
-                    return null;
-                },
-                delegate (string new_filter) { filter = new_filter; }
-            );
+            // If the only item is the "All" item, then we shouldn't allow any matches, so insert an always-false condition
+            if (Count == 1) {
+                return "0=1";
+            } else {
+                ModelHelper.BuildIdFilter<object> (GetSelectedObjects (), FilterColumn, null,
+                    delegate (object item) {
+                        if (item != select_all_item) {
+                            return ItemToFilterValue (item);
+                        }
+                        return null;
+                    },
+                    delegate (string new_filter) { filter = new_filter; }
+                );
+            }
             
             return filter;
         }



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