[gnome-maps/wip/mlundblad/auto-disable-aerial: 1/2] 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: 1/2] layersPopover: Disable switch button when aerial is unavailable
- Date: Thu, 9 Nov 2017 21:42:29 +0000 (UTC)
commit b7e250bed87428845bf37acf522acc56c9c5d202
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 a5c7fa3..02d9ac1 100644
--- a/src/layersPopover.js
+++ b/src/layersPopover.js
@@ -21,6 +21,7 @@ const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const MapView = imports.mapView;
+const Service = imports.service;
const ShapeLayer = imports.shapeLayer;
const Utils = imports.utils;
@@ -85,13 +86,19 @@ var LayersPopover = new Lang.Class({
row.set_header(header);
});
- this._streetLayerButton.connect('clicked', (function () {
- this._mapView.setMapType(MapView.MapType.STREET);
- }).bind(this));
-
- this._aerialLayerButton.connect('clicked', (function () {
- this._mapView.setMapType(MapView.MapType.AERIAL);
- }).bind(this));
+ // disable the map type switch buttons if aerial is unavailable
+ if (Service.getService().tiles.aerial) {
+ this._streetLayerButton.connect('clicked', (function () {
+ this._mapView.setMapType(MapView.MapType.STREET);
+ }).bind(this));
+
+ this._aerialLayerButton.connect('clicked', (function () {
+ this._mapView.setMapType(MapView.MapType.AERIAL);
+ }).bind(this));
+ } else {
+ this._streetLayerButton.visible = false;
+ this._aerialLayerButton.visible = false;
+ }
},
setMapType: function(mapType) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]