[gnome-maps] routeQuery: Notify transportation on reset



commit e87c688537ce0e7f0ed92ebbbdb98913c96a1d77
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date:   Fri Sep 5 06:09:06 2014 -0400

    routeQuery: Notify transportation on reset
    
    Make sure that the transporation mode is notified
    on init.
    
    This fixes a bug where the sidebar showed PEDESTRIAN
    as selected but the search was actually done with CAR.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736111

 src/routeQuery.js |    2 +-
 src/sidebar.js    |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/routeQuery.js b/src/routeQuery.js
index bf6ad2b..f2753a4 100644
--- a/src/routeQuery.js
+++ b/src/routeQuery.js
@@ -105,7 +105,7 @@ const RouteQuery = new Lang.Class({
     },
 
     reset: function() {
-        this._transportation = Transportation.CAR;
+        this.transportation = Transportation.CAR;
         this._points.forEach(function(point) {
             point.place = null;
         });
diff --git a/src/sidebar.js b/src/sidebar.js
index 83be5c7..37ba572 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -101,7 +101,7 @@ const Sidebar = new Lang.Class({
         car.connect('toggled', onToggle.bind(this, transport.CAR));
         bike.connect('toggled', onToggle.bind(this, transport.BIKE));
 
-        query.connect('notify::transportation', function() {
+        let setToggles = function() {
             switch(query.transportation) {
             case transport.PEDESTRIAN:
                 pedestrian.active = true;
@@ -113,7 +113,10 @@ const Sidebar = new Lang.Class({
                 bike.active = true;
                 break;
             }
-        });
+        };
+
+        setToggles();
+        query.connect('notify::transportation', setToggles);
     },
 
     _createPlaceEntry: function() {


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