[gnome-maps] mapView: Only goto last view on normal startup



commit 756b52aa5c26cd4af3f91664ea6a511a4b342b83
Author: Alaf Azam <alafazam gmail com>
Date:   Wed Feb 3 20:18:15 2016 +0530

    mapView: Only goto last view on normal startup
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744032

 src/application.js |    7 ++++---
 src/mainWindow.js  |    7 +------
 src/mapView.js     |    6 +++---
 3 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index d7ba080..85cdeda 100644
--- a/src/application.js
+++ b/src/application.js
@@ -53,6 +53,7 @@ let networkMonitor = null;
 let checkInManager = null;
 let contactStore = null;
 let osmEdit = null;
+let normalStartup = true;
 
 const Application = new Lang.Class({
     Name: 'Application',
@@ -94,6 +95,7 @@ const Application = new Lang.Class({
             if (options.contains('local')) {
                 let variant = options.lookup_value('local', null);
                 this.local_tile_path = variant.deep_unpack();
+                normalStartup = false;
             }
 
             return -1;
@@ -248,8 +250,7 @@ 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,
-                                                       opening: this._opening });
+                                                       overlay: overlay });
         this._mainWindow.connect('destroy', this._onWindowDestroy.bind(this));
         if (GLib.getenv('MAPS_DEBUG') === 'focus') {
             this._mainWindow.connect('set-focus', function(window, widget) {
@@ -289,7 +290,7 @@ const Application = new Lang.Class({
     },
 
     vfunc_open: function(files) {
-        this._opening = true;
+        normalStartup = false;
         this.activate();
 
         let mapView = this._mainWindow.mapView;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index ba4d9f1..3c388de 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -67,18 +67,13 @@ 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,
-            opening: opening
-        });
+                MapView.MapType.LOCAL : MapView.MapType.STREET });
 
         this._overlay.add(this._mapView);
 
diff --git a/src/mapView.js b/src/mapView.js
index 0090f60..dba22e5 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -83,7 +83,7 @@ const MapView = new Lang.Class({
         let mapType = params.mapType || MapType.STREET;
         delete params.mapType;
 
-        this.view = this._initView(params.opening);
+        this.view = this._initView();
         this._initLayers();
 
         this._factory = Champlain.MapSourceFactory.dup_default();
@@ -116,7 +116,7 @@ const MapView = new Lang.Class({
         view.add_child(this._scale);
     },
 
-    _initView: function(opening) {
+    _initView: function() {
         let view = this.get_view();
         view.zoom_level = 3;
         view.min_zoom_level = MapMinZoom;
@@ -124,7 +124,7 @@ const MapView = new Lang.Class({
         view.reactive = true;
         view.kinetic_mode = true;
 
-        if (!opening)
+        if (Application.normalStartup)
             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


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