mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:10:48 +00:00
Fixes bonaza.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4725 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a73d9b885a
commit
942b4ac554
5 changed files with 49 additions and 12 deletions
|
@ -149,11 +149,16 @@
|
|||
@end
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
@class NSBundle;
|
||||
|
||||
@interface NSWorkspace (GNUstep)
|
||||
- (NSString*) getBestAppInRole: (NSString*)role
|
||||
forExtension: (NSString*)ext;
|
||||
- (NSString*) getBestIconForExtension: (NSString*)ext;
|
||||
- (NSDictionary*) infoForExtension: (NSString*)ext;
|
||||
- (NSBundle *)bundleForApp:(NSString *)appName;
|
||||
- (NSImage *)appIconForApp:(NSString *)appName;
|
||||
- (NSString*) locateApplicationBinary: (NSString*)appName;
|
||||
- (void) setBestApp: (NSString*)appName
|
||||
inRole: (NSString*)role
|
||||
|
|
|
@ -290,6 +290,7 @@ void __dummy_GMAppKit_functionForLinking() {}
|
|||
[self getPeriodicDelay:&delay interval:&interval];
|
||||
[archiver encodeFloat:delay withName:@"delay"];
|
||||
[archiver encodeFloat:interval withName:@"interval"];
|
||||
[archiver encodeString:[self title] withName:@"title"];
|
||||
[archiver encodeString:[self alternateTitle] withName:@"alternateTitle"];
|
||||
[archiver encodeObject:[self alternateImage] withName:@"alternateImage"];
|
||||
[archiver encodeInt:[self imagePosition] withName:@"imagePosition"];
|
||||
|
@ -313,6 +314,8 @@ void __dummy_GMAppKit_functionForLinking() {}
|
|||
interval = [unarchiver decodeFloatWithName:@"interval"];
|
||||
[self setPeriodicDelay:delay interval:interval];
|
||||
|
||||
obj = [unarchiver decodeStringWithName:@"title"];
|
||||
if (obj) [self setTitle:obj];
|
||||
obj = [unarchiver decodeStringWithName:@"alternateTitle"];
|
||||
if (obj) [self setAlternateTitle:obj];
|
||||
obj = [unarchiver decodeObjectWithName:@"alternateImage"];
|
||||
|
|
|
@ -231,6 +231,8 @@
|
|||
id label;
|
||||
id upperObjectRepresentation;
|
||||
|
||||
anObject = [anObject replacementObjectForModelArchiver: self];
|
||||
|
||||
label = NSMapGet(objects, anObject);
|
||||
|
||||
if (findingConditionals && !label) {
|
||||
|
@ -268,7 +270,7 @@
|
|||
encoded. */
|
||||
upperObjectRepresentation = lastObjectRepresentation;
|
||||
|
||||
anObject = [anObject replacementObjectForModelArchiver: self];
|
||||
// anObject = [anObject replacementObjectForModelArchiver: self];
|
||||
archiveClass = [anObject classForModelArchiver];
|
||||
|
||||
if (!findingConditionals) {
|
||||
|
|
|
@ -131,7 +131,7 @@ static NSImage *highlight_image;
|
|||
_isLeaf = NO;
|
||||
_isLoaded = NO;
|
||||
|
||||
[self setEditable: YES];
|
||||
[self setEditable:NO];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -965,11 +965,9 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
|
|||
return [map objectForKey: ext];
|
||||
}
|
||||
|
||||
- (NSString*) locateApplicationBinary: (NSString*)appName
|
||||
- (NSBundle *)bundleForApp:(NSString *)appName
|
||||
{
|
||||
NSString *path;
|
||||
NSString *file;
|
||||
NSBundle *bundle;
|
||||
|
||||
if (appName == nil)
|
||||
return nil;
|
||||
|
@ -993,14 +991,43 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
|
|||
if (path == nil)
|
||||
return nil;
|
||||
|
||||
/*
|
||||
* See if the 'Info-gnustep.plist' specifies the location of the
|
||||
* executable - if it does, replace our app name with the specified
|
||||
* value. If the executable name is an absolute path name, we also
|
||||
* replace the path with that specified.
|
||||
*/
|
||||
bundle = [NSBundle bundleWithPath: path];
|
||||
return [NSBundle bundleWithPath: path];
|
||||
}
|
||||
|
||||
/** Returns the application icon for the given app.
|
||||
* Or null if none defined or appName is not a valid application name.
|
||||
*/
|
||||
- (NSImage *)appIconForApp:(NSString *)appName
|
||||
{
|
||||
NSBundle *bundle = [self bundleForApp:appName];
|
||||
NSImage *appImage;
|
||||
NSString *iconPath;
|
||||
|
||||
if (bundle == nil)
|
||||
return nil;
|
||||
|
||||
iconPath = [[bundle infoDictionary] objectForKey: @"NSIcon"];
|
||||
|
||||
if (![iconPath isAbsolutePath])
|
||||
{
|
||||
iconPath = [[bundle bundlePath] stringByAppendingPathComponent:iconPath];
|
||||
}
|
||||
|
||||
return [[NSImage alloc] initWithContentsOfFile:iconPath];
|
||||
}
|
||||
|
||||
- (NSString*) locateApplicationBinary: (NSString*)appName
|
||||
{
|
||||
NSString *path;
|
||||
NSString *file;
|
||||
NSBundle *bundle = [self bundleForApp:appName];;
|
||||
|
||||
if (bundle == nil)
|
||||
return nil;
|
||||
|
||||
path = [bundle bundlePath];
|
||||
file = [[bundle infoDictionary] objectForKey: @"NSExecutable"];
|
||||
|
||||
if (file != nil)
|
||||
{
|
||||
NSString *exepath;
|
||||
|
|
Loading…
Reference in a new issue