preference: Unify duplicate toggle-menubar-setting event.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-02-17 20:56:11 -08:00
parent 7fb0cfd176
commit 3ffc7251f4
3 changed files with 7 additions and 4 deletions

View File

@@ -73,7 +73,6 @@ export interface RendererMessage {
updateMenu: boolean,
) => void;
"toggle-dnd": (state: boolean, newSettings: Partial<DNDSettings>) => void;
"toggle-menubar-setting": (state: boolean) => void;
"toggle-sidebar": (show: boolean) => void;
"toggle-sidebar-setting": (state: boolean) => void;
"toggle-silent": (state: boolean) => void;

View File

@@ -1028,7 +1028,11 @@ class ServerManagerView {
return;
}
this.updateGeneralSettings("toggle-menubar-setting", autoHideMenubar);
this.updateGeneralSettings(
"toggle-autohide-menubar",
autoHideMenubar,
updateMenu,
);
},
);

View File

@@ -58,7 +58,7 @@ export class PreferenceView {
ipcRenderer.on("switch-settings-nav", this.handleSwitchSettingsNav);
ipcRenderer.on("toggle-sidebar-setting", this.handleToggleSidebar);
ipcRenderer.on("toggle-menubar-setting", this.handleToggleMenubar);
ipcRenderer.on("toggle-autohide-menubar", this.handleToggleMenubar);
ipcRenderer.on("toggle-tray", this.handleToggleTray);
ipcRenderer.on("toggle-dnd", this.handleToggleDnd);
}
@@ -107,7 +107,7 @@ export class PreferenceView {
destroy(): void {
ipcRenderer.off("switch-settings-nav", this.handleSwitchSettingsNav);
ipcRenderer.off("toggle-sidebar-setting", this.handleToggleSidebar);
ipcRenderer.off("toggle-menubar-setting", this.handleToggleMenubar);
ipcRenderer.off("toggle-autohide-menubar", this.handleToggleMenubar);
ipcRenderer.off("toggle-tray", this.handleToggleTray);
ipcRenderer.off("toggle-dnd", this.handleToggleDnd);
}