mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
refactor: Remove setupMenu function and its invocation from app initialization
This commit is contained in:
41
main.js
41
main.js
@@ -150,46 +150,6 @@ ipcMain.on("open-wiki", () => {
|
|||||||
shell.openExternal("https://masteracnolo.github.io/FreedomLoader/pages/wiki.html");
|
shell.openExternal("https://masteracnolo.github.io/FreedomLoader/pages/wiki.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Menu
|
|
||||||
function setupMenu() {
|
|
||||||
const menuTemplate = [
|
|
||||||
{
|
|
||||||
label: "Logs",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Open Logs",
|
|
||||||
click: () => shell.openPath(logsFolderPath),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Website",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Go to Website",
|
|
||||||
click: () => shell.openExternal("https://masteracnolo.github.io/FreedomLoader/"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Documentation",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Go to Wiki",
|
|
||||||
click: () => shell.openExternal("https://masteracnolo.github.io/FreedomLoader/pages/wiki.html"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
const defaultMenu = Menu.getApplicationMenu();
|
|
||||||
const mergedTemplate = defaultMenu
|
|
||||||
? [...defaultMenu.items.map(item => item), ...menuTemplate]
|
|
||||||
: menuTemplate;
|
|
||||||
|
|
||||||
Menu.setApplicationMenu(Menu.buildFromTemplate(mergedTemplate));
|
|
||||||
}
|
|
||||||
|
|
||||||
// App ready
|
// App ready
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
@@ -208,7 +168,6 @@ app.whenReady().then(async () => {
|
|||||||
|
|
||||||
await createMainWindow();
|
await createMainWindow();
|
||||||
AutoUpdater(mainWindow);
|
AutoUpdater(mainWindow);
|
||||||
setupMenu();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Window or Server error :", err);
|
logger.error("Window or Server error :", err);
|
||||||
app.quit();
|
app.quit();
|
||||||
|
|||||||
Reference in New Issue
Block a user