[gnome-maps/wip/jonasdn/storedRoute: 1/13] wip_signals



commit 964187ee267cc6cc73f605ec6d9ad46ac36590aa
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Feb 12 18:42:07 2015 +0100

    wip_signals

 src/sidebar.js |   63 +++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 32 deletions(-)
---
diff --git a/src/sidebar.js b/src/sidebar.js
index 924e43a..cd02dcd 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -96,7 +96,7 @@ const Sidebar = new Lang.Class({
         this._initTransportationToggles(ui.modePedestrianToggle,
                                         ui.modeBikeToggle,
                                         ui.modeCarToggle);
-        this._initQuerySignals();
+        this._initRouteSignals();
 
         let query = Application.routeService.query;
 
@@ -136,9 +136,38 @@ const Sidebar = new Lang.Class({
         query.connect('notify::transportation', setToggles);
     },
 
-    _initQuerySignals: function() {
+    _initRouteSignals: function() {
+        let route = Application.routeService.route;
         let query = Application.routeService.query;
 
+        route.connect('reset', (function() {
+            this._clearInstructions();
+            this._instructionStack.visible_child = this._instructionWindow;
+
+            let length = this._entryList.get_children().length;
+            for (let index = 1; index < (length - 1); index++) {
+                query.removePoint(index);
+            }
+        }).bind(this));
+
+        route.connect('update', (function() {
+            this._clearInstructions();
+            this._instructionStack.visible_child = this._instructionWindow;
+
+            route.turnPoints.forEach((function(turnPoint) {
+                let row = new InstructionRow({ visible: true,
+                                               turnPoint: turnPoint });
+                this._instructionList.add(row);
+            }).bind(this));
+
+
+        query.connect('notify', (function() {
+            if (query.isValid())
+                this._instructionStack.visible_child = this._instructionSpinner;
+            else
+                this._clearInstructions();
+        }).bind(this));
+
         query.connect('point-added', (function(obj, point, index) {
             this._createRouteEntry(index, point);
         }).bind(this));
@@ -183,36 +212,6 @@ const Sidebar = new Lang.Class({
     },
 
     _initInstructionList: function() {
-        let route = Application.routeService.route;
-        let query = Application.routeService.query;
-
-        route.connect('reset', (function() {
-            this._clearInstructions();
-            this._instructionStack.visible_child = this._instructionWindow;
-
-            let length = this._entryList.get_children().length;
-            for (let index = 1; index < (length - 1); index++) {
-                query.removePoint(index);
-            }
-        }).bind(this));
-
-        query.connect('notify', (function() {
-            if (query.isValid())
-                this._instructionStack.visible_child = this._instructionSpinner;
-            else
-                this._clearInstructions();
-        }).bind(this));
-
-        route.connect('update', (function() {
-            this._clearInstructions();
-            this._instructionStack.visible_child = this._instructionWindow;
-
-            route.turnPoints.forEach((function(turnPoint) {
-                let row = new InstructionRow({ visible: true,
-                                               turnPoint: turnPoint });
-                this._instructionList.add(row);
-            }).bind(this));
-
             /* Translators: %s is a time expression with the format "%f h" or "%f min" */
             this._timeInfo.label = _("Estimated time: %s").format(Utils.prettyTime(route.time));
             this._distanceInfo.label = Utils.prettyDistance(route.distance);


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