Center search in 10.14 and above, keep it "centerish" in older systems

This commit is contained in:
Michael Starke
2020-01-21 15:12:25 +01:00
parent 77f3f23cfe
commit 228170c717
3 changed files with 85 additions and 67 deletions

View File

@@ -122,6 +122,11 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
self.toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainWindowToolbar"];
self.toolbar.autosavesConfiguration = YES;
self.toolbar.allowsUserCustomization = YES;
if (@available(macOS 10.14, *)) {
self.toolbar.centeredItemIdentifier = MPToolbarItemIdentifierSearch;
} else {
// to not do any magic here
}
self.toolbar.delegate = self.toolbarDelegate;
self.window.toolbar = self.toolbar;
self.toolbarDelegate.toolbar = self.toolbar;