Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Master
-
None
Description
currently it is not easy possible to capture the applications preferences menu item, except via the title, which is a bit unstable.
either we define a tag value or a predefined action selector that can be detected. for example:
- (void) pluginInitialize { [super pluginInitialize]; NSMenu* appMenu = self.viewController.window.menu; NSMenu* mainMenu = [appMenu itemAtIndex:0].submenu; bool found = false; for (NSMenuItem* item in mainMenu.itemArray) { if (item.action == @selector(onPreferences:)) { // we simply adjust the target for the preferences menu item to this plugin instance item.target = self; found = true; break; } } if (!found) { NSLog(@"Warning, didn't find preferences menu item."); } } - (IBAction) onPreferences:(id) sender { NSLog(@"onPreferences..."); }