New method to load user bundles

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16804 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-05-27 04:10:20 +00:00
parent aabdfd8e8f
commit 1740b49ea6
3 changed files with 41 additions and 0 deletions

View file

@ -221,6 +221,7 @@ initialize_gnustep_backend(void)
_(@"Backend at path %@ doesn't contain the GSBackend class"), path);
[backend initializeBackend];
}
#else
/* GSBackend will be in a separate library, so use the runtime
to find the class and avoid an unresolved reference problem */
@ -232,6 +233,29 @@ initialize_gnustep_backend(void)
return YES;
}
void
gsapp_user_bundles()
{
NSUserDefaults *defs=[NSUserDefaults standardUserDefaults];
NSArray *a=[defs arrayForKey: @"GSAppKitUserBundles"];
int i, c;
c = [a count];
if (a == nil || c == 0)
return;
NSLog(@"Loading %d user defined AppKit bundles", c);
for (i = 0; i < c; i++)
{
NSBundle *b = [NSBundle bundleWithPath: [a objectAtIndex: i]];
if (!b)
{
NSLog(@"* Unable to load '%@'", [a objectAtIndex: i]);
continue;
}
NSLog(@"Loaded '%@'\n", [a objectAtIndex: i]);
[[[b principalClass] alloc] init];
}
}
/*
* Types
*/
@ -588,6 +612,9 @@ static NSCell* tileCell = nil;
/* Initialize the backend here. */
initialize_gnustep_backend();
/* Load user-defined bundles */
gsapp_user_bundles();
/* Connect to our window server. */
srv = [GSDisplayServer serverWithAttributes: nil];