mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-17 08:01:24 +00:00
Fix bugs appearing during openning legacy projects
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@19501 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
801bade1da
commit
755f874774
6 changed files with 74 additions and 13 deletions
|
@ -1,6 +1,13 @@
|
|||
2004-06-12 Serg Stoyan <stoyan255@ukr.net>
|
||||
|
||||
* Library/PCProjectManager.m:
|
||||
* Library/PCProject.m:
|
||||
* PCPrefController.m:
|
||||
Fix bugs related to opening legacy projects.
|
||||
|
||||
2004-06-11 Serg Stoyan <stoyan255@ukr.net>
|
||||
|
||||
* Library/PCProjectManager.[m]:
|
||||
* Library/PCProjectManager.m:
|
||||
(loadProjectAt:): Fix loading "Gorm" poject.
|
||||
|
||||
2004-06-09 Serg Stoyan <stoyan255@ukr.net>
|
||||
|
|
|
@ -1000,18 +1000,11 @@ NSString
|
|||
{
|
||||
if ([self isValidDictionary:projectDict] == NO)
|
||||
{
|
||||
int ret = NSRunAlertPanel(@"Attention!",
|
||||
@"The project file lacks some entries\nUpdate it automatically?",
|
||||
@"Update",@"Leave",nil);
|
||||
[self updateProjectDict];
|
||||
|
||||
if (ret == NSAlertDefaultReturn)
|
||||
{
|
||||
[self updateProjectDict];
|
||||
|
||||
NSRunAlertPanel(@"Project updated!",
|
||||
@"The project file has been updated successfully!\nPlease make sure that all new project keys contain valid entries!",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
NSRunAlertPanel(@"Project updated!",
|
||||
@"The project file was converted from previous version!\nPlease make sure that every project attribute contain valid values!",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -409,6 +409,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
{
|
||||
projectTypeName = [NSString stringWithString:@"Application"];;
|
||||
projectClassName = [projectTypes objectForKey:projectTypeName];
|
||||
projectTypeName = nil;
|
||||
}
|
||||
|
||||
if (projectClassName == nil)
|
||||
|
@ -426,11 +427,12 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
pPath = [[aPath stringByDeletingLastPathComponent]
|
||||
stringByAppendingPathComponent:@"PC.project"];
|
||||
|
||||
[[NSFileManager defaultManager] removeFileAtPath:aPath handler:nil];
|
||||
// [[NSFileManager defaultManager] removeFileAtPath:aPath handler:nil];
|
||||
|
||||
[projectFile removeObjectForKey:PCProjectBuilderClass];
|
||||
projectTypeName = [projectCreator projectTypeName];
|
||||
[projectFile setObject:projectTypeName forKey:PCProjectType];
|
||||
[projectFile removeObjectForKey:PCPrincipalClass];
|
||||
[projectFile writeToFile:pPath atomically:YES];
|
||||
|
||||
aPath = pPath;
|
||||
|
@ -443,6 +445,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
// Started only if there's not save timer yet
|
||||
[self startSaveTimer];
|
||||
[project validateProjectDict];
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
if ((self = [super init]))
|
||||
{
|
||||
infoController = [[PCInfoController alloc] init];
|
||||
// Termporary workaround to initialize defaults values
|
||||
prefController = [PCPrefController sharedPCPreferences];
|
||||
logController = [PCLogController sharedLogController];
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
|
||||
- (id)init;
|
||||
- (void)dealloc;
|
||||
- (void)setDefaultValues;
|
||||
- (void)loadPrefernces;
|
||||
|
||||
- (NSDictionary *)preferencesDict;
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include "PCLogController.h"
|
||||
|
||||
// TODO: rewrite it as PCPrefernces, use +sharedPreferences instead of
|
||||
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
|
||||
|
||||
@implementation PCPrefController
|
||||
|
||||
// ===========================================================================
|
||||
|
@ -60,6 +63,11 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
preferencesDict = [[NSMutableDictionary alloc] initWithDictionary:prefs];
|
||||
|
||||
if ([preferencesDict objectForKey:@"Version"] == nil)
|
||||
{
|
||||
[self setDefaultValues];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -81,6 +89,54 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setDefaultValues
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
PCLogInfo(self, @"setDefaultValues");
|
||||
|
||||
// Clean preferences
|
||||
[preferencesDict removeAllObjects];
|
||||
|
||||
[preferencesDict setObject:@"0.4" forKey:@"Version"];
|
||||
|
||||
// Building
|
||||
[preferencesDict setObject:@"" forKey:SuccessSound];
|
||||
[preferencesDict setObject:@"" forKey:FailureSound];
|
||||
[preferencesDict setObject:@"YES" forKey:PromptOnClean];
|
||||
[preferencesDict setObject:@"" forKey:RootBuildDirectory];
|
||||
|
||||
// Saving
|
||||
[preferencesDict setObject:@"YES" forKey:SaveOnQuit];
|
||||
[preferencesDict setObject:@"YES" forKey:KeepBackup];
|
||||
[preferencesDict setObject:@"120" forKey:AutoSavePeriod];
|
||||
|
||||
// Key Bindings
|
||||
[preferencesDict setObject:@"Tab" forKey:TabBehaviour];
|
||||
|
||||
// Miscellaneous
|
||||
[preferencesDict setObject:@"YES" forKey:PromptOnQuit];
|
||||
[preferencesDict setObject:@"YES" forKey:DeleteCacheWhenQuitting];
|
||||
[preferencesDict setObject:@"YES" forKey:FullPathInFilePanels];
|
||||
[preferencesDict setObject:@"/usr/bin/gdb" forKey:Debugger];
|
||||
[preferencesDict setObject:@"ProjectCenter" forKey:Editor];
|
||||
|
||||
// Interface
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateBuilder];
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateLauncher];
|
||||
[preferencesDict setObject:@"NO" forKey:SeparateEditor];
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateLoadedFiles];
|
||||
|
||||
[preferencesDict setObject:@"30" forKey:EditorLines];
|
||||
[preferencesDict setObject:@"80" forKey:EditorColumns];
|
||||
|
||||
[preferencesDict setObject:@"YES" forKey:RememberWindows];
|
||||
[preferencesDict setObject:@"NO" forKey:DisplayLog];
|
||||
|
||||
[ud setPersistentDomain:preferencesDict forName:@"ProjectCenter"];
|
||||
[ud synchronize];
|
||||
}
|
||||
|
||||
- (void)loadPrefernces
|
||||
{
|
||||
NSDictionary *prefs = nil;
|
||||
|
|
Loading…
Reference in a new issue