[gnome-maps/wip/mlundblad/transit-routing: 1/13] application: Add a	function to switch to/from transit route mode
- From: Marcus Lundblad <mlundblad src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 1/13] application: Add a	function to switch to/from transit route mode
 
- Date: Mon, 21 Nov 2016 21:31:34 +0000 (UTC)
 
commit 27aba7120b7a4209e143043e7e6ff8af7a7272b3
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]