[Banshee-List] [Patch] speeding up "search by track"



Hi,

I'm the guy who provided the patch for BGO #333904 (searching based on a
track's metadata).
I noticed that this can be very slow when having a larger library due to
the fact that banshee tries to search after each character "entered" to
the search field.
I've attached a patch which speeds up the search by suspending the
OnSimpleSearch method until the whole search criteria has been "entered"
into the field.
I was not sure about posting this on the mailing list but it's only a
small 4-lines patch. If you prefer a bugzilla entry, should I open a new
bug or attach it to the original one (and reopen it)?

Thanks, Dominik
-- 
Dominik Meister <neptoon gmail com>
My public GnuPG key is available at http://meischter.homelinux.org/gpg.txt
Index: src/PlayerInterface.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/PlayerInterface.cs,v
retrieving revision 1.198
diff -u -p -r1.198 PlayerInterface.cs
--- src/PlayerInterface.cs	12 Jul 2006 21:12:16 -0000	1.198
+++ src/PlayerInterface.cs	21 Jul 2006 08:17:12 -0000
@@ -91,6 +91,8 @@ namespace Banshee
         [Widget] private ProgressBar dapDiskUsageBar;
         
         private bool incrementedCurrentSongPlayCount;
+
+        private bool suspendSearch;
     
         public Gtk.Window Window {
             get {
@@ -1377,6 +1379,10 @@ namespace Banshee
             if(SourceManager.ActiveSource.HandlesSearch) {
                 return;
             }
+
+            if (suspendSearch) {
+                return;
+            }
             
             playlistModel.ClearModel();
             
@@ -2272,6 +2278,9 @@ namespace Banshee
                 return;
             }
 
+            // suspend the search functionality (for performance reasons)
+            suspendSearch = true;
+
             switch(criteria) {
                 case SearchTrackCriteria.Album:
                     searchEntry.Field = Catalog.GetString("Album Title");
@@ -2286,6 +2295,8 @@ namespace Banshee
                     searchEntry.Query = track.Genre;
                     break;
             }
+
+            suspendSearch = false;
             
             playlistView.HasFocus = true;
         }

Attachment: signature.asc
Description: This is a digitally signed message part



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