add better handling of native menu actions, add handlers for backup

This commit is contained in:
Gordon Hall 2014-06-03 10:50:37 -04:00
parent 20c7d7fe62
commit 6143dd4066
1 changed files with 30 additions and 9 deletions

View File

@ -14,7 +14,9 @@
if (typeof module !== 'undefined') module = { exports: null }; if (typeof module !== 'undefined') module = { exports: null };
// are we running in copay shell? // are we running in copay shell?
if (window.process && process.type === 'renderer') initCopayShellBindings(); if (window.process && process.type === 'renderer') {
window.cshell = initCopayShellBindings();
}
function controller(name) { function controller(name) {
return angular.element( return angular.element(
@ -29,8 +31,11 @@
var ipc = require('ipc'); var ipc = require('ipc');
ipc.on('address:create', function(data) { ipc.on('address:create', function(data) {
location.href = '#/addresses'; var ctrl = controller('AddressesController');
controller('AddressesController').newAddr(); if (ctrl) {
location.href = '#/addresses';
ctrl.newAddr();
}
}); });
ipc.on('transactions:send', function(data) { ipc.on('transactions:send', function(data) {
@ -38,23 +43,39 @@
}); });
ipc.on('transactions:all', function(data) { ipc.on('transactions:all', function(data) {
location.href = '#/transactions'; var ctrl = controller('TransactionsController');
controller('TransactionsController').show(); if (ctrl) {
location.href = '#/transactions';
ctrl.show();
}
}); });
ipc.on('transactions:pending', function(data) { ipc.on('transactions:pending', function(data) {
location.href = '#/transactions'; var ctrl = controller('TransactionsController');
controller('TransactionsController').show(true); if (ctrl) {
location.href = '#/transactions';
ctrl.show(true);
}
}); });
ipc.on('backup:download', function(data) { ipc.on('backup:download', function(data) {
var ctrl = controller('BackupController');
if (ctrl) {
location.href = '#/backup';
ctrl.download();
}
}); });
ipc.on('backup:email', function(data) { ipc.on('backup:email', function(data) {
var ctrl = controller('BackupController');
if (ctrl) {
location.href = '#/backup';
ctrl.email();
}
}); });
return ipc;
}; };
})(); })();