MagicPrefs plugins API
About MagicPrefs plugins API
The API is currently very limited, it is subject to be expanded in the future.
All the details are below,
MPPluginInterface.h
needs to be downloaded and used as it is.
You can download the
MPPExample.zip
example project for a plugin that illustrates both basic functionality and pref settings.
A example
MPPExample.plist
shows the structure of the file that needs to reside at your app's url along with the zip archive of the plugin.
Feel free to distibute your plugin any way you like, if you want it included in the list shown under the plugin preferences in MagicPrefs i reserve the right to test it that everything is kosher.
Xcode > New Project > Framework & Library > Bundle > Cocoa > Choose
(Add the main class files now and build your project to see the GCC settings section, Xcode3 bug)
Project Settings > Build > Objective-C Garbage Collection : supported
Project Settings > Build > Wrapper Extension : MPplugin
Project Settings > Build > Deployment SDK: 10.6
(with Xcode 3 check that the Targets > [PluginName] > Build settings are the same)
Info.plist > Principal Class : [PluginName]
Info.plist > Bundle Identifier : com.yourcompany.MagicPrefs.[PluginName]
Info.plist > MPUrlString : [http:// url to a page for the plugin (is also used for update [PluginName].MPplugin.zip and [PluginName].plist must exist there)]
Info.plist > MPDescriptionString : [a description of the plugin]
NSDistributedNotification named MPPlugin[PluginName]Event
events : [notification name] [title]
optionally if a icon named [notification name].png exists in the plugin's bundle resources it will be loaded
//show a dialog
[[NSNotificationCenter defaultCenter] postNotificationName:@"MPpluginsEvent" object:nil userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:@"doAlert",@"what",@"A dialog title.",@"title",@"A dialog message",@"text",@"OK",@"action",nil]
];
//send a growl notification
[NSDictionary dictionaryWithObjectsAndKeys:@"doGrowl",@"what",@"A growl title",@"title",@"A growl message",@"message",nil]
//show a main dialog
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"MPcoreMainEvent" object:nil userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:@"doAlert",@"what",@"A dialog title.",@"title",@"A dialog message",@"text",@"Button Action",@"action",nil]
//show a main notification
[NSDictionary dictionaryWithObjectsAndKeys:@"doNotif",@"what",@"square",@"image",@"Some Text",@"text",nil]
//set the dock icon to a image on the disk
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"MPpluginsEvent" object:nil userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:@"showDockImage",@"what",@"/the/path/to/a/image/name.ext",@"path",nil]