Authors
- Niels Grewe (
niels.grewe@halbordnung.de
)
-
Date: Generated at 2025-05-09 09:10:33 -0600
Copyright: (C) 2010 Free Software Foundation, Inc.
- Declared in:
- DBusKit/DKNotificationCenter.h
The DKNotificationCenter class allows Objective-C objects
to watch for notifications from other D-Bus objects
('signals' in the D-Bus dialect) or to post
notifications to D-Bus themselves. You can use
this class just as you would use an
NSNotificationCenter. Notification
names will be mapped to signals as follows: If the
introspection data for theD-Bus signal carries
an
org.gnustep.openstep.notification
annotation,the value of this annotation will be
used as the name of the notification. Otherwise, the
notification name will be
DKSignal_<InterfaceName>_<SignalName>
. Additionally, D-Bus provides a rather sophisticated
matching mechanism to catch only signal emissions
with a specific signature. This mechanism is available
to applications through the
-addObserver:selector:signal:interface:sender:destination:
method and its more specific variants. Unfortunately, at this time, you need to specify identical match rules when removing the observer again. Every notification from D-Bus carries a reference to a proxy for the object emitting the signal and also guarantees that the following keys are present in the dictionary:
- member
-
The name of the signal being emitted (e.g. "NameOwnerChanged"
- interface
-
The name of the interface to which the signal belongs. (e.g. "org.freedesktop.DBus").
- sender
-
The service emitting the signal (e.g. "org.freedesktop.DBus"). This will always be the unique name of the service, even if you registered the signal for another name.
- path
-
The path to the object emitting the signal (e.g "/org/freedesktop/DBus").
- destination
-
The intended receiver of the signal, might be empty if the signal was broadcast, which is usually the case.
Additionally the userInfo dictionary will contain keys for every argument specified in the signal, named "arg
N ". The dictionary might also contain further keys if
org.gnustep.openstep.notification.key
annotations were available.
+ (id)
centerForBusType: (
DKDBusBusType)type;
Returns a notification center for the specified bus
type.
+ (id)
sessionBusCenter;
Returns a notification center for the session
message bus.
+ (id)
systemBusCenter;
Returns a notification center for the system
message bus.
- (void)
addObserver: (id)observer
selector: (SEL)notifySelector
name: (NSString*)notificationName
object: (
DKProxy*)sender;
Watches the bus for signals matching
notificationName from sender.
If one of them is nil
, the value will not
be used to restrict the notifications delivered to the
observer. Notifications are delivered by
calling notifySelector on
observer as a receiver. Neither can be
nil
and notifySelector takes
exactly one argument (the notification).
- (void)
addObserver: (id)observer
selector: (SEL)notifySelector
name: (NSString*)notificationName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination;
- (void)
addObserver: (id)observer
selector: (SEL)notifySelector
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination;
- (void)
addObserver: (id)observer
selector: (SEL)notifySelector
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination
filter: (NSString*)filter
atIndex: (NSUInteger)index;
Similar to
-addObserver:selector:signal:interface:sender:destination:
but additionally allows matching a single argument. Due to D-Bus constraints,
index must be less than 64. The signal will only be matched if the value of the argument at
index is equal to the value of
filter. Additionally, this matching is limited to string arguments.
- (void)
addObserver: (id)observer
selector: (SEL)notifySelector
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination
filtersAndIndices: (NSString*)firstFilter
,...;
- (void)
postNotification: (NSNotification*)notification;
NOTE: Not yet implemented.
- (void)
postNotificationName: (NSString*)name
object: (id)sender;
NOTE: Not yet implemented.
- (void)
postNotificationName: (NSString*)name
object: (id)sender
userInfo: (NSDictionary*)info;
NOTE: Not yet implemented.
- (void)
postSignalName: (NSString*)signalName
interface: (NSString*)interfaceName
object: (id)sender;
NOTE: Not yet implemented.
- (void)
postSignalName: (NSString*)signalName
interface: (NSString*)interfaceName
object: (id)sender
userInfo: (NSDictionary*)info;
NOTE: Not yet implemented.
- (BOOL)
registerNotificationName: (NSString*)notificationName
asSignal: (NSString*)signalName
inInterface: (NSString*)interface;
This method allows notification names to be registered
for specific signals. E.g.:
[[DKNotificationCenter sessionBusCenter] registerNotificationName: @"DKNameChanged"
asSignal: @"NameOwnerChanged"
inInterface: @"org.freedesktop.DBus"];
would deliver all "
NameOwnerChanged
"
emissions as notifications named "
DKNameChanged
". The method returns
NO
if the notification name has already
been registered.
- (void)
removeObserver: (id)observer;
Removes all observation activities involving the
observer.
- (void)
removeObserver: (id)observer
name: (NSString*)notificationName
object: (
DKProxy*)sender;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.
- (void)
removeObserver: (id)observer
name: (NSString*)notificationName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.
- (void)
removeObserver: (id)observer
signal: (NSString*)signalName
interface: (NSString*)interfaceName
object: (
DKProxy*)sender;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.
- (void)
removeObserver: (id)observer
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.
- (void)
removeObserver: (id)observer
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination
filter: (NSString*)filter
atIndex: (NSUInteger)index;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.
- (void)
removeObserver: (id)observer
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (
DKProxy*)sender
destination: (
DKProxy*)destination
filtersAndIndices: (NSString*)firstFilter
,...;
Removes all observation activities matching the
arguments specified. The match is inclusive.
Every observation for a more specific rule will also
be removed.