[gnome-maps/wip/mlundblad/transit-routing: 8/10] WIP: Add list box row to display a transit itinerary
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 8/10] WIP: Add list box row to display a transit itinerary
- Date: Mon, 6 Jun 2016 21:25:01 +0000 (UTC)
commit 65d6786aaf268cc44699a5d5ff130e0638dfa915
Author: Marcus Lundblad <ml update uu se>
Date: Mon Jun 6 23:19:56 2016 +0200
WIP: Add list box row to display a transit itinerary
data/org.gnome.Maps.data.gresource.xml | 1 +
data/ui/transit-leg-row.ui | 66 +++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitLegRow.js | 71 ++++++++++++++++++++++++++++++++
5 files changed, 140 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index 33cbea1..ebf23a5 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -32,6 +32,7 @@
<file preprocess="xml-stripblanks">ui/social-place-more-results-row.ui</file>
<file preprocess="xml-stripblanks">ui/social-place-row.ui</file>
<file preprocess="xml-stripblanks">ui/transit-itinerary-row.ui</file>
+ <file preprocess="xml-stripblanks">ui/transit-leg-row.ui</file>
<file preprocess="xml-stripblanks">ui/transit-route-label.ui</file>
<file preprocess="xml-stripblanks">ui/user-location-bubble.ui</file>
<file preprocess="xml-stripblanks">ui/zoom-control.ui</file>
diff --git a/data/ui/transit-leg-row.ui b/data/ui/transit-leg-row.ui
new file mode 100644
index 0000000..857050c
--- /dev/null
+++ b/data/ui/transit-leg-row.ui
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<interface>
+ <requires lib="gtk+" version="3.14"/>
+ <template class="Gjs_TransitLegRow" parent="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
+ <child>
+ <object class="GtkImage" id="modeImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-left">12</property>
+ <property name="margin-right">12</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="fromLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">GTK_ALIGN_START</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="headsignLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">3</property>
+ <property name="use-markup">True</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="timeLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c79f8f7..7267ca4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -49,6 +49,7 @@ src/routeService.js
src/sendToDialog.js
src/shapeLayer.js
src/sidebar.js
+src/transitLegRow.js
src/transitPlan.js
src/translations.js
src/utils.js
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 468f46d..66b5f7b 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -73,6 +73,7 @@
<file>storedRoute.js</file>
<file>togeojson/togeojson.js</file>
<file>transitItineraryRow.js</file>
+ <file>transitLegRow.js</file>
<file>transitOptions.js</file>
<file>transitPlan.js</file>
<file>transitRouteLabel.js</file>
diff --git a/src/transitLegRow.js b/src/transitLegRow.js
new file mode 100644
index 0000000..2855702
--- /dev/null
+++ b/src/transitLegRow.js
@@ -0,0 +1,71 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+const Lang = imports.lang;
+
+const _ = imports.gettext.gettext;
+
+const Gtk = imports.gi.Gtk;
+
+const TransitRouteLabel = imports.transitRouteLabel;
+const Utils = imports.utils;
+
+const TransitLegRow = new Lang.Class({
+ Name: 'TransitLegRow',
+ Extends: Gtk.ListBoxRow,
+ Template: 'resource:///org/gnome/Maps/ui/transit-leg-row.ui',
+ InternalChildren: ['grid',
+ 'modeImage',
+ 'fromLabel',
+ 'headsignLabel',
+ 'timeLabel'],
+
+ _init: function(params) {
+ this._leg = params.leg;
+ delete params.leg;
+
+ this._start = params.start;
+ delete params.start;
+
+ this.parent();
+
+ Utils.debug('from: ' + this._leg.from);
+
+ this._modeImage.icon_name = this._leg.iconName;
+ if (this._leg.from)
+ this._fromLabel.label = this._leg.from;
+
+ if (this._leg.transit)
+ this._grid.attach(new TransitRouteLabel.TransitRouteLabel({ leg: this._leg }),
+ 1, 1, 1, 1);
+
+ if (this._leg.transit) {
+ this._headsignLabel.label =
+ '<span size="small">%s</span>'.format(this._leg.headsign);
+ } else {
+ /* Translators: this is a format string indicating walking a certain
+ * distance, with the distance expression being the %s placeholder */
+ this._headsignLabel.label =
+ _("Walk %s").format(Utils.prettyDistance(this._leg.distance));
+ }
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]