Commit Graph

93 Commits

Author SHA1 Message Date
Niels Grewe
3ad6b56190 Implement method to add match rules for signals.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31101 72102866-910b-0410-8b05-ffd578937521
2010-08-09 19:41:05 +00:00
Niels Grewe
3011c73f7f Remove workaround for some libdbus oddity I was experiencing earlier.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31100 72102866-910b-0410-8b05-ffd578937521
2010-08-09 15:48:56 +00:00
Niels Grewe
660085f72b * Headers/DKProxy.h
Source/DKProxy.m:
  API refinements for DKDBus.
* Headers/DKPort.h
  Source/DKPort.m
  Tests/TestDKProxy.m:
  Finish replacing subclasses with equivalent initializers. Adopt test case.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31098 72102866-910b-0410-8b05-ffd578937521
2010-08-09 14:54:59 +00:00
Niels Grewe
8f8717337b * Source/DKArgument.m: Mark some functions as inlineable.
* Source/DKEndpoint.[hm]: Carry over information about the new endpoint when an
  old one is being reused. Fix bug in -initWithConnectionTo: where the new
  connection never got assigned. Rearrange method order. Improve documentation a
  bit.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31097 72102866-910b-0410-8b05-ffd578937521
2010-08-09 12:33:14 +00:00
Niels Grewe
4e5c14e7d5 Move rule generation into DKObservable helper-class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31096 72102866-910b-0410-8b05-ffd578937521
2010-08-09 09:01:50 +00:00
Niels Grewe
b64dca900c Remove struct nonsense in favour of real objects.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31095 72102866-910b-0410-8b05-ffd578937521
2010-08-08 20:20:44 +00:00
Niels Grewe
5f686a8408 * Source/DKSignal.[hm]: Make DKSignal useful.
* Header/DKNotificationCenter.h: Add notificationNames ivar.
* Source/DKNotificationCenter.m: Implement registration of signals and
  notification names.
* DKIntrospectionParserDelegate.m: Parse signals and trigger their
  registration with the appropriate notification center.
* Tests/TestDKProxy.m: Fix test for errors returned by remote objects.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31094 72102866-910b-0410-8b05-ffd578937521
2010-08-08 02:28:09 +00:00
Niels Grewe
5ee3a0e4d2 Clarify exception name.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31092 72102866-910b-0410-8b05-ffd578937521
2010-08-07 20:34:51 +00:00
Niels Grewe
451bfbb3dc Add methods to generate rules for matching D-Bus signals.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31091 72102866-910b-0410-8b05-ffd578937521
2010-08-07 20:02:41 +00:00
Niels Grewe
dd63b72009 * Headers/DKProxy.h
Source/DKProxy.m:
  Add DKDBus subclass for getting shared proxies to the org.freedesktop.DBus
  services on their respective busses.
* Source/DKProxy.m
  Source/DKProxy+Private.h:
  Implement -_uniqueName to get the unique name of a service from the bus.
* Headers/DKPort.h: Add "don't know" member value to the bus type enumeration.
* Source/DKPort.m: Use DKDBus instead of -getBusObject magic.
* Source/DKEndpoint.[hm]: Implement -DBusBusType to get the type of bus an
  endpoint is connected to.
* Source/DKInterface.[hm]: Add some more methods for signals/properties.
* Headers/DKNotificationCenter.h
  Source/DKNotificationCenter.m
  Source/GNUmakefile:
  Add very much work-in-progress notification center class for managing D-Bus
  signals.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31090 72102866-910b-0410-8b05-ffd578937521
2010-08-07 17:35:22 +00:00
Niels Grewe
d9b398271b * Source/DKArgument.m
Source/DKInterface.m
  Source/DKIntrospectionNode.m
  Source/DKMethod.m
  Source/DKSignal.m
  Source/DKObjectPathNode.m:
  Fix various issues in -copyWithZone:.
