Browse Source

fixed main window cloning issue

all-modes
pbca26 8 years ago
parent
commit
08ef0f85cf
  1. 9
      main.js

9
main.js

@ -9,7 +9,7 @@ const electron = require('electron'),
os = require('os'), os = require('os'),
spawn = require('child_process').spawn, spawn = require('child_process').spawn,
exec = require('child_process').exec, exec = require('child_process').exec,
{Menu} = require("electron"), { Menu } = require("electron"),
fixPath = require('fix-path'); fixPath = require('fix-path');
var express = require('express'), var express = require('express'),
@ -175,6 +175,7 @@ fs.copy(iguanaConfsDirSrc, iguanaConfsDir, function (err) {
let mainWindow; let mainWindow;
let loadingWindow; let loadingWindow;
var isMainWindowExist;
function createLoadingWindow() { function createLoadingWindow() {
mainWindow = null; mainWindow = null;
@ -199,6 +200,7 @@ function createLoadingWindow() {
// putting them into an window_arr // putting them into an window_arr
loadingWindow = null; loadingWindow = null;
createWindow('open'); createWindow('open');
isMainWindowExist = true;
}); });
//ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms //ca333 todo - add os detector to use correct binary - so we can use the same bundle on ALL OS platforms
@ -223,10 +225,8 @@ function createLoadingWindow() {
app.on('ready', createLoadingWindow); app.on('ready', createLoadingWindow);
function createWindow (status) { function createWindow (status) {
if ( status === 'open') { if ( status === 'open' && !isMainWindowExist) {
require(path.join(__dirname, 'private/mainmenu')); require(path.join(__dirname, 'private/mainmenu'));
// initialise window // initialise window
@ -262,6 +262,7 @@ function createWindow (status) {
mainWindow.webContents.on('context-menu', (e, params) => { //context-menu returns params mainWindow.webContents.on('context-menu', (e, params) => { //context-menu returns params
const { selectionText, isEditable } = params; //params obj const { selectionText, isEditable } = params; //params obj
if (isEditable) { if (isEditable) {
editMenu.popup(mainWindow); editMenu.popup(mainWindow);
} else if (selectionText && selectionText.trim() !== '') { } else if (selectionText && selectionText.trim() !== '') {

Loading…
Cancel
Save