[gnome-maps/wip/mlundblad/night-mode] layersPopover: Show dark street thumbnail when night mode active



commit 587cfb9d06ccb0beb03f3bf8701280910cbb93cb
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Jun 5 12:19:04 2020 +0200

    layersPopover: Show dark street thumbnail when night mode active

 src/layersPopover.js | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/layersPopover.js b/src/layersPopover.js
index 118cbdc1..822f672b 100644
--- a/src/layersPopover.js
+++ b/src/layersPopover.js
@@ -22,6 +22,7 @@ const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const Gdk = imports.gi.Gdk;
 
+const Application = imports.application;
 const MapSource = imports.mapSource;
 const MapView = imports.mapView;
 const Service = imports.service;
@@ -98,6 +99,11 @@ var LayersPopover = GObject.registerClass({
                 widget: this._streetLayerImage,
                 lastLocation: { x: -1, y: -1, z: -1 }
             },
+            streetDark: {
+                source: MapSource.createStreetDarkSource(),
+                widget: this._streetLayerImage,
+                lastLocation: { x: -1, y: -1, z: -1 }
+            },
             aerial: {
                 source: MapSource.createAerialSource(),
                 widget: this._aerialLayerImage,
@@ -125,6 +131,9 @@ var LayersPopover = GObject.registerClass({
                                        this._setLayerPreviews.bind(this));
             this._mapView.view.connect("notify::longitude",
                                        this._setLayerPreviews.bind(this));
+            Application.settings.connect("changed::night-mode",
+                                         this._setLayerPreviews.bind(this));
+
         } else {
             this._streetLayerButton.visible = false;
             this._aerialLayerButton.visible = false;
@@ -137,8 +146,13 @@ var LayersPopover = GObject.registerClass({
     }
 
     _setLayerPreviews() {
-        this._setLayerPreviewImage("street");
-        this._setLayerPreviewImage("aerial");
+        if (Service.getService().tiles.streetDark &&
+            Application.settings.get('night-mode')) {
+            this._setLayerPreviewImage('streetDark');
+        } else {
+            this._setLayerPreviewImage('street');
+        }
+        this._setLayerPreviewImage('aerial');
     }
 
     _setLayerPreviewImage(layer) {


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