summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mono/DBusType/ObjectPath.cs18
-rw-r--r--mono/Handler.cs29
-rw-r--r--mono/Makefile.am2
-rw-r--r--mono/example/Makefile.am2
4 files changed, 19 insertions, 32 deletions
diff --git a/mono/DBusType/ObjectPath.cs b/mono/DBusType/ObjectPath.cs
index 5dc9505..a7014b5 100644
--- a/mono/DBusType/ObjectPath.cs
+++ b/mono/DBusType/ObjectPath.cs
@@ -12,7 +12,7 @@ namespace DBus.DBusType
public class ObjectPath : IDBusType
{
public const char Code = 'o';
- private string pathName = null;
+ private string path = null;
private object val = null;
private Service service = null;
@@ -29,25 +29,25 @@ namespace DBus.DBusType
public ObjectPath(IntPtr iter, Service service)
{
- this.pathName = Marshal.PtrToStringAnsi(dbus_message_iter_get_object_path(iter));
+ this.path = Marshal.PtrToStringAnsi(dbus_message_iter_get_object_path(iter));
this.service = service;
}
- private string PathName
+ private string Path
{
get {
- if (this.pathName == null && this.val != null) {
+ if (this.path == null && this.val != null) {
Handler handler = this.service.GetHandler(this.val);
- this.pathName = handler.PathName;
+ this.path = handler.Path;
}
- return this.pathName;
+ return this.path;
}
}
public void Append(IntPtr iter)
{
- if (!dbus_message_iter_append_object_path(iter, Marshal.StringToHGlobalAnsi(PathName)))
+ if (!dbus_message_iter_append_object_path(iter, Marshal.StringToHGlobalAnsi(Path)))
throw new ApplicationException("Failed to append OBJECT_PATH argument:" + val);
}
@@ -84,7 +84,7 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
try {
- return this.service.GetObject(type, PathName);
+ return this.service.GetObject(type, Path);
} catch(Exception ex) {
throw new ArgumentException("Cannot cast object pointed to by Object Path to type '" + type.ToString() + "': " + ex);
}
@@ -94,6 +94,6 @@ namespace DBus.DBusType
private extern static IntPtr dbus_message_iter_get_object_path(IntPtr iter);
[DllImport("dbus-1")]
- private extern static bool dbus_message_iter_append_object_path(IntPtr iter, IntPtr pathName);
+ private extern static bool dbus_message_iter_append_object_path(IntPtr iter, IntPtr path);
}
}
diff --git a/mono/Handler.cs b/mono/Handler.cs
index ce3974b..91569e9 100644
--- a/mono/Handler.cs
+++ b/mono/Handler.cs
@@ -15,8 +15,7 @@ namespace DBus
internal class Handler : IDisposable
{
- private string[] path = null;
- private string pathName = null;
+ private string path = null;
private Introspector introspector = null;
private object handledObject = null;
private DBusObjectPathVTable vTable;
@@ -69,7 +68,7 @@ namespace DBus
service = null;
// Clean up unmanaged resources
- if (Connection != null && Connection.RawConnection != IntPtr.Zero && path != null) {
+ if (Connection != null && Connection.RawConnection != IntPtr.Zero && Path != null) {
dbus_connection_unregister_object_path(Connection.RawConnection,
Path);
}
@@ -88,17 +87,13 @@ namespace DBus
}
public Handler(object handledObject,
- string pathName,
+ string path,
Service service)
{
Service = service;
Connection = service.Connection;
HandledObject = handledObject;
-
- // Strip the leading / off if there is one and get the path as an array
- pathName = pathName.TrimStart('/');
- this.path = pathName.Split('/');
- this.pathName = "/" + pathName;
+ this.path = path;
// Create the vTable and register the path
vTable = new DBusObjectPathVTable(new DBusObjectPathUnregisterFunction(Unregister_Called),
@@ -115,7 +110,7 @@ namespace DBus
private void RegisterSignalHandlers()
{
- ProxyBuilder proxyBuilder = new ProxyBuilder(Service, HandledObject.GetType(), this.pathName);
+ ProxyBuilder proxyBuilder = new ProxyBuilder(Service, HandledObject.GetType(), Path);
foreach (DictionaryEntry interfaceEntry in this.introspector.InterfaceProxies) {
InterfaceProxy interfaceProxy = (InterfaceProxy) interfaceEntry.Value;
@@ -195,7 +190,7 @@ namespace DBus
return Result.Handled;
}
- internal string[] Path
+ internal string Path
{
get
{
@@ -203,14 +198,6 @@ namespace DBus
}
}
- public string PathName
- {
- get
- {
- return pathName;
- }
- }
-
internal Connection Connection
{
get
@@ -238,10 +225,10 @@ namespace DBus
}
[DllImport ("dbus-1")]
- private extern static bool dbus_connection_register_object_path (IntPtr rawConnection, string[] path, ref DBusObjectPathVTable vTable, IntPtr userData);
+ private extern static bool dbus_connection_register_object_path (IntPtr rawConnection, string path, ref DBusObjectPathVTable vTable, IntPtr userData);
[DllImport ("dbus-1")]
- private extern static void dbus_connection_unregister_object_path (IntPtr rawConnection, string[] path);
+ private extern static void dbus_connection_unregister_object_path (IntPtr rawConnection, string path);
}
}
diff --git a/mono/Makefile.am b/mono/Makefile.am
index 4b61816..2c62368 100644
--- a/mono/Makefile.am
+++ b/mono/Makefile.am
@@ -54,7 +54,7 @@ dbus-sharp.dll: $(DBUS_SHARP_FILES)
$(CSC) --unsafe --target library -o dbus-sharp.dll $(DBUS_SHARP_FILES) AssemblyInfo.cs
test-dbus-sharp.exe: $(TEST_DBUS_SHARP_FILES)
- $(CSC) --unsafe --target exe -L . -r dbus-sharp.dll -r gtk-sharp.dll -o test-dbus-sharp.exe $(TEST_DBUS_SHARP_FILES)
+ $(CSC) --unsafe --target exe -L . -r dbus-sharp.dll -pkg:gtk-sharp -o test-dbus-sharp.exe $(TEST_DBUS_SHARP_FILES)
clean:
rm -f $(TARGET) $(NOINST_EXES)
diff --git a/mono/example/Makefile.am b/mono/example/Makefile.am
index e7fd9b6..65a466a 100644
--- a/mono/example/Makefile.am
+++ b/mono/example/Makefile.am
@@ -5,7 +5,7 @@ NOINST_EXES=echo-server.exe echo-client.exe
all: $(NOINST_EXES)
echo-server.exe: EchoServer.cs Echoer.cs
- $(CSC) --target exe -L .. -r:../dbus-sharp.dll -r gtk-sharp -o echo-server.exe EchoServer.cs Echoer.cs
+ $(CSC) --target exe -L .. -r:../dbus-sharp.dll -pkg:gtk-sharp -o echo-server.exe EchoServer.cs Echoer.cs
echo-client.exe: EchoClient.cs Echoer.cs
$(CSC) --target exe -L .. -r:../dbus-sharp.dll -o echo-client.exe EchoClient.cs Echoer.cs