banshee r3028 - in trunk/banshee: . build src/Core src/Core/Banshee.Services/Banshee.ServiceStack src/Extensions src/Extensions/Banshee.MultimediaKeys src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys src/Extensions/Banshee.MultimediaKeys/Resources



Author: abock
Date: Sat Jan 26 04:41:13 2008
New Revision: 3028
URL: http://svn.gnome.org/viewvc/banshee?rev=3028&view=rev

Log:
2008-01-25  Aaron Bockover  <abock gnome org>

    Patch adds GNOME/DBus multimedia keys support; ported by Alex Hixon

    * build/build.environment.mk: 
    * configure.ac:
    * src/Extensions/Extensions.mds:
    * src/Extensions/Makefile.am:
    * src/Core/Makefile.am:
    * src/Extensions/Banshee.MultimediaKeys/Makefile.am: 
    * src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp: Build 
    stuff for the multimedia keys extension

    * src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs:
    * src/Extensions/Banshee.MultimediaKeys/Resources/Banshee.MultimediaKeys.addin.xml: MMKeys plugin code/extension

    * src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs:
    Log when a service has started



Added:
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Makefile.am
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Resources/
   trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Resources/Banshee.MultimediaKeys.addin.xml
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/configure.ac
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
   trunk/banshee/src/Core/Makefile.am
   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	Sat Jan 26 04:41:13 2008
@@ -132,8 +132,12 @@
 # Extensions
 DIR_EXTENSIONS = $(top_srcdir)/src/Extensions
 
+DIR_EXTENSION_MULTIMEDIAKEYS = $(DIR_EXTENSIONS)/Banshee.MultimediaKeys
+MONO_ADDINS_PATH += $(DIR_EXTENSION_MULTIMEDIAKEYS)
+REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
+
 DIR_EXTENSION_NOTIFICATIONAREA = $(DIR_EXTENSIONS)/Banshee.NotificationArea
-MONO_ADDINS_PATH += $(DIR_EXTENSION_NOTIFICATIONAREA)
+MONO_ADDINS_PATH += $(DIR_EXTENSION_NOTIFICATIONAREA) 
 REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 
 

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Sat Jan 26 04:41:13 2008
@@ -146,6 +146,7 @@
 src/Backends/Banshee.GStreamer/Makefile
 
 src/Extensions/Makefile
