Skip to content

Commit 34fde77

Browse files
author
Waley Chen
committed
Merge pull request #223 from 10gen/INT-820-revise-windows-menu
INT-820 move exit menu item to connect in windows
2 parents 071babd + e042dd8 commit 34fde77

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

src/electron/menu.js

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,27 @@ function darwinCompassSubMenu() {
6363
};
6464
}
6565

66-
function connectSubMenu() {
66+
function connectSubMenuItem() {
67+
return {
68+
label: 'Connect to...',
69+
accelerator: 'CmdOrCtrl+N',
70+
click: function() {
71+
app.emit('show connect dialog');
72+
}
73+
};
74+
}
75+
76+
function connectSubMenu(nonDarwin) {
77+
var subMenu = [connectSubMenuItem()];
78+
79+
if (nonDarwin) {
80+
subMenu.push(separator());
81+
subMenu.push(quitSubMenu('Exit'));
82+
}
83+
6784
return {
6885
label: 'Connect',
69-
submenu: [
70-
{
71-
label: 'Connect to...',
72-
accelerator: 'CmdOrCtrl+N',
73-
click: function() {
74-
app.emit('show connect dialog');
75-
}
76-
}
77-
]
86+
submenu: subMenu
7887
};
7988
}
8089

@@ -146,15 +155,6 @@ function helpSubMenu(showCompassOverview) {
146155
};
147156
}
148157

149-
function nonDarwinCompassSubMenu() {
150-
return {
151-
label: 'MongoDB Compass',
152-
submenu: [
153-
quitSubMenu('Exit')
154-
]
155-
};
156-
}
157-
158158
function shareSubMenu() {
159159
return {
160160
label: 'Share',
@@ -222,7 +222,7 @@ function darwinMenu(menuState) {
222222
];
223223

224224
if (menuState.showConnect) {
225-
menu.push(connectSubMenu());
225+
menu.push(connectSubMenu(false));
226226
}
227227

228228
menu.push(editSubMenu());
@@ -243,15 +243,10 @@ function darwinMenu(menuState) {
243243

244244
function nonDarwinMenu(menuState) {
245245
var menu = [
246-
nonDarwinCompassSubMenu()
246+
connectSubMenu(true),
247+
viewSubMenu()
247248
];
248249

249-
if (menuState.showConnect) {
250-
menu.push(connectSubMenu());
251-
}
252-
253-
menu.push(viewSubMenu());
254-
255250
if (menuState.showShare) {
256251
menu.push(shareSubMenu());
257252
}

0 commit comments

Comments
 (0)