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



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

 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                  |   49 ++++++++++++++++++++++++++++++++
 5 files changed, 92 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 39fa36d..b7f54b9 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -78,6 +78,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..f0deb52
--- /dev/null
+++ b/src/transitMoreRow.js
@@ -0,0 +1,49 @@
+/* -*- 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 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]