Added support for CF keys.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26807 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-08-13 05:17:19 +00:00
parent bfde86fcd5
commit b79669d5f1
4 changed files with 57 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2008-08-13 01:17-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSInfoPanel.m
* Source/NSWorkspace.m
* Tools/make_services.m: Added support for CF keys so that icons and
document associations from document oriented apps written for Mac OS X
can be ported more easily.
2008-08-12 21:53-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSApplication.m: Add logic to load the icns if it's specified

View file

@ -212,13 +212,17 @@ new_label (NSString *value)
if (nil_or_not_of_class (name, [NSString class]))
{
name = value_from_info_plist_for_key (@"ApplicationName");
if (nil_or_not_of_class (name, [NSString class]))
{
name = value_from_info_plist_for_key (@"NSHumanReadableShortName");
if (nil_or_not_of_class (name, [NSString class]))
name = [[NSProcessInfo processInfo] processName];
{
name = value_from_info_plist_for_key (@"CFBundleName");
if (nil_or_not_of_class (name, [NSString class]))
{
name = [[NSProcessInfo processInfo] processName];
}
}
}
}
/* Application Description */
@ -263,7 +267,14 @@ new_label (NSString *value)
release = value_from_info_plist_for_key (@"NSAppVersion");
if (nil_or_not_of_class (release, [NSString class]))
release = @"Unknown";
{
release = value_from_info_plist_for_key (@"CFBundleVersion");
if (nil_or_not_of_class (release, [NSString class]))
{
release = @"Unknown";
}
}
}
}
}

View file

@ -1849,7 +1849,14 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
}
iconPath = [[bundle infoDictionary] objectForKey: @"NSIcon"];
if(iconPath == nil)
{
/*
* Try the CFBundleIconFile property.
*/
iconPath = [[bundle infoDictionary] objectForKey: @"CFBundleIconFile"];
}
if (iconPath && [iconPath isAbsolutePath] == NO)
{
NSString *file = iconPath;
@ -1875,7 +1882,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
* try 'wrapper/app.png'
*/
if (iconPath == nil)
{
{
NSString *str;
str = [fullPath lastPathComponent];
@ -1887,11 +1894,15 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
iconPath = [iconPath stringByAppendingPathExtension: @"tiff"];
if ([mgr isReadableFileAtPath: iconPath] == NO)
{
iconPath = nil;
iconPath = [iconPath stringByAppendingPathExtension: @"icns"];
if ([mgr isReadableFileAtPath: iconPath] == NO)
{
iconPath = nil;
}
}
}
}
if (iconPath != nil)
{
image = [self _saveImageFor: iconPath];
@ -2042,6 +2053,11 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
NSDictionary *typeInfo = [extInfo objectForKey: appName];
NSString *file = [typeInfo objectForKey: @"NSIcon"];
if(file == nil)
{
file = [typeInfo objectForKey: @"CFBundleTypeIconFile"];
}
if (file && [file length] != 0)
{
if ([file isAbsolutePath] == NO)

View file

@ -308,6 +308,11 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
o0 = [info objectForKey: @"NSTypes"];
if (o0 == nil)
{
o0 = [info objectForKey: @"CFBundleDocumentTypes"];
}
if (o0)
{
if ([o0 isKindOfClass: aClass] == NO)
@ -336,6 +341,11 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
*/
t = (NSDictionary*)o1;
o1 = [t objectForKey: @"NSUnixExtensions"];
if(o1 == nil)
{
o1 = [t objectForKey: @"CFBundleTypeExtensions"];
}
if (o1 == nil)
{
continue;
@ -378,6 +388,10 @@ static void addExtensionsForApplication(NSDictionary *info, NSString *app)
NSDictionary *extensions;
o0 = [info objectForKey: @"NSExtensions"];
if(o0 == nil)
{
o0 = [info objectForKey: @"CFBundleTypeExtensions"];
}
if (o0 == nil)
{
return;