[gnome-maps/wip/mlundblad/auto-disable-aerial: 2/2] mainWindow: Don't activate aerial view when unavailable



commit e5f8136a158e0ccca460a6fc73ddad5853b06d51
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Nov 9 22:39:14 2017 +0100

    mainWindow: Don't activate aerial view when unavailable

 src/mainWindow.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index f9b80d5..2303eed 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -39,6 +39,7 @@ const MapView = imports.mapView;
 const PlaceEntry = imports.placeEntry;
 const PlaceStore = imports.placeStore;
 const PrintOperation = imports.printOperation;
+const Service = imports.service;
 const ShapeLayer = imports.shapeLayer;
 const Sidebar = imports.sidebar;
 const Utils = imports.utils;
@@ -465,8 +466,11 @@ var MainWindow = new Lang.Class({
     },
 
     _onAerialViewActivate: function() {
-        this._mapView.setMapType(MapView.MapType.AERIAL);
-        this.layersPopover.setMapType(MapView.MapType.AERIAL);
+        // don't attempt to switch to aerial if we don't have tiles for it
+        if (Service.getService().tiles.aerial) {
+            this._mapView.setMapType(MapView.MapType.AERIAL);
+            this.layersPopover.setMapType(MapView.MapType.AERIAL);
+        }
     },
 
     _onToggleSidebarChangeState: function(action, variant) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]