banshee r3281 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Library



Author: scottp
Date: Wed Feb 20 04:50:35 2008
New Revision: 3281
URL: http://svn.gnome.org/viewvc/banshee?rev=3281&view=rev

Log:
* src/Core/Banshee.Services/Banshee.Library/IExtensionImportSource.cs:
  Added the IExtensionImportSource interface which extends the
  IImportSource interface to include bool CanImport { get; }. This
  means that an extension-provided import source will only be added
  to the list if the import source can be imported. Such a check
  might entail determining whether Beagle is installed, or a
  particular file (other music player's db) is present, &c..

* src/Core/Banshee.Services/Banshee.Library/ImportSourceManager.cs:
  Made to use the new IExtensionImportSource when adding extension
  sources to the list of availible import sources.

Added:
   trunk/banshee/src/Core/Banshee.Services/Banshee.Library/IExtensionImportSource.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ImportSourceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Makefile.am

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/IExtensionImportSource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/IExtensionImportSource.cs	Wed Feb 20 04:50:35 2008
@@ -0,0 +1,37 @@
+//
+// IExtensionImportSource.cs
+//
+// Author:
+//   Scott Peterson <lunchtimemama gmail com>
+//
+// Copyright (C) 2008
+//
+// 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;
+
+namespace Banshee.Library
+{
+    public interface IExtensionImportSource : IImportSource
+    {
+        bool CanImport { get; }
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ImportSourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ImportSourceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/ImportSourceManager.cs	Wed Feb 20 04:50:35 2008
@@ -43,8 +43,10 @@
         {
             import_sources.Add (new HomeDirectoryImportSource ());
             
-            foreach (IImportSource source in AddinManager.GetExtensionObjects ("/Banshee/Library/ImportSource")) {
-                import_sources.Add (source);
+            foreach (IExtensionImportSource source in AddinManager.GetExtensionObjects ("/Banshee/Library/ImportSource")) {
+                if (source.CanImport) {
+                    import_sources.Add (source);
+                }
             }
         }
         

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	Wed Feb 20 04:50:35 2008
@@ -121,6 +121,7 @@
     <File name="Banshee.Query/SmartPlaylistQueryValue.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Query/YearQueryValue.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.MediaEngine/NullPlayerEngine.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Library/IExtensionImportSource.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am	Wed Feb 20 04:50:35 2008
@@ -35,6 +35,7 @@
 	Banshee.Equalizer/EqualizerSetting.cs \
 	Banshee.Equalizer/EqualizerSettingEvent.cs \
 	Banshee.Library/HomeDirectoryImportSource.cs \
+	Banshee.Library/IExtensionImportSource.cs \
 	Banshee.Library/IImportSource.cs \
 	Banshee.Library/ImportSourceManager.cs \
 	Banshee.Library/LibraryImportManager.cs \



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