Add default GNUstep image

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@39812 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2016-05-26 17:27:30 +00:00
parent c6a0e4c4bc
commit dc7101d1c4
4 changed files with 39 additions and 23 deletions

View file

@ -33,6 +33,7 @@ NSUserNotification_BUNDLE_LIBS = -lgnustep-gui -lgdi32
# -I/mingw/lib/gcc/mingw32/4.8.1/include/c++/mingw32 \
# -I/mingw/lib/gcc/mingw32/4.8.1/include/c++
NSUserNotification_RESOURCE_FILES = \
Images/GNUstep.png \
ToastNotifications/obj/ToastNotifications-0.dll \
TaskbarNotifications/obj/TaskbarNotifications-0.dll
#NSUserNotification_SUBPROJECTS = ToastNotifications TaskbarNotifications

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

View file

@ -66,6 +66,11 @@ static NSString * const kButtonActionKey = @"show";
@end
@implementation NSImage (Private)
- (void)_setFilename:(NSString*)filename
{
_fileName = [filename copy];
}
- (NSString*)_filename
{
return _fileName;
@ -106,10 +111,12 @@ static NSString * const kButtonActionKey = @"show";
NSString *imageName = [[infoDict objectForKey:@"CFBundleIconFiles"] objectAtIndex:0];
NSString *imageType = @"";
NSString *path = nil;
NSLog(@"XXX");
NSImage *image = [self _imageForBundleInfo:infoDict];
NSLog(@"XXX");
appIcon = [self _iconFromImage:image];
appIconPath = [image _filename];
appIconPath = [[image _filename] copy];
NSLog(@"%s:bundle: %@ image: %@ icon: %p path: %@", __PRETTY_FUNCTION__, classBundle, image, appIcon, appIconPath);
if (appIcon == NULL)
@ -186,7 +193,8 @@ static NSString * const kButtonActionKey = @"show";
DestroyIcon(icon);
}
[imageToIcon release];
RELEASE(appIconPath);
RELEASE(imageToIcon);
[super dealloc];
}
@ -195,32 +203,39 @@ static NSString * const kButtonActionKey = @"show";
NSImage *image = nil;
NSString *appIconFile = [infoDict objectForKey: @"NSIcon"];
if (appIconFile && ![appIconFile isEqual: @""])
if (appIconFile && ![appIconFile isEqual: @""] && ![[appIconFile pathExtension] isEqual: @"png"])
{
image = [NSImage imageNamed: appIconFile];
}
// Try to look up the icns file.
appIconFile = [infoDict objectForKey: @"CFBundleIconFile"];
if (appIconFile && ![appIconFile isEqual: @""])
{
image = [NSImage imageNamed: appIconFile];
}
if (image == nil)
{
image = [NSImage imageNamed: @"GNUstep"];
}
else
{
/* Set the new image to be named 'NSApplicationIcon' ... to do that we
* must first check that any existing image of the same name has its
* name removed.
*/
[(NSImage*)[NSImage imageNamed: @"NSApplicationIcon"] setName: nil];
// We need to copy the image as we may have a proxy here
image = AUTORELEASE([image copy]);
[image setName: @"NSApplicationIcon"];
// Try to look up the icns file.
appIconFile = [infoDict objectForKey: @"CFBundleIconFile"];
if (appIconFile && ![appIconFile isEqual: @""] && ![[appIconFile pathExtension] isEqual: @"png"])
{
image = [NSImage imageNamed: appIconFile];
}
if (image == nil)
{
NSBundle *bundle = [NSBundle bundleForClass: [self class]];
appIconFile = [bundle pathForResource:@"GNUstep" ofType:@"png"];
image = AUTORELEASE([[NSImage alloc] initWithContentsOfFile:appIconFile]);
[image setName:@"NSUserNotificationIcon"];
[image _setFilename:appIconFile];
}
else
{
/* Set the new image to be named 'NSApplicationIcon' ... to do that we
* must first check that any existing image of the same name has its
* name removed.
*/
[(NSImage*)[NSImage imageNamed: @"NSApplicationIcon"] setName: nil];
// We need to copy the image as we may have a proxy here
image = AUTORELEASE([image copy]);
[image setName: @"NSApplicationIcon"];
}
}
return image;
}