banshee r4514 - in trunk/banshee: . build src/Clients src/Clients/Beroe/Beroe src/Clients/Booter src/Clients/Booter/Booter src/Clients/Halie/Halie src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient/Banshee.Gui src/Dap/Banshee.Dap



Author: abock
Date: Thu Sep 11 14:57:17 2008
New Revision: 4514
URL: http://svn.gnome.org/viewvc/banshee?rev=4514&view=rev

Log:
2008-09-11  Aaron Bockover  <abock gnome org>

    * src/Clients/Booter: New client to take care of the booting of other
    clients based on the crazy boot sequence logic (to be added)

    * src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs: Moved
    the non-GUI related boot logic to the new Booter client

    * src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs:
    Call DBusConnection.Connect

    * src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs:
    * src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs:
    Refactored slightly to allow for the use of multiple busses

    * src/Clients/Halie/Halie/Client.cs:
    * src/Clients/Beroe/Beroe/IndexerClient.cs: Updated to reflect small API
    change in DBusConnection

    * build/build.environment.mk:
    * Banshee.sln:
    * configure.ac: Add Booter



Added:
   trunk/banshee/src/Clients/Booter/
   trunk/banshee/src/Clients/Booter/Booter/
   trunk/banshee/src/Clients/Booter/Booter.csproj
   trunk/banshee/src/Clients/Booter/Booter/Entry.cs
   trunk/banshee/src/Clients/Booter/Makefile.am
   trunk/banshee/src/Clients/Booter/banshee-1.in
Removed:
   trunk/banshee/src/Clients/banshee-1.in
Modified:
   trunk/banshee/Banshee.sln
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/configure.ac
   trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
   trunk/banshee/src/Clients/Halie/Halie/Client.cs
   trunk/banshee/src/Clients/Makefile.am
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusServiceManager.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
   trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.csproj

