Plugins/Displays/WebKit/GrowlWebKitPluginHandler.m
author boredzo
Sun Jul 06 17:07:42 2008 +0000 (2008-07-06)
changeset 4139 442ca737bbcb
parent 4137 a8b169b45c40
child 4259 0e9b6b0b1e25
permissions -rw-r--r--
Oops. Now, the clang static analyzer now flags this as a use-after-release. I need to release the plug-in bundle later; i.e, at the end of the method.
eridius@2773
     1
//
eridius@2773
     2
//  GrowlWebKitPluginHandler.m
eridius@2773
     3
//  Growl
eridius@2773
     4
//
eridius@2773
     5
//  Created by JKP on 03/11/2005.
ingmarstein@3040
     6
//  Copyright 2005-2006 The Growl Project. All rights reserved.
eridius@2773
     7
//
eridius@2773
     8
eridius@2773
     9
#import "GrowlWebKitPluginHandler.h"
eridius@2773
    10
#import "GrowlWebKitDisplayPlugin.h"
eridius@2773
    11
#import "GrowlPluginController.h"
eridius@2773
    12
eridius@2773
    13
@implementation GrowlWebKitPluginHandler
eridius@2773
    14
eridius@2773
    15
- (id) initSingleton {
ingmarstein@2943
    16
	if ((self = [super initSingleton]))
ingmarstein@2943
    17
		[[GrowlPluginController sharedController] addPluginHandler:self forPluginTypes:[NSSet setWithObject:GROWL_STYLE_EXTENSION]];
ingmarstein@2943
    18
eridius@2773
    19
	return self;
eridius@2773
    20
}
eridius@2773
    21
ingmarstein@2941
    22
- (BOOL) loadPluginAtPath:(NSString *)path {
eridius@2773
    23
	NSBundle *pluginBundle = [[NSBundle alloc] initWithPath:path];
eridius@2773
    24
	if (!pluginBundle) {
eridius@2773
    25
		NSLog(@"%@ Failed to load: %@",NSStringFromClass([self class]),path);
eridius@2773
    26
		return NO;
eridius@2773
    27
	}
ingmarstein@2943
    28
eridius@2773
    29
	GrowlWebKitDisplayPlugin *instance = [[GrowlWebKitDisplayPlugin alloc] initWithStyleBundle:pluginBundle];
eridius@2773
    30
	if (!instance) {
eridius@2773
    31
		NSLog(@"%@ Failed to load: %@ - the bundle did not contain a valid WebKit plugin",
eridius@2773
    32
			  NSStringFromClass([self class]),
eridius@2773
    33
			  path);
eridius@2773
    34
		return NO;
eridius@2773
    35
	}
ingmarstein@2943
    36
eridius@2773
    37
	[[GrowlPluginController sharedController] addPluginInstance:instance fromBundle:pluginBundle];
boredzo@4137
    38
	[instance release];
boredzo@4139
    39
	[pluginBundle release];
eridius@2773
    40
	return YES;
eridius@2773
    41
}
eridius@2773
    42
eridius@2773
    43
eridius@2773
    44
@end