[gnome-maps/wip/mlundblad/airplane-transit-mode: 2/2] transitOptionsPanel: Add option for airplanes



commit 094916cbef2fa54d5c1232edab5cbe5396a678d3
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Sep 30 22:46:19 2019 +0200

    transitOptionsPanel: Add option for airplanes
    
    Add an option to select if airplanes should
    be considered for transit routing.

 data/ui/transit-options-panel.ui | 7 +++++++
 src/transitOptionsPanel.js       | 9 +++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/transit-options-panel.ui b/data/ui/transit-options-panel.ui
index 1d449cd..a11acfa 100644
--- a/data/ui/transit-options-panel.ui
+++ b/data/ui/transit-options-panel.ui
@@ -145,6 +145,13 @@
             <property name="label" translatable="yes">Ferries</property>
           </object>
         </child>
+        <child>
+          <object class="GtkCheckButton" id="airplaneCheckButton">
+            <property name="visible">True</property>
+            <property name="active">True</property>
+            <property name="label" translatable="yes">Airplanes</property>
+          </object>
+        </child>
       </object>
     </child>
   </object>
diff --git a/src/transitOptionsPanel.js b/src/transitOptionsPanel.js
index daa8b31..e26ef15 100644
--- a/src/transitOptionsPanel.js
+++ b/src/transitOptionsPanel.js
@@ -25,6 +25,7 @@ const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Application = imports.application;
+const HVT = imports.hvt;
 const Time = imports.time;
 const TransitOptions = imports.transitOptions;
 const TransitPlan = imports.transitPlan;
@@ -46,7 +47,8 @@ var TransitOptionsPanel = GObject.registerClass({
                        'tramCheckButton',
                        'trainCheckButton',
                        'subwayCheckButton',
-                       'ferryCheckButton']
+                       'ferryCheckButton',
+                       'airplaneCheckButton']
 }, class TransitOptionsPanel extends Gtk.Grid {
 
     _init(params) {
@@ -171,9 +173,10 @@ var TransitOptionsPanel = GObject.registerClass({
         let trainSelected = this._trainCheckButton.active;
         let subwaySelected = this._subwayCheckButton.active;
         let ferrySelected = this._ferryCheckButton.active;
+        let airplaneSelected = this._airplaneCheckButton.active;
 
         if (busSelected && tramSelected && trainSelected && subwaySelected &&
-            ferrySelected) {
+            ferrySelected && airplaneSelected) {
             options.showAllTransitTypes = true;
         } else {
             if (busSelected)
@@ -186,6 +189,8 @@ var TransitOptionsPanel = GObject.registerClass({
                 options.addTransitType(TransitPlan.RouteType.SUBWAY);
             if (ferrySelected)
                 options.addTransitType(TransitPlan.RouteType.FERRY);
+            if (airplaneSelected)
+                options.addTransitType(HVT.AIR_SERVICE);
         }
 
         return options;


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