Modified: trunk/banshee/Banshee.sln
==============================================================================
--- trunk/banshee/Banshee.sln	(original)
+++ trunk/banshee/Banshee.sln	Thu Sep 11 14:57:17 2008
@@ -18,6 +18,10 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Halie", "src\Clients\Halie\Halie.csproj", "{B574AEB0-59F1-4FB7-A91A-8E5A651970CE}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Beroe", "src\Clients\Beroe\Beroe.csproj", "{E0E10333-9B05-4463-8A15-6738C186BF87}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Booter", "src\Clients\Booter\Booter.csproj", "{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{48EA1A64-29EE-4555-9E79-49453EB51976}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Widgets", "src\Core\Banshee.Widgets\Banshee.Widgets.csproj", "{A3701765-E571-413D-808C-9788A22791AF}"
@@ -141,6 +145,8 @@
 		{46AD1892-C5D3-4696-BA40-FBF7F4CE2B39}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{46C02D13-5ED4-4A14-9ACF-125B1E4B6EB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{46C02D13-5ED4-4A14-9ACF-125B1E4B6EB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4F66A4DE-5204-4150-8D0B-CE21CA52E309}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4F66A4DE-5204-4150-8D0B-CE21CA52E309}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{6171E5DE-5B36-4AE4-8707-F6BEE0AD945B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -213,6 +219,8 @@
 		{4F66A4DE-5204-4150-8D0B-CE21CA52E309} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{E0E10333-9B05-4463-8A15-6738C186BF87} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{B574AEB0-59F1-4FB7-A91A-8E5A651970CE} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
+		{E0E10333-9B05-4463-8A15-6738C186BF87} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
+		{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{A3701765-E571-413D-808C-9788A22791AF} = {48EA1A64-29EE-4555-9E79-49453EB51976}
 		{B28354F0-BA87-44E8-989F-B864A3C7C09F} = {48EA1A64-29EE-4555-9E79-49453EB51976}
 		{2ADB831A-A050-47D0-B6B9-9C19D60233BB} = {48EA1A64-29EE-4555-9E79-49453EB51976}

Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk	(original)
+++ trunk/banshee/build/build.environment.mk	Thu Sep 11 14:57:17 2008
@@ -99,6 +99,7 @@
 REF_NEREID = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_HALIE = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_BEROE = $(LINK_BANSHEE_SERVICES_DEPS)
+REF_BOOTER = $(LINK_BANSHEE_SERVICES_DEPS)
 
 # Dap
 REF_DAP = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS)

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Thu Sep 11 14:57:17 2008
@@ -138,8 +138,9 @@
 src/AssemblyInfo.cs
 
 src/Clients/Makefile
-src/Clients/banshee-1
 src/Clients/Beroe/Makefile
+src/Clients/Booter/Makefile
+src/Clients/Booter/banshee-1
 src/Clients/Halie/Makefile
 src/Clients/Muinshee/Makefile
 src/Clients/Nereid/Makefile

Modified: trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
==============================================================================
--- trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs	(original)
+++ trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs	Thu Sep 11 14:57:17 2008
@@ -50,7 +50,7 @@
             if (!DBusConnection.Enabled) {
                 Log.Error ("All commands ignored, DBus support is disabled");
                 return;
-            } else if (DBusConnection.InstanceAlreadyRunning) {
+            } else if (DBusConnection.ApplicationInstanceAlreadyRunning) {
                 Log.Error ("Banshee is already running");
                 return;
             }

Added: trunk/banshee/src/Clients/Booter/Booter.csproj
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Clients/Booter/Booter.csproj	Thu Sep 11 14:57:17 2008
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <OutputType>Exe</OutputType>
+    <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
+    <AssemblyName>Banshee</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0}</ProjectGuid>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\..\bin</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+    <ApplicationIcon>.</ApplicationIcon>
+    <StartupObject />
+    <Externalconsole>true</Externalconsole>
+    <AssemblyKeyFile>.</AssemblyKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj">
+      <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project>
+      <Name>Banshee.Services</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj">
+      <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project>
+      <Name>Banshee.Core</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Libraries\Hyena\Hyena.csproj">
+      <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>
+      <Name>Hyena</Name>
+      <Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Booter\Entry.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ProjectExtensions>
+    <MonoDevelop>
+      <Properties>
+        <GtkDesignInfo />
+        <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" ExecuteTargetName="run">
+          <BuildFilesVar Sync="true" Name="SOURCES" />
+          <DeployFilesVar />
+          <ResourcesVar />
+          <OthersVar />
+          <GacRefVar />
+          <AsmRefVar />
+          <ProjectRefVar />
+        </MonoDevelop.Autotools.MakefileInfo>
+      </Properties>
+    </MonoDevelop>
+  </ProjectExtensions>
+</Project>

Added: trunk/banshee/src/Clients/Booter/Booter/Entry.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Clients/Booter/Booter/Entry.cs	Thu Sep 11 14:57:17 2008
@@ -0,0 +1,198 @@
+//
+// Booter.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;
+using System.Reflection;
+using System.Collections.Generic;
+
+using Mono.Unix;
+
+using Hyena.CommandLine;
+
+using Banshee.Base;
+using Banshee.ServiceStack;
+
+namespace Booter
+{
+    public static class Booter
+    {
+        public static void Main ()
+        {
+            if (CheckHelpVersion ()) {
+                return;
+            }
+        
+            bool gui_notify_startup = false;
+            string client_assembly_name = "Nereid";
+            
+            if (ApplicationContext.CommandLine.Contains ("client")) {
+                client_assembly_name = ApplicationContext.CommandLine["client"];
+            }
+        
+            DBusConnection.Connect ();
+            
+            if (DBusConnection.ApplicationInstanceAlreadyRunning) {
+                client_assembly_name = "Halie"; // DBus Command/Query/File Proxy Client
+                gui_notify_startup = true;
+            } else if (ApplicationContext.CommandLine.Contains ("indexer")) {
+                client_assembly_name = "Beroe"; // Indexer Client
+            }
+            
+            AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
+                Assembly.GetEntryAssembly ().Location), String.Format ("{0}.exe", client_assembly_name)));
+                
+            if (gui_notify_startup) {
+                // Gdk.Global.InitCheck (ref args);
+                // Gdk.Global.NotifyStartupComplete ();
+            }
+        }
+
+        private static bool CheckHelpVersion ()
+        {
+            if (ApplicationContext.CommandLine.ContainsStart ("help")) {
+                ShowHelp ();
+                return true;
+            } else if (ApplicationContext.CommandLine.Contains ("version")) {
+                ShowVersion ();
+                return true;
+            }
+            
+            return false;
+        }
+        
+        private static void ShowHelp ()
+        {
+            Console.WriteLine ("Usage: {0} [options...] [files|URIs...]", "banshee-1");
+            Console.WriteLine ();
+            
+            Layout commands = new Layout (
+                new LayoutGroup ("help", Catalog.GetString ("Help Options"),
+                    new LayoutOption ("help", Catalog.GetString ("Show this help")),
+                    new LayoutOption ("help-playback", Catalog.GetString ("Show options for controlling playback")),
+                    new LayoutOption ("help-query-track", Catalog.GetString ("Show options for querying the playing track")),
+                    new LayoutOption ("help-query-player", Catalog.GetString ("Show options for querying the playing engine")),
+                    new LayoutOption ("help-ui", Catalog.GetString ("Show options for the user interface")),
+                    new LayoutOption ("help-debug", Catalog.GetString ("Show options for developers and debugging")),
+                    new LayoutOption ("help-all", Catalog.GetString ("Show all option groups")),
+                    new LayoutOption ("version", Catalog.GetString ("Show version information"))
+                ),
+                
+                new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
+                    new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
+                    new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
+                    new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
+                    new LayoutOption ("play", Catalog.GetString ("Start playback")),
+                    new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
+                    new LayoutOption ("stop", Catalog.GetString ("Completely stop playback")),
+                    new LayoutOption ("stop-when-finished", Catalog.GetString (
+                        "Enable or disable playback stopping after the currently playing track (value should be either 'true' or 'false')")),
+                    new LayoutOption ("set-volume=LEVEL", Catalog.GetString ("Set the playback volume (0-100)")),
+                    new LayoutOption ("set-position=POS", Catalog.GetString ("Seek to a specific point (seconds, float)"))
+                ),
+                
+                new LayoutGroup ("query-player", Catalog.GetString ("Player Engine Query Options"),
+                    new LayoutOption ("query-current-state", Catalog.GetString ("Current player state")),
+                    new LayoutOption ("query-last-state", Catalog.GetString ("Last player state")),
+                    new LayoutOption ("query-can-pause", Catalog.GetString ("Query whether the player can be paused")),
+                    new LayoutOption ("query-can-seek", Catalog.GetString ("Query whether the player can seek")),
+                    new LayoutOption ("query-volume", Catalog.GetString ("Player volume")),
+                    new LayoutOption ("query-position", Catalog.GetString ("Player position in currently playing track"))
+                ),
+                
+                new LayoutGroup ("query-track", Catalog.GetString ("Playing Track Metadata Query Options"),
+                    new LayoutOption ("query-uri", Catalog.GetString ("URI")),
+                    new LayoutOption ("query-artist", Catalog.GetString ("Artist Name")),
+                    new LayoutOption ("query-album", Catalog.GetString ("Album Title")),
+                    new LayoutOption ("query-title", Catalog.GetString ("Track Title")),
+                    new LayoutOption ("query-duration", Catalog.GetString ("Duration")),
+                    new LayoutOption ("query-track-number", Catalog.GetString ("Track Number")),
+                    new LayoutOption ("query-track-count", Catalog.GetString ("Track Count")),
+                    new LayoutOption ("query-disc", Catalog.GetString ("Disc Number")),
+                    new LayoutOption ("query-year", Catalog.GetString ("Year")),
+                    new LayoutOption ("query-rating", Catalog.GetString ("Rating"))
+                ),
+                
+                new LayoutGroup ("ui", Catalog.GetString ("User Interface Options"),
+                    new LayoutOption ("show|--present", Catalog.GetString ("Present the user interface on the active workspace")),
+                    new LayoutOption ("hide", Catalog.GetString ("Hide the user interface")),
+                    new LayoutOption ("no-present", Catalog.GetString ("Do not present the user interface, regardless of any other options"))
+                ),
+                
+                new LayoutGroup ("debugging", Catalog.GetString ("Debugging and Development Options"), 
+                    new LayoutOption ("debug", Catalog.GetString ("Enable general debugging features")),
+                    new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
+                    new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
+                    new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
+                    new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " + 
+                        "most notably, this will create an alternate Mono.Addins database in the working directory")),
+                    new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),
+                    new LayoutOption ("no-gtkrc", String.Format (Catalog.GetString (
+                        "Skip loading a custom gtkrc file ({0}) if it exists"), 
+                        Path.Combine (Paths.ApplicationData, "gtkrc").Replace (
+                            Environment.GetFolderPath (Environment.SpecialFolder.Personal), "~")))
+                )
+            );
+            
+            if (ApplicationContext.CommandLine.Contains ("help-all")) {
+                Console.WriteLine (commands);
+                return;
+            }
+            
+            List<string> errors = null;
+            
+            foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
+                switch (argument.Key) {
+                    case "help": Console.WriteLine (commands.ToString ("help")); break;
+                    case "help-debug": Console.WriteLine (commands.ToString ("debugging")); break;
+                    case "help-query-track": Console.WriteLine (commands.ToString ("query-track")); break;
+                    case "help-query-player": Console.WriteLine (commands.ToString ("query-player")); break;
+                    case "help-ui": Console.WriteLine (commands.ToString ("ui")); break;
+                    case "help-playback": Console.WriteLine (commands.ToString ("playback")); break;
+                    default:
+                        if (argument.Key.StartsWith ("help")) {
+                            (errors ?? errors = new List<string> ()).Add (argument.Key);
+                        }
+                        break;
+                }
+            }
+            
+            if (errors != null) {
+                Console.WriteLine (commands.LayoutLine (String.Format (Catalog.GetString (
+                    "The following help arguments are invalid: {0}"),
+                    Hyena.Collections.CollectionExtensions.Join (errors, "--", null, ", "))));
+            }
+        }
+        
+        private static void ShowVersion ()
+        {
+            Console.WriteLine ("Banshee {0} ({1}) http://banshee-project.org";, Application.DisplayVersion, Application.Version);
+            Console.WriteLine ("Copyright 2005-{0} Novell, Inc. and Contributors.", DateTime.Now.Year);
+        }
+    }
+}

