From c1cdecd147c021582e5ffea67b8bd1744160dc76 Mon Sep 17 00:00:00 2001 From: Akemi Date: Tue, 5 Jun 2018 19:12:57 +0200 Subject: mac: add Open Playlist menu bar item --- osdep/macosx_menubar.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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]; -- cgit v1.2.3