From 5d10d4ccbba979b37f14a79cd641b24a3f10863a Mon Sep 17 00:00:00 2001
From: fedor Control-g
.
+ 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. +
+diff --git a/Source/NSApplication.m b/Source/NSApplication.m index da1b9fda8..a1d0be8f3 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -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];