[gnome-maps] sidebar: Use the transportation type from the query



commit 3f4e61d9f4e9809506b2cea10ebc9bec1e97ee54
Author: Marcus Lundblad <ml update uu se>
Date:   Sun May 28 23:36:31 2017 +0200

    sidebar: Use the transportation type from the query
    
    Start off with the transportation type for the route query
    at startup. Also move initilization of the transit options panel
    before setting up the toggles, as it needs to be ready in the
    case where the saved mode is transit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783089

 src/sidebar.js |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/sidebar.js b/src/sidebar.js
index 736ea68..3c811fc 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -75,6 +75,14 @@ const Sidebar = new Lang.Class({
 
         this._query = Application.routeQuery;
         this._initInstructionList();
+
+        /* I could not get the custom GTK+ template widget to init properly
+         * from the UI file, we also need to manually insert the transit
+         * itinerary header widget into the GtkStack to get the correct
+         * animation direction.
+         */
+        this._transitOptionsPanel =
+            new TransitOptionsPanel.TransitOptionsPanel({ visible: true });
         this._initTransportationToggles(this._modePedestrianToggle,
                                         this._modeBikeToggle,
                                         this._modeCarToggle,
@@ -83,7 +91,7 @@ const Sidebar = new Lang.Class({
         this._initQuerySignals();
         this._query.addPoint(0);
         this._query.addPoint(1);
-        this._switchRoutingMode(RouteQuery.Transportation.CAR);
+        this._switchRoutingMode(Application.routeQuery.transportation);
         /* Enable/disable transit mode switch based on the presence of
          * OpenTripPlanner.
          * For some reason, setting visible to false in the UI file and
@@ -93,13 +101,7 @@ const Sidebar = new Lang.Class({
          */
         if (!Application.routingDelegator.openTripPlanner.enabled)
             this._modeTransitToggle.destroy();
-        /* I could not get the custom GTK+ template widget to init properly
-         * from the UI file, we also need to manually insert the transit
-         * itinerary header widget into the GtkStack to get the correct
-         * animation direction.
-         */
-        this._transitOptionsPanel =
-            new TransitOptionsPanel.TransitOptionsPanel({ visible: true });
+
         this._transitHeader.add_named(this._transitOptionsPanel, 'options');
         this._transitHeader.add_named(this._transitItineraryHeader,
                                       'itinerary-header');


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