banshee r4916 - in trunk/banshee: . src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper src/Core/Banshee.Services/Banshee.Collection.Indexer



Author: gburt
Date: Wed Jan 14 00:12:17 2009
New Revision: 4916
URL: http://svn.gnome.org/viewvc/banshee?rev=4916&view=rev

Log:
2009-01-13  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs:
	Fix bug in logic of whether to raise a collection changed event.  We
	should have been ignoring all changes unless to a field other than
	LastPlayed/Skipped or Play/SkipCount but weren't (BGO #567552)

	* src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs:
	* src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/SimpleIndexerClient.cs:
	Add IndexWhenCollectionChanged property to allow disabling the default
	behavior of retriggering a reindex on every collection change event.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs
   trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/SimpleIndexerClient.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs

Modified: trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	Wed Jan 14 00:12:17 2009
@@ -50,6 +50,7 @@
         private bool listening;
         private ICollectionIndexerService service;
         private bool cleanup_and_shutdown;
+        private bool index_when_collection_changed = true;
         
         public void Start ()
         {
@@ -87,7 +88,7 @@
                 indexer.Index ();
             }
         }
-        
+
         private void _UpdateIndex (ICollectionIndexer indexer)
         {
             ThreadPool.QueueUserWorkItem (delegate {
@@ -182,7 +183,9 @@
         
         private void OnCollectionChanged ()
         {
-            Index ();
+            if (IndexWhenCollectionChanged) {
+                Index ();
+            }
         }
         
         private void OnCleanupAndShutdown ()
@@ -216,6 +219,11 @@
         protected bool CleanupAndShutdown {
             get { return cleanup_and_shutdown; }
         }
+
+        public bool IndexWhenCollectionChanged {
+            get { return index_when_collection_changed; }
+            set { index_when_collection_changed = value; }
+        }
         
         protected ICollectionIndexerService Service {
             get { return service; }

Modified: trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/SimpleIndexerClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/SimpleIndexerClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.CollectionIndexer/Banshee.Collection.Indexer.RemoteHelper/SimpleIndexerClient.cs	Wed Jan 14 00:12:17 2009
@@ -51,6 +51,10 @@
         {
             return client.GetAvailableExportFields ();
         }
+
+        protected bool IndexWhenCollectionChanged {
+            set { client.IndexWhenCollectionChanged = value; }
+        }
         
         public void AddExportField (params string [] fields)
         {
@@ -173,7 +177,7 @@
             }
             
             protected override bool HasCollectionChanged {
-                get { return Service.HasCollectionCountChanged (parent.CollectionCount) || 
+                get { return Service.HasCollectionCountChanged (parent.CollectionCount) ||
                     Service.HasCollectionLastModifiedChanged (Hyena.DateTimeUtil.ToTimeT (parent.CollectionLastModified)); }
             }
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs	Wed Jan 14 00:12:17 2009
@@ -214,11 +214,12 @@
             }
             
             foreach (Hyena.Query.QueryField field in args.ChangedFields) {
-                if (field != Banshee.Query.BansheeQuery.LastPlayedField ||
+                if (field != Banshee.Query.BansheeQuery.LastPlayedField &&
                     field != Banshee.Query.BansheeQuery.LastSkippedField &&
                     field != Banshee.Query.BansheeQuery.PlayCountField &&
                     field != Banshee.Query.BansheeQuery.SkipCountField) {
                     OnCollectionChanged ();
+                    return;
                 }
             }
         }



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