[gnome-maps] MapView,MapLocation: Add signals to track goTo*



commit d3546eb5553fc895b7cfaaa1640393ce6644e087
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 17 17:02:01 2013 +0300

    MapView,MapLocation: Add signals to track goTo*
    
    These methods launch an async operation on Champlain.View and we need
    signals to be able track their actual completion.

 src/mapLocation.js | 3 +++
 src/mapView.js     | 7 +++++++
 2 files changed, 10 insertions(+)
---
diff --git a/src/mapLocation.js b/src/mapLocation.js
index 02e46d2..a3f4953 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -24,6 +24,7 @@ const Geocode = imports.gi.GeocodeGlib;
 
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
+const Signals = imports.signals;
 
 const Utils = imports.utils;
 const Path = imports.path;
@@ -73,6 +74,7 @@ const MapLocation = new Lang.Class({
                 Mainloop.idle_add(Lang.bind(this,
                     function() {
                         this._view.set_zoom_level(zoom);
+                        this.emit('gone-to');
                     }));
                 this._view.disconnect(anim_completed_id);
             }));
@@ -92,3 +94,4 @@ const MapLocation = new Lang.Class({
         this.goTo(animate);
     },
 });
+Signals.addSignalMethods(MapLocation.prototype);
diff --git a/src/mapView.js b/src/mapView.js
index f2c939f..122831e 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -30,6 +30,7 @@ const Geocode = imports.gi.GeocodeGlib;
 
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
+const Signals = imports.signals;
 
 const Application = imports.application;
 const Properties = imports.properties;
@@ -130,6 +131,11 @@ const MapView = new Lang.Class({
     },
 
     gotoUserLocation: function(animate) {
+        let goneToId = this._userLocation.connect("gone-to", Lang.bind(this,
+            function() {
+                this.emit('gone-to-user-location');
+                this._userLocation.disconnect(goneToId);
+            }));
         this._userLocation.goTo(animate);
     },
 
@@ -186,3 +192,4 @@ const MapView = new Lang.Class({
             this.ensureVisible(locations);
     },
 });
+Signals.addSignalMethods(MapView.prototype);


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