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



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

 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]