Problems trying to get simple Mail plugin working
Problems trying to get simple Mail plugin working
- Subject: Problems trying to get simple Mail plugin working
- From: Neil Clayton <email@hidden>
- Date: Mon, 23 Jan 2006 21:03:26 +0000
Hi Everyone,
I'm trying to write a plugin for Mail, that'll let me at least have a
preferences pane.
So far, I've done the following:
1) Looked at the Growl and GPGMail code
2) Used the Growl version of NSPreferences.h and
NSPreferencesModule.h (the private headers)
3) Written a DigitizerPlugin.m (this is my NSPrincipalClass)
4) Written a DigitizerPluginPreferencesModule, which has a view, with
a NSBox in it. The File Owner of the .nib points to the NSBox.
There's a few controls in the nib, but no code behind it - I just
wanted to see it come up in Mail first.
When I run, I get the following in the console:
2006-01-23 20:34:54.976 Mail[3525] Digitizer Preferences initialized
2006-01-23 18:16:25.891 Mail[2908] Returning prefs module name:
DigitizerPluginPreferencesModule
2006-01-23 18:16:25.891 Mail[2908] Returning preference panel name
2006-01-23 18:16:25.891 Mail[2908] Loaded Digitizer
So the NSPrincipalClass is being loaded (DigitizerPlugin), and it
looks like the DigitizerPluginPreferencesModule class is also being
used, but Mail doesn't load the nib file, or access any other method
of DigitizerPluginPreferencesModule.
Anyone got any ideas why this might be?
I've included the code below.
---
Neil Clayton
// DigitizerPlugin.h
#import <Cocoa/Cocoa.h>
#import "MailApp.h"
@interface DigitizerPlugin : MVMailBundle {
}
+ (BOOL)hasPreferencesPanel;
+ (id)preferencesOwnerClassName;
+ (id)preferencesPanelName;
@end
// DigitizerPlugin.m
#import "DigitizerPlugin.h"
#import "DigitizerPluginPreferencesModule.h"
@implementation DigitizerPlugin
+ (void) initialize {
[super initialize];
[self registerBundle];
NSLog(@"Loaded Digitizer");
}
+ (BOOL)hasPreferencesPanel {
return YES;
}
+ (id)preferencesOwnerClassName {
NSLog(@"Returning prefs module name: %@", NSStringFromClass
([DigitizerPluginPreferencesModule class]));
return NSStringFromClass([DigitizerPluginPreferencesModule class]);
}
+ (id)preferencesPanelName {
NSLog(@"Returning preference panel name");
return @"Digitizer";
}
@end
-------------- HERE IS THE PREFS MODULE -------------
// DigitizerPreferencesModule.h
#import <Cocoa/Cocoa.h>
#import "NSPreferencesModule.h"
@interface DigitizerPluginPreferencesModule : NSPreferencesModule {
}
@end
// DigitizerPreferencesModule.m
#import "DigitizerPluginPreferencesModule.h"
@implementation DigitizerPluginPreferencesModule
+ (void) initialize {
[super initialize];
NSLog(@"Digitizer Preferences initialized");
}
- (NSString *) preferencesNibName {
NSLog(@"Returning prefs nib name");
return @"DigitizerPluginPreferencesPanel";
}
- (id) viewForPreferenceNamed:(NSString *)aName {
NSLog(@"Getting view for preferences");
#pragma unused(aName)
if (!_preferencesView) {
NSLog(@"Loading nib file");
[NSBundle loadNibNamed:[self preferencesNibName] owner:self];
}
NSLog(@"Returning prefs view");
return _preferencesView;
}
- (void) didChange {
NSLog(@"Did change");
}
- (void) initializeFromDefaults {
[super initializeFromDefaults];
NSLog(@"Init from defaults");
}
- (NSSize) minSize {
NSLog(@"Returning a min size");
return NSMakeSize(298.0f, 215.0f);
}
- (void) willBeDisplayed {
NSLog(@"Will be displayed");
}
- (NSString *) titleForIdentifier:(NSString *)aName {
#pragma unused(aName)
NSLog(@"Returning title");
return @"Digitizer";
}
- (NSImage *) imageForPreferenceNamed:(NSString *)aName {
NSLog(@"Returning icon");
return [NSImage imageNamed:@"NSApplicationIcon"];
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden