~ubuntu-branches/ubuntu/lucid/gnustep-base/lucid

« back to all changes in this revision

Viewing changes to Tools/gdnc.m

  • Committer: Bazaar Package Importer
  • Author(s): Hubert Chathi
  • Date: 2009-04-11 13:30:33 UTC
  • mfrom: (1.2.8 upstream) (7.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090411133033-g6qrsuo8mep7h0eo
Tags: 1.19.0-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#define NSIG    32
40
40
#endif
41
41
 
 
42
static BOOL     debugging = NO;
42
43
static BOOL     is_daemon = NO;         /* Currently running as daemon.  */
43
44
static BOOL     auto_stop = NO;         /* Should we shut down when unused? */
44
45
static char     ebuf[2048];
160
161
                              object: (NSString*)object
161
162
                            userInfo: (NSData*)info
162
163
                            selector: (NSString*)aSelector
163
 
                                  to: (unsigned long)observer;
 
164
                                  to: (NSUInteger)observer;
164
165
@end
165
166
@implementation NSDistributedNotificationCenterGDNCDummy
166
167
- (oneway void) postNotificationName: (NSString*)name
167
168
                              object: (NSString*)object
168
169
                            userInfo: (NSData*)info
169
170
                            selector: (NSString*)aSelector
170
 
                                  to: (unsigned long)observer
 
171
                                  to: (NSUInteger)observer
171
172
{
172
173
  return;
173
174
}
174
175
@end
175
176
 
176
 
 
177
177
@interface      GDNCNotification : NSObject
178
178
{
179
179
@public
194
194
  RELEASE(info);
195
195
  [super dealloc];
196
196
}
 
197
- (NSString*) description
 
198
{
 
199
  return [NSString stringWithFormat: @"%@ Name:'%@' Object:'%@' Info:'%@'",
 
200
    [super description], name, object, info];
 
201
}
197
202
+ (GDNCNotification*) notificationWithName: (NSString*)notificationName
198
203
                                    object: (NSString*)notificationObject
199
204
                                      data: (NSData*)notificationData
242
247
@interface      GDNCObserver : NSObject
243
248
{
244
249
@public
245
 
  unsigned long         observer;
 
250
  NSUInteger            observer;
246
251
  NSString              *notificationName;
247
252
  NSString              *notificationObject;
248
253
  NSString              *selector;
280
285
  NSMutableDictionary   *observersForObjects;
281
286
}
282
287
 
283
 
- (void) addObserver: (unsigned long)anObserver
 
288
- (void) addObserver: (NSUInteger)anObserver
284
289
            selector: (NSString*)aSelector
285
290
                name: (NSString*)notificationName
286
291
              object: (NSString*)anObject
302
307
 
303
308
- (void) removeObserversForClients: (NSMapTable*)clients;
304
309
 
305
 
- (void) removeObserver: (unsigned long)anObserver
 
310
- (void) removeObserver: (NSUInteger)anObserver
306
311
                   name: (NSString*)notificationName
307
312
                 object: (NSString*)notificationObject
308
313
                    for: (id<GDNCClient>)client;
501
506
  return self;
502
507
}
503
508
 
504
 
- (void) addObserver: (unsigned long)anObserver
 
509
- (void) addObserver: (NSUInteger)anObserver
505
510
            selector: (NSString*)aSelector
506
511
                name: (NSString*)notificationName
507
512
              object: (NSString*)anObject
513
518
  GDNCObserver  *obs;
514
519
  NSConnection  *connection;
515
520
 
 
521
  if (debugging)
 
522
    NSLog(@"Adding observer %lu for %@ %@",
 
523
      anObserver, notificationName, anObject);
 
524
 
516
525
  connection = [(NSDistantObject*)client connectionForProxy];
517
526
  clients = (NSMapTable*)NSMapGet(connections, connection);
518
527
  if (clients == 0)
792
801
              NS_DURING
793
802
                {
794
803
                  [obs->queue removeObjectAtIndex: 0];
 
804
  if (debugging)
 
805
    NSLog(@"Posting to observer %lu with %@", obs->observer, n);
795
806
                  [obs->client->client postNotificationName: n->name
796
807
                                                     object: n->object
797
808
                                                   userInfo: n->info
801
812
              NS_HANDLER
802
813
                {
803
814
                  obs = nil;
 
815
                  NSLog(@"Problem posting notification to client: %@",
 
816
                    localException);
804
817
                }
805
818
              NS_ENDHANDLER
806
819
              RELEASE(n);
811
824
 
812
825
- (void) removeObserver: (GDNCObserver*)observer
813
826
{
 
827
  if (debugging)
 
828
    NSLog(@"Removing observer %lu for %@ %@",
 
829
      observer->observer, observer->notificationName,
 
830
      observer->notificationObject);
 
831
 
814
832
  if (observer->notificationObject)
815
833
    {
816
834
      NSMutableArray    *objList;
852
870
    }
853
871
}
854
872
 
855
 
- (void) removeObserver: (unsigned long)anObserver
 
873
- (void) removeObserver: (NSUInteger)anObserver
856
874
                   name: (NSString*)notificationName
857
875
                 object: (NSString*)notificationObject
858
876
                    for: (id<GDNCClient>)client
1037
1055
{
1038
1056
  GDNCServer            *server;
1039
1057
  BOOL                  subtask = YES;
1040
 
  BOOL                  debugging = NO;
1041
1058
  NSProcessInfo         *pInfo;
1042
1059
  NSMutableArray        *args;
1043
1060
  CREATE_AUTORELEASE_POOL(pool);