Add View -> Debug Log to menu bar

Just send an event from the main process to the renderer,
The latter routes it the appropriate view method.

For now it's a no-op unless the main window exists and it is showing the inbox,
which will be addressed in a future commit.

// FREEBIE
pull/749/head
lilia 8 years ago committed by Scott Nonnenberg
parent 8243f25e5a
commit 04e40043d2
No known key found for this signature in database
GPG Key ID: A4931C09644C654B

@ -36,6 +36,12 @@ const template = [
{ {
label: 'View', label: 'View',
submenu: [ submenu: [
{
label: 'Debug Log'
},
{
type: 'separator'
},
{ {
role: 'reload' role: 'reload'
}, },

@ -78,6 +78,9 @@
appView.openInstaller(); appView.openInstaller();
} }
Whisper.events.on('showDebugLog', function() {
appView.inboxView.showDebugLog();
});
Whisper.events.on('unauthorized', function() { Whisper.events.on('unauthorized', function() {
appView.inboxView.networkStatusView.update(); appView.inboxView.networkStatusView.update();
}); });

@ -149,6 +149,12 @@ function createWindow () {
}); });
} }
function showDebugLog() {
if (mainWindow) {
mainWindow.webContents.send('debug-log')
}
}
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
@ -169,6 +175,9 @@ app.on('ready', function() {
template[3].submenu[3].click = function() { template[3].submenu[3].click = function() {
mainWindow.show(); mainWindow.show();
}; };
template[2].submenu[0].click = showDebugLog;
} else {
template[1].submenu[0].click = showDebugLog;
} }
const menu = Menu.buildFromTemplate(template); const menu = Menu.buildFromTemplate(template);

@ -24,6 +24,9 @@
console.log('restart'); console.log('restart');
ipc.send('restart'); ipc.send('restart');
}; };
ipc.on('debug-log', function() {
Whisper.events.trigger('showDebugLog');
});
/** /**
* Enables spell-checking and the right-click context menu in text editors. * Enables spell-checking and the right-click context menu in text editors.
* Electron (`webFrame.setSpellCheckProvider`) only underlines misspelled words; * Electron (`webFrame.setSpellCheckProvider`) only underlines misspelled words;

Loading…
Cancel
Save