banshee r4013 - in trunk/banshee: . build src/Clients/Halie/Halie src/Clients/Nereid/Nereid src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Extensions src/Extensions/Banshee.FileSystemQueue src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue src/Extensions/Banshee.FileSystemQueue/Resources src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue



Author: abock
Date: Wed May 28 21:07:23 2008
New Revision: 4013
URL: http://svn.gnome.org/viewvc/banshee?rev=4013&view=rev

Log:
2008-05-28  Aaron Bockover  <abock gnome org>

    * src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs:
    The new file system queue, much like the old local queue - not finished
    but mostly working

    * src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
    Fixed source order

    * src/Clients/Halie/Halie/Client.cs: Support presenting the main window

    * src/Clients/Nereid/Nereid/PlayerInterface.cs:
    * src/Clients/Nereid/Nereid/Client.cs: Call NotifyStartupComplete in case
    an instance was already running and the new process exits quickly; this
    prevents GTK/GDK/GNOME from spinning a cursor if the process was started
    through a GUI launcher

    * src/Core/Banshee.ThickClient/Banshee.Gui/IClientWindow.cs: New interface
    for client windows to expose remote functionality

    * src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs: Added support
    for an AutoAddSource property - if it's set to false an extension source
    will not get added automatically to the source manager

    * src/Core/Banshee.Services/Banshee.ServiceStack/IDBusObjectName.cs:
    An interface that can be used to override the export name of a remote object

    * src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs:
    Support IDBusObjectName interface naming



Added:
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/IDBusObjectName.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IClientWindow.cs
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.addin.xml
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.mdp
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Makefile.am
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/ActiveSourceUI.xml
   trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/GlobalUI.xml
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/configure.ac
   trunk/banshee/src/Clients/Halie/Halie/Client.cs
   trunk/banshee/src/Clients/Nereid/Nereid/Client.cs
   trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
   trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
   trunk/banshee/src/Extensions/Extensions.mds
   trunk/banshee/src/Extensions/Makefile.am

Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk	(original)
+++ trunk/banshee/build/build.environment.mk	Wed May 28 21:07:23 2008
@@ -112,6 +112,7 @@
 REF_EXTENSION_BOOSCRIPT = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_BOO)
 REF_EXTENSION_COVERART = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_DAAP = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_ICSHARP_ZIP_LIB) $(LINK_MONO_ZEROCONF)
+REF_EXTENSION_FILESYSTEMQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_MINIMODE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Wed May 28 21:07:23 2008
@@ -161,6 +161,7 @@
 src/Extensions/Banshee.BooScript/Makefile
 src/Extensions/Banshee.CoverArt/Makefile
 src/Extensions/Banshee.Daap/Makefile
+src/Extensions/Banshee.FileSystemQueue/Makefile
 src/Extensions/Banshee.Lastfm/Makefile
 src/Extensions/Banshee.MiniMode/Makefile
 src/Extensions/Banshee.MultimediaKeys/Makefile

Modified: trunk/banshee/src/Clients/Halie/Halie/Client.cs
==============================================================================
--- trunk/banshee/src/Clients/Halie/Halie/Client.cs	(original)
+++ trunk/banshee/src/Clients/Halie/Halie/Client.cs	Wed May 28 21:07:23 2008
@@ -27,8 +27,11 @@
 //
 
 using System;
+using System.IO;
 using System.Collections.Generic;
 
+using NDesk.DBus;
+
 using Hyena;
 using Banshee.Base;
 using Banshee.ServiceStack;
