mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 05:52:58 +00:00
Removed unloading code as it seems to be unsafe
Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
|
||||
NSString *const MPPluginManagerWillLoadPlugin = @"com.hicknhack.macpass.MPPluginManagerWillLoadPlugin";
|
||||
NSString *const MPPluginManagerDidLoadPlugin = @"comt.hicknhack.macpass.MPPluginManagerDidLoadPlugin";
|
||||
NSString *const MPPluginManagerWillUnloadPlugin = @"com.hicknhack.macpass.MPPluginManagerWillUnloadPlugin";
|
||||
NSString *const MPPluginManagerDidUnloadPlugin = @"com.hicknhack.macpass.MPPluginManagerDidUnloadPlugin";
|
||||
|
||||
NSString *const MPPluginManagerPluginBundleIdentifiyerKey = @"MPPluginManagerPluginBundleIdentifiyerKey";
|
||||
|
||||
@@ -72,27 +70,6 @@ NSString *const MPPluginManagerPluginBundleIdentifiyerKey = @"MPPluginManagerPlu
|
||||
return [self.mutablePlugins copy];
|
||||
}
|
||||
|
||||
- (void)_unloadPlugins {
|
||||
/* TODO Notofications for UI */
|
||||
NSMutableArray *bundles = [[NSMutableArray alloc] initWithCapacity:self.mutablePlugins.count];
|
||||
// clear our interal refernce
|
||||
for(MPPlugin *plugin in self.mutablePlugins) {
|
||||
// let the plugin know we are about to unload it
|
||||
[plugin willUnloadPlugin];
|
||||
NSBundle *pluginBundle = [NSBundle bundleForClass:plugin.class];
|
||||
if(pluginBundle) {
|
||||
[bundles addObject:pluginBundle];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerWillUnloadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : plugin.identifier}];
|
||||
}
|
||||
}
|
||||
[self.mutablePlugins removeAllObjects];
|
||||
for(NSBundle *bundle in bundles) {
|
||||
NSString *identifiery = bundle.bundleIdentifier ? bundle.bundleIdentifier : @"unknown";
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerDidUnloadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : identifiery }];
|
||||
[bundle unload];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_loadPlugins {
|
||||
NSURL *dir = [NSApp applicationSupportDirectoryURL:YES];
|
||||
NSError *error;
|
||||
|
||||
@@ -24,33 +24,6 @@ NSString *const _kMPPluginTableNameColumn = @"Name";
|
||||
|
||||
@implementation MPPluginSettingsController
|
||||
|
||||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if(self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_didChangePlugins:)
|
||||
name:MPPluginManagerWillLoadPlugin
|
||||
object:[MPPluginManager sharedManager]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_didChangePlugins:)
|
||||
name:MPPluginManagerDidLoadPlugin
|
||||
object:[MPPluginManager sharedManager]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_didChangePlugins:)
|
||||
name:MPPluginManagerWillUnloadPlugin
|
||||
object:[MPPluginManager sharedManager]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_didChangePlugins:)
|
||||
name:MPPluginManagerDidUnloadPlugin
|
||||
object:[MPPluginManager sharedManager]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (NSString *)nibName {
|
||||
return @"PluginSettings";
|
||||
}
|
||||
@@ -121,11 +94,4 @@ NSString *const _kMPPluginTableNameColumn = @"Name";
|
||||
[self showSettingsForPlugin:[self pluginForRow:table.selectedRow]];
|
||||
}
|
||||
|
||||
|
||||
- (void)_didChangePlugins:(NSNotification *)notification {
|
||||
/* better way? */
|
||||
[self.pluginTableView deselectAll:self];
|
||||
[self.pluginTableView reloadData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user