Changes in-line with new object_path param changes. Also bumped required mono version...
authorOwen Fraser-Green <owen@discobabe.net>
Mon, 7 Jun 2004 11:40:20 +0000 (11:40 +0000)
committerOwen Fraser-Green <owen@discobabe.net>
Mon, 7 Jun 2004 11:40:20 +0000 (11:40 +0000)
ChangeLog
mono/DBusType/ObjectPath.cs
mono/Handler.cs
mono/Makefile.am
mono/example/Makefile.am

index b28add7..afac16a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-06-07  Owen Fraser-Green  <owen@discobabe.net>
+
+       * mono/DBusType/ObjectPath.cs: Renamed PathName argument to Path
+
+       * mono/Handler.cs: Updated to follow new path argument for
+       (un-)registering objects.
+
+       * mono/example/Makefile.am:
+       * mono/Makefile.am:
+       * configure.in: Bumped required version for mono and use new -pkg
+       syntax for deps
+
 2004-06-05  Olivier Andrieu  <oliv__a@users.sourceforge.net>
 
        * dbus/dbus-connection.h, dbus/dbus-connection.c: have object path
index 40460bb..f82c680 100644 (file)
@@ -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);
   }
 }
index ce3974b..91569e9 100644 (file)
@@ -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);
 
   }
 }
index 4b61816..2c62368 100644 (file)
@@ -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)
index e7fd9b6..65a466a 100644 (file)
@@ -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 -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