banshee r3638 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: gburt
Date: Tue Apr  1 21:22:16 2008
New Revision: 3638
URL: http://svn.gnome.org/viewvc/banshee?rev=3638&view=rev

Log:
2008-04-01  Gabriel Burt  <gabriel burt gmail com>

	* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
	Fix bug where newly migrated databases kept refreshing metadata each time
	Banshee started.

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs: Fix
	bug with assuming the column cache has > 0 items in it.  Fixes BGO #525598.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs	Tue Apr  1 21:22:16 2008
@@ -309,7 +309,7 @@
             Execute ("INSERT INTO CoreConfiguration VALUES (null, 'MetadataVersion', 0)");
             return true;
         }
-        
+
 #pragma warning restore 0169
         
         private void InitializeFreshDatabase()
@@ -334,6 +334,7 @@
                 )
             ");
             Execute (String.Format ("INSERT INTO CoreConfiguration VALUES (null, 'DatabaseVersion', {0})", CURRENT_VERSION));
+            Execute ("INSERT INTO CoreConfiguration VALUES (null, 'MetadataVersion', 0)");
             
             Execute(@"
                 CREATE TABLE CorePrimarySources (
@@ -651,7 +652,11 @@
                 }
             }
 
-            Execute (String.Format ("UPDATE CoreConfiguration SET Value = {0} WHERE Key = 'MetadataVersion'", CURRENT_METADATA_VERSION));
+            if (ServiceManager.DbConnection.Query<int> ("SELECT count(*) FROM CoreConfiguration WHERE Key = 'MetadataVersion'") == 0) {
+                Execute (String.Format ("INSERT INTO CoreConfiguration VALUES (null, 'MetadataVersion', {0})", CURRENT_METADATA_VERSION));
+            } else {
+                Execute (String.Format ("UPDATE CoreConfiguration SET Value = {0} WHERE Key = 'MetadataVersion'", CURRENT_METADATA_VERSION));
+            }
 
             job.Finish ();
             ServiceManager.SourceManager.MusicLibrary.NotifyTracksChanged ();

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	Tue Apr  1 21:22:16 2008
@@ -137,8 +137,10 @@
             
             // TODO handle max width
             int index = column_cache.Length - 1;
-            column_cache[index].X2 = header_width;
-            column_cache[index].Width = column_cache[index].X2 - column_cache[index].X1;
+            if (index >= 0) {
+                column_cache[index].X2 = header_width;
+                column_cache[index].Width = column_cache[index].X2 - column_cache[index].X1;
+            }
         }
         
         private void RecalculateColumnSizes ()



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