/usr/lib/GNUstep/Frameworks/DBusKit.framework/Versions/0/Headers/DKNotificationCenter.h is in libdbuskit-dev 0.1.1-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | /** Interface for DKNotificationCenter to handle D-Bus signals.
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Niels Grewe <niels.grewe@halbordnung.de>
Created: August 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import <Foundation/NSObject.h>
#import <DBusKit/DKPort.h>
@class DKEndpoint, DKProxy, NSDictionary, NSHashTable, NSRecursiveLock,
NSMapTable, NSMutableDictionary, NSNotification, NSString;
/**
* 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
* <code>org.gnustep.openstep.notification</code> annotation ,the value of this
* annotation will be used as the name of the notification. Otherwise, the
* notification name will be
* <code>DKSignal_<InterfaceName>_<SignalName></code>.
*
* 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:
* <deflist>
* <term>member</term><desc>The name of the signal being emitted (e.g.
* "NameOwnerChanged"</desc>
* <term>interface</term><desc>The name of the interface to which the signal
* belongs. (e.g. "org.freedesktop.DBus").</desc>
* <term>sender</term><desc>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.</desc>
* <term>path</term><desc>The path to the object emitting the signal (e.g
* "/org/freedesktop/DBus").</desc>
* <term>destination</term><desc>The intended receiver of the signal, might be
* empty if the signal was broadcast, which is usually the case.</desc>
* </deflist>
* Additionally the userInfo dictionary will contain keys for every argument
* specified in the signal, named "arg<em>N</em>". The dictionary might also
* contain further keys if <code>org.gnustep.openstep.notification.key</code>
* annotations were available.
*/
@interface DKNotificationCenter: NSObject
{
@private
/**
* The endpoint object used by the notification center to communicate with
* D-Bus.
*/
DKEndpoint *endpoint;
/**
* Set of all rules the notification center is going to match.
*/
NSHashTable *observables;
/**
* The signalInfo dictionary holds DKSignal objects indexed by their interface
* and signal names. Proxies that discover signals during introspection will
* register them here.
*/
NSMutableDictionary *signalInfo;
/**
* The notificationNames dictionary holds mappings between notification names
* and D-Bus signals. They will either be obtained by explicit registration
* (with -registerNotificationName:asSignal:inInterface:) or from an
* "org.gnustep.openstep.notification" annotation in the introspection data of
* the signal.
*/
NSMutableDictionary *notificationNames;
/**
* The inverse mapping for the notificationNames dictionary, allowing lookup
* of names by signal.
*/
NSMapTable *notificationNamesBySignal;
/**
* The lock protecting the tables.
*/
NSRecursiveLock *lock;
}
/**
* Returns a notification center for the session message bus.
*/
+ (id)sessionBusCenter;
/**
* Returns a notification center for the system message bus.
*/
+ (id)systemBusCenter;
/**
* Returns a notification center for the specified bus type.
*/
+ (id)centerForBusType: (DKDBusBusType)type;
/**
* Watches the bus for signals matching <var>notificationName</var> from
* <var>sender</var>. If one of them is <code>nil</code>, the value will not be
* used to restrict the notifications delivered to the observer. Notifications
* are delivered by calling <var>notifySelector</var> on <var>observer</var> as
* a receiver. Neither can be <code>nil</code> and <var>notifySelector</var>
* takes exactly one argument (the notification).
*/
- (void)addObserver: (id)observer
selector: (SEL)notifySelector
name: (NSString*)notificationName
object: (DKProxy*)sender;
/**
* Similar to -addObserver:selector:name:object: but allows to specify both
* sender and destination of the notification.
*/
- (void)addObserver: (id)observer
selector: (SEL)notifySelector
name: (NSString*)notificationName
sender: (DKProxy*)sender
destination: (DKProxy*)destination;
/**
* Similar to -addObserver:selector:name:sender:destination: but allows finer
* grained control over what signals to match. (E.g. it would be possible to
* request all notifications matching a particular interface only.).
*/
- (void)addObserver: (id)observer
selector: (SEL)notifySelector
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (DKProxy*)sender
destination: (DKProxy*)destination;
/**
* Similar to -addObserver:selector:signal:interface:sender:destination: but
* additionally allows matching a single argument. Due to D-Bus constraints,
* <var>index</var> must be less than 64. The signal will only be matched if the
* value of the argument at <var>index</var> <em>is equal</em> to
* the value of <var>filter</var>. 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
filter: (NSString*)filter
atIndex: (NSUInteger) index;
/**
* Similar to
* -addObserver:selector:signal:interface:sender:destination:filter:atIndex: but
* allows matching more than one signal. The argument list needs to be
* terminated by <code>nil</code>. If you want to match the first argument,
* specify that particular match as the first one and set <var>firstIndex</var>
* to <code>0</code>.
*/
- (void)addObserver: (id)observer
selector: (SEL)notifySelector
signal: (NSString*)signalName
interface: (NSString*)interfaceName
sender: (DKProxy*)sender
destination: (DKProxy*)destination
filtersAndIndices: (NSString*)firstFilter, NSUInteger firstindex, ...;
/**
* Removes all observation activities involving the <var>observer</var>.
*/
- (void)removeObserver: (id)observer;
/**
* 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
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, NSUInteger firstindex, ...;
/** NOTE: Not yet implemented. */
- (void)postNotification: (NSNotification*)notification;
/** NOTE: Not yet implemented. */
- (void)postNotificationName: (NSString*)name
object: (id)sender;
/** NOTE: Not yet implemented. */
- (void)postSignalName: (NSString*)signalName
interface: (NSString*)interfaceName
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
userInfo: (NSDictionary*)info;
/**
* This method allows notification names to be registered for specific signals.
* E.g.:
* <example>
* [[DKNotificationCenter sessionBusCenter] registerNotificationName: @"DKNameChanged"
* asSignal: @"NameOwnerChanged"
* inInterface: @"org.freedesktop.DBus"];
* </example>
* would deliver all "<code>NameOwnerChanged</code>" emissions as notifications
* named "<code>DKNameChanged</code>". The method returns <code>NO</code> if the
* notification name has already been registered.
*/
- (BOOL)registerNotificationName: (NSString*)notificationName
asSignal: (NSString*)signalName
inInterface: (NSString*)interface;
@end
|