Author: mlytwyn
Date: Thu May 26 19:27:30 2016
New Revision: 39812
URL: http://svn.gna.org/viewcvs/gnustep?rev=39812&view=rev
Log:
Add default GNUstep image
Added:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/Images/GNUstep.png
(with props)
Modified:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/GNUmakefile
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/MSUserNotification.mm
Modified:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/GNUmakefile
URL:
http://svn.gna.org/viewcvs/gnustep/libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/GNUmakefile?rev=39812&r1=39811&r2=39812&view=diff
==============================================================================
---
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/GNUmakefile
(original)
+++
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/GNUmakefile
Thu May 26 19:27:30 2016
@@ -33,6 +33,7 @@
# -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
Added:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/Images/GNUstep.png
URL:
http://svn.gna.org/viewcvs/gnustep/libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/Images/GNUstep.png?rev=39812&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/Images/GNUstep.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified:
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/MSUserNotification.mm
URL:
http://svn.gna.org/viewcvs/gnustep/libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/MSUserNotification.mm?rev=39812&r1=39811&r2=39812&view=diff
==============================================================================
---
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/MSUserNotification.mm
(original)
+++
libs/back/branches/gnustep_testplant_branch/Source/win32/MSUserNotifications/MSUserNotification.mm
Thu May 26 19:27:30 2016
@@ -66,6 +66,11 @@
@end
@implementation NSImage (Private)
+- (void)_setFilename:(NSString*)filename
+{
+ _fileName = [filename copy];
+}
+
- (NSString*)_filename
{
return _fileName;
@@ -106,10 +111,12 @@
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 @@
DestroyIcon(icon);
}
- [imageToIcon release];
+ RELEASE(appIconPath);
+ RELEASE(imageToIcon);
[super dealloc];
}
@@ -195,32 +203,39 @@
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;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs