mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 10:38:55 +00:00
Remove "About Electron" from app menu, add nativefier version to help, which fixes #18
Also refactor buildMenu function arguments
This commit is contained in:
parent
82317a08d3
commit
e8a7c634cd
@ -2,7 +2,7 @@ var electron = require('electron');
|
|||||||
var Menu = electron.Menu;
|
var Menu = electron.Menu;
|
||||||
var shell = electron.shell;
|
var shell = electron.shell;
|
||||||
|
|
||||||
module.exports = function (app, mainWindow) {
|
module.exports = function (mainWindow, nativefierVersion, onQuit) {
|
||||||
if (Menu.getApplicationMenu())
|
if (Menu.getApplicationMenu())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ module.exports = function (app, mainWindow) {
|
|||||||
role: 'help',
|
role: 'help',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Learn More About Nativefier',
|
label: `Built with Nativefier v${nativefierVersion}`,
|
||||||
click: function() { shell.openExternal('https://github.com/jiahaog/nativefier') }
|
click: function() { shell.openExternal('https://github.com/jiahaog/nativefier') }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -135,13 +135,6 @@ module.exports = function (app, mainWindow) {
|
|||||||
template.unshift({
|
template.unshift({
|
||||||
label: 'Electron',
|
label: 'Electron',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
|
||||||
label: 'About Electron',
|
|
||||||
role: 'about'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Services',
|
label: 'Services',
|
||||||
role: 'services',
|
role: 'services',
|
||||||
@ -151,7 +144,7 @@ module.exports = function (app, mainWindow) {
|
|||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Hide Electron',
|
label: 'Hide App',
|
||||||
accelerator: 'Command+H',
|
accelerator: 'Command+H',
|
||||||
role: 'hide'
|
role: 'hide'
|
||||||
},
|
},
|
||||||
@ -170,7 +163,7 @@ module.exports = function (app, mainWindow) {
|
|||||||
{
|
{
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
accelerator: 'Command+Q',
|
accelerator: 'Command+Q',
|
||||||
click: function() { app.quit(); }
|
click: function() { onQuit(); }
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -57,7 +57,7 @@ app.on('ready', function () {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
buildMenu(app, mainWindow);
|
buildMenu(mainWindow, appArgs.nativefierVersion, app.quit);
|
||||||
|
|
||||||
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
mainWindow.loadURL('file://' + __dirname + '/index.html');
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ import ncp from 'ncp';
|
|||||||
import async from 'async';
|
import async from 'async';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import packageJson from './../package.json';
|
||||||
|
|
||||||
const copy = ncp.ncp;
|
const copy = ncp.ncp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,8 +67,8 @@ function buildApp(options, callback) {
|
|||||||
* @param {tempDirCallback} callback
|
* @param {tempDirCallback} callback
|
||||||
*/
|
*/
|
||||||
function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, height, userAgent, callback) {
|
function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, height, userAgent, callback) {
|
||||||
copy(srcAppDir, tempDir, error => {
|
const loadedPackageJson = packageJson;
|
||||||
|
copy(srcAppDir, tempDir, function(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
callback(`Error Copying temporary directory: ${error}`);
|
callback(`Error Copying temporary directory: ${error}`);
|
||||||
@ -79,7 +81,8 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, h
|
|||||||
badge: badge,
|
badge: badge,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
userAgent: userAgent
|
userAgent: userAgent,
|
||||||
|
nativefierVersion: loadedPackageJson.version
|
||||||
};
|
};
|
||||||
|
|
||||||
fs.writeFileSync(path.join(tempDir, '/nativefier.json'), JSON.stringify(appArgs));
|
fs.writeFileSync(path.join(tempDir, '/nativefier.json'), JSON.stringify(appArgs));
|
||||||
|
Loading…
Reference in New Issue
Block a user