bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix, GMAppKit - Image loading


From: Georg Fleischmann
Subject: Fix, GMAppKit - Image loading
Date: Fri, 11 Nov 2005 15:14:18 GMT

Hi,

here is a patch for GMAppKit to allow loading of images from the owners bundle  
(not just the main bundle).

Best wishes,
Georg


2005-11-11  Georg Fleischmann
        * gui/Model/GMAppKit.m [NSImage +createObjectForModelUnarchiver:]
          allow loading of images from the owners bundle


*** gui/Model/GMAppKit.m.old    2005-07-22 17:15:43.000000000 +0200
--- gui/Model/GMAppKit.m        2005-11-09 22:30:59.000000000 +0100
***************
*** 756,761 ****
--- 756,763 ----

  @implementation NSImage (GMArchiverMethods)

+ extern id _nibOwner;
+
  - (void)encodeWithModelArchiver:(GMArchiver*)archiver
  {
    [archiver encodeString:[self name] withName:@"name"];
***************
*** 770,776 ****
--- 772,787 ----
    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"];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]