/**
PKPrefPanesRegistry Description
*/ @implementation PKPreferencePaneRegistry /**Returns PKPrefPanesRegistry shared instance (singleton).
*/ + (id) sharedRegistry { if (sharedPrefPanesRegistry == nil) { sharedPrefPanesRegistry = [[PKPreferencePaneRegistry alloc] init]; } return sharedPrefPanesRegistry; } - (id) init { self = [super init]; [self setInstantiate: NO]; return self; } /**Locates and loads preference pane bundles.
Normally you only need to call this method to load a preference pane.
*/ - (void) loadAllPlugins { [self loadPluginsOfType: @"prefPane"]; } - (NSMutableDictionary *) loadPluginForPath: (NSString *)path { NSMutableDictionary *info = [super loadPluginForPath: path]; /* Plugin key pieces haven't been loaded, we give up */ if (info == nil) return nil; NSString *type = [[info objectForKey: @"path"] pathExtension]; NSBundle *bundle = [NSBundle bundleWithPath: path]; id name; id iconFileName; /* Retrieve pane specific informations we need to display the preference pane in presentation list, without loading the related nib file and the whole plugin/pane code. */ if ([type isEqualToString: @"prefPane"]) /* System Preferences pane. */ { name = [[bundle infoDictionary] objectForKey: @"NSPrefPaneIconLabel"]; if (name != nil && [name isEqual: [NSNull null]] == NO && [name length] != 0) { [info setObject: name forKey: @"name"]; } iconFileName = [[bundle infoDictionary] objectForKey: @"NSPrefPaneIconFile"]; if (iconFileName != nil && [iconFileName isEqual: [NSNull null]] == NO) { NSString *iconPath = [bundle pathForImageResource: iconFileName]; NSImage *image = nil; if (iconPath != nil) image = [[[NSImage alloc] initWithContentsOfFile: iconPath] autorelease]; if (image != nil) [info setObject: image forKey: @"image"]; } } return info; } #ifdef HAVE_UKTEST - (void) testPreferencePaneAtPath { UKFalse([self instantiate]); } #endif /**Loads the plugin bundle located at path, checks it conforms to Plugin schema stored in the related bundle property list.
Every property list values associated to Plugin schema are put in a dictionary to be used as plugin object, eventual validity errors are reported each time a value is read in NSBundle description values returned by -infoDictionary.
*/ - (PKPreferencePane *) preferencePaneAtPath: (NSString *)path { return [self paneAtPath: path]; } - (PKPreferencePane *) preferencePaneWithIdentifier: (NSString *)identifier { return [self paneWithIdentifier: identifier]; } @end