[gnome-maps] Do not go to stored location when opening GeoJSON



commit 4a4ef0d1e56bcfec3e817147aab3b08199a427f3
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sat Dec 12 20:41:03 2015 +0100

    Do not go to stored location when opening GeoJSON

 src/application.js |    4 +++-
 src/mainWindow.js  |    6 +++++-
 src/mapView.js     |    7 ++++---
 3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 99bb426..678cc6b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -244,7 +244,8 @@ const Application = new Lang.Class({
         let overlay = new Gtk.Overlay({ visible: true, can_focus: false });
         notificationManager = new NotificationManager.NotificationManager(overlay);
         this._mainWindow = new MainWindow.MainWindow({ application: this,
-                                                       overlay: overlay });
+                                                       overlay: overlay,
+                                                       opening: this._opening });
         this._mainWindow.connect('destroy', this._onWindowDestroy.bind(this));
     },
 
@@ -282,6 +283,7 @@ const Application = new Lang.Class({
     },
 
     vfunc_open: function(files) {
+        this._opening = true;
         this.activate();
 
         let mapView = this._mainWindow.mapView;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index e2d3ae5..89c4d47 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -67,13 +67,17 @@ const MainWindow = new Lang.Class({
         this._overlay = params.overlay;
         delete params.overlay;
 
+        let opening = params.opening;
+        delete params.opening;
+
         this.parent(params);
 
         this._configureId = 0;
 
         this._mapView = new MapView.MapView({
             mapType: this.application.local_tile_path ?
-                MapView.MapType.LOCAL : MapView.MapType.STREET
+                MapView.MapType.LOCAL : MapView.MapType.STREET,
+            opening: opening
         });
 
         this._overlay.add(this._mapView);
diff --git a/src/mapView.js b/src/mapView.js
index 840d392..3f85a37 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -81,7 +81,7 @@ const MapView = new Lang.Class({
         let mapType = params.mapType || MapType.STREET;
         delete params.mapType;
 
-        this.view = this._initView();
+        this.view = this._initView(params.opening);
         this._initLayers();
 
         this._factory = Champlain.MapSourceFactory.dup_default();
@@ -96,7 +96,7 @@ const MapView = new Lang.Class({
         this._connectRouteSignals();
     },
 
-    _initView: function() {
+    _initView: function(opening) {
         let view = this.get_view();
         view.zoom_level = 3;
         view.min_zoom_level = MapMinZoom;
@@ -104,7 +104,8 @@ const MapView = new Lang.Class({
         view.reactive = true;
         view.kinetic_mode = true;
 
-        view.connect('notify::realized', this._goToStoredLocation.bind(this));
+        if (!opening)
+            view.connect('notify::realized', this._goToStoredLocation.bind(this));
         view.connect('notify::latitude', this._onViewMoved.bind(this));
         // switching map type will set view min-zoom-level from map source
         view.connect('notify::min-zoom-level', (function() {


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