[gnome-maps] Go to users location rather than centering on it



commit baa87cb91747608993ad3d0fe43881c8aedd0f09
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 27 05:20:30 2013 +0200

    Go to users location rather than centering on it
    
    The difference is that the former can be animated while latter can not.

 src/mainWindow.js |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 5f266f2..821b7a3 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -105,10 +105,18 @@ const MainWindow = new Lang.Class({
     _onSearchComplete: function(ipclient, res) {
         try {
             let [location, accuracy] = ipclient.search_finish(res);
-            this.view.center_on(location.latitude, location.longitude);
 
             let zoom = Utils.getZoomLevelForAccuracy(accuracy);
-            this.view.set_zoom_level(zoom);
+            this.view.go_to(location.latitude, location.longitude);
+            this.view.connect("animation-completed::go-to", Lang.bind(this,
+                function() {
+                    // Apparently the signal is called before animation is really complete so if we don't
+                    // zoom in idle, we get a crash. Perhaps a bug in libchamplain?
+                    Mainloop.idle_add(Lang.bind(this,
+                        function() {
+                            this.view.set_zoom_level(zoom);
+                        }));
+                }));
         } catch (e) {
             log("Failed to find your location: " + e);
         }


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