diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-13 04:29:02 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 04:29:02 +0530 |
commit | 7f13f380e154d881c32997cdc7948c1fa5697dce (patch) | |
tree | 63468a20159ff3eda896ec6a90441353565a898b /src/lib | |
parent | fix: no top menu at all (#1917) (diff) | |
download | ferdium-app-7f13f380e154d881c32997cdc7948c1fa5697dce.tar.gz ferdium-app-7f13f380e154d881c32997cdc7948c1fa5697dce.tar.zst ferdium-app-7f13f380e154d881c32997cdc7948c1fa5697dce.zip |
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Tray.js | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index c897d597a..f5970f7e7 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js | |||
@@ -1,5 +1,5 @@ | |||
1 | import { | 1 | import { |
2 | app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, dialog, | 2 | app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, |
3 | } from 'electron'; | 3 | } from 'electron'; |
4 | import { join } from 'path'; | 4 | import { join } from 'path'; |
5 | import macosVersion from 'macos-version'; | 5 | import macosVersion from 'macos-version'; |
@@ -43,7 +43,9 @@ export default class TrayIcon { | |||
43 | }, | 43 | }, |
44 | { | 44 | { |
45 | label: 'Quit Ferdi', | 45 | label: 'Quit Ferdi', |
46 | click: this.quitApp, | 46 | click() { |
47 | app.quit(); | ||
48 | }, | ||
47 | }, | 49 | }, |
48 | ]; | 50 | ]; |
49 | 51 | ||
@@ -176,22 +178,4 @@ export default class TrayIcon { | |||
176 | __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, | 178 | __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, |
177 | )); | 179 | )); |
178 | } | 180 | } |
179 | |||
180 | // TODO: Extract this into a reusable component and remove the duplications | ||
181 | quitApp = () => { | ||
182 | const yesButtonIndex = 0; | ||
183 | let selection = yesButtonIndex; | ||
184 | if (window.ferdi.stores.settings.app.confirmOnQuit) { | ||
185 | selection = dialog.showMessageBoxSync(app.mainWindow, { | ||
186 | // TODO: Externalize strings | ||
187 | type: 'question', | ||
188 | message: 'Quit', | ||
189 | detail: 'Do you really want to quit Ferdi?', | ||
190 | buttons: ['Yes', 'No'], | ||
191 | }); | ||
192 | } | ||
193 | if (selection === yesButtonIndex) { | ||
194 | app.quit(); | ||
195 | } | ||
196 | }; | ||
197 | } | 181 | } |