@@ -39,6 +42,18 @@
 {
     public static class Client
     {
+        // NOTE: Interface is copied from Banshee.ThickClient/Banshee.Gui
+        // since we don't want to link against any GUI assemblies for this
+        // client. It's a simple interface
+        [Interface ("org.bansheeproject.Banshee.ClientWindow")]
+        public interface IClientWindow
+        {
+            void Present ();
+        }
+        
+        private static bool hide_field;
+        private static DBusCommandService command;
+    
         public static void Main ()
         {
             if (!DBusConnection.ConnectTried) {
@@ -53,25 +68,49 @@
                 return;
             }
             
-            HandlePlayerCommands ();
+            command = DBusServiceManager.FindInstance<DBusCommandService> ("/DBusCommandService");
+            hide_field = ApplicationContext.CommandLine.Contains ("hide-field");
+            
             HandleFiles ();
+            bool present = HandlePlayerCommands ();
+            HandleWindowCommands (present);
+        }
+        
+        private static void HandleWindowCommands (bool present)
+        {
+            IClientWindow window = DBusServiceManager.FindInstance<IClientWindow> ("/ClientWindow");
+            if (window == null) {
+                return;
+            }
+            
+            foreach (KeyValuePair<string, string> arg in ApplicationContext.CommandLine.Arguments) {
+                switch (arg.Key) {
+                    case "show":
+                    case "present": present = true; break;
+                }
+            }
+            
+            if (present) {
+                window.Present ();
+            }
         }
         
         private static void HandleFiles ()
         {
-            DBusCommandService command = DBusServiceManager.FindInstance<DBusCommandService> ("/DBusCommandService");
             foreach (string file in ApplicationContext.CommandLine.Files) {
-                command.PushFile (file);
+                command.PushFile (Path.GetFullPath (file));
             }
         }
         
-        private static void HandlePlayerCommands ()
+        private static bool HandlePlayerCommands ()
         {
             IPlayerEngineService player = DBusServiceManager.FindInstance<IPlayerEngineService> ("/PlayerEngine");
             IPlaybackControllerService controller = DBusServiceManager.FindInstance<IPlaybackControllerService> ("/PlaybackController");
             IDictionary<string, object> track = null;
+            int handled_count = 0;
             
             foreach (KeyValuePair<string, string> arg in ApplicationContext.CommandLine.Arguments) {
+                handled_count++;
                 switch (arg.Key) {
                     // For the player engine
                     case "play":           player.Play ();          break;
@@ -92,10 +131,15 @@
                                 track = player.CurrentTrack;
                             }
                             HandleQuery (player, track, arg.Key.Substring (6));
+                        } else {
+                            command.PushArgument (arg.Key, arg.Value ?? String.Empty);
+                            handled_count--;
                         }
                         break;
                 }
             }
+            
+            return handled_count <= 0;
         }
         
         private static void HandleQuery (IPlayerEngineService player, IDictionary<string, object> track, string query)
@@ -157,7 +201,11 @@
                 result = value.ToString ();
             }
             
-            Console.WriteLine ("{0}: {1}", field, result);
+            if (hide_field) {
+                Console.WriteLine (result);
+            } else {
+                Console.WriteLine ("{0}: {1}", field, result);
+            }
         }
         
         private static bool ParseBool (string value)

Modified: trunk/banshee/src/Clients/Nereid/Nereid/Client.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/Client.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/Client.cs	Wed May 28 21:07:23 2008
@@ -46,6 +46,7 @@
                 // Try running our friend Halie, the DBus command line client
                 AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
                     Assembly.GetEntryAssembly ().Location), "Halie.exe"));
+                Gdk.Global.NotifyStartupComplete ();
                 return;
             }
                     

Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	Wed May 28 21:07:23 2008
@@ -54,7 +54,7 @@
 
 namespace Nereid
 {
-    public class PlayerInterface : BaseClientWindow, IService, IDisposable, IHasSourceView
+    public class PlayerInterface : BaseClientWindow, IClientWindow, IDBusObjectName, IService, IDisposable, IHasSourceView
     {
         // Major Layout Components
         private VBox primary_vbox;
@@ -543,6 +543,14 @@
 
 #endregion
 
+        IDBusExportable IDBusExportable.Parent {
+            get { return null; }
+        }
+        
+        string IDBusObjectName.ExportObjectName {
+            get { return "ClientWindow"; }
+        }
+
         string IService.ServiceName {
             get { return "NereidPlayerInterface"; }
         }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs	Wed May 28 21:07:23 2008
@@ -67,7 +67,7 @@
             IDBusExportable p = o.Parent;
             
             while (p != null) {
-                paths.Push (String.Format ("{0}/", p.ServiceName));
+                paths.Push (String.Format ("{0}/", GetObjectName (p)));
                 p = p.Parent;
             }
             
@@ -75,11 +75,16 @@
                 object_path.Append (paths.Pop ());
             }
             
-            object_path.Append (o.ServiceName);
+            object_path.Append (GetObjectName (o));
             
             return object_path.ToString ();
         }
         
