banshee r3597 - in trunk/banshee: . src/Backends/Banshee.Gnome/Banshee.GnomeBackend src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.ServiceStack src/Libraries/Hyena/Hyena.Data.Sqlite tests/Hyena
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3597 - in trunk/banshee: . src/Backends/Banshee.Gnome/Banshee.GnomeBackend src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.ServiceStack src/Libraries/Hyena/Hyena.Data.Sqlite tests/Hyena
- Date: Sun, 30 Mar 2008 04:04:24 +0100 (BST)
Author: gburt
Date: Sun Mar 30 04:04:23 2008
New Revision: 3597
URL: http://svn.gnome.org/viewvc/banshee?rev=3597&view=rev
Log:
2008-03-30 Gabriel Burt <gabriel burt gmail com>
* src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs:
Optimize CreateKey method.
* src/Core/Banshee.Core/Banshee.Base/Paths.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
Use the CachedLibraryLocation to save a lot of unnecessary work.
LibraryLocation should probably just be cached itself.
* src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: If a
service fails to start, log the exception.
* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs: Add a
couple TODOs about reusing some object [].
* tests/Hyena/StringUtilTests.cs: Add another test case.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelProvider.cs
trunk/banshee/tests/Hyena/StringUtilTests.cs
Modified: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs (original)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.GnomeBackend/GConfConfigurationClient.cs Sun Mar 30 04:04:23 2008
@@ -58,24 +58,24 @@
}
}
- private string CreateKeyPart (string part)
+ private string CreateKey (string @namespace, string part)
{
+ string hash_key = String.Format ("{0}{1}", @namespace, part);
lock (((ICollection)key_table).SyncRoot) {
- if (!key_table.ContainsKey (part)) {
- key_table.Add (part, StringUtil.CamelCaseToUnderCase (part));
+ if (!key_table.ContainsKey (hash_key)) {
+ if (@namespace == null) {
+ key_table.Add (hash_key, String.Format ("{0}{1}", base_key, StringUtil.CamelCaseToUnderCase (part)));
+ } else {
+ key_table.Add (hash_key, String.Format ("{0}{1}",
+ base_key, StringUtil.CamelCaseToUnderCase (String.Format ("{0}/{1}", @namespace.Replace (".", "/"), part))
+ ));
+ }
}
- return key_table[part];
+ return key_table[hash_key];
}
}
- private string CreateKey (string @namespace, string key)
- {
- return @namespace == null
- ? base_key + CreateKeyPart (key)
- : base_key + CreateKeyPart (@namespace.Replace (".", "/")) + "/" + CreateKeyPart (key);
- }
-
public T Get<T> (SchemaEntry<T> entry)
{
return Get<T> (entry.Namespace, entry.Key, entry.DefaultValue);
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Paths.cs Sun Mar 30 04:04:23 2008
@@ -55,7 +55,7 @@
public static string MakePathRelativeToLibrary (string path)
{
- string library_location = LibraryLocation; // TODO: Use CachedLibraryLocation?
+ string library_location = CachedLibraryLocation;
if (path.Length < library_location.Length + 1) {
return null;
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 Sun Mar 30 04:04:23 2008
@@ -251,7 +251,7 @@
set_up = true;
if (uri_type_field.Value == (int)UriType.RelativePath) {
- uri_field = System.IO.Path.Combine (Paths.LibraryLocation, uri_field);
+ uri_field = System.IO.Path.Combine (Paths.CachedLibraryLocation, uri_field);
}
Uri = new SafeUri (uri_field);
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs Sun Mar 30 04:04:23 2008
@@ -120,6 +120,7 @@
throw;
}
+ Log.Exception (e.InnerException ?? e);
Log.Warning (String.Format ("Service `{0}' not started: {1}", type.FullName,
e.InnerException != null ? e.InnerException.Message : e.Message));
}
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 Sun Mar 30 04:04:23 2008
@@ -247,6 +247,7 @@
protected virtual void PrepareInsertCommand (T target)
{
+ // TODO create an instance variable object array and reuse it?
object [] values = new object [columns.Count - 1];
int j = 0;
for (int i = 0; i < columns.Count; i++) {
@@ -266,6 +267,7 @@
protected virtual void PrepareUpdateCommand (T target)
{
+ // TODO create an instance variable object array and reuse it?
object [] values = new object [columns.Count];
int j = 0;
for (int i = 0; i < columns.Count; i++) {
Modified: trunk/banshee/tests/Hyena/StringUtilTests.cs
==============================================================================
--- trunk/banshee/tests/Hyena/StringUtilTests.cs (original)
+++ trunk/banshee/tests/Hyena/StringUtilTests.cs Sun Mar 30 04:04:23 2008
@@ -46,6 +46,7 @@
new Map ("SRSLYHowAreYou", "srsly_how_are_you"),
new Map ("OMGThisShitIsBananas", "omg_this_shit_is_bananas"),
new Map ("KTHXBAI", "kthxbai"),
+ new Map ("nereid.track_view_columns.MusicLibrarySource-Library/composer", "nereid.track_view_columns._music_library_source_-_library/composer"),
new Map ("", null),
new Map ("H", "h")
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]