[gnome-maps/wip/mlundblad/transit-routing: 6/8] Add list box row class for transit stops
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 6/8] Add list box row class for transit stops
- Date: Wed, 24 Aug 2016 20:23:39 +0000 (UTC)
commit 4910a4a2626a55bed0f1ce4ff6c26f2151c8f3f9
Author: Marcus Lundblad <ml update uu se>
Date: Wed Jun 29 22:59:13 2016 +0200
Add list box row class for transit stops
List box row showing intermediate stops.
data/org.gnome.Maps.data.gresource.xml | 1 +
data/ui/transit-stop-row.ui | 50 ++++++++++++++++++++++++++++++
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitStopRow.js | 52 ++++++++++++++++++++++++++++++++
4 files changed, 104 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index d8cac68..a313ce8 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -36,6 +36,7 @@
<file preprocess="xml-stripblanks">ui/transit-leg-row.ui</file>
<file preprocess="xml-stripblanks">ui/transit-more-row.ui</file>
<file preprocess="xml-stripblanks">ui/transit-route-label.ui</file>
+ <file preprocess="xml-stripblanks">ui/transit-stop-row.ui</file>
<file preprocess="xml-stripblanks">ui/user-location-bubble.ui</file>
<file preprocess="xml-stripblanks">ui/zoom-control.ui</file>
<file preprocess="xml-stripblanks">ui/zoom-in-notification.ui</file>
diff --git a/data/ui/transit-stop-row.ui b/data/ui/transit-stop-row.ui
new file mode 100644
index 0000000..a75217b
--- /dev/null
+++ b/data/ui/transit-stop-row.ui
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<interface>
+ <template class="Gjs_TransitStopRow" parent="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-left">0</property>
+ <property name="margin-right">6</property>
+ <property name="icon-name">maps-point-end-symbolic</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="nameLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="halign">GTK_ALIGN_START</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="timeLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">GTK_ALIGN_END</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 6612de5..fa1b45d 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -83,6 +83,7 @@
<file>transitOptions.js</file>
<file>transitPlan.js</file>
<file>transitRouteLabel.js</file>
+ <file>transitStopRow.js</file>
<file>transitWalkMarker.js</file>
<file>translations.js</file>
<file>turnPointMarker.js</file>
diff --git a/src/transitStopRow.js b/src/transitStopRow.js
new file mode 100644
index 0000000..f7c2f58
--- /dev/null
+++ b/src/transitStopRow.js
@@ -0,0 +1,52 @@
+/* -*- 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 TransitStopRow = new Lang.Class({
+ Name: 'TransitStopRow',
+ Extends: Gtk.ListBoxRow,
+ Template: 'resource:///org/gnome/Maps/ui/transit-stop-row.ui',
+ InternalChildren: [ 'nameLabel',
+ 'timeLabel' ],
+
+ _init: function(params) {
+ this.stop = params.stop;
+ delete params.stop;
+
+ this._final = params.final;
+ delete params.final;
+
+ this.parent();
+
+ this._nameLabel.label = this.stop.name;
+
+ if (this._final)
+ this._timeLabel.label = this.stop.prettyPrintArrivalTime();
+ else
+ this._timeLabel.label = this.stop.prettyPrintDepartureTime();
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]