* Source/DKInterface.[hm]: Begin adding plumbing for signals/properties.
* Source/DKIntrospectionNode.[hm]: Add -annotations method to get the
  annotation dictionary for a node.
* Tests/TestDKMethod.m: Fix the copy test to use the correct selector.

Fix NSCopying for DKIntrospectionNode and subclasses.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31089 72102866-910b-0410-8b05-ffd578937521
2010-08-07 14:27:26 +00:00
Niels Grewe
6ad2357538 Add test for copying parts of the introspection graph (fails at the moment).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31088 72102866-910b-0410-8b05-ffd578937521
2010-08-07 12:46:36 +00:00
Niels Grewe
a74e8429f8 * Headers/DKPort.h
Source/DKPort.m:
  Add DKDBusBusType enumeration and related initializer.
* Source/DKArgument.m
  Source/DKInterface.m
  Source/DKIntrospectionNode.[hm]
  Source/DKMethod.m
  Source/DKObjectPathNode.m
  Source/DKSignal.m:
  Adopt NSCopying for DKIntrospectionNode and subclasses.
* Source/NSConnection+DBus.m: Add further integration methods (commented out
  until DKPortNameServer can be committed).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31083 72102866-910b-0410-8b05-ffd578937521
2010-08-05 07:14:13 +00:00
Niels Grewe
de8e4920fc * Headers/DKProxy.h
Source/DKProxy.m:
  Add an explicit NSCondition and a state variable to make synchronisation more
  robust (and readable).
* Tests/TestDKProxy.m: Adopt to changed code and add test for calling methods
  from multiple threads.

