[gnome-maps/wip/mlundblad/auto-disable-aerial: 73/74] layersPopover: Disable switch button when aerial is unavailable
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/auto-disable-aerial: 73/74] layersPopover: Disable switch button when aerial is unavailable
- Date: Tue, 20 Feb 2018 21:15:22 +0000 (UTC)
commit 02770af4fd853e3865660115efaa562d56880a0d
Author: Marcus Lundblad <ml update uu se>
Date: Thu Nov 9 22:31:31 2017 +0100
layersPopover: Disable switch button when aerial is unavailable
Don't show the layer switching buttons when aerial tiles are
not available.
src/layersPopover.js | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/layersPopover.js b/src/layersPopover.js
index 741f561..3d7db8f 100644
--- a/src/layersPopover.js
+++ b/src/layersPopover.js
@@ -21,6 +21,7 @@ const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const MapView = imports.mapView;
+const Service = imports.service;
const ShapeLayer = imports.shapeLayer;
const Utils = imports.utils;
@@ -83,13 +84,19 @@ var LayersPopover = GObject.registerClass({
row.set_header(header);
});
- this._streetLayerButton.connect('clicked', () => {
- this._mapView.setMapType(MapView.MapType.STREET);
- });
-
- this._aerialLayerButton.connect('clicked', () => {
- this._mapView.setMapType(MapView.MapType.AERIAL);
- });
+ // disable the map type switch buttons if aerial is unavailable
+ if (Service.getService().tiles.aerial) {
+ this._streetLayerButton.connect('clicked', () => {
+ this._mapView.setMapType(MapView.MapType.STREET);
+ });
+
+ this._aerialLayerButton.connect('clicked', () => {
+ this._mapView.setMapType(MapView.MapType.AERIAL);
+ });
+ } else {
+ this._streetLayerButton.visible = false;
+ this._aerialLayerButton.visible = false;
+ }
}
setMapType(mapType) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]