[gnome-maps/wip/mlundblad/transit-routing: 17/28] Add list box row for loading more transit results



commit 085877a9495cd76308c555f0a329cd7fa3dfbe27
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Aug 24 22:19:37 2016 +0200

    Add list box row for loading more transit results
    
    This adds a GtkListBoxRow implementation used as clickable placeholder
    for loading later/earlier transit alternatives.

 data/org.gnome.Maps.data.gresource.xml |    1 +
 data/ui/transit-more-row.ui            |   40 +++++++++++++++++++++++++
 po/POTFILES.in                         |    1 +
 src/org.gnome.Maps.src.gresource.xml   |    1 +
 src/transitMoreRow.js                  |   50 ++++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index f596942..d8cac68 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -34,6 +34,7 @@
     <file preprocess="xml-stripblanks">ui/transit-arrival-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-more-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-more-row.ui b/data/ui/transit-more-row.ui
new file mode 100644
index 0000000..7de5b98
--- /dev/null
+++ b/data/ui/transit-more-row.ui
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<interface>
+  <template class="Gjs_TransitMoreRow" parent="GtkListBoxRow">
+    <property name="visible">True</property>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="margin">13</property>
+        <child>
+          <object class="GtkStack" id="stack">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkLabel" id="label">
+                <property name="visible">True</property>
+                <property name="expand">True</property>
+              </object>
+              <packing>
+                <property name="name">label</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinner">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="active">True</property>
+              </object>
+              <packing>
+                <property name="name">spinner</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="top-attach">0</property>
+            <property name="left-attach">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4e5d75a..6bf15eb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -52,6 +52,7 @@ src/shapeLayer.js
 src/sidebar.js
 src/transitArrivalRow.js
 src/transitLegRow.js
+src/transitMoreRow.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 817bb75..91fa0a4 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -77,6 +77,7 @@
     <file>transitArrivalRow.js</file>
     <file>transitItineraryRow.js</file>
     <file>transitLegRow.js</file>
+    <file>transitMoreRow.js</file>
     <file>transitOptions.js</file>
     <file>transitPlan.js</file>
     <file>transitRouteLabel.js</file>
diff --git a/src/transitMoreRow.js b/src/transitMoreRow.js
new file mode 100644
index 0000000..66dcd1d
--- /dev/null
+++ b/src/transitMoreRow.js
@@ -0,0 +1,50 @@
+/* -*- 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 Application = imports.application;
+
+const TransitMoreRow = new Lang.Class({
+    Name: 'TransitMoreRow',
+    Extends: Gtk.ListBoxRow,
+    Template: 'resource:///org/gnome/Maps/ui/transit-more-row.ui',
+    InternalChildren: ['stack',
+                       'label'],
+
+    _init: function(params) {
+        this.parent(params);
+
+        if (Application.routeQuery.arriveBy)
+            this._label.label = _("Load earlier alternatives");
+        else
+            this._label.label = _("Load later alternatives");
+    },
+
+    startLoading: function() {
+        this._stack.visible_child_name = 'spinner';
+    }
+});


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