[banshee/gtk3] PlayQueue: prevent a SchemaEntry depend on ServiceManager



commit 33ef0c11b929ed4ea3c046bb2db6a3f9b081e228
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Tue Dec 18 23:32:19 2012 +0000

    PlayQueue: prevent a SchemaEntry depend on ServiceManager
    
    If this happens, GSettingsSchemaExtractor cannot retrieve the SchemaEntry's
    default value. So we should make it depend on static values which don't
    need previous initialization.
    
    For the record, this was the exception thrown by GSettingsSchemaExtractor:
    
    [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Banshee.PlayQueue.PlayQueueSource ---> System.NullReferenceException: Object reference not set to an instance of an object
      at Banshee.PlayQueue.PlayQueueSource..cctor () [0x0008f] in /home/andres1210/Code/bansheeGTK3/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:1016
      --- End of inner exception stack trace ---
      at (wrapper managed-to-native) System.Reflection.MonoField:GetValueInternal (System.Reflection.MonoField,object)
      at System.Reflection.MonoField.GetValue (System.Object obj) [0x0006a] in /home/andres1210/Code/mono/mcs/class/corlib/System.Reflection/MonoField.cs:125
      at GSettingsSchemaExtractorProgram.Extract (IEnumerable`1 types) [0x000ad] in /home/andres1210/Code/bansheeGTK3/build/GSettingsSchemaExtractor.cs:78
      at GSettingsSchemaExtractorProgram.Extract (System.IO.DirectoryInfo dir) [0x000ae] in /home/andres1210/Code/bansheeGTK3/build/GSettingsSchemaExtractor.cs:48
      at GSettingsSchemaExtractorProgram.Main (System.String[] args) [0x0004f] in /home/andres1210/Code/bansheeGTK3/build/GSettingsSchemaExtractor.cs:27

 .../Banshee.Library/MusicLibrarySource.cs          |    4 +++-
 .../Banshee.PlayQueue/PlayQueueSource.cs           |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs b/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
index 2fc7bc8..9d4174d 100644
--- a/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
@@ -56,8 +56,10 @@ namespace Banshee.Library
             Banshee.Base.FileNamePattern.MusicPattern = music_filename_pattern;
         }
 
+        public static readonly string SourceName = Catalog.GetString ("Music");
+
         // Catalog.GetString ("Music Library")
-        public MusicLibrarySource () : base (Catalog.GetString ("Music"), "Library", 40)
+        public MusicLibrarySource () : base (SourceName, "Library", 40)
         {
             MediaTypes = TrackMediaAttributes.Music | TrackMediaAttributes.AudioStream;
             NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.AudioBook;
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
index a62d8ed..b4b631a 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
@@ -1015,7 +1015,7 @@ namespace Banshee.PlayQueue
 
         public static readonly SchemaEntry<string> PopulateFromSchema = new SchemaEntry<string> (
             "plugins.play_queue", "populate_from",
-            ServiceManager.SourceManager.MusicLibrary.Name,
+            MusicLibrarySource.SourceName,
             "Source to poplulate from",
             "Name of the source to populate the the Play Queue from"
         );



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