diff options
author | Marcus Lundblad <ml@dfupdate.se> | 2022-03-02 23:24:31 +0100 |
---|---|---|
committer | Marcus Lundblad <ml@dfupdate.se> | 2022-03-03 21:44:20 +0100 |
commit | d502d9469c8178c89e9513c02ef9b8200c3badee (patch) | |
tree | 7e8db8b60b08b909114fc7bd398dfed8baa2db26 /src | |
parent | d2c0068e8eb41f6a100ed2b96f44d112e18c9489 (diff) | |
download | gnome-maps-d502d9469c8178c89e9513c02ef9b8200c3badee.tar.gz |
mapView: Store scale visibility in gsettingswip/mlundblad/scale-visible-setting
Track visibility of the scale in a setting,
so that the state is preserved between launches
rather than always starting as visible.
Diffstat (limited to 'src')
-rw-r--r-- | src/mapView.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mapView.js b/src/mapView.js index fef736c2..8ead5916 100644 --- a/src/mapView.js +++ b/src/mapView.js @@ -175,7 +175,9 @@ var MapView = GObject.registerClass({ } _initScale(view) { - this._scale = new Champlain.Scale({ visible: true }); + let showScale = Application.settings.get('show-scale'); + + this._scale = new Champlain.Scale({ visible: showScale }); this._scale.connect_view(view); if (Utils.getMeasurementSystem() === Utils.METRIC_SYSTEM) @@ -225,6 +227,9 @@ var MapView = GObject.registerClass({ this._gtkSettings.connect('notify::gtk-application-prefer-dark-theme', this._onPreferDarkThemeChanged.bind(this)); + Application.settings.connect('changed::show-scale', + this._onShowScaleChanged.bind(this)); + this._initScale(view); return view; } @@ -471,7 +476,13 @@ var MapView = GObject.registerClass({ } toggleScale() { - this._scale.visible = !this._scale.visible; + let showScale = Application.settings.get('show-scale'); + + Application.settings.set('show-scale', !showScale); + } + + _onShowScaleChanged() { + this._scale.visible = Application.settings.get('show-scale'); } _checkIfFileSizeNeedsConfirmation(files) { |