diff --git a/ChangeLog b/ChangeLog index 9d23f1f8f..e3c2529b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-07 10:02-EDT Gregory John Casamento + + * Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Declaration + for NSIBHelpConnector ivars and methods. + * Source/GSNibCompatibility.m: Implemented NSIBHelpConnector. + * Source/NSBundleAdditions.m: Added check to initWithCoder so that + values aren't decoded, if there's no value in the coder. + 2006-10-06 Richard Frith-Macdonald * Source/GSToolTips.h: Remove some ivars diff --git a/Headers/Additions/GNUstepGUI/GSNibCompatibility.h b/Headers/Additions/GNUstepGUI/GSNibCompatibility.h index 91bf14eee..374e3c541 100644 --- a/Headers/Additions/GNUstepGUI/GSNibCompatibility.h +++ b/Headers/Additions/GNUstepGUI/GSNibCompatibility.h @@ -80,8 +80,15 @@ typedef struct _GSWindowTemplateFlags // help connector class... @interface NSIBHelpConnector : NSNibConnector +{ + id _marker; + id _file; +} +- (void) setFile: (id)file; +- (id) file; +- (void) setMarker: (id)file; +- (id) marker; @end - /** * Button image source class. */ diff --git a/Source/GSNibCompatibility.m b/Source/GSNibCompatibility.m index 63813e405..1e62ea5aa 100644 --- a/Source/GSNibCompatibility.m +++ b/Source/GSNibCompatibility.m @@ -1477,6 +1477,70 @@ static BOOL _isInInterfaceBuilder = NO; @end @implementation NSIBHelpConnector +- (id) initWithCoder: (NSCoder *)coder +{ + if((self = [super initWithCoder: coder]) != nil) + { + if([coder allowsKeyedCoding]) + { + if([coder containsValueForKey: @"NSFile"]) + { + _file = RETAIN([coder decodeObjectForKey: @"NSFile"]); + } + if([coder containsValueForKey: @"NSMarker"]) + { + _marker = RETAIN([coder decodeObjectForKey: @"NSMarker"]); + } + } + else + { + _file = RETAIN([coder decodeObject]); + _marker = RETAIN([coder decodeObject]); + } + } + return self; +} + +- (void) encodeWithCoder: (NSCoder *)coder +{ + [super encodeWithCoder: coder]; + if([coder allowsKeyedCoding]) + { + if(_file != nil) + { + [coder encodeObject: _file forKey: @"NSFile"]; + } + if(_marker != nil) + { + [coder encodeObject: _file forKey: @"NSMarker"]; + } + } + else + { + [coder encodeObject: _file]; + [coder encodeObject: _marker]; + } +} + +- (void) setFile: (id)file +{ + ASSIGN(_file, file); +} + +- (id) file +{ + return _file; +} + +- (void) setMarker: (id)marker +{ + ASSIGN(_marker, marker); +} + +- (id) marker +{ + return _marker; +} @end @interface NSDecimalNumberPlaceholder : NSObject diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index 5a43b9745..e21cc77e9 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -72,9 +72,18 @@ { if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject: _src forKey: @"NSSource"]; - [aCoder encodeObject: _dst forKey: @"NSDestination"]; - [aCoder encodeObject: _tag forKey: @"NSLabel"]; + if(_src != nil) + { + [aCoder encodeObject: _src forKey: @"NSSource"]; + } + if(_dst != nil) + { + [aCoder encodeObject: _dst forKey: @"NSDestination"]; + } + if(_tag != nil) + { + [aCoder encodeObject: _tag forKey: @"NSLabel"]; + } } else { @@ -92,9 +101,18 @@ { if ([aDecoder allowsKeyedCoding]) { - ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]); - ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]); - ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]); + if([aDecoder containsValueForKey: @"NSDestination"]) + { + ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]); + } + if([aDecoder containsValueForKey: @"NSSource"]) + { + ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]); + } + if([aDecoder containsValueForKey: @"NSLabel"]) + { + ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]); + } } else {