| 69 | // Handles auto-update related menu items for macOS. |
| 70 | // Adds or disables update menu items based on config state. |
| 71 | function handleAutoUpdateMenu(menuFile, configStore, callbacks) { |
| 72 | if (!configStore.get('auto_update_enabled')) return; |
| 73 | if (configStore.get('update_downloaded')) { |
| 74 | // Add "Restart to Update" if update is downloaded |
| 75 | menuFile.submenu.unshift({ |
| 76 | name: 'mnu_restart_to_update', |
| 77 | id: 'mnu_restart_to_update', |
| 78 | label: 'Restart to Update', |
| 79 | enabled: true, |
| 80 | priority: 998, |
| 81 | click: callbacks['restart_to_update'], |
| 82 | }); |
| 83 | } else { |
| 84 | // Add "Check for Updates" if update is not downloaded |
| 85 | menuFile.submenu.unshift({ |
| 86 | name: 'mnu_check_updates', |
| 87 | id: 'mnu_check_updates', |
| 88 | label: 'Check for Updates...', |
| 89 | enabled: true, |
| 90 | priority: 998, |
| 91 | click: callbacks['check_for_updates'], |
| 92 | }); |
| 93 | } |
| 94 | // Disable "Check for Updates" if update is downloading |
| 95 | if (configStore.get('update_downloading')) { |
| 96 | menuFile.submenu.forEach((item) => { |
| 97 | if (item.id == 'mnu_check_updates') item.enabled = false; |
| 98 | }); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Remove About pgAdmin 4 from help menu and add it to the top of menuFile submenu. |
| 103 | function moveAboutMenuToTop(pgadminMenus, menuFile) { |