mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Extract menu item for quitting application as injectable
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
0b39cc1044
commit
cf9bf23ac5
@ -75,16 +75,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
||||
const macAppMenu: MenuItemOpts = {
|
||||
label: appName,
|
||||
id: "root",
|
||||
submenu: [
|
||||
{
|
||||
label: "Quit",
|
||||
accelerator: "Cmd+Q",
|
||||
id: "quit",
|
||||
click() {
|
||||
stopServicesAndExitApp();
|
||||
},
|
||||
},
|
||||
],
|
||||
submenu: [],
|
||||
};
|
||||
|
||||
const fileMenu: MenuItemOpts = {
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import applicationMenuItemInjectionToken from "../../application-menu-item-injection-token";
|
||||
import stopServicesAndExitAppInjectable from "../../../../../../main/stop-services-and-exit-app.injectable";
|
||||
|
||||
const quitApplicationMenuItemInjectable = getInjectable({
|
||||
id: "quit-application-menu-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
||||
|
||||
return {
|
||||
id: "quit",
|
||||
parentId: "primary-for-mac",
|
||||
orderNumber: 140,
|
||||
label: "Quit",
|
||||
accelerator: "Cmd+Q",
|
||||
|
||||
click: () => {
|
||||
stopServicesAndExitApp();
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: applicationMenuItemInjectionToken,
|
||||
});
|
||||
|
||||
export default quitApplicationMenuItemInjectable;
|
||||
Loading…
Reference in New Issue
Block a user