dbus/mono Arguments.cs, 1.8, 1.9 BusDriver.cs, 1.2, 1.3 Connection.cs, 1.9, 1.10 Custom.cs, 1.1, NONE Makefile.am, 1.16, 1.17 Service.cs, 1.7, 1.8

Joe Shaw joe@freedesktop.org
Tue Jan 25 11:47:15 PST 2005


Update of /cvs/dbus/dbus/mono
In directory gabe:/tmp/cvs-serv1895/mono

Modified Files:
	Arguments.cs BusDriver.cs Connection.cs Makefile.am Service.cs 
Removed Files:
	Custom.cs 
Log Message:
2005-01-25  Joe Shaw  <joeshaw@novell.com>

	* Land the mono binding changes to conform to the new APIs.

	* mono/Makefile.am: Remove Custom.cs, DBusType/Custom.cs,
	DBusType/Dict.cs, and DBusType/Nil.cs from the build.

	* mono/Arguments.cs (GetCodeAsString): Added.  Returns the dbus
	type code as a string.
	(InitAppending): Rename dbus_message_append_iter_init() to
	dbus_message_iter_init_append().

	* mono/BusDriver.cs: Rename ServiceEventHandler to
	NameOwnerChangedHandler.  Rename GetServiceOwner to GetOwner.
	Rename ServiceOwnerChanged to NameOwnerChanged.

	* mono/Connection.cs: Rename BaseService to UniqueName, and the
	underlying C call.

	* mono/Custom.cs: Removed.  The CUSTOM type has been removed.

	* mono/Service.cs: Rename Exists to HasOwner, internally rename
	dbus_bus_acquire_service() to dbus_bus_request_name().

	* mono/DBusType/Array.cs (ctor): Use Type.GetElementType() instead
	of Type.UnderlyingSystemType to get the correct element type for
	the array.
	(ctor): Update code for new APIs: use dbus_message_iter_recurse(),
	dbus_message_get_{element|arg}_type() instead of
	dbus_message_iter_init_array_iterator().
	(Append): Replace dbus_message_iter_append_array() with
	dbus_message_iter_open_container() and
	dbus_message_iter_close_container().

	* mono/DBusType/Custom.cs, mono/DBusType/Nil.cs: Removed.  These
	types have been removed.
	
	* mono/DBusType/*.cs: Replace calls of
	dbus_message_iter_get_[type]() to dbus_message_iter_get_basic(),
	but specify the type in the DllImport extern declaration.  Ditto
	for dbus_message_iter_append_[type]() ->
	dbus_message_iter_append_basic().

	* mono/example/BusListener.cs: Update for ServiceEventHandler ->
	NameOwnerChangedHandler.

Index: Arguments.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/Arguments.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Arguments.cs	12 Jan 2005 17:31:08 -0000	1.8
+++ Arguments.cs	25 Jan 2005 19:47:13 -0000	1.9
@@ -183,6 +183,12 @@
       return (char) dbusType.InvokeMember("Code", BindingFlags.Static | BindingFlags.GetField, null, null, null);
     }
 
+    // Get the type code for a given D-BUS type as a string
+    public static string GetCodeAsString (Type dbusType)
+    {
+      return GetCode (dbusType).ToString ();
+    }
+
     // Get a complete method signature
     public override string ToString() 
     {
@@ -201,7 +207,7 @@
 	  key += code;
 	} while (dbus_message_iter_next(iter));
       }
-      
+
       Marshal.FreeCoTaskMem(iter);
 
       return key;
@@ -217,7 +223,7 @@
     // Begin appending
     public void InitAppending() 
     {
-      dbus_message_append_iter_init(message.RawMessage, appenderIter);
+      dbus_message_iter_init_append(message.RawMessage, appenderIter);
     }
 
     // Get the enumerator
@@ -277,7 +283,7 @@
     }
 
     [DllImport("dbus-1")]
-    private extern static void dbus_message_append_iter_init(IntPtr rawMessage, IntPtr iter);
+    private extern static void dbus_message_iter_init_append(IntPtr rawMessage, IntPtr iter);
 
     [DllImport("dbus-1")]
     private extern static bool dbus_message_iter_has_next(IntPtr iter);

Index: BusDriver.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/BusDriver.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- BusDriver.cs	29 Sep 2004 01:46:45 -0000	1.2
+++ BusDriver.cs	25 Jan 2005 19:47:13 -0000	1.3
@@ -3,9 +3,9 @@
 
   using System;
 
-  public delegate void ServiceEventHandler (string serviceName,
-					    string oldOwner,
-					    string newOwner);
+  public delegate void NameOwnerChangedHandler (string name,
+						string oldOwner,
+						string newOwner);
 
   [Interface ("org.freedesktop.DBus")]
   public abstract class BusDriver
@@ -14,14 +14,14 @@
     public abstract string[] ListServices ();
 
     [Method]
-    public abstract string GetServiceOwner (string serviceName);
+    public abstract string GetOwner (string name);
 
     [Method]
     public abstract UInt32 GetConnectionUnixUser (string connectionName);
 
 
     [Signal]
-    public virtual event ServiceEventHandler ServiceOwnerChanged;
+    public virtual event NameOwnerChangedHandler NameOwnerChanged;
 
     static public BusDriver New (Connection connection)
     {

Index: Connection.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/Connection.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Connection.cs	31 Aug 2004 03:59:14 -0000	1.9
+++ Connection.cs	25 Jan 2005 19:47:13 -0000	1.10
@@ -76,11 +76,11 @@
       return new Connection(rawConnection);
     }
 
-    public string BaseService
+    public string UniqueName
     {
       get
 	{
-	  return Marshal.PtrToStringAnsi (dbus_bus_get_base_service (RawConnection));
+	  return Marshal.PtrToStringAnsi (dbus_bus_get_unique_name (RawConnection));
 	}
     }
 
@@ -192,6 +192,6 @@
     private extern static void dbus_connection_disconnect (IntPtr ptr);
 
     [DllImport ("dbus-1")]
-    private extern static IntPtr dbus_bus_get_base_service (IntPtr ptr);
+    private extern static IntPtr dbus_bus_get_unique_name (IntPtr ptr);
   }
 }

--- Custom.cs DELETED ---

Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/mono/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Makefile.am	12 Jan 2005 22:52:34 -0000	1.16
+++ Makefile.am	25 Jan 2005 19:47:13 -0000	1.17
@@ -10,7 +10,6 @@
 	$(srcdir)/Bus.cs			\
 	$(srcdir)/BusDriver.cs			\
 	$(srcdir)/Connection.cs			\
-	$(srcdir)/Custom.cs			\
 	$(srcdir)/DBusException.cs		\
 	$(srcdir)/Error.cs			\
 	$(srcdir)/ErrorMessage.cs		\
@@ -31,12 +30,9 @@
 	$(srcdir)/DBusType/Array.cs		\
 	$(srcdir)/DBusType/Boolean.cs		\
 	$(srcdir)/DBusType/Byte.cs		\
-	$(srcdir)/DBusType/Custom.cs		\
-	$(srcdir)/DBusType/Dict.cs		\
 	$(srcdir)/DBusType/Double.cs		\
 	$(srcdir)/DBusType/Int32.cs		\
 	$(srcdir)/DBusType/Int64.cs		\
-	$(srcdir)/DBusType/Nil.cs		\
 	$(srcdir)/DBusType/ObjectPath.cs	\
 	$(srcdir)/DBusType/String.cs		\
 	$(srcdir)/DBusType/UInt32.cs		\

Index: Service.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/Service.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Service.cs	31 Aug 2004 03:59:14 -0000	1.7
+++ Service.cs	25 Jan 2005 19:47:13 -0000	1.8
@@ -38,7 +38,7 @@
       // This isn't used for now
       uint flags = 0;
 
-      if (dbus_bus_acquire_service(connection.RawConnection, name, flags, ref error) == -1) {
+      if (dbus_bus_request_name (connection.RawConnection, name, flags, ref error) == -1) {
 	throw new DBusException(error);
       }
 
@@ -47,12 +47,12 @@
       this.local = true;
     }
 
-    public static bool Exists(Connection connection, string name)
+    public static bool HasOwner(Connection connection, string name)
     {
       Error error = new Error();
       error.Init();
       
-      if (dbus_bus_service_exists(connection.RawConnection, 
+      if (dbus_bus_name_has_owner(connection.RawConnection, 
 				  name, 
 				  ref error)) {
 	return true;
@@ -66,10 +66,10 @@
 
     public static Service Get(Connection connection, string name)
     {
-      if (Exists(connection, name)) {
+      if (HasOwner(connection, name)) {
 	return new Service(name, connection);
       } else {
-	throw new ApplicationException("Service '" + name + "' does not exist.");
+	throw new ApplicationException("Name '" + name + "' does not exist.");
       }
     }
 
@@ -184,12 +184,12 @@
     }
 
     [DllImport("dbus-1")]
-    private extern static int dbus_bus_acquire_service(IntPtr rawConnection, 
-							string serviceName, 
-							uint flags, ref Error error);
+    private extern static int dbus_bus_request_name(IntPtr rawConnection, 
+						    string serviceName, 
+						    uint flags, ref Error error);
 
     [DllImport("dbus-1")]
-    private extern static bool dbus_bus_service_exists(IntPtr rawConnection, 
+    private extern static bool dbus_bus_name_has_owner(IntPtr rawConnection, 
 						       string serviceName, 
 						       ref Error error);    
 



More information about the dbus-commit mailing list