[gnome-maps/wip/mlundblad/transit-routing: 10/16] 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: 10/16] Add list box row class for transit stops
- Date: Fri, 10 Feb 2017 06:56:44 +0000 (UTC)
commit e4c234e1051b3184d51fde9b32c67bd1901011d4
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.
https://bugzilla.gnome.org/show_bug.cgi?id=755808
data/org.gnome.Maps.data.gresource.xml | 1 +
data/ui/transit-stop-row.ui | 52 ++++++++++++++++++++++++++++++++
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitStopRow.js | 47 ++++++++++++++++++++++++++++
4 files changed, 101 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..6557ab7
--- /dev/null
+++ b/data/ui/transit-stop-row.ui
@@ -0,0 +1,52 @@
+<?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>
+ <property name="max-width-chars">25</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_END</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 27c8cca..698a8b8 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -86,6 +86,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..c9f6259
--- /dev/null
+++ b/src/transitStopRow.js
@@ -0,0 +1,47 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2017 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, see <http://www.gnu.org/licenses/>.
+ *
+ * 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(params);
+
+ this._nameLabel.label = this.stop.name;
+ this._timeLabel.label = this.stop.prettyPrint({ isFinal: this._final });
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]