mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-20 01:20:59 +00:00
* Framework/PCProjectBrowser.m: Stop using 'SeparateEditor' prefernce.
Remove use of preferences code. (doubleClick:): Change support of external editor (add support for .app editors). * Framework/PCProjectWindow.m: Start implementing two-mode handling of tear-off windows. New handling will support two modes: 1. all windows are opened inside projet window and 2. Build, Launch/Debug, Loaded Files (Project Find in future) are opened as tear-off windows. This simplifiles the code and in my opinion more intuitive then current implementation. * Modules/Editors/ProjectCenter/PCEditor.m: (_createWindow): Change window attribute ReleasedWhenClosed to NO. * PCPrefController.m: Add new parameter 'notify' to method setObject. This parameter is usefull for situation when open and save panels saves its values. For example: when project are opened 'Open Project' panel save last opened dir to PC prefernces and post notificaion about prefs changes. Newly created objects of projects may lead to PC segfault. * Modules/Preferences/Build/PCBuildPrefs.m, * Modules/Preferences/Interface/PCInterfacePrefs.m, * Modules/Preferences/Saving/PCSavingPrefs.m, * Modules/Preferences/Misc/PCMiscPrefs.m, * Framework/PCFileManager: Use new preferences setObject method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@28038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
863a0c679b
commit
9d2a79b3a4
13 changed files with 96 additions and 91 deletions
|
@ -430,7 +430,7 @@ static PCFileManager *_mgr = nil;
|
|||
|
||||
if (key != nil)
|
||||
{
|
||||
[prefs setObject:[panel directory] forKey:key];
|
||||
[prefs setObject:[panel directory] forKey:key notify:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Interface/PCInterfacePrefs.h"
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||
|
||||
|
@ -69,13 +69,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
selector:@selector(projectDictDidChange:)
|
||||
name:PCProjectDictDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(loadPreferences:)
|
||||
name:PCPreferencesDidChangeNotification
|
||||
object:nil];
|
||||
[self loadPreferences:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -94,15 +87,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)loadPreferences:(NSNotification *)aNotification
|
||||
{
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSString *val;
|
||||
|
||||
val = [prefs objectForKey:SeparateEditor];
|
||||
editorIsSeperate = ([val isEqualToString:@"YES"]) ? YES : NO;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Accessory methods
|
||||
// ============================================================================
|
||||
|
@ -403,8 +387,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
if (filePath &&
|
||||
[filePath isEqualToString:browserPath] &&
|
||||
![fileName isEqualToString:[activeProject projectName]] &&
|
||||
!editorIsSeperate)
|
||||
![fileName isEqualToString:[activeProject projectName]])
|
||||
{
|
||||
// NSLog(@"[click] category: %@ filePath: %@", category, filePath);
|
||||
[[activeProject projectEditor] openEditorForCategoryPath:browserPath
|
||||
|
@ -424,6 +407,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
PCProject *activeProject;
|
||||
NSString *key;
|
||||
NSString *filePath;
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSWorkspace *workspace;
|
||||
NSString *appName, *type;
|
||||
|
||||
|
@ -445,7 +429,8 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
workspace = [NSWorkspace sharedWorkspace];
|
||||
foundApp = [workspace getInfoForFile:filePath
|
||||
application:&appName type:&type];
|
||||
application:&appName
|
||||
type:&type];
|
||||
// NSLog (@"Open file: %@ with app: %@", filePath, appName);
|
||||
|
||||
// If 'Editor' role was set in .GNUstepExtPrefs application
|
||||
|
@ -454,8 +439,19 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
// from Info-gnustep.plist file of PC.
|
||||
if(foundApp == NO || [appName isEqualToString:@"ProjectCenter.app"])
|
||||
{
|
||||
[[activeProject projectEditor] openEditorForCategoryPath:[self path]
|
||||
windowed:YES];
|
||||
appName = [prefs objectForKey:Editor];
|
||||
|
||||
if (![appName isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
[workspace openFile:filePath
|
||||
withApplication:appName];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[activeProject projectEditor]
|
||||
openEditorForCategoryPath:[self path]
|
||||
windowed:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
RELEASE(buildStatusTarget);
|
||||
RELEASE(buildTarget);
|
||||
RELEASE(buildArgs);
|
||||
RELEASE(buildOptions);
|
||||
|
||||
RELEASE(successSound);
|
||||
RELEASE(failureSound);
|
||||
|
@ -111,7 +112,6 @@
|
|||
RELEASE(componentView);
|
||||
RELEASE(errorArray);
|
||||
RELEASE(errorString);
|
||||
RELEASE(buildOptions);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#ifdef DEBUG
|
||||
NSLog (@"PCProjectManager: dealloc");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -143,10 +143,10 @@
|
|||
* Custom view
|
||||
* View where non-separated Builder, Launcher, Editor goes.
|
||||
*/
|
||||
if ([self hasCustomView])
|
||||
{
|
||||
// if ([self hasCustomView])
|
||||
// {
|
||||
[self _createCustomView];
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
- (id)initWithProject:(PCProject *)owner
|
||||
|
@ -272,6 +272,11 @@
|
|||
// ==== Accessory methods
|
||||
// ============================================================================
|
||||
|
||||
// TODO: Should be removed when two modes will be implemented:
|
||||
// Build, Launch and Loaded Files are tear-off and tear-on.
|
||||
// Custom view is always shown because editor always opened on
|
||||
// one click in Browser. External editor will be opened only on
|
||||
// double click.
|
||||
- (BOOL)hasCustomView
|
||||
{
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
|
@ -336,8 +341,6 @@
|
|||
NSView *view = [[project projectBuilder] componentView];
|
||||
NSPanel *buildPanel = [[project projectManager] buildPanel];
|
||||
|
||||
/* if ([[[PCPrefController sharedPCPreferences] objectForKey:SeparateBuilder]
|
||||
isEqualToString: @"YES"])*/
|
||||
if ([[[[project projectManager] prefController] objectForKey:SeparateBuilder]
|
||||
isEqualToString: @"YES"])
|
||||
{
|
||||
|
@ -555,13 +558,18 @@
|
|||
[self makeKeyWindow];*/
|
||||
}
|
||||
|
||||
// TODO: Review determining of tear-off panels. Current implementation
|
||||
// loads Build, Launch and Loaded Files to check visibility status.
|
||||
// It is incorrect behaviour; Build. Launch and LoadedFiles initialized
|
||||
// even if not in use.
|
||||
- (void)preferencesDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
id <PCPreferences> prefs = [aNotif object];
|
||||
|
||||
PCLogStatus(self, @"Preferences did change");
|
||||
|
||||
//--- Add Custom view
|
||||
|
||||
// See comment to _createCustomView
|
||||
/* //--- Add Custom view
|
||||
if ([self hasCustomView] && customView == nil)
|
||||
{
|
||||
[self _createCustomView];
|
||||
|
@ -572,7 +580,7 @@
|
|||
[customView removeFromSuperview];
|
||||
[h_split adjustSubviews];
|
||||
customView = nil;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Project Builder
|
||||
if ([[prefs objectForKey:@"SeparateBuilder"] isEqualToString:@"YES"])
|
||||
|
@ -880,25 +888,25 @@
|
|||
vSplitRect = [browserView frame];
|
||||
vSplitRect.origin.x = 0;
|
||||
vSplitRect.origin.y = 0;
|
||||
if (![self hasCustomView])
|
||||
/* if (![self hasCustomView])
|
||||
{
|
||||
vSplitRect.size = hSplitSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
vSplitRect.size.width = hSplitSize.width;
|
||||
}
|
||||
/* }*/
|
||||
[v_split setFrame:vSplitRect];
|
||||
|
||||
// Custom view (Editor|Builder|Launcher)
|
||||
if ([self hasCustomView])
|
||||
{
|
||||
/* if ([self hasCustomView])
|
||||
{*/
|
||||
boxRect.origin.x = 0;
|
||||
boxRect.origin.y = vSplitRect.size.height + [h_split dividerThickness];
|
||||
boxRect.size.width = hSplitSize.width;
|
||||
boxRect.size.height = hSplitSize.height - boxRect.origin.y;
|
||||
[customView setFrame:boxRect];
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
- (void) splitView:(NSSplitView *)sender
|
||||
|
|
|
@ -36,8 +36,6 @@ extern NSString *PCBrowserDidSetPathNotification;
|
|||
{
|
||||
PCProject *project;
|
||||
NSBrowser *browser;
|
||||
|
||||
BOOL editorIsSeperate;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -46,7 +44,6 @@ extern NSString *PCBrowserDidSetPathNotification;
|
|||
|
||||
- (id)initWithProject:(PCProject *)aProject;
|
||||
- (void)dealloc;
|
||||
- (void)loadPreferences:(NSNotification *)aNotification;
|
||||
|
||||
// ============================================================================
|
||||
// ==== Accessory methods
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
@protocol PCPreferences <NSObject>
|
||||
|
||||
- (id)objectForKey:(NSString *)key;
|
||||
- (void)setObject:(id)anObject forKey:(NSString *)aKey;
|
||||
- (void)setObject:(id)anObject forKey:(NSString *)aKey notify:(BOOL)notify;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
styleMask:style
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:YES];
|
||||
[_window setReleasedWhenClosed:YES];
|
||||
[_window setReleasedWhenClosed:NO];
|
||||
[_window setMinSize:NSMakeSize(512,320)];
|
||||
[_window setDelegate:self];
|
||||
[_window center];
|
||||
|
|
|
@ -78,12 +78,12 @@
|
|||
// Protocol
|
||||
- (void)setDefaults
|
||||
{
|
||||
[prefs setObject:@"" forKey:SuccessSound];
|
||||
[prefs setObject:@"" forKey:FailureSound];
|
||||
[prefs setObject:@"" forKey:RootBuildDirectory];
|
||||
[prefs setObject:PCDefaultBuildTool forKey:BuildTool];
|
||||
[prefs setObject:@"YES" forKey:DeleteCacheWhenQuitting];
|
||||
[prefs setObject:@"YES" forKey:PromptOnClean];
|
||||
[prefs setObject:@"" forKey:SuccessSound notify:NO];
|
||||
[prefs setObject:@"" forKey:FailureSound notify:NO];
|
||||
[prefs setObject:@"" forKey:RootBuildDirectory notify:NO];
|
||||
[prefs setObject:PCDefaultBuildTool forKey:BuildTool notify:NO];
|
||||
[prefs setObject:@"YES" forKey:DeleteCacheWhenQuitting notify:NO];
|
||||
[prefs setObject:@"YES" forKey:PromptOnClean notify:NO];
|
||||
}
|
||||
|
||||
- (void)readPreferences
|
||||
|
@ -153,7 +153,7 @@
|
|||
if (path)
|
||||
{
|
||||
[successField setStringValue:path];
|
||||
[prefs setObject:path forKey:SuccessSound];
|
||||
[prefs setObject:path forKey:SuccessSound notify:YES];
|
||||
}
|
||||
|
||||
[[buildingView window] makeFirstResponder:successField];
|
||||
|
@ -183,7 +183,7 @@
|
|||
if (path)
|
||||
{
|
||||
[failureField setStringValue:path];
|
||||
[prefs setObject:path forKey:FailureSound];
|
||||
[prefs setObject:path forKey:FailureSound notify:YES];
|
||||
}
|
||||
|
||||
[[buildingView window] makeFirstResponder:failureField];
|
||||
|
@ -212,7 +212,7 @@
|
|||
if (path)
|
||||
{
|
||||
[rootBuildDirField setStringValue:path];
|
||||
[prefs setObject:path forKey:RootBuildDirectory];
|
||||
[prefs setObject:path forKey:RootBuildDirectory notify:YES];
|
||||
}
|
||||
|
||||
[[buildingView window] makeFirstResponder:rootBuildDirField];
|
||||
|
@ -241,7 +241,7 @@
|
|||
if (path)
|
||||
{
|
||||
[buildToolField setStringValue:path];
|
||||
[prefs setObject:path forKey:BuildTool];
|
||||
[prefs setObject:path forKey:BuildTool notify:YES];
|
||||
}
|
||||
|
||||
[[buildingView window] makeFirstResponder:buildToolField];
|
||||
|
@ -258,7 +258,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:DeleteCacheWhenQuitting];
|
||||
[prefs setObject:state forKey:DeleteCacheWhenQuitting notify:YES];
|
||||
}
|
||||
|
||||
- (void)setPromptOnClean:(id)sender
|
||||
|
@ -273,7 +273,7 @@
|
|||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
NSLog(@"Set PromptOnClean to %@", state);
|
||||
[prefs setObject:state forKey:PromptOnClean];
|
||||
[prefs setObject:state forKey:PromptOnClean notify:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -96,13 +96,13 @@
|
|||
// Protocol
|
||||
- (void)setDefaults
|
||||
{
|
||||
[prefs setObject:@"YES" forKey:SeparateBuilder];
|
||||
[prefs setObject:@"YES" forKey:SeparateLauncher];
|
||||
[prefs setObject:@"NO" forKey:SeparateEditor];
|
||||
[prefs setObject:@"YES" forKey:SeparateLoadedFiles];
|
||||
[prefs setObject:@"YES" forKey:SeparateBuilder notify:NO];
|
||||
[prefs setObject:@"YES" forKey:SeparateLauncher notify:NO];
|
||||
[prefs setObject:@"NO" forKey:SeparateEditor notify:NO];
|
||||
[prefs setObject:@"YES" forKey:SeparateLoadedFiles notify:NO];
|
||||
|
||||
[prefs setObject:@"30" forKey:EditorLines];
|
||||
[prefs setObject:@"80" forKey:EditorColumns];
|
||||
[prefs setObject:@"30" forKey:EditorLines notify:NO];
|
||||
[prefs setObject:@"80" forKey:EditorColumns notify:NO];
|
||||
}
|
||||
|
||||
- (void)readPreferences
|
||||
|
@ -187,7 +187,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:key];
|
||||
[prefs setObject:state forKey:key notify:YES];
|
||||
}
|
||||
|
||||
- (void)setEditorSize:(id)sender
|
||||
|
@ -206,7 +206,7 @@
|
|||
val = [editorColumnsField stringValue];
|
||||
}
|
||||
|
||||
[prefs setObject:val forKey:key];
|
||||
[prefs setObject:val forKey:key notify:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -77,13 +77,13 @@
|
|||
// Protocol
|
||||
- (void)setDefaults
|
||||
{
|
||||
[prefs setObject:@"YES" forKey:PromptOnQuit];
|
||||
[prefs setObject:@"YES" forKey:FullPathInFilePanels];
|
||||
[prefs setObject:@"YES" forKey:RememberWindows];
|
||||
[prefs setObject:@"NO" forKey:DisplayLog];
|
||||
[prefs setObject:@"YES" forKey:PromptOnQuit notify:NO];
|
||||
[prefs setObject:@"YES" forKey:FullPathInFilePanels notify:NO];
|
||||
[prefs setObject:@"YES" forKey:RememberWindows notify:NO];
|
||||
[prefs setObject:@"NO" forKey:DisplayLog notify:NO];
|
||||
|
||||
[prefs setObject:@"/usr/bin/gdb" forKey:Debugger];
|
||||
[prefs setObject:@"ProjectCenter" forKey:Editor];
|
||||
[prefs setObject:@"/usr/bin/gdb" forKey:Debugger notify:NO];
|
||||
[prefs setObject:@"ProjectCenter" forKey:Editor notify:NO];
|
||||
}
|
||||
|
||||
- (void)readPreferences
|
||||
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:PromptOnQuit];
|
||||
[prefs setObject:state forKey:PromptOnQuit notify:YES];
|
||||
}
|
||||
|
||||
- (void)setFullPathInFilePanels:(id)sender
|
||||
|
@ -147,7 +147,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:FullPathInFilePanels];
|
||||
[prefs setObject:state forKey:FullPathInFilePanels notify:YES];
|
||||
}
|
||||
|
||||
- (void)setRememberWindows:(id)sender
|
||||
|
@ -161,7 +161,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:RememberWindows];
|
||||
[prefs setObject:state forKey:RememberWindows notify:YES];
|
||||
}
|
||||
|
||||
- (void)setDisplayLog:(id)sender
|
||||
|
@ -175,7 +175,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:DisplayLog];
|
||||
[prefs setObject:state forKey:DisplayLog notify:YES];
|
||||
}
|
||||
|
||||
- (void)setDebugger:(id)sender
|
||||
|
@ -231,7 +231,7 @@
|
|||
|
||||
// Set
|
||||
[debuggerField setStringValue:path];
|
||||
[prefs setObject:path forKey:Debugger];
|
||||
[prefs setObject:path forKey:Debugger notify:YES];
|
||||
}
|
||||
|
||||
- (void)setEditor:(id)sender
|
||||
|
@ -240,13 +240,14 @@
|
|||
NSString *path;
|
||||
NSString *editorPath;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||
|
||||
// Choose
|
||||
if ((sender == debuggerField))
|
||||
{
|
||||
path = [debuggerField stringValue];
|
||||
}
|
||||
else
|
||||
else if ([path = [editorField stringValue] isEqualToString:@""])
|
||||
{
|
||||
files = [[PCFileManager defaultManager]
|
||||
filesOfTypes:nil
|
||||
|
@ -267,15 +268,15 @@
|
|||
}
|
||||
|
||||
// Check
|
||||
if (path && ![path isEqualToString:@"ProjectCenter"])
|
||||
if (path && ![ws fullPathForApplication:path])
|
||||
{
|
||||
editorPath = [[path componentsSeparatedByString:@" "] objectAtIndex:0];
|
||||
if (![fm fileExistsAtPath:editorPath])
|
||||
{
|
||||
[editorField selectText:self];
|
||||
NSRunAlertPanel(@"Set Editor",
|
||||
@"File %@ doesn't exist!\n"
|
||||
"Setting field to default value.",
|
||||
@"Editor %@ doesn't exist!\n"
|
||||
@"Setting field to default value.",
|
||||
@"Close", nil, nil, path);
|
||||
path = @"";
|
||||
}
|
||||
|
@ -299,7 +300,7 @@
|
|||
|
||||
// Set
|
||||
[editorField setStringValue:path];
|
||||
[prefs setObject:path forKey:Editor];
|
||||
[prefs setObject:path forKey:Editor notify:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -58,9 +58,9 @@
|
|||
|
||||
- (void)setDefaults
|
||||
{
|
||||
[prefs setObject:@"YES" forKey:SaveOnQuit];
|
||||
[prefs setObject:@"YES" forKey:KeepBackup];
|
||||
[prefs setObject:@"120" forKey:AutoSavePeriod];
|
||||
[prefs setObject:@"YES" forKey:SaveOnQuit notify:NO];
|
||||
[prefs setObject:@"YES" forKey:KeepBackup notify:NO];
|
||||
[prefs setObject:@"120" forKey:AutoSavePeriod notify:NO];
|
||||
}
|
||||
|
||||
- (void)readPreferences
|
||||
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:SaveOnQuit];
|
||||
[prefs setObject:state forKey:SaveOnQuit notify:YES];
|
||||
}
|
||||
|
||||
- (void)setKeepBackup:(id)sender
|
||||
|
@ -127,7 +127,7 @@
|
|||
}
|
||||
|
||||
state = ([sender state] == NSOffState) ? @"NO" : @"YES";
|
||||
[prefs setObject:state forKey:KeepBackup];
|
||||
[prefs setObject:state forKey:KeepBackup notify:YES];
|
||||
}
|
||||
|
||||
- (void)setSavePeriod:(id)sender
|
||||
|
@ -140,7 +140,7 @@
|
|||
}
|
||||
|
||||
periodString = [autosaveField stringValue];
|
||||
[prefs setObject:periodString forKey:AutoSavePeriod];
|
||||
[prefs setObject:periodString forKey:AutoSavePeriod notify:YES];
|
||||
|
||||
// TODO: Check if this can be replaced with generic notification
|
||||
// posted by PCPrefsController
|
||||
|
|
|
@ -68,7 +68,7 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
|
||||
// Clean preferences
|
||||
[NSUserDefaults resetStandardUserDefaults];
|
||||
[self setObject:@"0.5" forKey:@"Version"];
|
||||
[self setObject:@"0.5" forKey:@"Version" notify:NO];
|
||||
|
||||
// Make preferences modules load default values
|
||||
[[sectionsDict allValues]
|
||||
|
@ -103,14 +103,17 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
return [userDefaults objectForKey:key];
|
||||
}
|
||||
|
||||
- (void)setObject:(id)anObject forKey:(NSString *)aKey
|
||||
- (void)setObject:(id)anObject forKey:(NSString *)aKey notify:(BOOL)notify
|
||||
{
|
||||
[userDefaults setObject:anObject forKey:aKey];
|
||||
[userDefaults synchronize];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCPreferencesDidChangeNotification
|
||||
object:self];
|
||||
if (notify)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCPreferencesDidChangeNotification
|
||||
object:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadPrefsSections
|
||||
|
|
Loading…
Reference in a new issue