diff options
Diffstat (limited to 'mono/Service.cs')
| -rw-r--r-- | mono/Service.cs | 50 | 
1 files changed, 3 insertions, 47 deletions
diff --git a/mono/Service.cs b/mono/Service.cs index b5547961..4280c6b3 100644 --- a/mono/Service.cs +++ b/mono/Service.cs @@ -14,9 +14,6 @@ namespace DBus      private string name;      private bool local = false;      private Hashtable registeredHandlers = new Hashtable(); -    private delegate int DBusHandleMessageFunction(IntPtr rawConnection, -						   IntPtr rawMessage, -						   IntPtr userData);      private DBusHandleMessageFunction filterCalled;      public delegate void SignalCalledHandler(Signal signal);      public event SignalCalledHandler SignalCalled; @@ -50,12 +47,6 @@ namespace DBus        this.local = true;      } -    ~Service () -    { -      if (this.filterCalled != null) -        RemoveFilter (); -    } -      public static bool HasOwner(Connection connection, string name)      {        Error error = new Error(); @@ -116,23 +107,9 @@ namespace DBus      {        // Setup the filter function        this.filterCalled = new DBusHandleMessageFunction(Service_FilterCalled); -      if (!dbus_connection_add_filter(Connection.RawConnection, -				      this.filterCalled, -				      IntPtr.Zero, -				      IntPtr.Zero)) -	throw new OutOfMemoryException(); - -      dbus_bus_add_match(connection.RawConnection, MatchRule, IntPtr.Zero); -    } - -    private void RemoveFilter()  -    { -      dbus_connection_remove_filter (Connection.RawConnection, -				     this.filterCalled, -				     IntPtr.Zero); -      this.filterCalled = null; - -      dbus_bus_remove_match (connection.RawConnection, MatchRule, IntPtr.Zero); +      Connection.AddFilter (this.filterCalled); +      // Add a match for signals. FIXME: Can we filter the service? +      Connection.AddMatch ("type='signal'");      }      private int Service_FilterCalled(IntPtr rawConnection, @@ -210,26 +187,5 @@ namespace DBus  						       string serviceName,   						       ref Error error);     -    [DllImport("dbus-1")] -    private extern static bool dbus_connection_add_filter(IntPtr rawConnection, -							  DBusHandleMessageFunction filter, -							  IntPtr userData, -							  IntPtr freeData); - -    [DllImport("dbus-1")] -    private extern static void dbus_connection_remove_filter(IntPtr rawConnection, -							     DBusHandleMessageFunction filter, -							     IntPtr userData); - -    [DllImport("dbus-1")] -    private extern static void dbus_bus_add_match(IntPtr rawConnection, -						  string rule, -						  IntPtr erro); - -    [DllImport("dbus-1")] -    private extern static void dbus_bus_remove_match(IntPtr rawConnection, -						     string rule, -						     IntPtr erro); -    }  }  | 
