- Timestamp:
- 03/05/08 11:35:32 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEServices.m
r322 r439 125 125 126 126 void ICCF_SetServicesMenu(NSMenu *servicesMenu) { 127 // in 10.3, this populates the menu; in 10.4, it attaches a delegate (NSServiceMaster)127 // attaches a delegate (NSServiceMaster in 10.4, NSServiceMenuDelegate in 10.5) 128 128 [[NSApplication sharedApplication] setServicesMenu: servicesMenu]; 129 129 id delegate; 130 if ( (delegate = [servicesMenu delegate]) != nil) { 131 // populate menu so we have something to filter 132 if ([delegate respondsToSelector: @selector(menuNeedsUpdate:)]) { 133 [delegate menuNeedsUpdate: servicesMenu]; 130 if ( (delegate = [servicesMenu delegate]) == nil) 131 return; 132 133 // populate menu so we have something to filter; delegate reponds to one of these methods 134 if ([delegate respondsToSelector: @selector(menuNeedsUpdate:)]) { 135 [delegate menuNeedsUpdate: servicesMenu]; 136 } 137 if ([delegate respondsToSelector: @selector(menu:updateItem:atIndex:shouldCancel:)]) { 138 int itemCount = [delegate numberOfItemsInMenu: servicesMenu]; 139 for (int i = 0 ; i < itemCount ; i++) { 140 [servicesMenu addItemWithTitle: @"" action: NULL keyEquivalent: @""]; 134 141 } 135 if ([delegate respondsToSelector: @selector(menu:updateItem:atIndex:shouldCancel:)]) { 136 int itemCount = [delegate numberOfItemsInMenu: servicesMenu]; 137 for (int i = 0 ; i < itemCount ; i++) { 138 [servicesMenu addItemWithTitle: @"" action: NULL keyEquivalent: @""]; 139 } 140 for (int i = 0 ; i < itemCount ; i++) { 141 if (![delegate menu: servicesMenu updateItem: (NSMenuItem *)[servicesMenu itemAtIndex: i] atIndex: i shouldCancel: NO]) 142 break; 143 } 142 for (int i = 0 ; i < itemCount ; i++) { 143 if (![delegate menu: servicesMenu updateItem: (NSMenuItem *)[servicesMenu itemAtIndex: i] atIndex: i shouldCancel: NO]) 144 break; 144 145 } 145 146 }
Note:
See TracChangeset
for help on using the changeset viewer.