banshee r3413 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Sources src/Libraries/Hyena/Hyena.Data.Sqlite



Author: gburt
Date: Tue Mar 11 03:03:20 2008
New Revision: 3413
URL: http://svn.gnome.org/viewvc/banshee?rev=3413&view=rev

Log:
2008-03-10  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
	* src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs:
	* src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs:
	* src/Core/Banshee.Services/Banshee.Database/BansheeModelProvider.cs:
	* src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs:
	* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs:
	* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs: Rename
	CacheId to SourceEntryId, only require T : ICacheableItem in *ModelCache
	classes, and set the SourceEntryId in SqliteModelCache.

	* src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs:
	Remove cruft.

	* src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: Comment out
	logging.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeModelProvider.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs	Tue Mar 11 03:03:20 2008
@@ -114,10 +114,10 @@
             get { return track_id; }
         }
 
-        private long cache_id;
-        public long CacheId {
-            get { return cache_id; }
-            set { cache_id = value; }
+        private long entry_id;
+        public long SourceEntryId {
+            get { return entry_id; }
+            set { entry_id = value; }
         }
 
         [DatabaseColumn ("SourceID", Index = "CoreTracksSourceIndex")]

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs	Tue Mar 11 03:03:20 2008
@@ -106,10 +106,10 @@
             get { return dbid; }
         }
 
-        private long cache_id;
-        public long CacheId {
-            get { return cache_id; }
-            set { cache_id = value; }
+        private long entry_id;
+        public long SourceEntryId {
+            get { return entry_id; }
+            set { entry_id = value; }
         }
 
         [DatabaseColumn("ArtistID")]

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs	Tue Mar 11 03:03:20 2008
@@ -102,10 +102,10 @@
             get { return dbid; }
         }
 
-        private long cache_id;
-        public long CacheId {
-            get { return cache_id; }
-            set { cache_id = value; }
+        private long entry_id;
+        public long SourceEntryId {
+            get { return entry_id; }
+            set { entry_id = value; }
         }
 
         [DatabaseColumn]

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs	Tue Mar 11 03:03:20 2008
@@ -210,9 +210,6 @@
 
         public void Reload (bool unfiltered, bool notify)
         {
-            if (suppress_reload)
-                return;
-
             Refilter ();
 
             UpdateUnfilteredAggregates ();
@@ -466,12 +463,6 @@
             set { caches_join_table_entries = value; }
         }
 
-        private bool suppress_reload = false;
-        public bool SuppressReloads {
-            get { return suppress_reload; }
-            set { suppress_reload = value; }
-        }
-
         // Implement ICacheableModel
         public int FetchCount {
             get { return RowsInView > 0 ? RowsInView * 5 : 100; }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeModelProvider.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeModelProvider.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeModelProvider.cs	Tue Mar 11 03:03:20 2008
@@ -36,7 +36,7 @@
 
 namespace Banshee.Database
 {
-    public class BansheeModelProvider<T> : SqliteModelProvider<T> where T : ICacheableItem, new ()
+    public class BansheeModelProvider<T> : SqliteModelProvider<T> where T : new ()
     {
         private string table_name;
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs	Tue Mar 11 03:03:20 2008
@@ -170,8 +170,8 @@
         protected virtual void ReloadTrackModel (bool unfiltered, bool notify)
         {
             track_model.Reload (unfiltered, notify);
-            Hyena.Log.DebugFormat ("Called {0}::ReloadTrackModel ({1}) [Count={2}]", GetType ().FullName, 
-                notify, track_model.Count);
+            //Hyena.Log.DebugFormat ("Called {0}::ReloadTrackModel ({1}) [Count={2}]", GetType ().FullName, 
+            //    notify, track_model.Count);
         }
 
         public virtual bool HasDependencies {

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs	Tue Mar 11 03:03:20 2008
@@ -32,6 +32,6 @@
 {
     public interface ICacheableItem
     {
-        long CacheId { get; set; }
+        long SourceEntryId { get; set; }
     }
 }

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs	Tue Mar 11 03:03:20 2008
@@ -329,9 +329,12 @@
             lock (this) {
             //using (new Timer (String.Format ("Fetching set for {0}", model))) {
                 using (IDataReader reader = connection.Query (select_range_command, offset, limit)) {
+                    T item;
                     while (reader.Read ()) {
                         if (!ContainsKey (offset)) {
-                            Add (offset, provider.Load (reader, (int)offset));
+                            item = provider.Load (reader, (int) offset);
+                            item.SourceEntryId = Convert.ToInt64 (reader[reader.FieldCount - 1]);
+                            Add (offset, item);
                         }
                         offset++;
                      }

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs	Tue Mar 11 03:03:20 2008
@@ -34,7 +34,7 @@
 
 namespace Hyena.Data.Sqlite
 {
-    public abstract class SqliteModelProvider<T> where T : ICacheableItem
+    public abstract class SqliteModelProvider<T>
     {
         private readonly List<DatabaseColumn> columns = new List<DatabaseColumn> ();
         private readonly List<VirtualDatabaseColumn> virtual_columns = new List<VirtualDatabaseColumn> ();
@@ -298,10 +298,6 @@
                     bad_column = column;
                     column.SetValue (target, reader, i++);
                 }
-
-                if (i < reader.FieldCount) {
-                    target.CacheId = Convert.ToInt64 (reader[i]);
-                }
             } catch (Exception e) {
                 Log.Debug (
                     String.Format ("Caught exception trying to load database column {0}", bad_column == null ? "[unknown]" : bad_column.Name),



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