Fixes from jgapen

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6355 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-03-22 21:39:00 +00:00
parent dd56c62969
commit f5384ec7aa
4 changed files with 28 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2000-03-22 Richard Frith-Macdonald <rfm@gnu.org>
Patch from jagapen@whitewater.chem.wisc.edu
* Model/IMLoading.m: new method ([+loadGModelNamed:owner:])
* Headers/AppKit/IMGmodel.h: ditto
* Source/NSApplication.m: Use new method.
Sun Mar 19 22:26:55 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Model/GMAppKit.m ([NSApplication -initWithModelUnarchiver:]):

View file

@ -34,6 +34,7 @@
@interface NSBundle (IMLoading)
+ (BOOL)loadGModelNamed:(NSString *)gmodelName owner:(id)owner;
- (BOOL)loadIMFile:(NSString*)filename owner:(id)owner;
@end

View file

@ -44,6 +44,25 @@ void __dummy_IMLoading_functionForLinking()
return [GMModel loadIMFile:path owner:owner bundle:self];
}
+ (BOOL)loadGModelNamed:(NSString *)gmodelName owner:(id)owner
{
NSBundle *bundle;
NSString *path;
/* Pull off the .gmodel extension (if any) for pathForResource:ofType: */
if ([[gmodelName pathExtension] isEqualToString:@"gmodel"])
gmodelName = [gmodelName stringByDeletingPathExtension];
/* Use owner's bundle (if any) just like +loadNibNamed:owner: does. */
bundle = [NSBundle bundleForClass: owner];
if (bundle == nil)
bundle = [NSBundle mainBundle];
path = [bundle pathForResource:gmodelName ofType:@"gmodel"];
return [GMModel loadIMFile:path owner:owner bundle:bundle];
}
@end /* NSBundle(IMLoading) */

View file

@ -562,8 +562,7 @@ static NSCell* tileCell = nil;
{
if ([NSBundle loadNibNamed: mainModelFile owner: self] == NO)
{
if ([GMModel loadIMFile: mainModelFile
owner: self] == NO)
if ([NSBundle loadGModelNamed: mainModelFile owner: self] == NO)
NSLog (@"Cannot load the main model file '%@'", mainModelFile);
}
}