[beast: 39/47] EBEAST: menus.js: send unknown menu commands to Shell.command()



commit cc3a9a20acfbde3e4d8ed32dd2f377974095cab7
Author: Tim Janik <timj gnu org>
Date:   Thu Jun 8 18:21:06 2017 +0200

    EBEAST: menus.js: send unknown menu commands to Shell.command()
    
    Signed-off-by: Tim Janik <timj gnu org>

 ebeast/menus.js |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/ebeast/menus.js b/ebeast/menus.js
index 5145f08..7b9fdd4 100644
--- a/ebeast/menus.js
+++ b/ebeast/menus.js
@@ -2,20 +2,20 @@
 
 // == Application Menu ==
 const file_menu = [
-  { label: '&Open...',                 role: 'open-file',              accelerator: 'Ctrl+O', },
-  { label: '&Quit',                    role: 'quit-app',               accelerator: 'Shift+Ctrl+Q', },
+  { label: T('&Open...'),              role: 'open-file',              accelerator: 'Ctrl+O', },
+  { label: T('&Quit'),                 role: 'quit-app',               accelerator: 'Shift+Ctrl+Q', },
 ];
 const view_menu = [
-  { label: 'Toggle &Fullscreen',       role: 'toggle-fulscreen',       accelerator: 'F11', },
-  { label: 'Toggle &Developer Tools',  role: 'toggle-devtools',        accelerator: 'Shift+Ctrl+I', },
+  { label: T('Toggle &Fullscreen'),     role: 'toggle-fulscreen',      accelerator: 'F11', },
+  { label: T('Toggle &Developer Tools'), role: 'toggle-devtools',      accelerator: 'Shift+Ctrl+I', },
 ];
 const help_menu = [
-  { label: '&About...',                        role: 'about-dialog',           },
+  { label: T('&About...'),             role: 'about-dialog',           },
 ];
 const menubar_menus = [
-  { label: '&File',                    submenu: file_menu,             accelerator: 'Alt+F' },
-  { label: '&View',                    submenu: view_menu,             accelerator: 'Alt+W' },
-  { label: '&Help',                    submenu: help_menu,             accelerator: 'Alt+H' },
+  { label: T('&File'),                         submenu: file_menu,             accelerator: 'Alt+F' },
+  { label: T('&View'),                         submenu: view_menu,             accelerator: 'Alt+W' },
+  { label: T('&Help'),                         submenu: help_menu,             accelerator: 'Alt+H' },
 ];
 
 // add 'click' handlers to menu templates
@@ -31,14 +31,14 @@ function assign_click (item, func) {
 
 // assign global app menu
 assign_click (menubar_menus, (menuitem, _focusedBrowserWindow, _event) => {
-  app_command (menuitem.role, menuitem.data);
+  menu_command (menuitem.role, menuitem.data);
 });
 module.exports.build_menubar = function () {
   return Electron.Menu.buildFromTemplate (menubar_menus);
 };
 
 // handle menu activations
-function app_command (role, _data) {
+function menu_command (role, _data) {
   const BrowserWindow = Electron.getCurrentWindow(); // http://electron.atom.io/docs/api/browser-window/
   const WebContents = BrowserWindow.webContents;     // http://electron.atom.io/docs/api/web-contents/
   switch (role) {
@@ -58,9 +58,8 @@ function app_command (role, _data) {
       console.log ('open-file: ' + result);
     });
     break;
-  case 'about-dialog':
-    App.show_about = !App.show_about;
-    Mithril.redraw();
+  default:
+    Shell.command (role, _data);
     break;
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]