[banshee/gtk3] Banshee.IO: move Provider's schema field into new class



commit c8d3173843121c9cc4fdf7d57f83455bd0853e4d
Author: Andres G. Aragoneses <knocte gmail com>
Date:   Wed Dec 19 17:44:53 2012 +0000

    Banshee.IO: move Provider's schema field into new class
    
    To avoid GSettingsSchemaExtractor calling the static constructor of Provider
    class and crashing, we put this SchemaEntry into a new class.
    
    The exception was, for the record:
    
    Found SchemaEntry: Banshee.IO.Provider.ProviderSchema
    
    Unhandled Exception:
    System.TypeInitializationException: An exception was thrown by the type initializer for Banshee.IO.Provider ---> System.InvalidOperationException: Add-in engine not initialized.
      at Mono.Addins.AddinEngine.CheckInitialized () [0x00000] in <filename unknown>:0
      at Mono.Addins.AddinManager.GetExtensionNodes (System.String path) [0x00000] in <filename unknown>:0
      at Banshee.IO.Provider.GetOrderedExtensions (System.String extensionPoint, System.String[] ordered_ids) [0x00000] in <filename unknown>:0
      at Banshee.IO.Provider..cctor () [0x00000] in <filename unknown>:0
      --- 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) [0x00000] in <filename unknown>:0
      at GSettingsSchemaExtractorProgram.Extract (IEnumerable`1 types) [0x00000] in <filename unknown>:0
      at GSettingsSchemaExtractorProgram.Extract (System.IO.DirectoryInfo dir) [0x00000] in <filename unknown>:0
      at GSettingsSchemaExtractorProgram.Main (System.String[] args) [0x00000] in <filename unknown>:0

 src/Core/Banshee.Core/Banshee.IO/Provider.cs       |   12 +-----
 .../Banshee.IO/ProviderConfiguration.cs            |   45 ++++++++++++++++++++
 src/Core/Banshee.Core/Makefile.am                  |    1 +
 3 files changed, 47 insertions(+), 11 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.IO/Provider.cs b/src/Core/Banshee.Core/Banshee.IO/Provider.cs
index 345c992..50214b6 100644
--- a/src/Core/Banshee.Core/Banshee.IO/Provider.cs
+++ b/src/Core/Banshee.Core/Banshee.IO/Provider.cs
@@ -63,7 +63,7 @@ namespace Banshee.IO
 
                 var extensions = GetOrderedExtensions (
                     "/Banshee/Platform/IOProvider",
-                    ProviderSchema.Get (),
+                    ProviderConfiguration.ProviderSchema.Get (),
                     "Banshee.IO.Gio.Provider", "Banshee.IO.Unix.Provider", "Banshee.IO.SystemIO.Provider"
                 );
 
@@ -119,15 +119,5 @@ namespace Banshee.IO
 
             return uri;
         }
-
-        internal static readonly SchemaEntry<string> ProviderSchema = new SchemaEntry<string> (
-            "core", "io_provider",
-            "Banshee.IO.Gio.Provider",
-            "Set the IO provider backend in Banshee",
-            "Can be either \"Banshee.IO.SystemIO.Provider\" (.NET System.IO), " +
-                "\"Banshee.IO.Gio.Provider\" (GIO), or " +
-                "\"Banshee.IO.Unix.Provider\" (Native Unix/POSIX), or " +
-                "takes effect on Banshee start (restart necessary)"
-        );
     }
 }
diff --git a/src/Core/Banshee.Core/Banshee.IO/ProviderConfiguration.cs b/src/Core/Banshee.Core/Banshee.IO/ProviderConfiguration.cs
new file mode 100644
index 0000000..777bdc8
--- /dev/null
+++ b/src/Core/Banshee.Core/Banshee.IO/ProviderConfiguration.cs
@@ -0,0 +1,45 @@
+//
+// ProviderConfiguration.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using Banshee.Configuration;
+
+namespace Banshee.IO
+{
+    public class ProviderConfiguration
+    {
+        internal static readonly SchemaEntry<string> ProviderSchema = new SchemaEntry<string> (
+            "core", "io_provider",
+            "Banshee.IO.Gio.Provider",
+            "Set the IO provider backend in Banshee",
+            "Can be either \"Banshee.IO.SystemIO.Provider\" (.NET System.IO), " +
+            "\"Banshee.IO.Gio.Provider\" (GIO), or " +
+            "\"Banshee.IO.Unix.Provider\" (Native Unix/POSIX), or " +
+            "takes effect on Banshee start (restart necessary)"
+        );
+    }
+}
+
diff --git a/src/Core/Banshee.Core/Makefile.am b/src/Core/Banshee.Core/Makefile.am
index ba64f54..3b0e064 100644
--- a/src/Core/Banshee.Core/Makefile.am
+++ b/src/Core/Banshee.Core/Makefile.am
@@ -47,6 +47,7 @@ SOURCES =  \
 	Banshee.IO/IFile.cs \
 	Banshee.IO/IProvider.cs \
 	Banshee.IO/Provider.cs \
+	Banshee.IO/ProviderConfiguration.cs \
 	Banshee.IO/StreamAssist.cs \
 	Banshee.IO/Tests.cs \
 	Banshee.IO/Utilities.cs \



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