More reliable mechanism for finding the main menu in a nib, fixed warning in NSNetServices

This commit is contained in:
Christopher Lloyd 2010-03-02 14:44:43 +00:00
parent f7d3919bba
commit 520a52004e
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSNibConnector.h>
#import <AppKit/NSFontManager.h>
#import <AppKit/NSNib.h>
#import <AppKit/NSMenu.h>
@interface NSKeyedUnarchiver(private)
-(void)replaceObject:object withObject:replacement;
@ -26,6 +27,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-(NSDictionary *)externalNameTable;
@end
@interface NSMenu(private)
-(NSString *)_name;
@end
@implementation NSIBObjectData
-initWithCoder:(NSCoder *)coder {
@ -112,10 +117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
int i,count=[_namesValues count];
for(i=0;i<count;i++){
NSString *check=[_namesValues objectAtIndex:i];
id check=[_namesKeys objectAtIndex:i];
if([check isEqual:@"MainMenu"])
return [_namesKeys objectAtIndex:i];
if([check isKindOfClass:[NSMenu class]])
if([[check _name] isEqual:@"_NSMainMenu"])
return check;
}
return nil;
}

View File

@ -22,6 +22,7 @@
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSSelectInputSource.h>
#import <Foundation/NSSocket.h>
#import <Foundation/NSHost.h>
#ifdef WIN32
#import <winsock2.h> // for ntohs