From: Cheng Zhao Date: Fri, 5 Sep 2014 05:07:05 +0000 (+0800) Subject: mac: Enable setting "Services" menu. X-Git-Tag: v0.16.0~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f604525b98e5afd5f717500ca056181c2b7f7b67;p=electron.git mac: Enable setting "Services" menu. Regarding https://github.com/atom/atom/issues/3204. --- diff --git a/atom/browser/default_app/default_app.js b/atom/browser/default_app/default_app.js index c79d5446..0e1b64d2 100644 --- a/atom/browser/default_app/default_app.js +++ b/atom/browser/default_app/default_app.js @@ -34,6 +34,13 @@ app.on('ready', function() { { type: 'separator' }, + { + label: 'Services', + submenu: [] + }, + { + type: 'separator' + }, { label: 'Hide Atom Shell', accelerator: 'Command+H', diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index 05e4b4cc..e0f22e3b 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -159,6 +159,9 @@ int EventFlagsFromNSEvent(NSEvent* event) { [NSApp setWindowsMenu:submenu]; else if ([[item title] isEqualToString:@"Help"]) [NSApp setHelpMenu:submenu]; + if ([[item title] isEqualToString:@"Services"] && + [submenu numberOfItems] == 0) + [NSApp setServicesMenu:submenu]; } else { // The MenuModel works on indexes so we can't just set the command id as the // tag like we do in other menus. Also set the represented object to be