Problem sending notification from C callback function
Problem sending notification from C callback function
- Subject: Problem sending notification from C callback function
- From: Sandro Noel <email@hidden>
- Date: Thu, 08 Jan 2009 20:57:32 -0500
Greetings.
I'm having a little problem due to lack of knowledge here.
I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.
the callback is registered like this.
daSession = DASessionCreate(kCFAllocatorSystemDefault);
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop currentRunLoop]
getCFRunLoop], kCFRunLoopCommonModes);
DARegisterDiskDisappearedCallback(daSession, NULL,
&DiskDisappearedCallback, (void *)self);
the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;
NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"];
[[NSNotificationCenter defaultCenter]
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];
}
Obviously, default center does not exist in the callback, but i cant
seem to typecast the context to
my object type and retrieve the notification center from the object. i
just do not know how to do it.
could someone enlighten me please ?
thank you Sandro Noel.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden