Changeset 516 for trunk/Cocoa/Pester/Source/PSDockBounceAlert.m
- Timestamp:
- 05/25/09 02:40:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSDockBounceAlert.m
r53 r516 9 9 #import <AppKit/AppKit.h> 10 10 #import "PSDockBounceAlert.h" 11 #import "PSAlarmAlertController.h" 12 13 #include <Carbon/Carbon.h> 11 14 12 15 static PSDockBounceAlert *PSDockBounceAlertShared; 16 static NMRec nmr; 13 17 14 18 @implementation PSDockBounceAlert … … 16 20 + (PSAlert *)alert; 17 21 { 18 if (PSDockBounceAlertShared == nil) 22 if (PSDockBounceAlertShared == nil) { 19 23 PSDockBounceAlertShared = [[PSDockBounceAlert alloc] init]; 24 25 [[NSNotificationCenter defaultCenter] addObserver: PSDockBounceAlertShared selector: @selector(_stopBouncing) name: PSAlarmAlertStopNotification object: nil]; 26 27 bzero(&nmr, sizeof(nmr)); 28 nmr.nmMark = 1; 29 nmr.qType = nmType; 30 } 31 20 32 return PSDockBounceAlertShared; 21 33 } 22 34 23 + (void)stopBouncing;35 - (void)_stopBouncing; 24 36 { 25 [NSApp cancelUserAttentionRequest: NSInformationalRequest]; 37 if ((void *)nmr.nmRefCon != self) 38 return; 39 40 nmr.nmRefCon = 0; 41 NMRemove(&nmr); 26 42 } 27 43 28 44 - (void)triggerForAlarm:(PSAlarm *)alarm; 29 45 { 30 [NSApp requestUserAttention: NSInformationalRequest]; 31 [[self class] performSelector: @selector(stopBouncing) withObject: nil afterDelay: 1 inModes: [NSArray arrayWithObject: NSDefaultRunLoopMode]]; 46 if (nmr.nmRefCon == 0) { 47 nmr.nmRefCon = (long)self; 48 NMInstall(&nmr); 49 } 50 32 51 [self completedForAlarm: alarm]; 33 52 } … … 35 54 - (NSAttributedString *)actionDescription; 36 55 { 37 return [@"Bounce dock icon" small];56 return [@"Bounce Dock icon" small]; 38 57 } 39 58
Note:
See TracChangeset
for help on using the changeset viewer.