mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Tweak caching of color list
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
399d13a168
commit
c2dc1e5647
1 changed files with 24 additions and 8 deletions
|
@ -249,6 +249,11 @@ static NSNull *null = nil;
|
|||
NSDictionary *infoDict;
|
||||
NSWindow *window;
|
||||
|
||||
/* Get rid of any cached colors list so that we regenerate it when needed
|
||||
*/
|
||||
[_colors release];
|
||||
_colors = nil;
|
||||
|
||||
/*
|
||||
* We step through all the bundle image resources and load them in
|
||||
* to memory, setting their names so that they are visible to
|
||||
|
@ -394,6 +399,25 @@ static NSNull *null = nil;
|
|||
|
||||
- (NSColorList*) colors
|
||||
{
|
||||
if (_colors == nil)
|
||||
{
|
||||
NSString *colorsPath;
|
||||
|
||||
colorsPath = [_bundle pathForResource: @"ThemeColors" ofType: @"clr"];
|
||||
if (colorsPath == nil)
|
||||
{
|
||||
_colors = [null retain];
|
||||
}
|
||||
else
|
||||
{
|
||||
_colors = [[NSColorList alloc] initWithName: @"System"
|
||||
fromFile: colorsPath];
|
||||
}
|
||||
}
|
||||
if ((id)_colors == (id)null)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return _colors;
|
||||
}
|
||||
|
||||
|
@ -468,17 +492,9 @@ static NSNull *null = nil;
|
|||
|
||||
- (id) initWithBundle: (NSBundle*)bundle
|
||||
{
|
||||
NSString *colorsPath;
|
||||
|
||||
ASSIGN(_bundle, bundle);
|
||||
_images = [NSMutableDictionary new];
|
||||
_tiles = [NSMutableDictionary new];
|
||||
colorsPath = [_bundle pathForResource: @"ThemeColors" ofType: @"clr"];
|
||||
if (colorsPath != nil)
|
||||
{
|
||||
_colors = [[NSColorList alloc] initWithName: @"System"
|
||||
fromFile: colorsPath];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue