1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
using System;
using DBus;
using org.freedesktop.DBus;
namespace Tasque
{
public static class RemoteControlProxy {
private const string Path = "/org/gnome/Tasque/RemoteControl";
private const string Namespace = "org.gnome.Tasque";
public static RemoteControl GetInstance () {
BusG.Init ();
if (! Bus.Session.NameHasOwner (Namespace))
Bus.Session.StartServiceByName (Namespace);
return Bus.Session.GetObject<RemoteControl> (Namespace,
new ObjectPath (Path));
}
public static RemoteControl Register () {
BusG.Init ();
RemoteControl remote_control = new RemoteControl ();
Bus.Session.Register (new ObjectPath (Path),
remote_control);
if (Bus.Session.RequestName (Namespace)
!= RequestNameReply.PrimaryOwner)
return null;
return remote_control;
}
}
}
|