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

@ -1,3 +1,9 @@
2003-05-26 Adam Fedor <fedor@gnu.org>
* Source/NSApplication.m (gsapp_user_bundles): New function
(-_init): Use it.
* Documentation/Gui/DefaultsSummary.gsdoc: Update.
2003-05-25 Adam Fedor <fedor@gnu.org>
* Version 0.8.6

View file

@ -55,6 +55,14 @@
Default is <code>Control-g</code>.
</p>
</desc>
<term>GSAppKitUserBundles</term>
<desc>
<p>
An array listing the names of bundles that will be automatically
loaded into every application at startup. Typically these will
be 'theme' bundles that control the look of the application.
</p>
</desc>
<term>GSQuoteKey</term>
<desc>
<p>

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];