Thread safety improvements.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31061 72102866-910b-0410-8b05-ffd578937521
2010-07-31 01:25:19 +00:00
Niels Grewe
2908218ead Disable asnychronous generation of the method cache again (it doesn't seem to be working reliably).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31058 72102866-910b-0410-8b05-ffd578937521
2010-07-30 15:44:43 +00:00
Niels Grewe
cb466978ff * Source/AsyncBehavior.h: Bugfix.
* Source/DKEndpoint.[hm]: Support watchers and timers on multiple run-loops.
* Source/DKProxy.m: Allow D-Bus methods to be called from multiple threads.
  Also enable asynchronous generation of the method cache.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31057 72102866-910b-0410-8b05-ffd578937521
2010-07-30 14:39:11 +00:00
Niels Grewe
5c4e0daf6f Attempt to clarify the code path for method lookup.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31056 72102866-910b-0410-8b05-ffd578937521
2010-07-30 12:20:01 +00:00
Niels Grewe
e438cd6517 * Source/DKProxy.m: Rename -_methodForSelector:block: to
-_methodForSelector:waitForCache:.
* Source/DKArgument.m: Add cast that might be needed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31051 72102866-910b-0410-8b05-ffd578937521
2010-07-29 15:24:35 +00:00
Niels Grewe
d381048421 * Source/DKInterface.m: Really fix the initializer this time.
* Source/DKIntrospectionParserDelegate.m: Smarter handling of the root node.
* Source/DKArgument.m
  Source/DKMethodCall.m
  Source/DKProxy.m
  Source/DKProxy+Private.m:
  Move some more methods that are often used by the internal classes into
  DKProxy+Private.h.
* Source/DKObjectPathNode.[mh]: Implement retrieval of a proxy for a
  DKObjectPathNode.

More cleanup and minor improvements.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31050 72102866-910b-0410-8b05-ffd578937521
2010-07-29 14:31:01 +00:00
Niels Grewe
303361c8e0 * Source/DKIntrospectionParserDelegate.m
Source/DKMethod.[hm]
  Source/DKSignal.[hm]:
  Simplify (or remove) method and signal initalizer to not require the interface
  name. Remove _DKMethodIntrospect.
* Source/DKProxy.m
  Source/DKProxy+Private.h:
  Implement _DKInterfaceIntrospectable to replace _DKMethodIntrospect.
* Source/DKInterface.m: Normalize selectors before table lookups/updates.
* Tests/TestDKMethod.m
  Tests/TestDKMethodCall.m:
  Adapt test cases to use _DKInterfaceIntrospectable.

Refactor the global introspection method into a global introspection interface
to allow simpler initializers for DKMethod and DKSignal.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31046 72102866-910b-0410-8b05-ffd578937521
2010-07-28 19:34:46 +00:00
Niels Grewe
5c427df3a2 * Headers/DKProxy.h
Source/GNUmakefile
  Source/DKObjectPathNode.[hm]
  Source/DKProxy.m
  Source/DKProxy+Private.h:
  Add DKObjectPathNode class and protocol (handles object trees and interfaces).
  Implement DKObjectPathNode protocol in DKProxy and expose it via
  DKProxy+Private.h.
* Source/DKArgument.m
  Source/DKIntrospectionNode.m
  Source/DKMethod.m
  Source/DKMethodCall.m
  Source/DKOutgoingProxy.h
  Source/DKPort.m
  Source/DKProxy.m
  Source/NSConnection+DBus.m:
  Include new DKProxy+Private.h instead of the public header.
* Source/DKMethod.[hm]
  Source/DKInterface.[hm]
  Source/DKIntrospectionParserDelegate.m
  Tests/TestDKMethod.m:
  Rename initializers of DKMethod and DKInterface to follow the naming scheme of
  the superclass more closely.
* Source/DKIntrospectionParserDelegate.[hm]: Use the parent to store the
  introspection tree and not the parser delegate.

Clean up the generation of the introspection data so that the parser delegate
doesn't need to keep the generated tree around. Also be more consistent about
naming initializers in subclasses of DKIntrospectionNode.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31045 72102866-910b-0410-8b05-ffd578937521
2010-07-28 14:56:58 +00:00
Niels Grewe
70c28b95fa Prevent libdbus from calling _exit() when the bus goes away.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31042 72102866-910b-0410-8b05-ffd578937521
2010-07-28 03:38:49 +00:00
Niels Grewe
5c5c67962d * Source/DKInterface.m
Source/DKIntrospectionNode.[hm]
  Source/DKMethod.m:
  Remove parser delegate methods and ivars.
* Source/DKSignal.[hm]
  Source/GNUmakefile:
  Add stub for handling signals.
* Source/DKIntrospectionParserDelegate.[hm]: Consolidate XML parsing and keep a
  stack for the XML tree.

Refactor introspection handling so that the generation of the introspection
graph happens entirely from within DKIntrospectionParserDelegate.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31041 72102866-910b-0410-8b05-ffd578937521
2010-07-27 15:45:07 +00:00
Niels Grewe
c3a0b5c9b0 Only refer to D-Bus methods by their untyped selector IDs.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31014 72102866-910b-0410-8b05-ffd578937521
2010-07-21 13:57:30 +00:00
Niels Grewe
203e164cf5 Fix memory leaks generated by the fact that I copy and paste too much without
thinking.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31013 72102866-910b-0410-8b05-ffd578937521
2010-07-21 13:11:51 +00:00
Niels Grewe
8e0343c404 * Headers/NSConnection+DBus.h
Source/NSConnection+DBus.m:
  Add -proxyAtPath: method to obtain proxies for non-root objects of a D-Bus
  service.
* Source/GNUmakefile: Add NSConnection+DBus.[hm] to build.
* Source/DKPort.m: Rearrange so that proxy generation is separated from encoding
  the proxy for use in NSConnection.
* Headers/DBusKit.h: Add DKProxy.h and NSConnection+DBus.h.
* Tests/TestDKProxy.m: Test for fetching proxies to non-root objects. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31012 72102866-910b-0410-8b05-ffd578937521
2010-07-21 13:06:35 +00:00
Niels Grewe
f1523d8002 Improve error reporting.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31009 72102866-910b-0410-8b05-ffd578937521
2010-07-20 19:55:49 +00:00
Niels Grewe
c6f3e15a40 Make DKPort check whether the requested remote is available on the bus.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31008 72102866-910b-0410-8b05-ffd578937521
2010-07-20 19:11:19 +00:00
Niels Grewe
e06efc0ca2 Use sel_get_type() instead of accessing a selector's type field directly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@31000 72102866-910b-0410-8b05-ffd578937521
2010-07-19 09:03:34 +00:00
Niels Grewe
dc8565c4bb * Source/DKPort.m: Move from NSLog() to NSDebugMLog()
* Source/DKProxy.[mh]: Move from NSLog() to NSDebugMLog(). Implement
  -setPrimaryDBusInterface:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30997 72102866-910b-0410-8b05-ffd578937521
2010-07-19 08:11:45 +00:00
Niels Grewe
11d640199e Check whether making calls to the org.apertium.info object on D-Bus raises an
exception. Also more checking when generating the localized language string for
the UI. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30996 72102866-910b-0410-8b05-ffd578937521
2010-07-19 08:06:38 +00:00
Niels Grewe
acffd69ad4 * Examples/Apertium/ApertiumInfo.m: Strip whitespace from mode strings.
* Examples/Apertium/ApertiumServer.m: Properly handle exceptions from the D-Bus
  side.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30994 72102866-910b-0410-8b05-ffd578937521
2010-07-18 20:04:54 +00:00
Niels Grewe
bf3375e08d Commit a little example demonstrating what is possible with DBusKit.
The Apertium.service hooks into the Apertium machine translation system via
D-Bus and exposes it as a service. You can thus use the translator from within
any GNUstep application. The DBusKit-specific portions are contained in
ApertiumTranslator.m and ApertiumInfo.m.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30993 72102866-910b-0410-8b05-ffd578937521
2010-07-18 13:00:28 +00:00
Niels Grewe
85457d1f7e Turn NSLog() calls into NSDebugMLog().
Fix a bug where timers were not tracked, causing them to not be invalidated
properly (they would sometimes fire after the target object disappeared).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30992 72102866-910b-0410-8b05-ffd578937521
2010-07-18 10:53:57 +00:00
Niels Grewe
a2a73be0b9 Guard against nil values as arguments. Fix bug in marshalling variant type arguments.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30990 72102866-910b-0410-8b05-ffd578937521
2010-07-17 07:40:34 +00:00
Niels Grewe
dcf07ce017 Fix bug where strings would be messed up because of an improper cast.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30989 72102866-910b-0410-8b05-ffd578937521
2010-07-16 23:52:56 +00:00
Niels Grewe
5ae078d523 Keep gnustep-make from installing the testsuite.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30984 72102866-910b-0410-8b05-ffd578937521
2010-07-16 15:09:35 +00:00
Niels Grewe
7cded89a4e Add test case for methods that contain boxed and non-boxed arguments.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30983 72102866-910b-0410-8b05-ffd578937521
2010-07-16 15:03:17 +00:00
Niels Grewe
919ac8a4b9 * Source/DKMethod.[hm]: Be more flexible about boxing. Decide whether argument
should or shouldn't be boxed based on the related invocation.
* Source/DKMethodCall.[hm]
  Source/DKProxy.m
  Tests/TestDKMethodCall.m
  Tests/TestDKProxy.m:
  Remove references to the old argument types which did statically decide on a
  boxing scheme.
* Headers/DKProxy.h: Remove unused ivar.

Make better use of D-Bus and Objective-C introspection data to decide on the fly
whether an argument to a D-Bus method should be boxed in an Objective-C object
or not.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30979 72102866-910b-0410-8b05-ffd578937521
2010-07-16 12:49:34 +00:00
Niels Grewe
355a85afe2 * Source/DKInterface.[hm]: Add -methods to return the array of all methods in
the interface. 
* Source/DKIntrospectionNode.[hm]: Add -setParent: method that is needed to
  reparent nodes from the parser delegate to the proxy that is using them.
* Source/DKIntrospectionParserDelegate.[hm]: Add class to hold the
  constructed introspection graph.
* Source/DKMethod.m: Remove call to DKProxy's _installMethod:... method.
* Source/DKProxy.m: Remove parser delegate methods and reorganise the code so
  that DKProxy itself is responsible for installing the methods found by
  introspection.
* Source/GNUmakefile: Add DKIntrospectionParserDelegate.m to the build.

Separate parsing of introspection data from DKProxy, which is now also
responsible for installing methods.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30976 72102866-910b-0410-8b05-ffd578937521
2010-07-16 08:56:36 +00:00
Niels Grewe
0b5000d11a Simply -proxyParent method.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30974 72102866-910b-0410-8b05-ffd578937521
2010-07-16 05:42:40 +00:00
Niels Grewe
06d0255d86 Reorganise the project so that the tests are built as a separate subproject and
linked against the framework.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30962 72102866-910b-0410-8b05-ffd578937521
2010-07-14 10:46:23 +00:00
Niels Grewe
2dbec50c23 Remove erratic parentheses around protocol names.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30960 72102866-910b-0410-8b05-ffd578937521
2010-07-13 22:14:18 +00:00
Niels Grewe
539eccf050 * Source/DKArgument.m
Source/DKMethod.m
  Source/DKMethodCall.m:
  Replace side-effect ridden NSAsserts.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30958 72102866-910b-0410-8b05-ffd578937521
2010-07-13 21:53:49 +00:00
Niels Grewe
284f5f44e0 * Source/DKProxy.m: Make proper use of selector types to generate the method
signature so that methods can be called unmangled without boxing the
  arguments.
* Source/Tests/TestDKProxy.m: Implement test for unboxed method calls.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30950 72102866-910b-0410-8b05-ffd578937521
2010-07-12 23:04:56 +00:00
Niels Grewe
2f6a628322 * Source/DKProxy.m: Some bugfixes. Implement handling mangled selectors.
* Source/Tests/TestDKProxy.m: Test sending unboxed method calls with mangled
  selectors.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30949 72102866-910b-0410-8b05-ffd578937521
2010-07-12 22:46:11 +00:00
Niels Grewe
71a413c3db * Source/DKMethodCall.m: Fix statement order and typo.
* Source/Tests/TestDKProxy.m: Test for returning errors from D-Bus.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30948 72102866-910b-0410-8b05-ffd578937521
2010-07-12 22:14:29 +00:00
Niels Grewe
95f4360669 * Headers/DKProxy.h: Add needed ivars.
* Source/AsyncBehavior.h: Minor addition.
* Source/DKArgument.[mh]: Remove -proxyParent method (now in superclass)
* Source/DKInterface.h: Declare -mangledName.
* Source/DKInterface.m: Implement selector/method-map and XML parser delegate
  methods.
* Source/DKIntrospectionNode.[mh]: Move -proxyParent method here. Handle
  annotations.
* Source/DKMethod.[hm]: Implement -selectorString method to generate selector
  names. Also add XML parser delegate methods.
* Source/DKMethodCall.m: Fix bug where an D-Bus error was used unitialized.
* Source/DKProxy.m: Remove async stuff (pretty superfluous right now). Fix
  various bugs in selector resolution and implement building the method cache.
* Source/Tests/TestDKProxy.m: Add tests for new functionality.

Implement the remaining bits of basic proxy functionality. Arbitrary D-Bus
methods can now be called when their arguments are boxed as Objective-C types.
Calling methods without boxing to come.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30947 72102866-910b-0410-8b05-ffd578937521
2010-07-12 20:35:03 +00:00
Niels Grewe
60acf9cdf9 Fix -isDictionary method for array arguments.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30920 72102866-910b-0410-8b05-ffd578937521
2010-07-04 15:20:42 +00:00
Niels Grewe
6fef792195 Remove isa-swizzling in favour of creating the correct objects in the
initalizers.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/dbuskit/trunk@30919 72102866-910b-0410-8b05-ffd578937521
2010-07-04 13:31:24 +00:00