Added: trunk/banshee/src/Clients/Booter/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Clients/Booter/Makefile.am	Thu Sep 11 14:57:17 2008
@@ -0,0 +1,9 @@
+ASSEMBLY = Banshee
+TARGET = exe
+LINK = $(REF_BOOTER)
+SOURCES = Booter/Entry.cs
+
+bin_SCRIPTS = banshee-1
+
+include $(top_srcdir)/build/build.mk
+

Added: trunk/banshee/src/Clients/Booter/banshee-1.in
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Clients/Booter/banshee-1.in	Thu Sep 11 14:57:17 2008
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+prefix= prefix@
+libdir= expanded_libdir@
+exec_asm="Banshee.exe"
+MONO_EXE="@expanded_libdir@/@PACKAGE@/$exec_asm"
+
+export DYLD_LIBRARY_PATH= expanded_libdir@:@expanded_libdir@/@PACKAGE ${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
+export LD_LIBRARY_PATH= expanded_libdir@:@expanded_libdir@/@PACKAGE ${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
+export GST_PLUGIN_PATH= expanded_libdir@/@PACKAGE@/gstreamer-0.10${GST_PLUGIN_PATH+:$GST_PLUGIN_PATH}
+
+[ -n "$BANSHEE_DEBUG" ] && BANSHEE_DEBUG="--debug"
+[ -n "$BANSHEE_TRACE" ] && BANSHEE_TRACE="--trace=$BANSHEE_TRACE"
+[ -n "$BANSHEE_PROFILE" ] && BANSHEE_PROFILE="--profile=$BANSHEE_PROFILE"
+
+for arg in $*; do
+    case "x--debug" in ("x$arg")
+        BANSHEE_DEBUG=$arg
+    esac
+
+    case "x--trace=" in ("x${arg:0:8}")
+        BANSHEE_TRACE=$arg
+    esac
+
+    case "x--profile=" in ("x${arg:0:10}")
+        BANSHEE_PROFILE=$arg
+    esac
+
+	case "x--redirect-log" in ("x$arg")
+		BANSHEE_REDIRECT_LOG="$HOME/.config/banshee-1/log"
+	esac
+done
+
+if [ -n "$BANSHEE_DEBUG" -o -n "$BANSHEE_TRACE" -o -n "$BANSHEE_PROFILE" ]; then
+    MONO_OPTIONS="$BANSHEE_DEBUG $BANSHEE_TRACE $BANSHEE_PROFILE"
+    echo "** Running Mono with $MONO_OPTIONS **"
+fi
+
+# Finally - environment is set up, time to run our beloved
+exec_args="-a banshee-1 mono $MONO_OPTIONS $MONO_EXE $@"
+
+if [ -z "$BANSHEE_REDIRECT_LOG" ]; then
+	exec $exec_args
+else
+	mkdir -p `dirname "$BANSHEE_REDIRECT_LOG"`
+	exec $exec_args &> $BANSHEE_REDIRECT_LOG
+fi
+
+

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	Thu Sep 11 14:57:17 2008
@@ -65,7 +65,7 @@
             if (!DBusConnection.Enabled) {
                 Error ("All commands ignored, DBus support is disabled");
                 return;
-            } else if (!DBusConnection.InstanceAlreadyRunning) {
+            } else if (!DBusConnection.ApplicationInstanceAlreadyRunning) {
                 Error ("Banshee does not seem to be running");
                 return;
             }

Modified: trunk/banshee/src/Clients/Makefile.am
==============================================================================
--- trunk/banshee/src/Clients/Makefile.am	(original)
+++ trunk/banshee/src/Clients/Makefile.am	Thu Sep 11 14:57:17 2008
@@ -1,10 +1,9 @@
 SUBDIRS = \
 	Beroe \
+	Booter \
 	Halie \
 	Muinshee \
 	Nereid
 
-bin_SCRIPTS = banshee-1
-
 MAINTAINERCLEANFILES = Makefile.in
 

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	Thu Sep 11 14:57:17 2008
@@ -82,6 +82,10 @@
             
             Catalog.Init (Application.InternalName, System.IO.Path.Combine (
                 Banshee.Base.Paths.InstalledApplicationDataRoot, "locale"));
+                
+            if (!DBusConnection.ConnectTried) {
+                DBusConnection.Connect ();
+            }
 
             ServiceManager.Run ();
 

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs	Thu Sep 11 14:57:17 2008
@@ -27,6 +27,7 @@
 //
 
 using System;
+using System.Collections.Generic;
 
 using NDesk.DBus;
 using org.freedesktop.DBus;
@@ -38,25 +39,43 @@
 {
     public static class DBusConnection
     {
-        public const string BusName = "org.bansheeproject.Banshee";
-        
+        private const string BusPrefix = "org.bansheeproject";
+        public const string DefaultServiceName = "Banshee";
+        public const string DefaultBusName=  "org.bansheeproject.Banshee";
+        
+        private static List<string> active_connections = new List<string> (); 
+    
+        public static string MakeBusName (string serviceName)
+        {
+            return String.Format ("{0}.{1}", BusPrefix, serviceName);
+        }
+    
         private static bool enabled;
         public static bool Enabled {
             get { return enabled; }
         }
         
-        private static bool instance_already_running;
-        public static bool InstanceAlreadyRunning {
-            get { return instance_already_running; }
-        }
-        
         private static bool connect_tried;
         public static bool ConnectTried {
             get { return connect_tried; }
         }
         
+        public static bool ApplicationInstanceAlreadyRunning {
+            get { return !ServiceIsConnected (DefaultServiceName); }
+        }
+        
+        public static bool ServiceIsConnected (string service)
+        {
+            return active_connections.Contains (service);   
+        }
+        
         public static void Connect ()
         {
+            Connect (DefaultServiceName);
+        }
+        
+        public static void Connect (string serviceName)
+        {
             connect_tried = true;
             
             enabled = !ApplicationContext.CommandLine.Contains ("disable-dbus");
@@ -65,14 +84,16 @@
             }
             
             try {
-                instance_already_running = Connect (true) != RequestNameReply.PrimaryOwner;
+                if (Connect (serviceName, true) == RequestNameReply.PrimaryOwner) {
+                    active_connections.Add (serviceName);
+                }
             } catch {
                 Log.Warning ("DBus support could not be started. Disabling for this session.");
                 enabled = false;
             }
         }
         
-        public static RequestNameReply Connect (bool init)
+        private static RequestNameReply Connect (string serviceName, bool init)
         {
             connect_tried = true;
             
@@ -80,8 +101,9 @@
                 BusG.Init ();
             }
             
-            RequestNameReply name_reply = Bus.Session.RequestName (BusName);
-            Log.DebugFormat ("NDesk.DBus.Bus.Session.RequestName ('{0}') => {1}", BusName, name_reply);
+            string bus_name = MakeBusName (serviceName);
+            RequestNameReply name_reply = Bus.Session.RequestName (bus_name);
+            Log.DebugFormat ("Bus.Session.RequestName ('{0}') replied with {1}", bus_name, name_reply);
             return name_reply;
         }
         

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	Thu Sep 11 14:57:17 2008
@@ -44,13 +44,6 @@
         public const string ObjectRoot = "/org/bansheeproject/Banshee";
         private Dictionary<object, ObjectPath> registered_objects = new Dictionary<object, ObjectPath> ();
         
-        public DBusServiceManager ()
-        {
-            if (!DBusConnection.ConnectTried) {
-                DBusConnection.Connect ();
-            }
-        }
-        
         public static string MakeDBusSafeString (string str)
         {
             return str == null ? String.Empty : Regex.Replace (str, @"[^A-Za-z0-9]*", String.Empty);
@@ -99,11 +92,21 @@
         
         public ObjectPath RegisterObject (IDBusExportable o)
         {
-            return RegisterObject (o, MakeObjectPath (o));
+            return RegisterObject (DBusConnection.DefaultServiceName, o);
+        }
+        
+        public ObjectPath RegisterObject (string serviceName, IDBusExportable o)
+        {
+            return RegisterObject (serviceName, o, MakeObjectPath (o));
         }
         
         public ObjectPath RegisterObject (object o, string objectName)
         {
+            return RegisterObject (DBusConnection.DefaultServiceName, o, objectName);
+        }
+        
+        public ObjectPath RegisterObject (string serviceName, object o, string objectName)
+        {
             ObjectPath path = null;
             
             if (DBusConnection.Enabled && Bus.Session != null) {
@@ -111,7 +114,7 @@
                     registered_objects.Add (o, path = new ObjectPath (objectName));
                 }
                 #pragma warning disable 0618
-                Bus.Session.Register (DBusConnection.BusName, path, o);
+                Bus.Session.Register (DBusConnection.MakeBusName (serviceName), path, o);
                 #pragma warning restore 0618
             }
             
@@ -136,7 +139,12 @@
         
         public static T FindInstance<T> (string objectPath) where T : class
         {
-            if (!DBusConnection.Enabled || !Bus.Session.NameHasOwner (DBusConnection.BusName)) {
+            return FindInstance<T> (DBusConnection.DefaultBusName, objectPath);
+        }
+        
+        public static T FindInstance<T> (string busName, string objectPath) where T : class
+        {
+            if (!DBusConnection.Enabled || !Bus.Session.NameHasOwner (busName)) {
                 return null;
             }
             
@@ -145,7 +153,7 @@
                 full_object_path = ObjectRoot + objectPath;
             }
 
-            return Bus.Session.GetObject<T> (DBusConnection.BusName, new ObjectPath (full_object_path));
+            return Bus.Session.GetObject<T> (busName, new ObjectPath (full_object_path));
         }
         
         string IService.ServiceName {

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	Thu Sep 11 14:57:17 2008
@@ -28,13 +28,8 @@
 
 using System;
 using System.IO;
-using System.Diagnostics;
-using System.Reflection;
-using System.Collections.Generic;
-using Mono.Unix;
 
 using Hyena;
-using Hyena.CommandLine;
 
 using Banshee.Base;
 using Banshee.Database;
@@ -51,28 +46,6 @@
         
         public static void Startup<T> (string [] args) where T : GtkBaseClient
         {
-            if (CheckHelpVersion ()) {
-                return;
-            }
-        
-            // Check for single instance
-            DBusConnection.Connect ();
-            if (DBusConnection.InstanceAlreadyRunning) {
-                // Try running our friend Halie, the DBus command line client
-                AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
-                    Assembly.GetEntryAssembly ().Location), "Halie.exe"));
-                Gdk.Global.InitCheck (ref args);
-                Gdk.Global.NotifyStartupComplete ();
-                return;
-            }
-            
-            // Run the indexer client
-            if (ApplicationContext.CommandLine.Contains ("indexer")) {
-                AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
-                    Assembly.GetEntryAssembly ().Location), "Beroe.exe"));
-                return;
-            }
-                    
             Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
             
             // This could go into GtkBaseClient, but it's probably something we