+        private static string GetObjectName (IDBusExportable o)
+        {
+            return o is IDBusObjectName ? ((IDBusObjectName)o).ExportObjectName : o.ServiceName;
+        }
+        
         public static string [] MakeObjectPathArray<T> (IEnumerable<T> collection) where T : IDBusExportable
         {
             List<string> paths = new List<string> ();

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/IDBusObjectName.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/IDBusObjectName.cs	Wed May 28 21:07:23 2008
@@ -0,0 +1,37 @@
+//
+// IDBusObjectName.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.ServiceStack
+{
+    public interface IDBusObjectName : IDBusExportable
+    {
+        string ExportObjectName { get; }
+    }
+}

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 May 28 21:07:23 2008
@@ -171,6 +171,7 @@
     <File name="Banshee.Collection/IFilterListModel.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.ServiceStack/DBusConnection.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.ServiceStack/DBusCommandService.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.ServiceStack/IDBusObjectName.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.Sources/SourceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs	Wed May 28 21:07:23 2008
@@ -114,7 +114,13 @@
                 if (args.Change == ExtensionChange.Add && !extension_sources.ContainsKey (node.Id)) {
                     Source source = (Source)node.CreateInstance ();
                     extension_sources.Add (node.Id, source);
-                    AddSource (source);
+                    bool add_source = true;
+                    if (source.Properties.Contains ("AutoAddSource")) {
+                        add_source = source.Properties.GetBoolean ("AutoAddSource");
+                    }
+                    if (add_source) {
+                        AddSource (source);
+                    }
                 } else if (args.Change == ExtensionChange.Remove && extension_sources.ContainsKey (node.Id)) {
                     Source source = extension_sources[node.Id];
                     extension_sources.Remove (node.Id);

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 May 28 21:07:23 2008
@@ -129,6 +129,7 @@
 	Banshee.ServiceStack/DBusConnection.cs \
 	Banshee.ServiceStack/DBusServiceManager.cs \
 	Banshee.ServiceStack/IDBusExportable.cs \
+	Banshee.ServiceStack/IDBusObjectName.cs \
 	Banshee.ServiceStack/IDelayedInitializeService.cs \
 	Banshee.ServiceStack/IExtensionService.cs \
 	Banshee.ServiceStack/IInitializeService.cs \

Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IClientWindow.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IClientWindow.cs	Wed May 28 21:07:23 2008
@@ -0,0 +1,41 @@
+//
+// IClientWindow.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 NDesk.DBus;
+
+using Banshee.ServiceStack;
+
+namespace Banshee.Gui
+{
+    [Interface ("org.bansheeproject.Banshee.ClientWindow")]
+    public interface IClientWindow : IDBusExportable
+    {
+        void Present ();
+    }
+}

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 May 28 21:07:23 2008
@@ -114,6 +114,7 @@
     <File name="Banshee.Sources.Gui/FilteredListSourceContents.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Collection.Gui/DefaultColumnController.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Collection.Gui/XmlColumnController.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui/IClientWindow.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am	Wed May 28 21:07:23 2008
@@ -64,6 +64,7 @@
 	Banshee.Gui/GlobalActions.cs \
 	Banshee.Gui/GtkBaseClient.cs \
 	Banshee.Gui/GtkElementsService.cs \
+	Banshee.Gui/IClientWindow.cs \
 	Banshee.Gui/IconThemeUtils.cs \
 	Banshee.Gui/IHasSourceView.cs \
 	Banshee.Gui/InterfaceActionService.cs \

Added: trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.addin.xml	Wed May 28 21:07:23 2008
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin 
+    id="Banshee.FileSystemQueue"
+    version="1.0"
+    compatVersion="1.0"
+    copyright="Â 2008 Novell Inc. Licensed under the MIT X11 license."
+    name="Play Queue"
+    category="User Interface"
+    description="Provides a source that allows files to be previewed without actually importing to the library."
+    author="Aaron Bockover"
+    url="http://banshee-project.org/";
+    defaultEnabled="true">
+
+  <Dependencies>
+    <Addin id="Banshee.Services" version="1.0"/>
+    <Addin id="Banshee.ThickClient" version="1.0"/>
+  </Dependencies>
+
+  <Extension path="/Banshee/SourceManager/Source">
+    <Source class="Banshee.FileSystemQueue.FileSystemQueueSource"/>
+  </Extension>
+  
+</Addin>

Added: trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue.mdp	Wed May 28 21:07:23 2008
@@ -0,0 +1,31 @@
+<Project name="Banshee.FileSystemQueue" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.FileSystemQueue" />
+      <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.FileSystemQueue/FileSystemQueueSource.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.FileSystemQueue.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/ActiveSourceUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
+    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+  </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/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Banshee.FileSystemQueue/FileSystemQueueSource.cs	Wed May 28 21:07:23 2008
@@ -0,0 +1,176 @@
+//
+// FileSystemQueueSource.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 Mono.Unix;
+using Gtk;
+
+using Hyena;
+
+using Banshee.Base;
+using Banshee.Sources;
+using Banshee.ServiceStack;
+using Banshee.Collection;
+using Banshee.Collection.Database;
+using Banshee.Configuration;
+
+using Banshee.Gui;
+
+namespace Banshee.FileSystemQueue
+{
+    public class FileSystemQueueSource : PrimarySource, IDisposable
+    {
+        private DatabaseImportManager importer;
+        private bool visible = false;
+        private bool actions_loaded = false;
+        
+        protected override string TypeUniqueId {
+            get { return "file-system-queue"; }
+        }
+        
+        public FileSystemQueueSource () : base (Catalog.GetString ("File System Queue"), 
+            Catalog.GetString ("File System Queue"), "file-system-queue", 9)
+        {
+            Properties.SetString ("Icon.Name", "system-file-manager");
+            Properties.Set<bool> ("AutoAddSource", false);
+            
+            importer = new DatabaseImportManager (this);
+            importer.KeepUserJobHidden = true;
+            
+            ServiceManager.Get<DBusCommandService> ().ArgumentPushed += OnCommandLineArgument;
+            
+            AfterInitialized ();
+            
+            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
+            uia_service.GlobalActions.AddImportant (
+                new ActionEntry ("ClearFileSystemQueueAction", Stock.Clear,
+                    Catalog.GetString ("Clear"), null,
+                    Catalog.GetString ("Remove all tracks from the file system queue"),
+                    OnClearFileSystemQueue)
+            );
+            
+            uia_service.GlobalActions.Add (new ToggleActionEntry [] {
+                new ToggleActionEntry ("ClearFileSystemQueueOnQuitAction", null,
+                    Catalog.GetString ("Clear on Quit"), null, 
+                    Catalog.GetString ("Clear the file system queue when quitting"), 
+                    OnClearFileSystemQueueOnQuit, ClearOnQuitSchema.Get ())
+            });
+            
+            uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+            
+            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
+            Properties.SetString ("GtkActionPath", "/FileSystemQueueContextMenu");
+            
+            actions_loaded = true;
+            
+            UpdateActions ();
+            ServiceManager.SourceManager.ActiveSourceChanged += delegate { UpdateActions (); };
+        }
+        
+        public void Enqueue (string path)
+        {
+            importer.QueueSource (path);
+        }
+        
+        public override void Dispose ()
+        {
+            ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
+            if (ClearOnQuitSchema.Get ()) {
+                OnClearFileSystemQueue (this, EventArgs.Empty);
+            }
+            base.Dispose ();
+        }
+        
+        private void OnCommandLineArgument (string argument, object value, bool isFile)
+        {
+            if (!isFile) {
+                return;
+            }
+            
+            Log.DebugFormat ("FileSystemQueueSource::Enqueue => {0}", argument);
+            
+            try {
+                if (Banshee.IO.Directory.Exists (argument) || Banshee.IO.File.Exists (new SafeUri (argument))) {
+                    Enqueue (argument);
+                }
+            } catch {
+            }
+        }
+        
+        protected override void OnUpdated ()
+        {
+            base.OnUpdated ();
+            
+            if (actions_loaded) {
+                UpdateActions ();
+            }
+            
+            if (Count > 0 && !visible) {
+                ServiceManager.SourceManager.AddSource (this);
+                visible = true;
+            } else if (Count <= 0 && visible) {
+                ServiceManager.SourceManager.RemoveSource (this);
+                visible = false;
+            }
+        }
+        
+        private void OnClearFileSystemQueue (object o, EventArgs args)
+        {
+            RemoveTrackRange ((DatabaseTrackListModel)TrackModel, new Hyena.Collections.RangeCollection.Range (0, Count));
+            Reload ();
+        }
+        
+        private void OnClearFileSystemQueueOnQuit (object o, EventArgs args)
+        {
+            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
+            if (uia_service == null) {
+                return;
+            }
+            
+            ToggleAction action = (ToggleAction)uia_service.GlobalActions["ClearFileSystemQueueOnQuitAction"];
+            ClearOnQuitSchema.Set (action.Active);
+        }
+        
+        private void UpdateActions ()
+        {   
+            InterfaceActionService uia_service = ServiceManager.Get<InterfaceActionService> ();
+            if (uia_service == null) {
+                return;
+            }
+            
+            uia_service.GlobalActions.UpdateAction ("ClearFileSystemQueueAction", true, Count > 0);
+        }
+        
+        public static readonly SchemaEntry<bool> ClearOnQuitSchema = new SchemaEntry<bool> (
+            "plugins.file_system_queue", "clear_on_quit",
+            false,
+            "Clear on Quit",
+            "Clear the file system queue when quitting"
+        );
+    }
+}

Added: trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Makefile.am	Wed May 28 21:07:23 2008
@@ -0,0 +1,14 @@
+ASSEMBLY = Banshee.FileSystemQueue
+TARGET = library
+LINK = $(REF_EXTENSION_FILESYSTEMQUEUE)
+INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
+
+SOURCES = Banshee.FileSystemQueue/FileSystemQueueSource.cs 
+
+RESOURCES =  \
+	Banshee.FileSystemQueue.addin.xml \
+	Resources/ActiveSourceUI.xml \
+	Resources/GlobalUI.xml
+
+include $(top_srcdir)/build/build.mk
+

Added: trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/ActiveSourceUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/ActiveSourceUI.xml	Wed May 28 21:07:23 2008
@@ -0,0 +1,7 @@
+<ui>
+    <toolbar name="HeaderToolbar">
+        <placeholder name="SourceActions">
+            <toolitem action="ClearFileSystemQueueAction" />
+        </placeholder>
+    </toolbar>
+</ui>

Added: trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/GlobalUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.FileSystemQueue/Resources/GlobalUI.xml	Wed May 28 21:07:23 2008
@@ -0,0 +1,6 @@
+<ui>
+    <popup name="FileSystemQueueContextMenu">
+        <menuitem action="ClearFileSystemQueueAction"></menuitem>
+        <menuitem action="ClearFileSystemQueueOnQuitAction"></menuitem>
+    </popup>
+</ui>
\ No newline at end of file

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	Wed May 28 21:07:23 2008
@@ -58,7 +58,7 @@
             get { return false; }
         }
         
-        public PlayQueueSource () : base (Catalog.GetString ("Play Queue"), null, 0)
+        public PlayQueueSource () : base (Catalog.GetString ("Play Queue"), null, 5)
         {
             BindToDatabase ();
             

Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds	(original)
+++ trunk/banshee/src/Extensions/Extensions.mds	Wed May 28 21:07:23 2008
@@ -14,6 +14,7 @@
       <Entry build="True" name="Banshee.Sample" configuration="Debug" />
       <Entry build="True" name="Banshee.BooScript" configuration="Debug" />
       <Entry build="True" name="Banshee.CoverArt" configuration="Debug" />
+      <Entry build="True" name="Banshee.FileSystemQueue" configuration="Debug" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="Banshee.Daap" single="True">
@@ -30,6 +31,7 @@
     <Execute type="None" entry="Banshee.Sample" />
     <Execute type="None" entry="Banshee.BooScript" />
     <Execute type="None" entry="Banshee.CoverArt" />
+    <Execute type="None" entry="Banshee.FileSystemQueue" />
   </StartMode>
   <Entries>
     <Entry filename="Banshee.Daap/Banshee.Daap.mdp" />
@@ -45,5 +47,6 @@
     <Entry filename="Banshee.Sample/Banshee.Sample.mdp" />
     <Entry filename="Banshee.BooScript/Banshee.BooScript.mdp" />
     <Entry filename="Banshee.CoverArt/Banshee.CoverArt.mdp" />
+    <Entry filename="Banshee.FileSystemQueue/Banshee.FileSystemQueue.mdp" />
   </Entries>
 </Combine>
\ No newline at end of file

Modified: trunk/banshee/src/Extensions/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Makefile.am	Wed May 28 21:07:23 2008
@@ -4,6 +4,7 @@
 	Banshee.BooScript \
 	Banshee.CoverArt \
 	Banshee.Daap \
+	Banshee.FileSystemQueue \
 	Banshee.Lastfm \
 	Banshee.MiniMode \
 	Banshee.MultimediaKeys \



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