banshee r3157 - in trunk/banshee: . build build/m4/banshee src/Backends src/Backends/Banshee.Gnome src/Backends/Banshee.Gnome/Banshee.Gnome src/Core/Banshee.Core src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Core/Banshee.Configuration src/Core/Banshee.Core/Banshee.I18n src/Core/Banshee.Core/Banshee.IO src/Core/Banshee.Core/Banshee.IO.SystemIO src/Core/Banshee.Core/Banshee.Streaming src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.AudioProfiles src/Core/Banshee.Services/Banshee.Base src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Metadata src/Core/Banshee.Services/Banshee.Metadata.Embedded src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Playlists.Formats src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.ThickClient src/Core/Banshee.Widget s/Banshee.Widgets src/Core/Hyena src/Core/Nereid/Nereid src/Extensions/Template win32-patches
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3157 - in trunk/banshee: . build build/m4/banshee src/Backends src/Backends/Banshee.Gnome src/Backends/Banshee.Gnome/Banshee.Gnome src/Core/Banshee.Core src/Core/Banshee.Core/Banshee.Base src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Core/Banshee.Configuration src/Core/Banshee.Core/Banshee.I18n src/Core/Banshee.Core/Banshee.IO src/Core/Banshee.Core/Banshee.IO.SystemIO src/Core/Banshee.Core/Banshee.Streaming src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.AudioProfiles src/Core/Banshee.Services/Banshee.Base src/Core/Banshee.Services/Banshee.Collection src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Metadata src/Core/Banshee.Services/Banshee.Metadata.Embedded src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Playlists.Formats src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.SmartPlaylist src/Core/Banshee.ThickClient src/Core/Banshee.Widget s/Banshee.Widgets src/Core/Hyena src/Core/Nereid/Nereid src/Extensions/Template win32-patches
- Date: Wed, 6 Feb 2008 23:49:54 +0000 (GMT)
Author: abock
Date: Wed Feb 6 23:49:53 2008
New Revision: 3157
URL: http://svn.gnome.org/viewvc/banshee?rev=3157&view=rev
Log:
2008-02-06 Aaron Bockover <abock gnome org>
Okay, so this is a big one. Probably nasty. This commit temporarily breaks
settings saving/loading from GConf and the POSIX IO layer is disabled
for now as well; these features will be reimplemented as platform
extensions in my next commit;
This commit puts us very close to being able to run the managed Banshee
core out of the box on Windows and probably OS X.
* src/Core/Banshee.Services/Banshee.AudioProfiles/ProfileConfiguration.cs:
Applied Scott's from SoC that makes this configuration layer just use
the standard configuration APIs in Banshee, so profile configuration
is stored using whatever provider is active (GConf, XML); Scott rules.
* src/Backends/Banshee.Gnome: Moved out GNOME specific code (GConf,
GnomeVFS) into this new platform extension, but it's not complete
* src/Core/Banshee.Core/Banshee.Base/RateLimiter.cs:
* src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs: Moved to
the service layer since these depend on Application
* src/Core/Banshee.Core/Banshee.Base/Resource.cs:
* src/Core/Banshee.Core/Banshee.Base/NamingUtil.cs: Moved/fixed these
classes out of the old Utilities.cs dumping grounds
* src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs:
Do not reference the GConfConfigurationClient; for now the Xml one
is hard coded to use until I finish turning the GConf support into
a provider - no complaining - the next commit will address it
* src/Core/Banshee.Core/Banshee.I18n/AssemblyCatalogAttribute.cs:
* src/Core/Banshee.Core/Banshee.I18n/Catalog.cs: Moved/cleaned up the
internal Banshee gettext wrapper
* src/Core/Banshee.Core/Banshee.IO: Redesigned the IO layer to be easier
to extend (soon) through extensions and it now provides a cleaner API
to use (no more IOProxy)
* src/Core/Banshee.Core/Banshee.IO.SystemIO: Fixed up System.IO provider
to implement the new Banshee.IO design changes
* src/Core/Banshee.Core/Banshee.Base/FileNamePattern.cs:
* src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs:
* src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/LibraryTrackInfo.cs:
* src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs:
* src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs:
* src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs:
Updated to consume the nicer Banshee.IO APIs
* src/Core/Banshee.Core/Banshee.IO/StreamAssist.cs: Added a class that
makes doing some common stream operations (currently, just saving one
stream to another) easier
* src/Core/Banshee.Services/Banshee.Metadata.Embedded/EmbeddedQueryJob.cs:
* src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs:
Updated to use the new Banshee.IO APIs and also StreamAssist.Save to
reduce so much duplication of stream code
* src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs: Added
another Inovke method that takes an EventHandler delegate to stay
compatible with Gtk.Application.Invoke
* src/Core/Banshee.Services/Banshee.Services.addin.xml: Added a few
platform extension points
* src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs:
Removed unnecessary Gnome.Vfs call
* src/Core/Banshee.Widgets/Banshee.Widgets/LinkLabel.cs: Removed
default Gnome.Open implementation; users must set a handle at all times
so the widget is not bound to a platform
* src/Core/Nereid/Nereid/Client.cs: Removed crappy Gnome.Program stuff
since it really doesn't provide anything for us
* src/Extensions/Template/Makefile.am: Small fix
* src/Core/Banshee.Core/Banshee.Base/Utilities.cs:
* src/Core/Banshee.Services/Banshee.AudioProfiles/GConfProfileConfiguration.cs:
Nuked, finally
* build/build.environment.mk:
* build/m4/banshee/gtk-sharp.m4: Removed gnome-sharp and gconf-sharp
dependencies
Added:
trunk/banshee/src/Backends/Banshee.Gnome/
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs
trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GnomeVfs.cs
trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/NamingUtil.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Resource.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/AssemblyCatalogAttribute.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/
trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/DemuxVfs.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Directory.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/File.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Provider.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/DemuxVfs.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Directory.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/File.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDemuxVfs.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDirectory.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IFile.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IProvider.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Provider.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/StreamAssist.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/UnixIOProvider.cs
- copied, changed from r3155, /trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Unix.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Base/
trunk/banshee/src/Core/Banshee.Services/Banshee.Base/RateLimiter.cs
- copied unchanged from r3155, /trunk/banshee/src/Core/Banshee.Core/Banshee.Base/RateLimiter.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs
Removed:
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/RateLimiter.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Utilities.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/GConfConfigurationClient.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/GnomeVfs.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IOProxy.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Interfaces.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/SystemIO.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Unix.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.AudioProfiles/GConfProfileConfiguration.cs
trunk/banshee/win32-patches/audio-profile-configuration.changes
trunk/banshee/win32-patches/audio-profile-configuration.patch
Modified:
trunk/banshee/ChangeLog
trunk/banshee/Makefile.am
trunk/banshee/build/build.environment.mk
trunk/banshee/build/m4/banshee/gtk-sharp.m4
trunk/banshee/configure.ac
trunk/banshee/src/Backends/Backends.mds
trunk/banshee/src/Backends/Makefile.am
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/FileNamePattern.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp
trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/Catalog.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Utilities.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
trunk/banshee/src/Core/Banshee.Core/Makefile.am
trunk/banshee/src/Core/Banshee.Services/Banshee.AudioProfiles/ProfileConfiguration.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryTrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata.Embedded/EmbeddedQueryJob.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/LinkLabel.cs
trunk/banshee/src/Core/Hyena/Hyena.mdp
trunk/banshee/src/Core/Nereid/Nereid/Client.cs
trunk/banshee/src/Extensions/Template/Makefile.am
Modified: trunk/banshee/Makefile.am
==============================================================================
--- trunk/banshee/Makefile.am (original)
+++ trunk/banshee/Makefile.am Wed Feb 6 23:49:53 2008
@@ -57,3 +57,10 @@
rmdir $(pkglibdir); \
fi
+dist-windows: all
+ rm -rf banshee-windows; \
+ mkdir banshee-windows; \
+ cp -rf bin/*.{dll,exe} banshee-windows; \
+ zip banshee-windows.zip -r banshee-windows; \
+ rm -rf banshee-windows
+
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Wed Feb 6 23:49:53 2008
@@ -71,8 +71,8 @@
LINK_HYENA_GUI = -r:$(DIR_BIN)/Hyena.Gui.dll
LINK_HYENA_GUI_DEPS = $(REF_HYENA_GUI) $(LINK_HYENA_GUI)
-REF_BANSHEE_CORE = $(LINK_HYENA_DEPS) $(LINK_MONO_POSIX) \
- $(LINK_DBUS) $(LINK_TAGLIB) $(LINK_GCONF)
+REF_BANSHEE_CORE = $(LINK_HYENA_DEPS) $(LINK_MONO_POSIX) $(LINK_GLIB) \
+ $(LINK_DBUS) $(LINK_TAGLIB)
LINK_BANSHEE_CORE = -r:$(DIR_BIN)/Banshee.Core.dll
LINK_BANSHEE_CORE_DEPS = $(REF_BANSHEE_CORE) $(LINK_BANSHEE_CORE)
Modified: trunk/banshee/build/m4/banshee/gtk-sharp.m4
==============================================================================
--- trunk/banshee/build/m4/banshee/gtk-sharp.m4 (original)
+++ trunk/banshee/build/m4/banshee/gtk-sharp.m4 Wed Feb 6 23:49:53 2008
@@ -3,10 +3,7 @@
GTKSHARP_REQUIRED=2.7
PKG_CHECK_MODULES(GTKSHARP,
gtk-sharp-2.0 >= $GTKSHARP_REQUIRED \
- gnome-sharp-2.0 >= $GTKSHARP_REQUIRED \
- gnome-vfs-sharp-2.0 >= $GTKSHARP_REQUIRED \
- glade-sharp-2.0 >= $GTKSHARP_REQUIRED \
- gconf-sharp-2.0 >= $GTKSHARP_REQUIRED)
+ glade-sharp-2.0 >= $GTKSHARP_REQUIRED)
AC_SUBST(GTKSHARP_LIBS)
PKG_CHECK_MODULES(GLIBSHARP,
Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac (original)
+++ trunk/banshee/configure.ac Wed Feb 6 23:49:53 2008
@@ -132,6 +132,7 @@
src/Core/Nereid/banshee2
src/Backends/Makefile
+src/Backends/Banshee.Gnome/Makefile
src/Backends/Banshee.GStreamer/Makefile
src/Extensions/Makefile
Modified: trunk/banshee/src/Backends/Backends.mds
==============================================================================
--- trunk/banshee/src/Backends/Backends.mds (original)
+++ trunk/banshee/src/Backends/Backends.mds Wed Feb 6 23:49:53 2008
@@ -2,12 +2,15 @@
<Configurations active="Debug">
<Configuration name="Debug" ctype="CombineConfiguration">
<Entry build="True" name="Banshee.GStreamer" configuration="Debug" />
+ <Entry build="True" name="Banshee.Gnome" configuration="Debug" />
</Configuration>
</Configurations>
<StartMode startupentry="Banshee.GStreamer" single="True">
<Execute type="None" entry="Banshee.GStreamer" />
+ <Execute type="None" entry="Banshee.Gnome" />
</StartMode>
<Entries>
<Entry filename="Banshee.GStreamer/Banshee.GStreamer.mdp" />
+ <Entry filename="Banshee.Gnome/Banshee.Gnome.mdp" />
</Entries>
</Combine>
\ No newline at end of file
Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.addin.xml Wed Feb 6 23:49:53 2008
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin
+ id="Banshee.Gnome"
+ version="1.0"
+ compatVersion="1.0"
+ copyright="Â 2008 Novell Inc. Licensed under the MIT X11 license."
+ name="GNOME Providers"
+ category="Platform"
+ description="Backend providers for the GNOME platform. Includes GConf and GNOME-VFS support."
+ author="Aaron Bockover"
+ url="http://banshee-project.org/"
+ defaultEnabled="true">
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/Platform/IOProvider">
+ <IOProvider class=""/>
+ </Extension>
+
+ <Extension path="/Banshee/Platform/ConfigurationProvider">
+ <ConfigurationProvider class=""/>
+ </Extension>
+
+</Addin>
Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome.mdp Wed Feb 6 23:49:53 2008
@@ -0,0 +1,31 @@
+<Project name="Banshee.Gnome" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+ <Configurations active="Debug">
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.Gnome" />
+ <Build debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <Contents>
+ <File name="Banshee.Gnome.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="Banshee.Gnome" subtype="Directory" buildaction="Compile" />
+ <File name="Banshee.Gnome/GnomeVfs.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Gnome/GConfConfigurationClient.cs" subtype="Code" buildaction="Compile" />
+ </Contents>
+ <References>
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+ <ProjectReference type="Project" localcopy="True" refto="Hyena" />
+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ </References>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
+ <BuildFilesVar Sync="True" Name="SOURCES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="True" Name="RESOURCES" />
+ <OthersVar />
+ <GacRefVar />
+ <AsmRefVar />
+ <ProjectRefVar />
+ </MonoDevelop.Autotools.MakefileInfo>
+</Project>
\ No newline at end of file
Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GConfConfigurationClient.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,136 @@
+/***************************************************************************
+ * GConfConfigurationClient.cs
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Written by Aaron Bockover <aaron abock org>
+ ****************************************************************************/
+
+/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
+ *
+ * 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 System.Collections;
+using System.Collections.Generic;
+using GConf;
+
+using Banshee.Base;
+
+namespace Banshee.Configuration
+{
+ public class GConfConfigurationClient : IConfigurationClient
+ {
+ private static string base_key = "/apps/banshee/";
+
+ private GConf.Client client;
+ private Dictionary<string, string> key_table = new Dictionary<string, string>();
+
+ private static bool disable_gconf_checked = false;
+ private static bool disable_gconf = false;
+
+ private static bool DisableGConf {
+ get {
+ if(!disable_gconf_checked) {
+ disable_gconf = ApplicationContext.EnvironmentIsSet("BANSHEE_DISABLE_GCONF");
+ disable_gconf_checked = true;
+ }
+
+ return disable_gconf;
+ }
+ }
+
+ public static string BaseKey {
+ get { return base_key; }
+ }
+
+ private string CreateKeyPart(string part)
+ {
+ lock(((ICollection)key_table).SyncRoot) {
+ if(!key_table.ContainsKey(part)) {
+ key_table.Add(part, StringUtil.CamelCaseToUnderCase(part));
+ }
+
+ return key_table[part];
+ }
+ }
+
+ public string CreateKey(string namespce, string key)
+ {
+ return namespce == null
+ ? base_key + CreateKeyPart(key)
+ : base_key + CreateKeyPart(namespce.Replace(".", "/")) + "/" + CreateKeyPart(key);
+ }
+
+ public T Get<T>(SchemaEntry<T> entry)
+ {
+ return Get<T>(entry.Namespace, entry.Key, entry.DefaultValue);
+ }
+
+ public T Get<T>(SchemaEntry<T> entry, T fallback)
+ {
+ return Get<T>(entry.Namespace, entry.Key, fallback);
+ }
+
+ public T Get<T>(string key, T fallback)
+ {
+ return Get<T>(null, key, fallback);
+ }
+
+ public T Get<T>(string namespce, string key, T fallback)
+ {
+ if(DisableGConf) {
+ return fallback;
+ }
+
+ if(client == null) {
+ client = new GConf.Client();
+ }
+
+ try {
+ return (T)client.Get(CreateKey(namespce, key));
+ } catch {
+ return fallback;
+ }
+ }
+
+ public void Set<T>(SchemaEntry<T> entry, T value)
+ {
+ Set<T>(entry.Namespace, entry.Key, value);
+ }
+
+ public void Set<T>(string key, T value)
+ {
+ Set<T>(null, key, value);
+ }
+
+ public void Set<T>(string namespce, string key, T value)
+ {
+ if(DisableGConf) {
+ return;
+ }
+
+ if(client == null) {
+ client = new GConf.Client();
+ }
+
+ client.Set(CreateKey(namespce, key), value);
+ }
+ }
+}
Added: trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GnomeVfs.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Banshee.Gnome/GnomeVfs.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,212 @@
+/***************************************************************************
+ * GnomeVfs.cs
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Written by Aaron Bockover <aaron abock org>
+ ****************************************************************************/
+
+/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
+ *
+ * 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 System.Collections;
+
+using Gnome.Vfs;
+
+using Banshee.Base;
+
+namespace Banshee.IO.GnomeVfs
+{
+ public class IOConfig : IIOConfig
+ {
+ public string Name { get { return "gnomevfs"; } }
+ public Type FileBackend { get { return typeof(File); } }
+ public Type DirectoryBackend { get { return typeof(Directory); } }
+ public Type DemuxVfsBackend { get { return typeof(DemuxVfs); } }
+
+ public string DetectMimeType(SafeUri uri)
+ {
+ return _DetectMimeType(uri);
+ }
+
+ internal static string _DetectMimeType(SafeUri uri)
+ {
+ try {
+ string mime = MimeType.GetMimeTypeForUri(uri.AbsoluteUri);
+ if(mime != null && mime != "application/octet-stream") {
+ return FilterMimeType(mime);
+ }
+ } catch {
+ }
+
+ return null;
+ }
+
+ private static string FilterMimeType(string mime)
+ {
+ string [] parts = mime.Split(',');
+ if(parts == null || parts.Length <= 0) {
+ return mime.Trim();
+ }
+
+ return parts[0].Trim();
+ }
+ }
+
+ public class File : IFile
+ {
+ public void Delete(SafeUri uri)
+ {
+ Gnome.Vfs.Unlink.FromUri(new Gnome.Vfs.Uri(uri.AbsoluteUri));
+ }
+
+ public bool Exists(SafeUri uri)
+ {
+ try {
+ return Exists(new FileInfo(uri.AbsoluteUri));
+ } catch {
+ return false;
+ }
+ }
+
+ public static bool Exists(FileInfo info)
+ {
+ return info != null && info.Size > 0 &&
+ (info.Type & FileType.Regular) != 0 &&
+ (info.Type & FileType.Directory) == 0;
+ }
+
+ public void Move(SafeUri from, SafeUri to)
+ {
+ Gnome.Vfs.Move.Uri(new Gnome.Vfs.Uri(from.AbsoluteUri),
+ new Gnome.Vfs.Uri(to.AbsoluteUri), true);
+ }
+
+ public System.IO.Stream OpenRead(SafeUri uri)
+ {
+ return new VfsStream(uri.AbsoluteUri, System.IO.FileMode.Open);
+ }
+
+ public System.IO.Stream OpenWrite(SafeUri uri, bool overwrite)
+ {
+ // FIXME: This always overwrites, and I can't figure out how to
+ // not do it with GnomeVFS - this means tag writing is probably
+ // completely broke with this backend
+
+ return new VfsStream(uri.AbsoluteUri, System.IO.FileMode.Create);
+ }
+
+ public long GetSize (SafeUri uri)
+ {
+ return 0;
+ }
+ }
+
+ public class Directory : IDirectory
+ {
+ public void Create(string directory)
+ {
+ Gnome.Vfs.Directory.Create(directory, FilePermissions.UserAll);
+ }
+
+ public void Delete(string directory)
+ {
+ Delete(directory);
+ }
+
+ public void Delete(string directory, bool recursive)
+ {
+ System.IO.Directory.Delete(directory, recursive);
+ }
+
+ public bool Exists(string directory)
+ {
+ return Exists(new FileInfo(directory));
+ }
+
+ public bool Exists(FileInfo info)
+ {
+ return (info.Type & FileType.Directory) != 0;
+ }
+
+ public IEnumerable GetFiles(string directory)
+ {
+ foreach(FileInfo file in Gnome.Vfs.Directory.GetEntries(directory)) {
+ if(Banshee.IO.GnomeVfs.File.Exists(file)) {
+ yield return System.IO.Path.Combine(directory, file.Name);
+ }
+ }
+ }
+
+ public IEnumerable GetDirectories(string directory)
+ {
+ foreach(FileInfo file in Gnome.Vfs.Directory.GetEntries(directory)) {
+ if(Exists(file)) {
+ yield return System.IO.Path.Combine(directory, file.Name);
+ }
+ }
+ }
+
+ public void Move(SafeUri from, SafeUri to)
+ {
+ Gnome.Vfs.Move.Uri(new Gnome.Vfs.Uri(from.AbsoluteUri),
+ new Gnome.Vfs.Uri(to.AbsoluteUri), true);
+ }
+ }
+
+ public class DemuxVfs: IDemuxVfs
+ {
+ private FilePermissions permissions;
+ private string name;
+
+ public DemuxVfs(string path)
+ {
+ name = path;
+ permissions = new FileInfo(name, FileInfoOptions.FollowLinks
+ | FileInfoOptions.GetAccessRights).Permissions;
+ }
+
+ public void CloseStream(System.IO.Stream stream)
+ {
+ stream.Close();
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ public System.IO.Stream ReadStream {
+ get { return new VfsStream(Name, System.IO.FileMode.Open); }
+ }
+
+ public System.IO.Stream WriteStream {
+ get { return new VfsStream(Name, System.IO.FileMode.OpenOrCreate); }
+ }
+
+ public bool IsReadable {
+ get { return (permissions | FilePermissions.AccessReadable) != 0; }
+ }
+
+ public bool IsWritable {
+ get { return (permissions | FilePermissions.AccessWritable) != 0; }
+ }
+ }
+}
Added: trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Backends/Banshee.Gnome/Makefile.am Wed Feb 6 23:49:53 2008
@@ -0,0 +1,12 @@
+ASSEMBLY = Banshee.Gnome
+TARGET = library
+LINK = $(REF_FIXME)
+
+SOURCES = \
+ Banshee.Gnome/GConfConfigurationClient.cs \
+ Banshee.Gnome/GnomeVfs.cs
+
+RESOURCES = Banshee.Gnome.addin.xml
+
+#include $(top_srcdir)/build/build.mk
+
Modified: trunk/banshee/src/Backends/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Makefile.am (original)
+++ trunk/banshee/src/Backends/Makefile.am Wed Feb 6 23:49:53 2008
@@ -1,3 +1,6 @@
-SUBDIRS = Banshee.GStreamer
+SUBDIRS = \
+ Banshee.Gnome \
+ Banshee.GStreamer
+
MAINTAINERCLEANFILES = Makefile.in
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/FileNamePattern.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Base/FileNamePattern.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/FileNamePattern.cs Wed Feb 6 23:49:53 2008
@@ -1,31 +1,31 @@
-/***************************************************************************
- * FileNamePattern.cs
- *
- * Copyright (C) 2005-2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
-
+//
+// FileNamePattern.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-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 System.Text.RegularExpressions;
using System.Collections.Generic;
@@ -240,8 +240,8 @@
string filename = dir + Path.DirectorySeparatorChar +
Path.GetFileName (songpath);
- if (!Banshee.IO.IOProxy.Directory.Exists (dir)) {
- Banshee.IO.IOProxy.Directory.Create (dir);
+ if (!Banshee.IO.Directory.Exists (dir)) {
+ Banshee.IO.Directory.Create (dir);
}
return filename;
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/NamingUtil.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/NamingUtil.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,124 @@
+//
+// NamingUtil.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 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 System.Collections;
+using System.Collections.Generic;
+
+using Banshee.Collection;
+
+namespace Banshee.Base
+{
+ public static class NamingUtil
+ {
+ public delegate bool PostfixDuplicateIncrementHandler (string check);
+
+ public static string GenerateTrackCollectionName (IEnumerable tracks, string fallback)
+ {
+ Dictionary<string, int> weight_map = new Dictionary<string, int> ();
+
+ if (tracks == null) {
+ return fallback;
+ }
+
+ foreach (TrackInfo track in tracks) {
+ string artist = null;
+ string album = null;
+
+ if (track.ArtistName != null) {
+ artist = track.ArtistName.Trim ();
+ if (artist == String.Empty) {
+ artist = null;
+ }
+ }
+
+ if (track.AlbumTitle != null) {
+ album = track.AlbumTitle.Trim ();
+ if (album == String.Empty) {
+ album = null;
+ }
+ }
+
+ if (artist != null && album != null) {
+ IncrementCandidate (weight_map, "\0" + artist + " - " + album);
+ IncrementCandidate (weight_map, artist);
+ IncrementCandidate (weight_map, album);
+ } else if (artist != null) {
+ IncrementCandidate (weight_map, artist);
+ } else if (album != null) {
+ IncrementCandidate (weight_map, album);
+ }
+ }
+
+ int max_hit_count = 0;
+ string max_candidate = fallback;
+
+ List<string> sorted_keys = new List<string> (weight_map.Keys);
+ sorted_keys.Sort ();
+
+ foreach (string candidate in sorted_keys) {
+ int current_hit_count = weight_map[candidate];
+ if (current_hit_count > max_hit_count) {
+ max_hit_count = current_hit_count;
+ max_candidate = candidate;
+ }
+ }
+
+ if (max_candidate[0] == '\0') {
+ return max_candidate.Substring (1);
+ }
+
+ return max_candidate;
+ }
+
+ private static void IncrementCandidate (Dictionary<string, int> map, string hit)
+ {
+ if (map.ContainsKey (hit)) {
+ map[hit]++;
+ } else {
+ map.Add (hit, 1);
+ }
+ }
+
+ public static string PostfixDuplicate (string prefix, PostfixDuplicateIncrementHandler duplicateHandler)
+ {
+ if (duplicateHandler == null) {
+ throw new ArgumentNullException ("A PostfixDuplicateIncrementHandler delegate must be given");
+ }
+
+ string name = prefix;
+ for (int i = 1; true; i++) {
+ if (!duplicateHandler (name)) {
+ return name;
+ }
+
+ name = prefix + " " + i;
+ }
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Resource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Resource.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,49 @@
+//
+// Resource.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-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 System.IO;
+using System.Reflection;
+
+namespace Banshee.Base
+{
+ public static class Resource
+ {
+ public static string GetFileContents (string name)
+ {
+ return GetFileContents (Assembly.GetCallingAssembly (), name);
+ }
+
+ public static string GetFileContents (Assembly assembly, string name)
+ {
+ using (StreamReader reader = new StreamReader (assembly.GetManifestResourceStream (name))) {
+ return reader.ReadToEnd ();
+ }
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs Wed Feb 6 23:49:53 2008
@@ -38,22 +38,22 @@
{
public class FileTrackInfo : TrackInfo
{
- public FileTrackInfo(SafeUri uri)
+ public FileTrackInfo (SafeUri uri)
{
LoadFromUri(uri);
Uri = uri;
}
- private void LoadFromUri(SafeUri uri)
+ private void LoadFromUri (SafeUri uri)
{
- ParsePath(uri.LocalPath);
+ ParsePath (uri.LocalPath);
- TagLib.File file = Banshee.IO.IOProxy.OpenFile(uri.LocalPath);
+ TagLib.File file = Banshee.IO.DemuxVfs.OpenFile (uri.LocalPath);
- ArtistName = Choose(file.Tag.JoinedAlbumArtists, ArtistName);
- AlbumTitle = Choose(file.Tag.Album, AlbumTitle);
- TrackTitle = Choose(file.Tag.Title, TrackTitle);
- Genre = Choose(file.Tag.FirstGenre, Genre);
+ ArtistName = Choose (file.Tag.JoinedAlbumArtists, ArtistName);
+ AlbumTitle = Choose (file.Tag.Album, AlbumTitle);
+ TrackTitle = Choose (file.Tag.Title, TrackTitle);
+ Genre = Choose (file.Tag.FirstGenre, Genre);
Disc = file.Tag.Disc == 0 ? (int)Disc : (int)file.Tag.Disc;
TrackNumber = file.Tag.Track == 0 ? (int)TrackNumber : (int)file.Tag.Track;
TrackCount = file.Tag.TrackCount == 0 ? (int)TrackCount : (int)file.Tag.TrackCount;
@@ -63,7 +63,7 @@
DateAdded = DateTime.Now;
}
- private void ParsePath(string path)
+ private void ParsePath (string path)
{
ArtistName = String.Empty;
AlbumTitle = String.Empty;
@@ -71,71 +71,72 @@
TrackNumber = 0;
Match match;
- SafeUri uri = new SafeUri(path);
- string fileName = path;
- if(uri.IsLocalPath) {
- fileName = uri.AbsolutePath;
+ SafeUri uri = new SafeUri (path);
+ string filename = path;
+ if (uri.IsLocalPath) {
+ filename = uri.AbsolutePath;
}
- match = Regex.Match(fileName, @"(\d+)\.? *(.*)$");
- if(match.Success) {
- TrackNumber = Convert.ToInt32(match.Groups[1].ToString());
- fileName = match.Groups[2].ToString().Trim();
+ match = Regex.Match (filename, @"(\d+)\.? *(.*)$");
+ if (match.Success) {
+ TrackNumber = Convert.ToInt32 (match.Groups[1].ToString ());
+ filename = match.Groups[2].ToString ().Trim ();
}
- /* Artist - Album - Title */
- match = Regex.Match(fileName, @"\s*(.*)-\s*(.*)-\s*(.*)$");
- if(match.Success) {
- ArtistName = match.Groups[1].ToString();
- AlbumTitle = match.Groups[2].ToString();
- TrackTitle = match.Groups[3].ToString();
+ // Artist - Album - Title
+ match = Regex.Match (filename, @"\s*(.*)-\s*(.*)-\s*(.*)$");
+ if (match.Success) {
+ ArtistName = match.Groups[1].ToString ();
+ AlbumTitle = match.Groups[2].ToString ();
+ TrackTitle = match.Groups[3].ToString ();
} else {
- /* Artist - Title */
- match = Regex.Match(fileName, @"\s*(.*)-\s*(.*)$");
- if(match.Success) {
- ArtistName = match.Groups[1].ToString();
- TrackTitle = match.Groups[2].ToString();
+ // Artist - Title
+ match = Regex.Match (filename, @"\s*(.*)-\s*(.*)$");
+ if (match.Success) {
+ ArtistName = match.Groups[1].ToString ();
+ TrackTitle = match.Groups[2].ToString ();
} else {
- /* Title */
- TrackTitle = fileName;
+ // Title
+ TrackTitle = filename;
}
}
- while(!String.IsNullOrEmpty(path)) {
- fileName = Path.GetFileName(path);
- path = Path.GetDirectoryName(path);
- if(AlbumTitle == String.Empty) {
- AlbumTitle = fileName;
+ while (!String.IsNullOrEmpty (path)) {
+ filename = Path.GetFileName (path);
+ path = Path.GetDirectoryName (path);
+ if (AlbumTitle == String.Empty) {
+ AlbumTitle = filename;
continue;
}
- if(ArtistName == String.Empty) {
- ArtistName = fileName;
+ if (ArtistName == String.Empty) {
+ ArtistName = filename;
continue;
}
+
break;
}
- ArtistName = ArtistName.Trim();
- AlbumTitle = AlbumTitle.Trim();
- TrackTitle = TrackTitle.Trim();
+ ArtistName = ArtistName.Trim ();
+ AlbumTitle = AlbumTitle.Trim ();
+ TrackTitle = TrackTitle.Trim ();
- if(ArtistName.Length == 0) {
+ if (ArtistName.Length == 0) {
ArtistName = /*"Unknown Artist"*/ null;
}
- if(AlbumTitle.Length == 0) {
+ if (AlbumTitle.Length == 0) {
AlbumTitle = /*"Unknown Album"*/ null;
}
- if(TrackTitle.Length == 0) {
+ if (TrackTitle.Length == 0) {
TrackTitle = /*"Unknown Title"*/ null;
}
}
- private static string Choose(string priority, string fallback)
+ private static string Choose (string priority, string fallback)
{
- return (priority == null || priority.Length == 0) ? fallback : priority;
+ return String.IsNullOrEmpty (priority) ? fallback : priority;
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Configuration/ConfigurationClient.cs Wed Feb 6 23:49:53 2008
@@ -36,9 +36,7 @@
private static IConfigurationClient Client {
get {
if(client == null) {
- client = Environment.OSVersion.Platform == PlatformID.Unix
- ? (IConfigurationClient) new GConfConfigurationClient()
- : new XmlConfigurationClient();
+ client = new XmlConfigurationClient();
}
return client;
}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Core.mdp Wed Feb 6 23:49:53 2008
@@ -14,7 +14,6 @@
<File name="Banshee.Kernel/JobPriority.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Kernel/Scheduler.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration/ConfigurationClient.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Configuration/GConfConfigurationClient.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration/IConfigurationClient.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration/SchemaEntry.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/FileNamePattern.cs" subtype="Code" buildaction="Compile" />
@@ -26,11 +25,9 @@
<File name="Banshee.Collection/ArtistInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/ITrackInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/TrackInfo.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.IO/GnomeVfs.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.IO/Interfaces.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.IO/IOProxy.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.IO/SystemIO.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.IO/Unix.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/IProvider.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/Provider.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/UnixIOProvider.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.IO/Utilities.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/ApplicationContext.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/FileTrackInfo.cs" subtype="Code" buildaction="Compile" />
@@ -56,7 +53,22 @@
<File name="Banshee.Base/Localization.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration/XmlConfigurationClient.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Base/CoverArtSpec.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.Base/RateLimiter.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.I18n/AssemblyCatalogAttribute.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.I18n/Catalog.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/IFile.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/IDirectory.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/Directory.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO.SystemIO" subtype="Directory" buildaction="Compile" />
+ <File name="Banshee.IO.SystemIO/Directory.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO.SystemIO/File.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO.SystemIO/Provider.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/IDemuxVfs.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/File.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO.SystemIO/DemuxVfs.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Base/Resource.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/DemuxVfs.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.IO/StreamAssist.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Base/NamingUtil.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="False" refto="Hyena" />
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/AssemblyCatalogAttribute.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/AssemblyCatalogAttribute.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,53 @@
+//
+// AssemblyCatalogAttribute.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;
+
+namespace Banshee.I18n
+{
+ [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
+ public class AssemblyCatalogAttribute : Attribute
+ {
+ private string domain;
+ private string localedir;
+
+ public AssemblyCatalogAttribute (string domain, string localedir)
+ {
+ this.domain = domain;
+ this.localedir = localedir;
+ }
+
+ public string Domain {
+ get { return domain; }
+ }
+
+ public string LocaleDir {
+ get { return localedir; }
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/Catalog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/Catalog.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.I18n/Catalog.cs Wed Feb 6 23:49:53 2008
@@ -1,205 +1,199 @@
//
-// Catalog.cs: Bindings for libintl
+// Catalog.cs
//
-// Authors:
-// Aaron Bockover (abockover novell com)
+// Author:
+// Aaron Bockover <abockover novell com>
//
-// (C) 2006 Novell, Inc.
+// 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 System.Reflection;
-using System.Collections;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using Mono.Unix;
-namespace Mono.Gettext
+namespace Banshee.I18n
{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
- public class AssemblyCatalogAttribute : Attribute
+ public static class Catalog
{
- private string domain;
- private string localedir;
-
- public AssemblyCatalogAttribute(string domain, string localedir)
- {
- this.domain = domain;
- this.localedir = localedir;
- }
-
- public string Domain {
- get { return domain; }
- }
-
- public string LocaleDir {
- get { return localedir; }
- }
- }
-
- public sealed /* static */ class Catalog
- {
- private Catalog()
- {
- }
-
- private static Hashtable domain_assembly_map = new Hashtable();
- private static ArrayList default_domain_assemblies = new ArrayList();
+ private static Dictionary<Assembly, string> domain_assembly_map = new Dictionary<Assembly, string> ();
+ private static List<Assembly> default_domain_assemblies = new List<Assembly> ();
- public static void Init(string domain, string localeDir)
+ public static void Init (string domain, string localeDir)
{
- if(domain == null || domain.Length == 0) {
- throw new ArgumentException("No text domain specified");
+ if (String.IsNullOrEmpty (domain)) {
+ throw new ArgumentException ("No text domain specified");
}
- IntPtr domain_ptr = UnixMarshal.StringToHeap(domain);
+ IntPtr domain_ptr = UnixMarshal.StringToHeap (domain);
IntPtr localedir_ptr = IntPtr.Zero;
try {
- BindTextDomainCodeset(domain_ptr);
+ BindTextDomainCodeset (domain_ptr);
- if(localeDir != null && localeDir.Length > 0) {
- localedir_ptr = UnixMarshal.StringToHeap(localeDir);
- BindTextDomain(domain_ptr, localedir_ptr);
+ if (localeDir != null && localeDir.Length > 0) {
+ localedir_ptr = UnixMarshal.StringToHeap (localeDir);
+ BindTextDomain (domain_ptr, localedir_ptr);
}
} finally {
- UnixMarshal.FreeHeap(domain_ptr);
- if(localedir_ptr != IntPtr.Zero) {
- UnixMarshal.FreeHeap(localedir_ptr);
+ UnixMarshal.FreeHeap (domain_ptr);
+ if (localedir_ptr != IntPtr.Zero) {
+ UnixMarshal.FreeHeap (localedir_ptr);
}
}
}
- public static string GetString(string msgid)
+ public static string GetString (string msgid)
{
- return GetString(GetDomainForAssembly(Assembly.GetCallingAssembly()), msgid);
+ return GetString (GetDomainForAssembly (Assembly.GetCallingAssembly ()), msgid);
}
- public static string GetString(string domain, string msgid)
+ public static string GetString (string domain, string msgid)
{
- IntPtr msgid_ptr = UnixMarshal.StringToHeap(msgid);
- IntPtr domain_ptr = domain == null ? IntPtr.Zero : UnixMarshal.StringToHeap(domain);
+ IntPtr msgid_ptr = UnixMarshal.StringToHeap (msgid);
+ IntPtr domain_ptr = domain == null ? IntPtr.Zero : UnixMarshal.StringToHeap (domain);
- if(domain == null) {
- IntPtr ptr = UnixMarshal.StringToHeap("banshee");
- UnixMarshal.FreeHeap(ptr);
+ if (domain == null) {
+ IntPtr ptr = UnixMarshal.StringToHeap ("banshee");
+ UnixMarshal.FreeHeap (ptr);
}
try {
IntPtr ret_ptr = domain_ptr == IntPtr.Zero ?
- gettext(msgid_ptr) :
- dgettext(domain_ptr, msgid_ptr);
+ gettext (msgid_ptr) :
+ dgettext (domain_ptr, msgid_ptr);
- if(msgid_ptr != ret_ptr) {
- return UnixMarshal.PtrToStringUnix(ret_ptr);
+ if (msgid_ptr != ret_ptr) {
+ return UnixMarshal.PtrToStringUnix (ret_ptr);
}
return msgid;
} finally {
- UnixMarshal.FreeHeap(msgid_ptr);
- if(domain_ptr != IntPtr.Zero) {
- UnixMarshal.FreeHeap(domain_ptr);
+ UnixMarshal.FreeHeap (msgid_ptr);
+ if (domain_ptr != IntPtr.Zero) {
+ UnixMarshal.FreeHeap (domain_ptr);
}
}
}
- public static string GetString(string msgid, string msgidPlural, int n)
+ public static string GetString (string msgid, string msgidPlural, int n)
{
- return GetString(GetDomainForAssembly(Assembly.GetCallingAssembly()), msgid, msgidPlural, n);
+ return GetString (GetDomainForAssembly (Assembly.GetCallingAssembly ()), msgid, msgidPlural, n);
}
- public static string GetPluralString(string msgid, string msgidPlural, int n)
+ public static string GetPluralString (string msgid, string msgidPlural, int n)
{
- return GetString(GetDomainForAssembly(Assembly.GetCallingAssembly()), msgid, msgidPlural, n);
+ return GetString (msgid, msgidPlural, n);
}
- public static string GetString(string domain, string msgid, string msgidPlural, int n)
+ public static string GetString (string domain, string msgid, string msgidPlural, int n)
{
- IntPtr msgid_ptr = UnixMarshal.StringToHeap(msgid);
- IntPtr msgid_plural_ptr = UnixMarshal.StringToHeap(msgidPlural);
- IntPtr domain_ptr = domain == null ? IntPtr.Zero : UnixMarshal.StringToHeap(domain);
+ IntPtr msgid_ptr = UnixMarshal.StringToHeap (msgid);
+ IntPtr msgid_plural_ptr = UnixMarshal.StringToHeap (msgidPlural);
+ IntPtr domain_ptr = domain == null ? IntPtr.Zero : UnixMarshal.StringToHeap (domain);
try {
IntPtr ret_ptr = domain_ptr == IntPtr.Zero ?
- ngettext(msgid_ptr, msgid_plural_ptr, n) :
- dngettext(domain_ptr, msgid_ptr, msgid_plural_ptr, n);
+ ngettext (msgid_ptr, msgid_plural_ptr, n) :
+ dngettext (domain_ptr, msgid_ptr, msgid_plural_ptr, n);
- if(ret_ptr == msgid_ptr) {
+ if (ret_ptr == msgid_ptr) {
return msgid;
- } else if(ret_ptr == msgid_plural_ptr) {
+ } else if (ret_ptr == msgid_plural_ptr) {
return msgidPlural;
}
- return UnixMarshal.PtrToStringUnix(ret_ptr);
+ return UnixMarshal.PtrToStringUnix (ret_ptr);
} finally {
- UnixMarshal.FreeHeap(msgid_ptr);
- UnixMarshal.FreeHeap(msgid_plural_ptr);
- if(domain_ptr != IntPtr.Zero) {
- UnixMarshal.FreeHeap(domain_ptr);
+ UnixMarshal.FreeHeap (msgid_ptr);
+ UnixMarshal.FreeHeap (msgid_plural_ptr);
+ if (domain_ptr != IntPtr.Zero) {
+ UnixMarshal.FreeHeap (domain_ptr);
}
}
}
- private static string GetDomainForAssembly(Assembly assembly)
+ private static string GetDomainForAssembly (Assembly assembly)
{
- if(default_domain_assemblies.Contains(assembly)) {
+ if (default_domain_assemblies.Contains (assembly)) {
return null;
- } else if(domain_assembly_map.ContainsKey(assembly)) {
- return domain_assembly_map[assembly] as string;
+ } else if (domain_assembly_map.ContainsKey (assembly)) {
+ return domain_assembly_map[assembly];
}
- AssemblyCatalogAttribute [] attributes = assembly.GetCustomAttributes(
+ AssemblyCatalogAttribute [] attributes = assembly.GetCustomAttributes (
typeof(AssemblyCatalogAttribute), true) as AssemblyCatalogAttribute [];
- if(attributes == null || attributes.Length == 0) {
- default_domain_assemblies.Add(assembly);
+ if (attributes == null || attributes.Length == 0) {
+ default_domain_assemblies.Add (assembly);
return null;
}
string domain = attributes[0].Domain;
- Init(domain, attributes[0].LocaleDir);
- domain_assembly_map.Add(assembly, domain);
+ Init (domain, attributes[0].LocaleDir);
+ domain_assembly_map.Add (assembly, domain);
return domain;
}
- private static void BindTextDomainCodeset(IntPtr domain)
+ private static void BindTextDomainCodeset (IntPtr domain)
{
IntPtr codeset = UnixMarshal.StringToHeap("UTF-8");
try {
- if(bind_textdomain_codeset(domain, codeset) == IntPtr.Zero) {
- throw new UnixIOException(Mono.Unix.Native.Errno.ENOMEM);
+ if (bind_textdomain_codeset (domain, codeset) == IntPtr.Zero) {
+ throw new UnixIOException (Mono.Unix.Native.Errno.ENOMEM);
}
} finally {
- UnixMarshal.FreeHeap(codeset);
+ UnixMarshal.FreeHeap (codeset);
}
}
- private static void BindTextDomain(IntPtr domain, IntPtr localedir)
+ private static void BindTextDomain (IntPtr domain, IntPtr localedir)
{
- if(bindtextdomain(domain, localedir) == IntPtr.Zero) {
- throw new UnixIOException(Mono.Unix.Native.Errno.ENOMEM);
+ if (bindtextdomain (domain, localedir) == IntPtr.Zero) {
+ throw new UnixIOException (Mono.Unix.Native.Errno.ENOMEM);
}
}
- [DllImport("intl")]
- private static extern IntPtr bind_textdomain_codeset(IntPtr domain, IntPtr codeset);
+ [DllImport ("intl")]
+ private static extern IntPtr bind_textdomain_codeset (IntPtr domain, IntPtr codeset);
- [DllImport("intl")]
- private static extern IntPtr bindtextdomain(IntPtr domain, IntPtr locale_dir);
+ [DllImport ("intl")]
+ private static extern IntPtr bindtextdomain (IntPtr domain, IntPtr locale_dir);
- [DllImport("intl")]
- private static extern IntPtr dgettext(IntPtr domain, IntPtr msgid);
+ [DllImport ("intl")]
+ private static extern IntPtr dgettext (IntPtr domain, IntPtr msgid);
- [DllImport("intl")]
- private static extern IntPtr dngettext(IntPtr domain, IntPtr msgid_singular, IntPtr msgid_plural, Int32 n);
+ [DllImport ("intl")]
+ private static extern IntPtr dngettext (IntPtr domain, IntPtr msgid_singular, IntPtr msgid_plural, Int32 n);
- [DllImport("intl")]
- private static extern IntPtr gettext(IntPtr msgid);
+ [DllImport ("intl")]
+ private static extern IntPtr gettext (IntPtr msgid);
- [DllImport("intl")]
- private static extern IntPtr ngettext(IntPtr msgid_singular, IntPtr msgid_plural, Int32 n);
+ [DllImport ("intl")]
+ private static extern IntPtr ngettext (IntPtr msgid_singular, IntPtr msgid_plural, Int32 n);
}
}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/DemuxVfs.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/DemuxVfs.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,84 @@
+//
+// DemuxVfs.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 System.IO;
+
+using Banshee.Base;
+
+namespace Banshee.IO.SystemIO
+{
+ public class DemuxVfs : Banshee.IO.IDemuxVfs
+ {
+ private FileInfo file_info;
+
+ public DemuxVfs (string path)
+ {
+ file_info = new FileInfo (path);
+ }
+
+ public void CloseStream (Stream stream)
+ {
+ stream.Close ();
+ }
+
+ public string Name {
+ get { return file_info.FullName; }
+ }
+
+ public Stream ReadStream {
+ get { return file_info.Open (FileMode.Open, FileAccess.Read); }
+ }
+
+ public Stream WriteStream {
+ get { return file_info.Open (FileMode.Open, FileAccess.ReadWrite); }
+ }
+
+ public bool IsReadable {
+ get {
+ try {
+ ReadStream.Close ();
+ return true;
+ } catch {
+ return false;
+ }
+ }
+ }
+
+ public bool IsWritable {
+ get {
+ try {
+ WriteStream.Close ();
+ return true;
+ } catch {
+ return false;
+ }
+ }
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Directory.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Directory.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,73 @@
+//
+// Directory.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 System.Collections.Generic;
+
+using Banshee.Base;
+
+namespace Banshee.IO.SystemIO
+{
+ public class Directory : Banshee.IO.IDirectory
+ {
+ public void Create (string directory)
+ {
+ System.IO.Directory.CreateDirectory (directory);
+ }
+
+ public void Delete (string directory)
+ {
+ Delete (directory, false);
+ }
+
+ public void Delete (string directory, bool recursive)
+ {
+ System.IO.Directory.Delete (directory, recursive);
+ }
+
+ public bool Exists (string directory)
+ {
+ return System.IO.Directory.Exists (directory);
+ }
+
+ public IEnumerable<string> GetFiles (string directory)
+ {
+ return System.IO.Directory.GetFiles (directory);
+ }
+
+ public IEnumerable<string> GetDirectories (string directory)
+ {
+ return System.IO.Directory.GetDirectories (directory);
+ }
+
+ public void Move (SafeUri from, SafeUri to)
+ {
+ System.IO.Directory.Move (from.LocalPath, to.LocalPath);
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/File.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/File.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,74 @@
+//
+// File.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 System.IO;
+
+using Banshee.Base;
+
+namespace Banshee.IO.SystemIO
+{
+ public class File : Banshee.IO.IFile
+ {
+ public void Delete (SafeUri uri)
+ {
+ System.IO.File.Delete (uri.LocalPath);
+ }
+
+ public bool Exists (SafeUri uri)
+ {
+ return System.IO.File.Exists (uri.LocalPath);
+ }
+
+ public void Move (SafeUri from, SafeUri to)
+ {
+ System.IO.File.Move (from.LocalPath, to.LocalPath);
+ }
+
+ public long GetSize (SafeUri uri)
+ {
+ try {
+ return new System.IO.FileInfo (uri.LocalPath).Length;
+ } catch {
+ return -1;
+ }
+ }
+
+ public System.IO.Stream OpenRead (SafeUri uri)
+ {
+ return System.IO.File.OpenRead (uri.LocalPath);
+ }
+
+ public System.IO.Stream OpenWrite (SafeUri uri, bool overwrite)
+ {
+ return overwrite
+ ? System.IO.File.Open (uri.LocalPath, FileMode.Create, FileAccess.ReadWrite)
+ : System.IO.File.OpenWrite (uri.LocalPath);
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Provider.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO.SystemIO/Provider.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,47 @@
+//
+// Provider.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 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;
+
+namespace Banshee.IO.SystemIO
+{
+ public class Provider : Banshee.IO.IProvider
+ {
+ public Type FileProvider {
+ get { return typeof (File); }
+ }
+
+ public Type DirectoryProvider {
+ get { return typeof (Directory); }
+ }
+
+ public Type DemuxVfsProvider {
+ get { return typeof (DemuxVfs); }
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/DemuxVfs.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/DemuxVfs.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,46 @@
+//
+// DemuxVfs.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 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 TagLib;
+
+namespace Banshee.IO
+{
+ public static class DemuxVfs
+ {
+ public static TagLib.File OpenFile (string file, string mimetype, TagLib.ReadStyle readStyle)
+ {
+ return TagLib.File.Create (Provider.CreateDemuxVfs (file), mimetype, readStyle);
+ }
+
+ public static TagLib.File OpenFile (string file)
+ {
+ return TagLib.File.Create (Provider.CreateDemuxVfs (file));
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Directory.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Directory.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,73 @@
+//
+// Directory.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 System.Collections.Generic;
+
+using Banshee.Base;
+
+namespace Banshee.IO
+{
+ public static class Directory
+ {
+ public static bool Exists (string directory)
+ {
+ return Provider.Directory.Exists (directory);
+ }
+
+ public static void Create (string directory)
+ {
+ Provider.Directory.Create (directory);
+ }
+
+ public static void Move (SafeUri from, SafeUri to)
+ {
+ Provider.Directory.Move (from, to);
+ }
+
+ public static void Delete (string directory)
+ {
+ Provider.Directory.Delete (directory);
+ }
+
+ public static void Delete (string directory, bool recursive)
+ {
+ Provider.Directory.Delete (directory, recursive);
+ }
+
+ public static IEnumerable<string> GetFiles (string directory)
+ {
+ return Provider.Directory.GetFiles (directory);
+ }
+
+ public static IEnumerable<string> GetDirectories (string directory)
+ {
+ return Provider.Directory.GetDirectories (directory);
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/File.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/File.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,67 @@
+//
+// File.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 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.Base;
+
+namespace Banshee.IO
+{
+ public static class File
+ {
+ public static void Delete (SafeUri uri)
+ {
+ Provider.File.Delete (uri);
+ }
+
+ public static bool Exists (SafeUri uri)
+ {
+ return Provider.File.Exists (uri);
+ }
+
+ public static void Move (SafeUri from, SafeUri to)
+ {
+ Provider.File.Move (from, to);
+ }
+
+ public static long GetSize (SafeUri uri)
+ {
+ return Provider.File.GetSize (uri);
+ }
+
+ public static System.IO.Stream OpenRead (SafeUri uri)
+ {
+ return Provider.File.OpenRead (uri);
+ }
+
+ public static System.IO.Stream OpenWrite (SafeUri uri, bool overwrite)
+ {
+ return Provider.File.OpenWrite (uri, overwrite);
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDemuxVfs.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDemuxVfs.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,34 @@
+//
+// IDemuxVfs.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.
+//
+
+namespace Banshee.IO
+{
+ public interface IDemuxVfs : TagLib.File.IFileAbstraction
+ {
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDirectory.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IDirectory.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,50 @@
+//
+// IDirectory.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 System.Collections.Generic;
+
+using Banshee.Base;
+
+namespace Banshee.IO
+{
+ public interface IDirectory
+ {
+ bool Exists (string directory);
+
+ void Create (string directory);
+ void Move (SafeUri from, SafeUri to);
+
+ void Delete (string directory);
+ void Delete (string directory, bool recursive);
+
+ // FIXME: These probably need to normalize to SafeUri
+ IEnumerable<string> GetFiles (string directory);
+ IEnumerable<string> GetDirectories (string directory);
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IFile.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IFile.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,45 @@
+//
+// IFile.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.Base;
+
+namespace Banshee.IO
+{
+ public interface IFile
+ {
+ void Delete (SafeUri uri);
+ bool Exists (SafeUri uri);
+ void Move (SafeUri from, SafeUri to);
+ long GetSize (SafeUri uri);
+
+ System.IO.Stream OpenRead (SafeUri uri);
+ System.IO.Stream OpenWrite (SafeUri uri, bool overwrite);
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IProvider.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/IProvider.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,39 @@
+//
+// IProvider.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;
+
+namespace Banshee.IO
+{
+ public interface IProvider
+ {
+ Type FileProvider { get; }
+ Type DirectoryProvider { get; }
+ Type DemuxVfsProvider { get; }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Provider.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Provider.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,69 @@
+//
+// Provider.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 System.Reflection;
+
+using Banshee.Base;
+using Banshee.Configuration;
+
+namespace Banshee.IO
+{
+ internal static class Provider
+ {
+ private static IProvider provider;
+ private static IDirectory directory;
+ private static IFile file;
+
+ private static void LoadProvider ()
+ {
+ lock (typeof (Provider)) {
+ if (provider != null) {
+ return;
+ }
+
+ provider = new Banshee.IO.SystemIO.Provider ();
+ directory = (IDirectory)Activator.CreateInstance (provider.DirectoryProvider);
+ file = (IFile)Activator.CreateInstance (provider.FileProvider);
+ }
+ }
+
+ public static IDirectory Directory {
+ get { LoadProvider (); return directory; }
+ }
+
+ public static IFile File {
+ get { LoadProvider (); return file; }
+ }
+
+ public static IDemuxVfs CreateDemuxVfs (string file)
+ {
+ return (IDemuxVfs)Activator.CreateInstance (provider.DemuxVfsProvider, new object [] { file });
+ }
+ }
+}
Added: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/StreamAssist.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/StreamAssist.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,57 @@
+//
+// StreamAssist.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 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 System.IO;
+
+namespace Banshee.IO
+{
+ public static class StreamAssist
+ {
+ public static void Save (Stream from, Stream to)
+ {
+ Save (from, to, 8192);
+ }
+
+ public static void Save (Stream from, Stream to, int bufferSize)
+ {
+ using (from) {
+ long bytes_read = 0;
+ using (to) {
+ byte [] buffer = new byte[bufferSize];
+ int chunk_bytes_read = 0;
+
+ while ((chunk_bytes_read = from.Read (buffer, 0, buffer.Length)) > 0) {
+ to.Write (buffer, 0, chunk_bytes_read);
+ bytes_read += chunk_bytes_read;
+ }
+ }
+ }
+ }
+ }
+}
Copied: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/UnixIOProvider.cs (from r3155, /trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Unix.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Unix.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/UnixIOProvider.cs Wed Feb 6 23:49:53 2008
@@ -25,7 +25,7 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
-
+/*
using System;
using System.IO;
using System.Collections;
@@ -134,7 +134,7 @@
throw new Exception("Failed to allocate native directory string");
}
- if(g_mkdir_with_parents(path_ptr, 493 /*0755 - C# doesn't do octal literals*/) == -1) {
+ if(g_mkdir_with_parents(path_ptr, 493 /*0755 - C# doesn't do octal literals*//*) == -1) {
Mono.Unix.UnixMarshal.ThrowExceptionForLastError();
}
} catch(EntryPointNotFoundException) {
@@ -229,3 +229,4 @@
}
}
}
+*/
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Utilities.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Utilities.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.IO/Utilities.cs Wed Feb 6 23:49:53 2008
@@ -36,7 +36,7 @@
{
public static void DeleteFileTrimmingParentDirectories(SafeUri uri)
{
- Banshee.IO.IOProxy.File.Delete(uri);
+ /*Banshee.IO.IOProxy.File.Delete(uri);
try {
string old_dir = System.IO.Path.GetDirectoryName(uri.LocalPath);
@@ -45,7 +45,7 @@
old_dir = System.IO.Path.GetDirectoryName(old_dir);
}
} catch {
- }
+ }*/
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs Wed Feb 6 23:49:53 2008
@@ -4,7 +4,7 @@
// Author:
// Aaron Bockover <abockover novell com>
//
-// Copyright (C) 2006-2007 Novell, Inc.
+// 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
@@ -37,7 +37,7 @@
{
public static TagLib.File ProcessUri (SafeUri uri)
{
- TagLib.File file = Banshee.IO.IOProxy.OpenFile (uri.IsLocalPath ? uri.LocalPath : uri.AbsoluteUri,
+ TagLib.File file = Banshee.IO.DemuxVfs.OpenFile (uri.IsLocalPath ? uri.LocalPath : uri.AbsoluteUri,
null, TagLib.ReadStyle.Average);
if (file.Properties.MediaTypes != TagLib.MediaTypes.Audio) {
@@ -65,7 +65,7 @@
track.TrackCount = file.Tag.TrackCount == 0 ? track.TrackCount : (int)file.Tag.TrackCount;
track.Year = (int)file.Tag.Year;
track.Duration = file.Properties.Duration;
- track.FileSize = Banshee.IO.IOProxy.File.GetSize (track.Uri);
+ track.FileSize = Banshee.IO.File.GetSize (track.Uri);
}
public static void TrackInfoMerge(TrackInfo track, StreamTag tag)
Modified: trunk/banshee/src/Core/Banshee.Core/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Core/Makefile.am Wed Feb 6 23:49:53 2008
@@ -7,10 +7,11 @@
Banshee.Base/FileNamePattern.cs \
Banshee.Base/Localization.cs \
Banshee.Base/Log.cs \
+ Banshee.Base/NamingUtil.cs \
Banshee.Base/Paths.cs \
Banshee.Base/PlatformHacks.cs \
Banshee.Base/ProductInformation.cs \
- Banshee.Base/RateLimiter.cs \
+ Banshee.Base/Resource.cs \
Banshee.Base/SafeUri.cs \
Banshee.Base/StringUtil.cs \
Banshee.Base/UriList.cs \
@@ -28,15 +29,25 @@
Banshee.Configuration.Schema/ImportSchema.cs \
Banshee.Configuration.Schema/LibrarySchema.cs \
Banshee.Configuration/ConfigurationClient.cs \
- Banshee.Configuration/GConfConfigurationClient.cs \
Banshee.Configuration/IConfigurationClient.cs \
Banshee.Configuration/SchemaEntry.cs \
Banshee.Configuration/XmlConfigurationClient.cs \
- Banshee.IO/GnomeVfs.cs \
- Banshee.IO/Interfaces.cs \
- Banshee.IO/IOProxy.cs \
- Banshee.IO/SystemIO.cs \
- Banshee.IO/Unix.cs \
+ Banshee.I18n/AssemblyCatalogAttribute.cs \
+ Banshee.I18n/Catalog.cs \
+ Banshee.IO.SystemIO/DemuxVfs.cs \
+ Banshee.IO.SystemIO/Directory.cs \
+ Banshee.IO.SystemIO/File.cs \
+ Banshee.IO.SystemIO/Provider.cs \
+ Banshee.IO/DemuxVfs.cs \
+ Banshee.IO/Directory.cs \
+ Banshee.IO/File.cs \
+ Banshee.IO/IDemuxVfs.cs \
+ Banshee.IO/IDirectory.cs \
+ Banshee.IO/IFile.cs \
+ Banshee.IO/IProvider.cs \
+ Banshee.IO/Provider.cs \
+ Banshee.IO/StreamAssist.cs \
+ Banshee.IO/UnixIOProvider.cs \
Banshee.IO/Utilities.cs \
Banshee.Kernel/IInstanceCriticalJob.cs \
Banshee.Kernel/IJob.cs \
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.AudioProfiles/ProfileConfiguration.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.AudioProfiles/ProfileConfiguration.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.AudioProfiles/ProfileConfiguration.cs Wed Feb 6 23:49:53 2008
@@ -32,9 +32,11 @@
using System.Collections;
using System.Collections.Generic;
+using Banshee.Configuration;
+
namespace Banshee.AudioProfiles
{
- public abstract class ProfileConfiguration : IEnumerable<KeyValuePair<string, string>>
+ public class ProfileConfiguration : IEnumerable<KeyValuePair<string, string>>
{
private Dictionary<string, string> variable_values = new Dictionary<string, string>();
private string id;
@@ -42,38 +44,31 @@
public static ProfileConfiguration Load(Profile profile, string id)
{
- ProfileConfiguration configuration = new GConfProfileConfiguration(profile,
- Banshee.Configuration.GConfConfigurationClient.BaseKey +
- "audio_profiles/" + id + "/" + profile.ID + "/", id);
+ ProfileConfiguration configuration = new ProfileConfiguration(profile, id);
configuration.Load();
return configuration;
}
-
+
public static Profile LoadActiveProfile(ProfileManager manager, string id)
{
- try {
- string profile_id = GConfProfileConfiguration.LoadActiveProfile(
- Banshee.Configuration.GConfConfigurationClient.BaseKey + "audio_profiles/", id);
-
- if(profile_id == null) {
- return null;
- }
-
- foreach(Profile profile in manager.GetAvailableProfiles()) {
- if(profile.ID == profile_id) {
- return profile;
- }
+ string profile_id = ConfigurationClient.Get<string>(MakeConfNamespace(id), "active_profile", string.Empty);
+
+ if(profile_id == string.Empty) {
+ return null;
+ }
+
+ foreach(Profile profile in manager.GetAvailableProfiles()) {
+ if(profile.ID == profile_id) {
+ return profile;
}
- } catch {
}
-
+
return null;
}
public static void SaveActiveProfile(Profile profile, string id)
{
- GConfProfileConfiguration.SaveActiveProfile(profile,
- Banshee.Configuration.GConfConfigurationClient.BaseKey + "audio_profiles/", id);
+ ConfigurationClient.Set<string>(MakeConfNamespace(id), "active_profile", profile.ID);
}
public ProfileConfiguration(Profile profile, string id)
@@ -82,8 +77,22 @@
this.id = id;
}
- protected abstract void Load();
- public abstract void Save();
+ protected virtual void Load()
+ {
+ foreach(string variable in ConfigurationClient.Get<string[]>(ConfNamespace, "variables", new string[0])) {
+ Add(variable, ConfigurationClient.Get<string>(ConfNamespace, variable, string.Empty));
+ }
+ }
+
+ public virtual void Save()
+ {
+ List<string> variable_names = new List<string>(Count);
+ foreach(KeyValuePair<string, string> variable in this) {
+ variable_names.Add(variable.Key);
+ ConfigurationClient.Set<string>(ConfNamespace, variable.Key, variable.Value);
+ }
+ ConfigurationClient.Set<string[]>(ConfNamespace, "variables", variable_names.ToArray());
+ }
public void Add(string variable, string value)
{
@@ -118,5 +127,18 @@
public string ID {
get { return id; }
}
+
+ public int Count {
+ get { return variable_values.Count; }
+ }
+
+ protected string ConfNamespace {
+ get { return MakeConfNamespace(id); }
+ }
+
+ protected static string MakeConfNamespace(string id)
+ {
+ return String.Format("audio_profiles.{0}", id);
+ }
}
-}
+}
\ No newline at end of file
Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Base/ThreadAssist.cs Wed Feb 6 23:49:53 2008
@@ -0,0 +1,71 @@
+//
+// ThreadAssist.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-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 System.Threading;
+
+namespace Banshee.Base
+{
+ public static class ThreadAssist
+ {
+ private static Thread main_thread;
+
+ static ThreadAssist ()
+ {
+ main_thread = Thread.CurrentThread;
+ }
+
+ public static bool InMainThread {
+ get { return main_thread.Equals (Thread.CurrentThread); }
+ }
+
+ public static void ProxyToMain (EventHandler handler)
+ {
+ if (!InMainThread) {
+ Banshee.ServiceStack.Application.Invoke (handler);
+ } else {
+ handler (null, new EventArgs ());
+ }
+ }
+
+ public static Thread Spawn (ThreadStart threadedMethod, bool autoStart)
+ {
+ Thread thread = new Thread (threadedMethod);
+ thread.IsBackground = true;
+ if (autoStart) {
+ thread.Start ();
+ }
+ return thread;
+ }
+
+ public static Thread Spawn (ThreadStart threadedMethod)
+ {
+ return Spawn (threadedMethod, true);
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryTrackInfo.cs Wed Feb 6 23:49:53 2008
@@ -266,12 +266,12 @@
SafeUri new_uri = new SafeUri (new_filename);
try {
- if (IOProxy.File.Exists (new_uri)) {
+ if (Banshee.IO.File.Exists (new_uri)) {
return null;
}
// TODO: Once GnomeVfs and Unix have proper Copy providers, use IOProxy.File.Copy instead.
- File.Copy (old_uri.LocalPath, new_uri.LocalPath);
+ System.IO.File.Copy (old_uri.LocalPath, new_uri.LocalPath);
// Return new SafeUri after copy
return new_uri;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection/ImportManager.cs Wed Feb 6 23:49:53 2008
@@ -191,8 +191,8 @@
SafeUri source_uri = new SafeUri (source);
try {
- is_regular_file = IOProxy.File.Exists (source_uri);
- is_directory = !is_regular_file && IOProxy.Directory.Exists (source);
+ is_regular_file = Banshee.IO.File.Exists (source_uri);
+ is_directory = !is_regular_file && Banshee.IO.Directory.Exists (source);
} catch {
Interlocked.Decrement (ref scan_ref_count);
return;
@@ -210,11 +210,11 @@
try {
if (!Path.GetFileName (Path.GetDirectoryName (source)).StartsWith (".")) {
try {
- foreach (string file in IOProxy.Directory.GetFiles (source)) {
+ foreach (string file in Banshee.IO.Directory.GetFiles (source)) {
ScanForFiles (file);
}
- foreach (string directory in IOProxy.Directory.GetDirectories (source)) {
+ foreach (string directory in Banshee.IO.Directory.GetDirectories (source)) {
ScanForFiles (directory);
}
} catch {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata.Embedded/EmbeddedQueryJob.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata.Embedded/EmbeddedQueryJob.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata.Embedded/EmbeddedQueryJob.cs Wed Feb 6 23:49:53 2008
@@ -27,6 +27,7 @@
//
using System;
+using System.IO;
using System.Collections.Generic;
using TagLib;
@@ -108,17 +109,16 @@
return preferred_index;
}
- protected bool SavePicture(IPicture picture, string image_path)
+ protected bool SavePicture (IPicture picture, string image_path)
{
- if(picture == null || picture.Data == null || picture.Data.Count == 0) {
+ if (picture == null || picture.Data == null || picture.Data.Count == 0) {
return false;
}
- using(System.IO.MemoryStream stream = new System.IO.MemoryStream(picture.Data.Data)) {
- Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(stream);
- pixbuf.Save(image_path, "jpeg");
- }
-
+ Banshee.IO.StreamAssist.Save (new MemoryStream (picture.Data.Data),
+ new FileStream (Path.ChangeExtension (image_path, "cover"),
+ FileMode.Create, FileAccess.ReadWrite));
+
return true;
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs Wed Feb 6 23:49:53 2008
@@ -139,20 +139,9 @@
return false;
}
- using(from_stream) {
- long bytes_read = 0;
-
- using(FileStream to_stream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite)) {
- byte [] buffer = new byte[8192];
- int chunk_bytes_read = 0;
-
- while((chunk_bytes_read = from_stream.Read(buffer, 0, buffer.Length)) > 0) {
- to_stream.Write(buffer, 0, chunk_bytes_read);
- bytes_read += chunk_bytes_read;
- }
- }
- }
-
+ Banshee.IO.StreamAssist.Save (from_stream, new FileStream (path,
+ FileMode.Create, FileAccess.ReadWrite));
+
return true;
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs Wed Feb 6 23:49:53 2008
@@ -131,7 +131,7 @@
foreach (PlaylistFormatDescription format in formats) {
try {
IPlaylistFormat playlist = (IPlaylistFormat)Activator.CreateInstance (format.Type);
- playlist.Load (Banshee.IO.IOProxy.File.OpenRead (new SafeUri (playlistUri)), true);
+ playlist.Load (Banshee.IO.File.OpenRead (new SafeUri (playlistUri)), true);
foreach (Dictionary<string, object> element in playlist.Elements) {
uris.Add (((Uri)element["uri"]).AbsoluteUri);
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlists.Formats/PlaylistParser.cs Wed Feb 6 23:49:53 2008
@@ -58,7 +58,7 @@
Stream stream = null;
if(uri.Scheme == "file") {
- stream = Banshee.IO.IOProxy.File.OpenRead(uri);
+ stream = Banshee.IO.File.OpenRead(uri);
} else if(uri.Scheme == "http") {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri.AbsoluteUri);
request.UserAgent = Banshee.Web.Browser.UserAgent;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs Wed Feb 6 23:49:53 2008
@@ -101,6 +101,11 @@
RunIdle (delegate { handler (); return false; });
}
+ public static void Invoke (EventHandler handler)
+ {
+ RunIdle (delegate { handler (null, EventArgs.Empty); return false; });
+ }
+
public static uint RunIdle (IdleHandler handler)
{
if (idle_handler == null) {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.addin.xml Wed Feb 6 23:49:53 2008
@@ -16,4 +16,12 @@
<ExtensionNode name="PlayerEngine"/>
</ExtensionPoint>
+ <ExtensionPoint path="/Banshee/Platform/IOProvider">
+ <ExtensionNode name="IOProvider"/>
+ </ExtensionPoint>
+
+ <ExtensionPoint path="/Banshee/Platform/ConfigurationProvider">
+ <ExtensionNode name="ConfigurationProvider"/>
+ </ExtensionPoint>
+
</Addin>
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 6 23:49:53 2008
@@ -78,7 +78,6 @@
<File name="Banshee.Sources/ErrorSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.MediaEngine/IPlayerEngineService.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection/BansheeListModel.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.AudioProfiles/GConfProfileConfiguration.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.AudioProfiles/Pipeline.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.AudioProfiles/PipelineVariable.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.AudioProfiles/Profile.cs" subtype="Code" buildaction="Compile" />
@@ -120,6 +119,9 @@
<File name="Banshee.ServiceStack/IExtensionService.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Configuration/DatabaseConfigurationClient.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Sources/SourceMergeType.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Base" subtype="Directory" buildaction="Compile" />
+ <File name="Banshee.Base/RateLimiter.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Base/ThreadAssist.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/Banshee.SmartPlaylist/SmartPlaylistCore.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.SmartPlaylist/SmartPlaylistCore.cs Wed Feb 6 23:49:53 2008
@@ -44,8 +44,6 @@
public SmartPlaylistCore()
{
- Gnome.Vfs.Vfs.Initialize();
-
Migrator.MigrateAll ();
// Listen for added/removed sources and added/changed songs
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 6 23:49:53 2008
@@ -3,12 +3,13 @@
LINK = $(REF_BANSHEE_SERVICES)
SOURCES = \
- Banshee.AudioProfiles/GConfProfileConfiguration.cs \
Banshee.AudioProfiles/Pipeline.cs \
Banshee.AudioProfiles/PipelineVariable.cs \
Banshee.AudioProfiles/Profile.cs \
Banshee.AudioProfiles/ProfileConfiguration.cs \
Banshee.AudioProfiles/ProfileManager.cs \
+ Banshee.Base/RateLimiter.cs \
+ Banshee.Base/ThreadAssist.cs \
Banshee.Collection.Database/AlbumListDatabaseModel.cs \
Banshee.Collection.Database/ArtistListDatabaseModel.cs \
Banshee.Collection.Database/LibraryAlbumInfo.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp Wed Feb 6 23:49:53 2008
@@ -80,6 +80,7 @@
<File name="Banshee.Sources.Gui/SourceRowRenderer.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Sources.Gui/SourceView_DragAndDrop.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Gui.Dialogs/PreferencesDialog.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Collection.Gui/ColumnCellTrackNumber.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />
Modified: trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/LinkLabel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/LinkLabel.cs (original)
+++ trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/LinkLabel.cs Wed Feb 6 23:49:53 2008
@@ -72,7 +72,7 @@
protected virtual void OnClicked()
{
- if(uri != null) {
+ if(uri != null && Open != null) {
Open(uri.AbsoluteUri);
}
@@ -230,14 +230,7 @@
}
public static UriOpenHandler DefaultOpen {
- get {
- if(default_open_handler == null) {
- default_open_handler = new UriOpenHandler(Gnome.Url.Show);
- }
-
- return default_open_handler;
- }
-
+ get { return default_open_handler; }
set { default_open_handler = value; }
}
}
Modified: trunk/banshee/src/Core/Hyena/Hyena.mdp
==============================================================================
--- trunk/banshee/src/Core/Hyena/Hyena.mdp (original)
+++ trunk/banshee/src/Core/Hyena/Hyena.mdp Wed Feb 6 23:49:53 2008
@@ -89,4 +89,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
-</Project>
+</Project>
\ No newline at end of file
Modified: trunk/banshee/src/Core/Nereid/Nereid/Client.cs
==============================================================================
--- trunk/banshee/src/Core/Nereid/Nereid/Client.cs (original)
+++ trunk/banshee/src/Core/Nereid/Nereid/Client.cs Wed Feb 6 23:49:53 2008
@@ -37,20 +37,10 @@
Banshee.Gui.GtkBaseClient.Entry<Client> ();
}
- private Gnome.Program program;
-
protected override void OnRegisterServices ()
{
- program = new Gnome.Program ("Banshee", Banshee.ServiceStack.Application.Version,
- Gnome.Modules.UI, System.Environment.GetCommandLineArgs ());
-
Banshee.ServiceStack.ServiceManager.RegisterService <PlayerInterface> ();
}
-
- public override void Run ()
- {
- program.Run ();
- }
}
}
Modified: trunk/banshee/src/Extensions/Template/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Template/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Template/Makefile.am Wed Feb 6 23:49:53 2008
@@ -4,7 +4,7 @@
SOURCES =
-RESOURCES =
+RESOURCES = @EXTENSION_NAME addin xml
include $(top_srcdir)/build/build.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]