diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-08 15:08:44 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-08 15:09:10 +0100 |
commit | c62a6a6031f01c200a008d6ed68f6889c339880f (patch) | |
tree | 23538af9ab7ff75c3c37074fd9c2634ad68eab22 /src | |
parent | add missing react-intl files (diff) | |
download | ferdium-app-c62a6a6031f01c200a008d6ed68f6889c339880f.tar.gz ferdium-app-c62a6a6031f01c200a008d6ed68f6889c339880f.tar.zst ferdium-app-c62a6a6031f01c200a008d6ed68f6889c339880f.zip |
correctly update services submenu on language change
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Menu.js | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index fb92644d0..7a60c448f 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -1,5 +1,5 @@ | |||
1 | import { remote, shell } from 'electron'; | 1 | import { remote, shell } from 'electron'; |
2 | import { observable, autorun, computed } from 'mobx'; | 2 | import { observable, autorun } from 'mobx'; |
3 | import { defineMessages } from 'react-intl'; | 3 | import { defineMessages } from 'react-intl'; |
4 | 4 | ||
5 | import { isMac, ctrlKey, cmdKey } from '../environment'; | 5 | import { isMac, ctrlKey, cmdKey } from '../environment'; |
@@ -535,7 +535,8 @@ export default class FranzMenu { | |||
535 | } | 535 | } |
536 | 536 | ||
537 | _build() { | 537 | _build() { |
538 | const serviceTpl = Object.assign([], this.serviceTpl); // need to clone object so we don't modify computed (cached) object | 538 | // need to clone object so we don't modify computed (cached) object |
539 | const serviceTpl = Object.assign([], this.serviceTpl()); | ||
539 | 540 | ||
540 | if (window.franz === undefined) { | 541 | if (window.franz === undefined) { |
541 | return; | 542 | return; |
@@ -708,7 +709,7 @@ export default class FranzMenu { | |||
708 | Menu.setApplicationMenu(menu); | 709 | Menu.setApplicationMenu(menu); |
709 | } | 710 | } |
710 | 711 | ||
711 | @computed get serviceTpl() { | 712 | serviceTpl() { |
712 | const { intl } = window.franz; | 713 | const { intl } = window.franz; |
713 | const { user, services, settings } = this.stores; | 714 | const { user, services, settings } = this.stores; |
714 | if (!user.isLoggedIn) return []; | 715 | if (!user.isLoggedIn) return []; |
@@ -740,17 +741,15 @@ export default class FranzMenu { | |||
740 | type: 'separator', | 741 | type: 'separator', |
741 | }); | 742 | }); |
742 | 743 | ||
743 | if (this.stores.user.isLoggedIn) { | 744 | services.allDisplayed.forEach((service, i) => (menu.push({ |
744 | services.allDisplayed.forEach((service, i) => (menu.push({ | 745 | label: this._getServiceName(service), |
745 | label: this._getServiceName(service), | 746 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, |
746 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, | 747 | type: 'radio', |
747 | type: 'radio', | 748 | checked: service.isActive, |
748 | checked: service.isActive, | 749 | click: () => { |
749 | click: () => { | 750 | this.actions.service.setActive({ serviceId: service.id }); |
750 | this.actions.service.setActive({ serviceId: service.id }); | 751 | }, |
751 | }, | 752 | }))); |
752 | }))); | ||
753 | } | ||
754 | 753 | ||
755 | return menu; | 754 | return menu; |
756 | } | 755 | } |