[gnome-maps] MainWindow: Simplify user-location button init code



commit 890d79daf7e5a1024733a7c2047ca81728cea42d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 7 17:32:27 2013 +0300

    MainWindow: Simplify user-location button init code
    
    Simplify user-location button initialization code. This also fixes the
    regression of button getting disabled on startup against latest (git
    master) libchamplain. We still have at least two more issues but those
    are most likely libchamplain bugs:
    
    * "cooridanate properties changes not notified"
      https://bugzilla.gnome.org/show_bug.cgi?id=699870
    * "Centering before zooming-in changes the center of the view"
      https://bugzilla.gnome.org/show_bug.cgi?id=699871

 src/mainWindow.js |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 44c8cbc..e9b8005 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -101,20 +101,17 @@ const MainWindow = new Lang.Class({
         this.mapView = new MapView.MapView();
 
         let trackUserLocation = Application.settings.get_boolean('track-user-location');
-        if (trackUserLocation)
-            this.mapView.gotoUserLocation(false);
 
         let toggle = builder.get_object('track-user-button');
-        toggle.active = trackUserLocation;
 
         let onViewMoved = Lang.bind(this,
             function () {
                 if (!this.mapView.userLocationVisible())
                     toggle.active = false;
             });
-        if (trackUserLocation)
-            this._onViewMovedId = this.mapView.connect('view-moved', onViewMoved);
 
+        // Disable animation for goto animation on startup only
+        let animateGotoUserLocation = !trackUserLocation;
         toggle.connect('toggled', Lang.bind(this,
             function() {
                 if (this._onViewMovedId > 0) {
@@ -128,11 +125,14 @@ const MainWindow = new Lang.Class({
                             this.mapView.disconnect(goneToUserLocationId);
                             this._onViewMovedId = this.mapView.connect('view-moved', onViewMoved);
                         }));
-                    this.mapView.gotoUserLocation(true);
+                    this.mapView.gotoUserLocation(animateGotoUserLocation);
+                    if (!animateGotoUserLocation)
+                        animateGotoUserLocation = true;
                 }
 
                 Application.settings.set_boolean('track-user-location', toggle.active);
             }));
+        toggle.active = trackUserLocation;
 
         grid.add(this.mapView);
 


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