+src/Extensions/Banshee.MultimediaKeys/Makefile
 src/Extensions/Banshee.NotificationArea/Makefile
 
 src/Extras/Makefile

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Sat Jan 26 04:41:13 2008
@@ -180,6 +180,7 @@
         
         private static void OnServiceStarted (IService service)
         {
+            Log.Debug ("Started service", service.ServiceName);
             ServiceStartedHandler handler = ServiceStarted;
             if (handler != null) {
                 handler (new ServiceStartedArgs (service));

Modified: trunk/banshee/src/Core/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Makefile.am	(original)
+++ trunk/banshee/src/Core/Makefile.am	Sat Jan 26 04:41:13 2008
@@ -18,7 +18,7 @@
 	for dir in $(MONO_ADDINS_PATH); do \
 		cp $$dir/*.{dll,mdb,config} .run.tmp/Addins 2>/dev/null; \
 	done; \
-	cp $(top_builddir)/libbanshee/.libs/libbanshee.so .run.tmp; \
+	cp $(top_builddir)/libbanshee/.libs/libbanshee.so .run.tmp || $(top_builddir)/libbanshee/libbanshee.so; \
 	pushd .run.tmp; \
 	echo "<Addins><Directory>./Addins</Directory></Addins>" > Nereid.addins; \
 	$(MONO) --debug Nereid.exe --debug --uninstalled $(BANSHEE_DEV_OPTIONS); \

Added: trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp	Sat Jan 26 04:41:13 2008
@@ -0,0 +1,27 @@
+<Project name="Banshee.MultimediaKeys" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="." assemblyKeyFile="." assembly="Banshee.MultimediaKeys" />
+      <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.MultimediaKeys/MultimediaKeysService.cs" subtype="Code" buildaction="Compile" />
+    <File name="Resources/Banshee.MultimediaKeys.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+  </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>

Added: trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Banshee.MultimediaKeys/MultimediaKeysService.cs	Sat Jan 26 04:41:13 2008
@@ -0,0 +1,107 @@
+//
+// MultimediaKeyService.cs
+//
+// Authors:
+//   Alexander Hixon <hixon alexander mediati org>
+//   Aaron Bockover <aaron abock org>
+//   Jan Arne Petersen <jap gnome org>
+//
+// Copyright (C) 2007-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 Banshee.ServiceStack;
+using Banshee.Configuration;
+using NDesk.DBus;
+
+namespace Banshee.MultimediaKeys
+{
+    public class MultimediaKeysService : IService, IDisposable
+    {
+        private const string BusName = "org.gnome.SettingsDaemon";
+        private const string ObjectPath = "/org/gnome/SettingsDaemon";
+        private ISettingsDaemon settings_daemon;
+        
+        private delegate void MediaPlayerKeyPressedHandler (string application, string key);
+        
+        [Interface("org.gnome.SettingsDaemon")]
+        private interface ISettingsDaemon
+        {
+            void GrabMediaPlayerKeys (string application, uint time);
+            void ReleaseMediaPlayerKeys (string application);
+            event MediaPlayerKeyPressedHandler MediaPlayerKeyPressed;
+        }
+                
+        private const string app_name = "Banshee";
+    
+        public MultimediaKeysService ()
+        {
+            Initialize ();
+        }
+        
+        private void Initialize ()
+        {
+            settings_daemon = Bus.Session.GetObject<ISettingsDaemon> (BusName, new ObjectPath (ObjectPath));
+            settings_daemon.GrabMediaPlayerKeys (app_name, 0);
+            settings_daemon.MediaPlayerKeyPressed += OnMediaPlayerKeyPressed;
+        }
+  
+        public void Dispose()
+        {
+            if (settings_daemon == null) {
+                return;
+            }
+            
+            settings_daemon.MediaPlayerKeyPressed -= OnMediaPlayerKeyPressed;
+            settings_daemon.ReleaseMediaPlayerKeys (app_name);
+            settings_daemon = null;
+        }
+        
+        private void OnMediaPlayerKeyPressed (string application, string key)
+        {
+            if (application != app_name) {
+                return;
+            }
+            
+            switch (key) {
+                case "Play":
+                    ServiceManager.PlayerEngine.TogglePlaying ();
+                    break;
+                case "Next":
+                    ServiceManager.PlaybackController.Next ();
+                    break;
+                case "Previous":
+                    ServiceManager.PlaybackController.Previous ();
+                    break;
+                case "Stop":
+                    ServiceManager.PlayerEngine.Close ();
+                    break;
+            }
+        }
+        
+        string IService.ServiceName {
+            get { return "MultimediaKeysService"; }
+        }
+    }
+}

Added: trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Makefile.am	Sat Jan 26 04:41:13 2008
@@ -0,0 +1,10 @@
+ASSEMBLY = Banshee.MultimediaKeys
+TARGET = library
+LINK = $(REF_EXTENSION_MULTIMEDIAKEYS)
+
+SOURCES = Banshee.MultimediaKeys/MultimediaKeysService.cs 
+
+RESOURCES = Resources/Banshee.MultimediaKeys.addin.xml
+
+include $(top_srcdir)/build/build.mk
+

Added: trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Resources/Banshee.MultimediaKeys.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MultimediaKeys/Resources/Banshee.MultimediaKeys.addin.xml	Sat Jan 26 04:41:13 2008
@@ -0,0 +1,15 @@
+<Addin  id="Banshee.MultimediaKeys"
+        name="Multimedia Keys"
+        description="Provides support for handling playback through the use of keyboard controls."
+        url="http://www.banshee-project.org/";
+        version="1.0">
+
+  <Dependencies>
+    <Addin id="Banshee.Services" version="1.0"/>
+  </Dependencies>
+
+  <Extension path="/Banshee/ServiceManager/Service">
+    <TypeExtensionNode class="Banshee.MultimediaKeys.MultimediaKeysService"/>
+  </Extension>
+  
+</Addin>

Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds	(original)
+++ trunk/banshee/src/Extensions/Extensions.mds	Sat Jan 26 04:41:13 2008
@@ -2,6 +2,7 @@
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="CombineConfiguration">
       <Entry build="True" name="Banshee.NotificationArea" configuration="Debug" />
+      <Entry build="True" name="Banshee.MultimediaKeys" configuration="Debug" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="Banshee.NotificationArea" single="True">
@@ -9,5 +10,6 @@
   </StartMode>
   <Entries>
     <Entry filename="Banshee.NotificationArea/Banshee.NotificationArea.mdp" />
+    <Entry filename="Banshee.MultimediaKeys/Banshee.MultimediaKeys.mdp" />
   </Entries>
-</Combine>
\ No newline at end of file
+</Combine>

Modified: trunk/banshee/src/Extensions/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Makefile.am	Sat Jan 26 04:41:13 2008
@@ -1,4 +1,5 @@
 SUBDIRS = \
+	Banshee.MultimediaKeys \
 	Banshee.NotificationArea
 
 MAINTAINERCLEANFILES = Makefile.in



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