1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

👌 Rename method from update to rebuild

This commit is contained in:
2022-01-03 16:20:53 +01:00
parent 40a0bd6cab
commit 722e082526
2 changed files with 10 additions and 9 deletions

View File

@ -24,8 +24,9 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
/** /**
Update the menu's contents, based on what's going on. Update the menu's contents, based on what's going on.
This will rebuild the entire menu, so this can take a few moments.
*/ */
func update() { func rebuild() {
// Update the menu item on the main thread // Update the menu item on the main thread
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
// Create a new menu // Create a new menu
@ -97,13 +98,13 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
PhpEnv.shared.isBusy = true PhpEnv.shared.isBusy = true
setBusyImage() setBusyImage()
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
update() rebuild()
execute() execute()
PhpEnv.shared.isBusy = false PhpEnv.shared.isBusy = false
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
updatePhpVersionInStatusBar() updatePhpVersionInStatusBar()
update() rebuild()
completion() completion()
} }
} }
@ -122,7 +123,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
@objc func updatePhpVersionInStatusBar() { @objc func updatePhpVersionInStatusBar() {
refreshIcon() refreshIcon()
update() rebuild()
} }
func refreshIcon() { func refreshIcon() {
@ -287,7 +288,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
updatePhpVersionInStatusBar() updatePhpVersionInStatusBar()
// Update the menu // Update the menu
update() rebuild()
let completion = { let completion = {
PhpEnv.shared.delegate?.switcherDidCompleteSwitch() PhpEnv.shared.delegate?.switcherDidCompleteSwitch()
@ -298,7 +299,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
// Perform UI updates on main thread // Perform UI updates on main thread
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
updatePhpVersionInStatusBar() updatePhpVersionInStatusBar()
update() rebuild()
let sendLocalNotification = { let sendLocalNotification = {
LocalNotification.send( LocalNotification.send(
@ -361,13 +362,13 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
private func updateGlobalDependencies(notify: Bool, completion: @escaping (Bool) -> Void) { private func updateGlobalDependencies(notify: Bool, completion: @escaping (Bool) -> Void) {
PhpEnv.shared.isBusy = true PhpEnv.shared.isBusy = true
setBusyImage() setBusyImage()
self.update() self.rebuild()
let noLongerBusy = { let noLongerBusy = {
PhpEnv.shared.isBusy = false PhpEnv.shared.isBusy = false
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
self.updatePhpVersionInStatusBar() self.updatePhpVersionInStatusBar()
self.update() self.rebuild()
} }
} }

View File

@ -64,7 +64,7 @@ class PrefsVC: NSViewController {
preference: .fullPhpVersionDynamicIcon, preference: .fullPhpVersionDynamicIcon,
action: { action: {
MainMenu.shared.refreshIcon() MainMenu.shared.refreshIcon()
MainMenu.shared.update() MainMenu.shared.rebuild()
} }
), ),
CheckboxPreferenceView.make( CheckboxPreferenceView.make(