[gnome-maps/wip/mlundblad/scale-visible-setting: 2/2] mapView: Store scale visibility in gsettings
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/scale-visible-setting: 2/2] mapView: Store scale visibility in gsettings
- Date: Wed, 2 Mar 2022 22:26:53 +0000 (UTC)
commit b9a1b4a06eb28a8f2a13c75f4cb0c9c0c2f0ff9e
Author: Marcus Lundblad <ml dfupdate se>
Date: Wed Mar 2 23:24:31 2022 +0100
mapView: Store scale visibility in gsettings
Track visibility of the scale in a setting,
so that the state is preserved between launches
rather than always starting as visible.
src/mapView.js | 15 +++++++++++++--
1 file 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]