[gnome-maps/wip/mlundblad/transit-routing: 1/13] application: Add a function to switch to/from transit route mode



commit 0a80a70e4f05c6dbb47d251ba1f7146dd379ab5d
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Nov 17 22:29:51 2016 +0100

    application: Add a function to switch to/from transit route mode
    
    Add a utility function in the Application module to switch routing
    "engine", so that modules such as the sidebar won't have to handle
    it themselves.

 src/application.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index e23ac9a..e666572 100644
--- a/src/application.js
+++ b/src/application.js
@@ -60,10 +60,25 @@ let openTripPlanner = null;
 let osmEdit = null;
 let normalStartup = true;
 let routeQuery = null;
+let transitRoutingEnabled = false;
 
 const _ensuredTypes = [WebKit2.WebView,
                        OSMTypeSearchEntry.OSMTypeSearchEntry];
 
+function setTransitRouting(enabled) {
+    if (enabled !== transitRoutingEnabled) {
+        if (enabled) {
+            routeService.disconnect();
+            openTripPlanner.connect();
+        } else {
+            openTripPlanner.disconnect();
+            routeService.connect();
+        }
+
+        transitRoutingEnabled = enabled;
+    }
+}
+
 const Application = new Lang.Class({
     Name: 'Application',
     Extends: Gtk.Application,


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