diff options
author | Akemi <der.richter@gmx.de> | 2018-06-05 19:12:57 +0200 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2019-09-23 19:28:38 +0200 |
commit | c1cdecd147c021582e5ffea67b8bd1744160dc76 (patch) | |
tree | 7e01b57d761e8f4929796653aa4a6f48ab863097 /osdep/macosx_menubar.m | |
parent | b6def652a4b0db0f3514a44fec08f4be66187f3b (diff) | |
download | mpv-c1cdecd147c021582e5ffea67b8bd1744160dc76.tar.bz2 mpv-c1cdecd147c021582e5ffea67b8bd1744160dc76.tar.xz |
mac: add Open Playlist menu bar item
Diffstat (limited to 'osdep/macosx_menubar.m')
-rw-r--r-- | osdep/macosx_menubar.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/osdep/macosx_menubar.m b/osdep/macosx_menubar.m index 558a33a905..c424df255c 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/macosx_menubar.m @@ -144,6 +144,12 @@ @"key" : @"O", @"target" : self }], + [NSMutableDictionary dictionaryWithDictionary:@{ + @"name" : @"Open Playlist…", + @"action" : @"openPlaylist", + @"key" : @"", + @"target" : self + }], @{ @"name": @"separator" }, [NSMutableDictionary dictionaryWithDictionary:@{ @"name" : @"Close", @@ -703,6 +709,17 @@ } } +- (void)openPlaylist +{ + NSOpenPanel *panel = [[NSOpenPanel alloc] init]; + + if ([panel runModal] == NSModalResponseOK){ + NSString *pl = [NSString stringWithFormat:@"loadlist \"%@\"", + [panel URLs][0].path]; + [(Application *)NSApp queueCommand:(char *)[pl UTF8String]]; + } +} + - (void)openURL { NSAlert *alert = [[NSAlert alloc] init]; |