2009-03-08 01:49:50 +00:00
|
|
|
//
|
|
|
|
// PreferencePluginController.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/7/09.
|
|
|
|
// Copyright 2009 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "PreferencePluginController.h"
|
|
|
|
#import "PreferencePanePlugin.h"
|
|
|
|
|
|
|
|
@implementation PreferencePluginController
|
|
|
|
|
|
|
|
- (id)initWithPlugins:(NSArray *)plugins
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self)
|
|
|
|
{
|
2016-05-05 20:05:39 +00:00
|
|
|
_plugins = plugins;
|
2009-03-08 01:49:50 +00:00
|
|
|
_preferencePanes = [[NSMutableArray alloc] init];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)_searchForPlugins
|
|
|
|
{
|
|
|
|
for (NSBundle *plugin in _plugins) {
|
|
|
|
[plugin load];
|
|
|
|
|
|
|
|
Class principalClass = [plugin principalClass];
|
|
|
|
if ([principalClass conformsToProtocol:@protocol(PreferencePanePlugin)]) {
|
|
|
|
NSArray *panes = [principalClass preferencePanes];
|
|
|
|
|
|
|
|
[_preferencePanes addObjectsFromArray:panes];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *)preferencePanes
|
|
|
|
{
|
|
|
|
[self _searchForPlugins];
|
|
|
|
|
|
|
|
return _preferencePanes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|