[gnome-maps/wip/mlundblad/transit-routing: 18/18] printOperation: Use transit print layout when requested



commit 5423c70bacf3e6e11fe2e483fe4ee2ee82561310
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Sep 20 23:56:19 2016 +0200

    printOperation: Use transit print layout when requested
    
    Use the transit print layout when a transit itinerary was selected.

 src/printOperation.js |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/printOperation.js b/src/printOperation.js
index 74b38b8..a81caa3 100644
--- a/src/printOperation.js
+++ b/src/printOperation.js
@@ -23,6 +23,7 @@ const Mainloop = imports.mainloop;
 
 const Application = imports.application;
 const PrintLayout = imports.printLayout;
+const TransitPrintLayout = imports.transitPrintLayout;
 const Utils = imports.utils;
 
 const _MIN_TIME_TO_ABORT = 3000;
@@ -57,6 +58,8 @@ const PrintOperation = new Lang.Class({
 
     _beginPrint: function(operation, context, data) {
         let route = Application.routeService.route;
+        let selectedTransitItinerary =
+            Application.openTripPlanner.plan.selectedItinerary;
         let width = context.get_width();
         let height = context.get_height();
 
@@ -67,7 +70,14 @@ const PrintOperation = new Lang.Class({
             return false;
         }).bind(this), null);
 
-        this._layout = PrintLayout.newFromRoute(route, width, height);
+        if (selectedTransitItinerary) {
+            this._layout =
+                new TransitPrintLayout.TransitPrintLayout({ itinerary: selectedTransitItinerary,
+                                                            pageWidth: width,
+                                                            pageHeight: height });
+        } else {
+            this._layout = PrintLayout.newFromRoute(route, width, height);
+        }
         this._layout.render();
     },
 


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