summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-18 13:57:23 -0200
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-18 13:57:23 -0200
commit2158a76673802c94794770495afea6e59a6e44ee (patch)
treefbe62b9aec0a696388610e4d0357cdb4dac56f83 /gui
parent5fb681b181675c7129a184e0fce59bfdf494e120 (diff)
downloadmullvadvpn-2158a76673802c94794770495afea6e59a6e44ee.tar.xz
mullvadvpn-2158a76673802c94794770495afea6e59a6e44ee.zip
Send GUI settings to renderer process
Diffstat (limited to 'gui')
-rw-r--r--gui/packages/desktop/src/main/gui-settings.js4
-rw-r--r--gui/packages/desktop/src/shared/gui-settings-state.js5
-rw-r--r--gui/packages/desktop/src/shared/ipc-event-channel.js14
3 files changed, 20 insertions, 3 deletions
diff --git a/gui/packages/desktop/src/main/gui-settings.js b/gui/packages/desktop/src/main/gui-settings.js
index c724ee8c47..633b172244 100644
--- a/gui/packages/desktop/src/main/gui-settings.js
+++ b/gui/packages/desktop/src/main/gui-settings.js
@@ -5,9 +5,7 @@ import log from 'electron-log';
import path from 'path';
import { app } from 'electron';
-export type GuiSettingsState = {
- startMinimized: boolean,
-};
+import type { GuiSettingsState } from '../shared/gui-settings-state';
export default class GuiSettings {
_state: GuiSettingsState = {
diff --git a/gui/packages/desktop/src/shared/gui-settings-state.js b/gui/packages/desktop/src/shared/gui-settings-state.js
new file mode 100644
index 0000000000..5e70295723
--- /dev/null
+++ b/gui/packages/desktop/src/shared/gui-settings-state.js
@@ -0,0 +1,5 @@
+// @flow
+
+export type GuiSettingsState = {
+ startMinimized: boolean,
+};
diff --git a/gui/packages/desktop/src/shared/ipc-event-channel.js b/gui/packages/desktop/src/shared/ipc-event-channel.js
index 471302f9f7..7b55c35ee6 100644
--- a/gui/packages/desktop/src/shared/ipc-event-channel.js
+++ b/gui/packages/desktop/src/shared/ipc-event-channel.js
@@ -3,6 +3,8 @@
import { ipcMain, ipcRenderer } from 'electron';
import type { WebContents } from 'electron';
+import type { GuiSettingsState } from './gui-settings-state';
+
import type { AppUpgradeInfo, CurrentAppVersionInfo } from '../main/index';
import type { Location, RelayList, Settings, TunnelStateTransition } from '../main/daemon-rpc';
@@ -14,6 +16,7 @@ export type AppStateSnapshot = {
relays: RelayList,
currentVersion: CurrentAppVersionInfo,
upgradeVersion: AppUpgradeInfo,
+ guiSettings: GuiSettingsState,
};
interface Sender<T> {
@@ -34,6 +37,7 @@ const LOCATION_CHANGED = 'location-changed';
const RELAYS_CHANGED = 'relays-changed';
const CURRENT_VERSION_CHANGED = 'current-version-changed';
const UPGRADE_VERSION_CHANGED = 'upgrade-version-changed';
+const GUI_SETTINGS_CHANGED = 'gui-settings-changed';
/// Typed IPC event channel
///
@@ -140,6 +144,16 @@ export default class IpcEventChannel {
notify: sender(this._webContents, UPGRADE_VERSION_CHANGED),
};
}
+
+ static guiSettings: Receiver<GuiSettingsState> & GuiSettingsMethods = {
+ listen: listen(GUI_SETTINGS_CHANGED),
+ };
+
+ get guiSettings(): Sender<GuiSettingsState> & GuiSettingsHandlers {
+ return {
+ notify: sender(this._webContents, GUI_SETTINGS_CHANGED),
+ };
+ }
}
function listen<T>(event: string): ((T) => void) => void {