[banshee/moblin: 4/11] Import from cubano, attempt to use DBusExportable.
- From: Michael Meeks <michael src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee/moblin: 4/11] Import from cubano, attempt to use DBusExportable.
- Date: Mon, 10 Aug 2009 20:35:07 +0000 (UTC)
commit 608d94d70a2c85571521a7b3c91fac7aac340a89
Author: Michael Meeks <michael meeks novell com>
Date: Fri Aug 7 12:36:29 2009 +0100
Import from cubano, attempt to use DBusExportable.
Sadly this creates a new service, but then exports just the same paths as in the other two (strangely) identical banshee exported services.
.../Banshee.MoblinBackend/BognorInterface.cs | 97 +++++++++++++++++++
.../Banshee.MoblinBackend/MoblinBognor.cs | 98 ++++++++++++++++++++
.../Banshee.MoblinBackend/MoblinService.cs | 1 +
src/Backends/Banshee.Moblin/Makefile.am | 2 +
4 files changed, 198 insertions(+), 0 deletions(-)
---
diff --git a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/BognorInterface.cs b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/BognorInterface.cs
new file mode 100644
index 0000000..6b08083
--- /dev/null
+++ b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/BognorInterface.cs
@@ -0,0 +1,97 @@
+/*
+ * The Bognor interface magic that we need to get play-queue
+ * integration working with the Moblin panel.
+ *
+ * keep in sync with bognor-regis/interfaces/*.xml
+ */
+using System;
+using System.Collections.Generic;
+
+using NDesk.DBus;
+using org.freedesktop.DBus;
+
+namespace org.moblin.BognorRegis
+{
+ // Service names
+ public class Name {
+ public const string QueueIface = "org.moblin.BognorRegis.Queue";
+ public const string LocalQueuePath = "/org/moblin/BognorRegis/Queues/local_queue";
+ // unused
+ public const string PlayerIface = "org.moblin.BognorRegis.Player";
+ public const string QueueManagerIface = "org.moblin.BognorRegis.QueueManager";
+ }
+
+ // signal signatures
+ public delegate void UriAddedHandler (string uri, int position);
+ public delegate void UriRemovedHandler (string uri, int position);
+ public delegate void PlayingChangedHandler (int type, double position);
+ public delegate void PositionChangedHandler (int type, double position);
+ public delegate void NowPlayingChangedHandler (string uri, int type);
+
+ [Interface (Name.QueueIface)]
+ public interface IQueue
+ {
+ // methods
+ void Play ();
+ void Stop ();
+ string GetName ();
+ bool GetPlaying ();
+
+ // seeking ?
+ double GetPosition (int type); // FIXME: type as enumeration ...
+ void SetPosition (int type, double position);
+
+ void PlayUri (string uri, string mimeType);
+ void AddUri (string uri, string mimeType);
+ void InsertUri (string uri, string mimeType, int pos);
+
+
+ void Remove (int index);
+ void Clear ();
+ List<string> ListUris ();
+// string,string GetNowPlaying (); - mangling ?
+
+ // signals
+ event UriAddedHandler UriAdded;
+ event UriRemovedHandler UriRemoved;
+ event NowPlayingChangedHandler UriNowPlayingChanged;
+ event PositionChangedHandler UriPositionChanged;
+ event PlayingChangedHandler PlayingChanged;
+ }
+
+ /* as yet unused by mutter */
+
+ public delegate void QueueHandler (string queue);
+ [Interface (Name.QueueManagerIface)]
+ public interface IQueueManager
+ {
+ // returns dbus queue paths
+ List<string> ListQueues();
+ event QueueHandler QueueCreated;
+ event QueueHandler QueueDestroyed;
+ }
+
+ /* if we don't mind not managing the queue - and can leave
+ bognor regis to do this, then we could implement this
+ instead. */
+
+ public delegate void UriCompletedHandler (string queue);
+ public delegate void ThisPositionChangedHandler (double position);
+ public delegate void CanShowVisualChangedHandler (bool canShowVisual);
+
+ [Interface (Name.PlayerIface)]
+ public interface IPlayer
+ {
+ void Play();
+ void Stop();
+
+ void SetPosition (double position);
+ void ShowUri (string uri, string mimeType);
+ bool CanShowVisual();
+ void ForceVisualMode();
+
+ event UriCompletedHandler UriCompleted;
+ event ThisPositionChangedHandler PositionChanged;
+ event CanShowVisualChangedHandler CanShowVisualChanged;
+ }
+}
diff --git a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs
new file mode 100644
index 0000000..febb5e6
--- /dev/null
+++ b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinBognor.cs
@@ -0,0 +1,98 @@
+//
+// MoblinService.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.Generic;
+
+using Banshee.Web;
+using Banshee.Base;
+using Banshee.Collection;
+using Banshee.MediaEngine;
+using Banshee.ServiceStack;
+using org.moblin.BognorRegis;
+
+namespace Banshee.MoblinBackend.BognorRegis
+{
+ // ... tried to use DBusExportable - and just ended up
+ // with an identical service and path-set to Banshee
+ // [DBusExportable (ServiceName = "BognorQueue")]
+ public class Queue : /* IDBusExportable */ IQueue, IDisposable
+ {
+ public static void Init()
+ {
+ Console.WriteLine ("Create queue");
+ new Queue();
+ }
+
+ public Queue()
+ {
+ DBusConnection.Connect ("BognorQueue");
+ }
+
+ IDBusExportable IDBusExportable.Parent {
+ get { return null; }
+ }
+
+ string IService.ServiceName {
+ get { return "BognorQueue"; }
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ // methods
+ public void Play () {}
+ public void Stop () {}
+ public string GetName () { return "foo"; }
+ public bool GetPlaying () { return true; }
+
+ public double GetPosition (int type) { return 0.0; }
+ public void SetPosition (int type, double position) {}
+
+ public void PlayUri (string uri, string mimeType)
+ {
+ Console.WriteLine ("Play URI " + uri + " type " + mimeType);
+ }
+ public void AddUri (string uri, string mimeType) {}
+ public void InsertUri (string uri, string mimeType, int pos) {}
+
+ public void Remove (int index) {}
+ public void Clear () {}
+ public List<string> ListUris () { return new List<string>(); }
+// public string,string GetNowPlaying (); - mangling ?
+
+ // signals
+ public event UriAddedHandler UriAdded;
+ public event UriRemovedHandler UriRemoved;
+ public event NowPlayingChangedHandler UriNowPlayingChanged;
+ public event PositionChangedHandler UriPositionChanged;
+ public event PlayingChangedHandler PlayingChanged;
+ }
+
+}
diff --git a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinService.cs b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinService.cs
index b31f066..349f28b 100644
--- a/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinService.cs
+++ b/src/Backends/Banshee.Moblin/Banshee.MoblinBackend/MoblinService.cs
@@ -47,6 +47,7 @@ namespace Banshee.MoblinBackend
// ServiceManager.PlayerEngine.ConnectEvent
// (UpdateRecentFilesHandler, PlayerEvent.StateChange);
Console.WriteLine ("Init MoblinBackend");
+ BognorRegis.Queue.Init ();
}
public void Dispose ()
diff --git a/src/Backends/Banshee.Moblin/Makefile.am b/src/Backends/Banshee.Moblin/Makefile.am
index d6216fd..a32df88 100644
--- a/src/Backends/Banshee.Moblin/Makefile.am
+++ b/src/Backends/Banshee.Moblin/Makefile.am
@@ -4,6 +4,8 @@ LINK = $(REF_BACKEND_GNOME)
INSTALL_DIR = $(BACKENDS_INSTALL_DIR)
SOURCES = \
+ Banshee.MoblinBackend/BognorInterface.cs \
+ Banshee.MoblinBackend/MoblinBognor.cs \
Banshee.MoblinBackend/MoblinService.cs
RESOURCES = \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]