Commit 37f949bc authored by Bertrand Lorentz's avatar Bertrand Lorentz Committed by Andrés G. Aragoneses

Update for dbus-sharp 0.8.1 & dbus-sharp-glib 0.6

We now require both dbus-sharp 0.8.1 and dbus-sharp-glib 0.6.

Switching to >=0.8 dbus-sharp was necessary as a first step
towards fixing bgo#630110 ("Get single instance and remote
control working on Win32"). But it's rather better to already
require 0.8.1 instead of 0.8, because 0.8 had regressions (see
bgo#725446).

These new versions of these dependencies have API/ABI breaks, so
then their version in their pc files is raised from 1.0 to 2.0.

Switching to these versions allow us to also make some cleanups:

We were using an obsolete Bus.Session.Register which required a bus
name, and it's now gone. This allows us to remove some
DBusServiceManager.RegisterObject overloads that become unnecessary.

As an additional consequence, we don't need the DBusExportable attribute
anymore. It was used by classes implementing IDBusExportable to indicate
their service name, which was then used for the bus name.
parent 5aef9d43
......@@ -28,8 +28,8 @@ acceptable; higher versions are fine.
* GStreamer 1.0.0
* Gtk# 2.99.1
* GLib 2.22
* dbus-sharp 0.7
* dbus-sharp-glib 0.5
* dbus-sharp 0.8.1
* dbus-sharp-glib 0.6
* Mono.Addins 0.6.2
* TagLib# 2.0.3.7
......
AC_DEFUN([BANSHEE_CHECK_DBUS_SHARP],
[
PKG_CHECK_MODULES(DBUS_SHARP_GLIB, dbus-sharp-glib-1.0 >= 0.5)
PKG_CHECK_MODULES(DBUS_SHARP_GLIB, dbus-sharp-glib-2.0 >= 0.6)
AC_SUBST(DBUS_SHARP_GLIB_LIBS)
PKG_CHECK_MODULES(DBUS_SHARP, dbus-sharp-1.0 >= 0.7)
PKG_CHECK_MODULES(DBUS_SHARP, dbus-sharp-2.0 >= 0.8.1)
AC_SUBST(DBUS_SHARP_LIBS)
])
......@@ -7,6 +7,6 @@ Libraries=${bansheedir}/Banshee.CollectionIndexer.dll
Name: Banshee Collection Indexer Helper
Description: A library for applications to bundle to easily consume the Banshee Collection Indexer
Version: @VERSION@
Requires: dbus-sharp-1.0
Requires: dbus-sharp-2.0
Libs: -r:${Libraries}
......@@ -6,5 +6,5 @@ bansheedir=${libdir}/@PACKAGE@
Name: Banshee Core
Description: Core APIs for the Banshee Media Framework
Version: @VERSION@
Requires: taglib-sharp dbus-sharp-1.0 dbus-sharp-glib-1.0 glib-sharp-3.0 mono-addins banshee-hyena banshee-hyena-data-sqlite banshee-musicbrainz
Requires: taglib-sharp dbus-sharp-2.0 dbus-sharp-glib-2.0 glib-sharp-3.0 mono-addins banshee-hyena banshee-hyena-data-sqlite banshee-musicbrainz
Libs: -r:${bansheedir}/Banshee.Core.dll
......@@ -76,8 +76,8 @@ $features
<li>GStreamer 1.0.0</li>
<li>GStreamerSharp 0.99.0</li>
<li>GLib 2.22</li>
<li>dbus-sharp 0.7</li>
<li>dbus-sharp-glib 0.5</li>
<li>dbus-sharp 0.8.1</li>
<li>dbus-sharp-glib 0.6</li>
<li>Mono.Addins (mono-addins) 0.6.2</li>
<li>TagLib# (taglib-sharp) &gt;= 2.0.3.7</li>
<li>Required to build default feature stack:
......
......@@ -43,7 +43,6 @@ using Banshee.Collection.Indexer;
namespace Beroe
{
[DBusExportable (ServiceName = "CollectionIndexer")]
public class IndexerClient : Client, IIndexerClient, IDBusExportable
{
public static void Main ()
......
......@@ -42,7 +42,6 @@ using Banshee.Collection.Database;
namespace Banshee.Collection.Indexer
{
[DBusExportable (ServiceName = "CollectionIndexer")]
public class CollectionIndexer : ICollectionIndexer, IService, IDBusExportable, IDisposable
{
private static int instance_count = 0;
......
......@@ -38,7 +38,6 @@ using Banshee.Collection.Database;
namespace Banshee.Collection.Indexer
{
[DBusExportable (ServiceName = "CollectionIndexer")]
public class CollectionIndexerService : ICollectionIndexerService, IDBusExportable, IDisposable
{
private List<LibrarySource> libraries = new List<LibrarySource> ();
......
......@@ -40,15 +40,6 @@ using Banshee.Base;
namespace Banshee.ServiceStack
{
public class DBusExportableAttribute : Attribute
{
private string service_name;
public string ServiceName {
get { return service_name; }
set { service_name = value; }
}
}
public class DBusServiceManager : IService
{
public const string ObjectRoot = "/org/bansheeproject/Banshee";
......@@ -102,43 +93,21 @@ namespace Banshee.ServiceStack
public ObjectPath RegisterObject (IDBusExportable o)
{
return RegisterObject (DBusConnection.DefaultServiceName, o);
}
public ObjectPath RegisterObject (string serviceName, IDBusExportable o)
{
return RegisterObject (serviceName, o, MakeObjectPath (o));
return RegisterObject (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) {
object [] attrs = o.GetType ().GetCustomAttributes (typeof (DBusExportableAttribute), true);
if (attrs != null && attrs.Length > 0) {
DBusExportableAttribute dbus_attr = (DBusExportableAttribute)attrs[0];
if (!String.IsNullOrEmpty (dbus_attr.ServiceName)) {
serviceName = dbus_attr.ServiceName;
}
}
lock (registered_objects) {
registered_objects.Add (o, path = new ObjectPath (objectName));
}
string bus_name = DBusConnection.MakeBusName (serviceName);
Log.DebugFormat ("Registering remote object {0} ({1}) on {2}", path, o.GetType (), bus_name);
Log.DebugFormat ("Registering remote object {0} ({1})", path, o.GetType ());
#pragma warning disable 0618
Bus.Session.Register (bus_name, path, o);
#pragma warning restore 0618
Bus.Session.Register (path, o);
}
return path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment