Skip to content
This repository was archived by the owner on Dec 9, 2020. It is now read-only.

Commit 80f8e81

Browse files
committed
Remove MGSFragariaPreferences. Fixes KosmicTask#30.
If you used it, now you have to instantiate the preference views yourself.
1 parent 8519872 commit 80f8e81

4 files changed

Lines changed: 4 additions & 179 deletions

File tree

Applications/Simple/MGSPreferencesController.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ -(void)dealloc
4949
- (void)showWindow:(id)sender
5050
{
5151
// load view controllers
52-
textEditingPrefsViewController = [MGSFragariaPreferences sharedInstance].textEditingPrefsViewController;
53-
54-
fontsAndColoursPrefsViewController = [MGSFragariaPreferences sharedInstance].fontsAndColoursPrefsViewController;
52+
textEditingPrefsViewController = [[MGSFragariaTextEditingPrefsViewController alloc] init];
53+
fontsAndColoursPrefsViewController = [[MGSFragariaFontsAndColoursPrefsViewController alloc] init];
5554

5655
[super showWindow:sender];
5756
}

Fragaria.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@
350350
01BB1BEA1A795EFD006C0056 /* Preferences */ = {
351351
isa = PBXGroup;
352352
children = (
353-
D08359DD1AA0875E001B7B50 /* MGSPreferencesObserver.h */,
354-
D08359DE1AA0875E001B7B50 /* MGSPreferencesObserver.m */,
355353
ABD0FE581193543600E6AFE6 /* MGSFragariaPreferences.h */,
356354
ABC578D2160350240040B3FB /* MGSFragariaPreferences.m */,
355+
D08359DD1AA0875E001B7B50 /* MGSPreferencesObserver.h */,
356+
D08359DE1AA0875E001B7B50 /* MGSPreferencesObserver.m */,
357357
01BB1BEF1A7966E7006C0056 /* Standard UI */,
358358
);
359359
name = Preferences;

MGSFragariaPreferences.h

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -91,68 +91,3 @@ extern NSString * const MGSFragariaPrefsSyntaxColouringPopUpString;
9191
#import "MGSFragariaTextEditingPrefsViewController.h"
9292

9393

94-
#pragma mark - MGSFragariaPreferences
95-
96-
/**
97-
* MGSFragariaPreferences is responsible for registering the userDefaults for instances
98-
* of Fragaria, and also offers some ready-made viewControllers should you want to
99-
* implement them in your application.
100-
**/
101-
@interface MGSFragariaPreferences : NSObject
102-
103-
104-
/// @name Class Methods
105-
106-
107-
/**
108-
* Provides a singleton instance of MGSFragariaPreferences.
109-
* @todo: this is *only* used in the demo application. And there, it's only
110-
* use is to resolve to `revertToStandardSettings`, which uses a
111-
* global NSUserDefaultsController to perform its action. Issue #30.
112-
**/
113-
+ (MGSFragariaPreferences *)sharedInstance DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");
114-
115-
116-
/// @name Instance Methods
117-
118-
/**
119-
* Used by the preference view controllers to propagate the changeFont message
120-
* up the responder chain.
121-
* @param sender is the sender of the message.
122-
**/
123-
- (void)changeFont:(id)sender DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");
124-
125-
126-
/**
127-
* Used by the preference view controllers, sets the shared userDefaultsController
128-
* back to initial values.
129-
* @param sender is the sender of the message.
130-
**/
131-
- (void)revertToStandardSettings:(id)sender DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");
132-
133-
134-
/// @name Properties
135-
136-
/**
137-
* Provides a dictionary of Fragaria's default values suitable for adding to your registerUserDefaults call in your
138-
* application.
139-
* @discussion The Framework should not register user defaults for you; you should register them yourself. This
140-
* dictionary is suitable for using with your own user defaults when your application starts up.
141-
**/
142-
@property (nonatomic, readonly) NSDictionary *fragariaDefaultsDictionary;
143-
144-
145-
/**
146-
* Provides a ready-made instance of MGSFragariaFontsAndColoursPrefsViewController for applications.
147-
**/
148-
@property (readonly) MGSFragariaFontsAndColoursPrefsViewController *fontsAndColoursPrefsViewController DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");
149-
150-
151-
/**
152-
* Provides a ready-made instance of MGSFragariaTextEditingPrefsViewController for applications.
153-
**/
154-
@property (readonly) MGSFragariaTextEditingPrefsViewController *textEditingPrefsViewController DEPRECATED_MSG_ATTRIBUTE("Proposed elimination.");
155-
156-
157-
@end
158-

MGSFragariaPreferences.m

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -79,113 +79,4 @@
7979
NSString * const MGSFragariaPrefsSyntaxColouringPopUpString = @"FragariaSyntaxColouringPopUpString";
8080

8181

82-
#pragma mark - Statics used for this class
83-
84-
85-
static id sharedInstance = nil;
86-
87-
88-
#pragma mark - MGSFragariaPreferences Implementation
89-
90-
@implementation MGSFragariaPreferences
91-
92-
@synthesize fontsAndColoursPrefsViewController = _fontsAndColoursPrefsViewController;
93-
@synthesize textEditingPrefsViewController = _textEditingPrefsViewController;
94-
95-
96-
#pragma mark - Class Methods
97-
98-
99-
/*
100-
* + sharedInstance
101-
*/
102-
+ (MGSFragariaPreferences *)sharedInstance
103-
{
104-
if (sharedInstance == nil) {
105-
sharedInstance = [[super allocWithZone:NULL] init];
106-
}
107-
return sharedInstance;
108-
}
109-
110-
111-
/*
112-
* + allocWithZone:
113-
* alloc with zone for singleton
114-
*/
115-
+ (id)allocWithZone:(NSZone *)zone
116-
{
117-
#pragma unused(zone)
118-
#pragma clang diagnostic push
119-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
120-
return [self sharedInstance];
121-
#pragma clang diagnostic pop
122-
}
123-
124-
125-
#pragma mark - Instance methods
126-
127-
/*
128-
* - init
129-
*/
130-
- (id)init
131-
{
132-
if (sharedInstance) return sharedInstance;
133-
self = [super init];
134-
sharedInstance = self;
135-
return self;
136-
}
137-
138-
139-
/*
140-
* - changeFont:
141-
*/
142-
- (void)changeFont:(id)sender
143-
{
144-
/* NSFontManager will send this method up the responder chain */
145-
[_fontsAndColoursPrefsViewController changeFont:sender];
146-
}
147-
148-
149-
/*
150-
* - revertToStandardSettings:
151-
*/
152-
- (void)revertToStandardSettings:(id)sender
153-
{
154-
[[NSUserDefaultsController sharedUserDefaultsController] revertToInitialValues:nil];
155-
}
156-
157-
158-
#pragma mark - Property Accessors
159-
160-
161-
/*
162-
* @property MGSFragariaTextEditingPrefsViewController
163-
* Don't allocate these resources unless someone actually needs them.
164-
*/
165-
-(MGSFragariaTextEditingPrefsViewController *)textEditingPrefsViewController
166-
{
167-
if (!_textEditingPrefsViewController)
168-
{
169-
_textEditingPrefsViewController = [[MGSFragariaTextEditingPrefsViewController alloc] init];
170-
}
171-
172-
return _textEditingPrefsViewController;
173-
}
174-
175-
176-
/*
177-
* @property MGSFragariaFontsAndColoursPrefsViewController
178-
* Don't allocate these resources unless someone actually needs them.
179-
*/
180-
-(MGSFragariaFontsAndColoursPrefsViewController *)fontsAndColoursPrefsViewController
181-
{
182-
if (!_fontsAndColoursPrefsViewController)
183-
{
184-
_fontsAndColoursPrefsViewController = [[MGSFragariaFontsAndColoursPrefsViewController alloc] init];
185-
}
186-
187-
return _fontsAndColoursPrefsViewController;
188-
}
189-
190-
@end
19182

0 commit comments

Comments
 (0)