summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-03-04 00:29:07 +0100
committerder richter <der.richter@gmx.de>2024-03-07 01:03:52 +0100
commit4eb58f6ea71ed9ee6454707d605cd0713c1baa4c (patch)
treec695865716d93c8564e22b467fe643587c716423
parent73e494a237939bc71632834f2d237034a10a665d (diff)
downloadmpv-4eb58f6ea71ed9ee6454707d605cd0713c1baa4c.tar.bz2
mpv-4eb58f6ea71ed9ee6454707d605cd0713c1baa4c.tar.xz
mac/menu: move conditional Bundle menu items into config
only add the "Show log File…" menu item config when invoked from the bundle, instead of testing on menu item creation. this is similar to the touch bar menu items now.
-rw-r--r--osdep/mac/menu_bar.swift17
1 files changed, 6 insertions, 11 deletions
diff --git a/osdep/mac/menu_bar.swift b/osdep/mac/menu_bar.swift
index 6fa64b43ca..75b1f35aba 100644
--- a/osdep/mac/menu_bar.swift
+++ b/osdep/mac/menu_bar.swift
@@ -210,7 +210,7 @@ class MenuBar: NSObject {
Config(name: "Zoom", commandSpecial: .zoom),
]
- let helpMenuConfigs = [
+ var helpMenuConfigs = [
Config(name: "mpv Website…", action: #selector(url(_:)), target: self, url: "https://mpv.io"),
Config(name: "mpv on GitHub…", action: #selector(url(_:)), target: self, url: "https://github.com/mpv-player/mpv"),
Config(name: "separator"),
@@ -220,13 +220,12 @@ class MenuBar: NSObject {
Config(name: "Keyboard Shortcuts…", action: #selector(url(_:)), target: self, url: "https://github.com/mpv-player/mpv/blob/master/etc/input.conf"),
Config(name: "separator"),
Config(name: "Report Issue…", action: #selector(url(_:)), target: self, url: "https://github.com/mpv-player/mpv/issues/new/choose"),
- Config(
- name: "Show log File…",
- action: #selector(showFile(_:)),
- target: self,
- url: NSHomeDirectory() + "/Library/Logs/mpv.log"
- ),
]
+ if ProcessInfo.processInfo.environment["MPVBUNDLE"] == "true" {
+ helpMenuConfigs += [
+ Config(name: "Show log File…", action: #selector(showFile(_:)), target: self, url: NSHomeDirectory() + "/Library/Logs/mpv.log")
+ ]
+ }
menuConfigs = [
Config(name: "Apple", configs: appMenuConfigs),
@@ -256,10 +255,6 @@ class MenuBar: NSObject {
mainMenu.setSubmenu(menu, for: item)
for subConfig in menuConfig.configs ?? [] {
- if subConfig.name == "Show log File…" && ProcessInfo.processInfo.environment["MPVBUNDLE"] != "true" {
- continue
- }
-
if subConfig.name == "separator" {
menu.addItem(MenuItem.separator())
} else {