Add "Open Recent" submenu to default
This commit is contained in:
parent
f8adaed763
commit
f0bff74995
6 changed files with 85 additions and 1 deletions
|
@ -200,6 +200,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
|
||||
dict.SetMethod("sendActionToFirstResponder",
|
||||
&Menu::SendActionToFirstResponder);
|
||||
dict.SetMethod("noteNewRecentDocumentURL", &Menu::NoteNewRecentDocumentURL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ class Menu : public mate::TrackableObject<Menu>,
|
|||
|
||||
// Fake sending an action from the application menu.
|
||||
static void SendActionToFirstResponder(const std::string& action);
|
||||
|
||||
// Add an item corresponding to the data located by a URL to the Open Recent
|
||||
// menu, or replace an existing item with the same URL.
|
||||
static void NoteNewRecentDocumentURL(const std::string& url);
|
||||
#endif
|
||||
|
||||
AtomMenuModel* model() const { return model_.get(); }
|
||||
|
|
|
@ -139,6 +139,13 @@ void Menu::SendActionToFirstResponder(const std::string& action) {
|
|||
[NSApp sendAction:selector to:nil from:[NSApp mainMenu]];
|
||||
}
|
||||
|
||||
// static
|
||||
void Menu::NoteNewRecentDocumentURL(const std::string& url) {
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentDocumentURL:
|
||||
[NSURL fileURLWithPath:base::SysUTF8ToNSString(url)]];
|
||||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* Menu::New(mate::Arguments* args) {
|
||||
return new MenuMac(args->isolate(), args->GetThis());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue