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



commit 1a73c1119428c7549a1a177e989c2a99970028f5
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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755808

 src/application.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 3fc8550..a6e4008 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]