@@ -89,127 +62,6 @@
             Banshee.Gui.GtkBaseClient.Startup<T> ();
         }
 
-        private static bool CheckHelpVersion ()
-        {
-            if (ApplicationContext.CommandLine.ContainsStart ("help")) {
-                ShowHelp ();
-                return true;
-            } else if (ApplicationContext.CommandLine.Contains ("version")) {
-                ShowVersion ();
-                return true;
-            }
-            
-            return false;
-        }
-        
-        private static void ShowHelp ()
-        {
-            Console.WriteLine ("Usage: {0} [options...] [files|URIs...]", "banshee-1");
-            Console.WriteLine ();
-            
-            Layout commands = new Layout (
-                new LayoutGroup ("help", Catalog.GetString ("Help Options"),
-                    new LayoutOption ("help", Catalog.GetString ("Show this help")),
-                    new LayoutOption ("help-playback", Catalog.GetString ("Show options for controlling playback")),
-                    new LayoutOption ("help-query-track", Catalog.GetString ("Show options for querying the playing track")),
-                    new LayoutOption ("help-query-player", Catalog.GetString ("Show options for querying the playing engine")),
-                    new LayoutOption ("help-ui", Catalog.GetString ("Show options for the user interface")),
-                    new LayoutOption ("help-debug", Catalog.GetString ("Show options for developers and debugging")),
-                    new LayoutOption ("help-all", Catalog.GetString ("Show all option groups")),
-                    new LayoutOption ("version", Catalog.GetString ("Show version information"))
-                ),
-                
-                new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
-                    new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
-                    new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
-                    new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
-                    new LayoutOption ("play", Catalog.GetString ("Start playback")),
-                    new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
-                    new LayoutOption ("stop", Catalog.GetString ("Completely stop playback")),
-                    new LayoutOption ("stop-when-finished", Catalog.GetString (
-                        "Enable or disable playback stopping after the currently playing track (value should be either 'true' or 'false')")),
-                    new LayoutOption ("set-volume=LEVEL", Catalog.GetString ("Set the playback volume (0-100)")),
-                    new LayoutOption ("set-position=POS", Catalog.GetString ("Seek to a specific point (seconds, float)"))
-                ),
-                
-                new LayoutGroup ("query-player", Catalog.GetString ("Player Engine Query Options"),
-                    new LayoutOption ("query-current-state", Catalog.GetString ("Current player state")),
-                    new LayoutOption ("query-last-state", Catalog.GetString ("Last player state")),
-                    new LayoutOption ("query-can-pause", Catalog.GetString ("Query whether the player can be paused")),
-                    new LayoutOption ("query-can-seek", Catalog.GetString ("Query whether the player can seek")),
-                    new LayoutOption ("query-volume", Catalog.GetString ("Player volume")),
-                    new LayoutOption ("query-position", Catalog.GetString ("Player position in currently playing track"))
-                ),
-                
-                new LayoutGroup ("query-track", Catalog.GetString ("Playing Track Metadata Query Options"),
-                    new LayoutOption ("query-uri", Catalog.GetString ("URI")),
-                    new LayoutOption ("query-artist", Catalog.GetString ("Artist Name")),
-                    new LayoutOption ("query-album", Catalog.GetString ("Album Title")),
-                    new LayoutOption ("query-title", Catalog.GetString ("Track Title")),
-                    new LayoutOption ("query-duration", Catalog.GetString ("Duration")),
-                    new LayoutOption ("query-track-number", Catalog.GetString ("Track Number")),
-                    new LayoutOption ("query-track-count", Catalog.GetString ("Track Count")),
-                    new LayoutOption ("query-disc", Catalog.GetString ("Disc Number")),
-                    new LayoutOption ("query-year", Catalog.GetString ("Year")),
-                    new LayoutOption ("query-rating", Catalog.GetString ("Rating"))
-                ),
-                
-                new LayoutGroup ("ui", Catalog.GetString ("User Interface Options"),
-                    new LayoutOption ("show|--present", Catalog.GetString ("Present the user interface on the active workspace")),
-                    new LayoutOption ("hide", Catalog.GetString ("Hide the user interface")),
-                    new LayoutOption ("no-present", Catalog.GetString ("Do not present the user interface, regardless of any other options"))
-                ),
-                
-                new LayoutGroup ("debugging", Catalog.GetString ("Debugging and Development Options"), 
-                    new LayoutOption ("debug", Catalog.GetString ("Enable general debugging features")),
-                    new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
-                    new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
-                    new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
-                    new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " + 
-                        "most notably, this will create an alternate Mono.Addins database in the working directory")),
-                    new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),
-                    new LayoutOption ("no-gtkrc", String.Format (Catalog.GetString (
-                        "Skip loading a custom gtkrc file ({0}) if it exists"), 
-                        user_gtkrc.Replace (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "~")))
-                )
-            );
-            
-            if (ApplicationContext.CommandLine.Contains ("help-all")) {
-                Console.WriteLine (commands);
-                return;
-            }
-            
-            List<string> errors = null;
-            
-            foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
-                switch (argument.Key) {
-                    case "help": Console.WriteLine (commands.ToString ("help")); break;
-                    case "help-debug": Console.WriteLine (commands.ToString ("debugging")); break;
-                    case "help-query-track": Console.WriteLine (commands.ToString ("query-track")); break;
-                    case "help-query-player": Console.WriteLine (commands.ToString ("query-player")); break;
-                    case "help-ui": Console.WriteLine (commands.ToString ("ui")); break;
-                    case "help-playback": Console.WriteLine (commands.ToString ("playback")); break;
-                    default:
-                        if (argument.Key.StartsWith ("help")) {
-                            (errors ?? errors = new List<string> ()).Add (argument.Key);
-                        }
-                        break;
-                }
-            }
-            
-            if (errors != null) {
-                Console.WriteLine (commands.LayoutLine (String.Format (Catalog.GetString (
-                    "The following help arguments are invalid: {0}"),
-                    Hyena.Collections.CollectionExtensions.Join (errors, "--", null, ", "))));
-            }
-        }
-        
-        private static void ShowVersion ()
-        {
-            Console.WriteLine ("Banshee {0} ({1}) http://banshee-project.org";, Application.DisplayVersion, Application.Version);
-            Console.WriteLine ("Copyright 2005-{0} Novell, Inc. and Contributors.", DateTime.Now.Year);
-        }
-
         public static void Startup<T> () where T : GtkBaseClient
         {
             if (client_type != null) {

Modified: trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.csproj
==============================================================================
--- trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.csproj	(original)
+++ trunk/banshee/src/Dap/Banshee.Dap/Banshee.Dap.csproj	Thu Sep 11 14:57:17 2008
@@ -73,6 +73,9 @@
     <EmbeddedResource Include="Resources\ActiveSourceUI.xml">
       <LogicalName>ActiveSourceUI.xml</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="Resources\GlobalUI.xml">
+      <LogicalName>GlobalUI.xml</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>



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