Allow loading of images from the owners bundle

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24119 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2006-11-17 04:53:09 +00:00
parent fb51fe62fe
commit f15b15d1ba
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2006-11-16 Adam Fedor <fedor@gnu.org>
* Model/GMAppKit.m ([NSImage +createObjectForModelUnarchiver:]):
Allow loading of images from the owners bundle (patch from
Georg Fleischmann.
2006-11-15 Nicola Pero <nicola.pero@meta-innovation.com>
Notice: you should now use 'make DESTDIR=/tmp/xxx install' if you

View file

@ -756,6 +756,8 @@ void __dummy_GMAppKit_functionForLinking() {}
@implementation NSImage (GMArchiverMethods)
extern id _nibOwner;
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[archiver encodeString:[self name] withName:@"name"];
@ -770,7 +772,16 @@ void __dummy_GMAppKit_functionForLinking() {}
imageName = [unarchiver decodeStringWithName:@"name"];
if (imageName)
{
image = [NSImage imageNamed: imageName];
if (image == nil)
{
NSBundle *bundle = [NSBundle bundleForClass:[_nibOwner class]];
NSString *path = [bundle pathForImageResource:imageName];
image = [[NSImage alloc] initByReferencingFile:path];
}
}
if (image == nil)
image = [NSImage imageNamed:@"GNUstepMenuImage"];