Copy of code from HardwareGrowler:
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSNotificationCenter *center = [workspace notificationCenter];
[center addObserver:[VolumeNotifier class] selector:@selector(volumeDidMount:) name:NSWorkspaceDidMountNotification object:nil];
[center addObserver:[VolumeNotifier class] selector:@selector(volumeDidUnmount:) name:NSWorkspaceDidUnmountNotification object:nil];
[center addObserver:[VolumeNotifier class] selector:@selector(volumeWillUnmount:) name:NSWorkspaceWillUnmountNotification object:nil];
Then you need to implement methods to respond to ala notifications
+ (void) volumeDidUnmount:(NSNotification *)aNotification;
{
...
}
http://growl.info/source.php
/HardwareGrowler VolumeNotifier.h/m
UPDATE:
Peters . , .