diff --git a/Headers/Additions/GNUstepGUI/GSNibLoading.h b/Headers/Additions/GNUstepGUI/GSNibLoading.h index 532c82397..209aa8039 100644 --- a/Headers/Additions/GNUstepGUI/GSNibLoading.h +++ b/Headers/Additions/GNUstepGUI/GSNibLoading.h @@ -217,6 +217,7 @@ typedef struct _GSWindowTemplateFlags NSString *_className; NSString *_extension; id _object; + NSString *_userLabel; } - (void) setClassName: (NSString *)name; - (NSString *)className; @@ -224,6 +225,7 @@ typedef struct _GSWindowTemplateFlags - (NSString *)extension; - (void) setRealObject: (id)obj; - (id) realObject; +- (NSString *) userLabel; @end @interface NSCustomView : NSView diff --git a/Headers/Additions/GNUstepGUI/GSXib5KeyedUnarchiver.h b/Headers/Additions/GNUstepGUI/GSXib5KeyedUnarchiver.h index d10e5fc09..26975a05f 100644 --- a/Headers/Additions/GNUstepGUI/GSXib5KeyedUnarchiver.h +++ b/Headers/Additions/GNUstepGUI/GSXib5KeyedUnarchiver.h @@ -49,14 +49,6 @@ - (NSRange) decodeRangeForKey: (NSString*)key; @end -@interface NSCustomObject5 : NSCustomObject -{ - NSString *_userLabel; -} - -- (NSString*) userLabel; -@end - @interface IBActionConnection5 : IBActionConnection { NSString *trigger; diff --git a/Source/GSNibLoading.m b/Source/GSNibLoading.m index c7b09ed3b..1105a5dd4 100644 --- a/Source/GSNibLoading.m +++ b/Source/GSNibLoading.m @@ -8,7 +8,7 @@ Copyright (C) 1997, 1999 Free Software Foundation, Inc. Author: Gregory John Casamento - Date: 2003, 2005 + Date: 2003, 2005, 2020 Author: Fred Kiefer Date: 2003, 2010 @@ -958,6 +958,9 @@ static BOOL _isInInterfaceBuilder = NO; @end @implementation NSCustomObject + +static NSString *ApplicationClass = nil; + - (void) setClassName: (NSString *)name { ASSIGNCOPY(_className, name); @@ -995,6 +998,27 @@ static BOOL _isInInterfaceBuilder = NO; ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]); ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]); ASSIGN(_object, [coder decodeObjectForKey: @"NSObject"]); + + // If we've not set the general application class yet... + if (_className && (ApplicationClass == nil) && + ([NSClassFromString(_className) isKindOfClass: [NSApplication class]])) + { + ASSIGNCOPY(ApplicationClass, _className); + } + + _userLabel = [coder decodeObjectForKey: @"userLabel"]; + + // Override this one type... + if (_userLabel) + { + if ([@"Application" isEqualToString: _userLabel]) + { + if (ApplicationClass == nil) + ASSIGN(_className, @"NSApplication"); + else + ASSIGN(_className, ApplicationClass); + } + } } else { @@ -1022,6 +1046,11 @@ static BOOL _isInInterfaceBuilder = NO; } +- (NSString *) userLabel +{ + return _userLabel; +} + - (id) nibInstantiate { if (_object == nil) diff --git a/Source/GSXib5KeyedUnarchiver.m b/Source/GSXib5KeyedUnarchiver.m index 8bdb7a64b..768705ed2 100644 --- a/Source/GSXib5KeyedUnarchiver.m +++ b/Source/GSXib5KeyedUnarchiver.m @@ -60,52 +60,6 @@ #define DEBUG_XIB5 0 -@implementation NSCustomObject5 - -static NSString *ApplicationClass = nil; - -- (id) initWithCoder: (NSCoder *)coder -{ - self = [super initWithCoder: coder]; - - if (self) - { - // If we've not set the general application class yet... - if (_className && (ApplicationClass == nil) && - ([NSClassFromString(_className) isKindOfClass: [NSApplication class]])) - { - ASSIGNCOPY(ApplicationClass, _className); - } - - _userLabel = [coder decodeObjectForKey: @"userLabel"]; - - // Override this one type... - if (_userLabel) - { - if ([@"Application" isEqualToString: _userLabel]) - { - if (ApplicationClass == nil) - ASSIGN(_className, @"NSApplication"); - else - ASSIGN(_className, ApplicationClass); - } - } - } - - return self; -} - -- (NSString *) userLabel -{ - return _userLabel; -} - -- (NSString *) description -{ - return [[super description] stringByAppendingFormat: @"%@ - %@", _userLabel, _className]; -} -@end - @implementation IBActionConnection5 - (instancetype) initWithCoder: (NSCoder *)coder @@ -292,7 +246,7 @@ static NSArray *XmlBoolDefaultYes = nil; @"NSMutableArray", @"rowTemplates", @"NSSegmentItem", @"segment", @"NSCell", @"customCell", - @"NSCustomObject5", @"customObject", + @"NSCustomObject", @"customObject", @"IBOutletConnection5", @"outlet", @"IBActionConnection5", @"action", @"NSNibBindingConnector", @"binding",