mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Correction for bug#15989
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@22601 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
33c6e0ce88
commit
577559fdcc
2 changed files with 39 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
|||
2006-03-05 20:10 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormPalettesManager.m: Correction for bug#15989
|
||||
|
||||
2006-03-04 19:44 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Palettes/3Containers/GormTableViewEditor.m: Correction for
|
||||
|
|
|
@ -370,6 +370,21 @@ static NSImage *dragImage = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) bundlePathIsLoaded: (NSString *)path
|
||||
{
|
||||
int col = 0;
|
||||
NSBundle *bundle;
|
||||
for (col = 0; col < [bundles count]; col++)
|
||||
{
|
||||
bundle = [bundles objectAtIndex: col];
|
||||
if ([path isEqualToString: [bundle bundlePath]] == YES)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) loadPalette: (NSString*)path
|
||||
{
|
||||
NSBundle *bundle;
|
||||
|
@ -385,15 +400,11 @@ static NSImage *dragImage = nil;
|
|||
NSImageCell *cell;
|
||||
int col;
|
||||
|
||||
for (col = 0; col < [bundles count]; col++)
|
||||
if([self bundlePathIsLoaded: path])
|
||||
{
|
||||
bundle = [bundles objectAtIndex: col];
|
||||
if ([path isEqualToString: [bundle bundlePath]] == YES)
|
||||
{
|
||||
NSRunAlertPanel (nil, _(@"Palette has already been loaded"),
|
||||
_(@"OK"), nil, nil);
|
||||
return NO;
|
||||
}
|
||||
NSRunAlertPanel (nil, _(@"Palette has already been loaded"),
|
||||
_(@"OK"), nil, nil);
|
||||
return NO;
|
||||
}
|
||||
bundle = [NSBundle bundleWithPath: path];
|
||||
if (bundle == nil)
|
||||
|
@ -552,11 +563,25 @@ static NSImage *dragImage = nil;
|
|||
{
|
||||
NSString *aFile = [filesToOpen objectAtIndex: i];
|
||||
|
||||
[newUserPalettes addObject: aFile];
|
||||
if([self loadPalette: aFile] == NO)
|
||||
if([self bundlePathIsLoaded: aFile] == YES &&
|
||||
[userPalettes containsObject: aFile] == NO)
|
||||
{
|
||||
// This is done here so that, if we try to reload a palette
|
||||
// that has previously been deleted during this session that
|
||||
// the palette manager won't fail, but it will simply add
|
||||
// the palette back in. If this returns NO, then we should
|
||||
// flag a problem otherwise it's successful if the palette is
|
||||
// already in the bundles array. This is to address bug#15989.
|
||||
[newUserPalettes addObject: aFile];
|
||||
}
|
||||
else if([self loadPalette: aFile] == NO)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
[newUserPalettes addObject: aFile];
|
||||
}
|
||||
}
|
||||
|
||||
// reset the defaults to include the new palette.
|
||||
|
|
Loading…
Reference in a new issue