[gnome-maps/wip/mlundblad/transit-plugin-gtfs-local: 12/13] sidebar: Add a label for showing progress status message



commit ce7759e035c2d0231f6bf189b325ceaf0161eec7
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Mar 20 23:57:17 2020 +0100

    sidebar: Add a label for showing progress status message

 data/ui/sidebar.ui | 31 +++++++++++++++++++++++++++----
 src/sidebar.js     | 13 +++++++++++++
 2 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/sidebar.ui b/data/ui/sidebar.ui
index ab7b3890..0888d2a8 100644
--- a/data/ui/sidebar.ui
+++ b/data/ui/sidebar.ui
@@ -245,10 +245,33 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkSpinner" id="instructionSpinner">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="active">True</property>
+                  <object class="GtkGrid" id="instructionSpinner">
+                    <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
+                    <property name="valign">GTK_ALIGN_CENTER</property>
+                    <property name="halign">GTK_ALIGN_CENTER</property>
+                    <child>
+                      <object class="GtkSpinner">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="active">True</property>
+                        <property name="halign">GTK_ALIGN_CENTER</property>
+                      </object>
+                      <packing>
+                        <property name="top-attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="progressLabel">
+                        <property name="visible">False</property>
+                        <property name="can_focus">False</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="top-attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
                 <child>
diff --git a/src/sidebar.js b/src/sidebar.js
index 32946654..dbc41287 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -48,6 +48,7 @@ var Sidebar = GObject.registerClass({
                         'instructionSpinner',
                         'instructionStack',
                         'errorLabel',
+                        'progressLabel',
                         'modeBikeToggle',
                         'modeCarToggle',
                         'modePedestrianToggle',
@@ -323,6 +324,9 @@ var Sidebar = GObject.registerClass({
         // connect error handlers
         route.connect('error', (route, msg) => this._showError(msg));
         transitPlan.connect('error', (plan, msg) => this._showError(msg));
+
+        // connect progress handler
+        transitPlan.connect('progress', (plan, msg) => this._showProgress(msg));
     }
 
     _showError(msg) {
@@ -330,6 +334,15 @@ var Sidebar = GObject.registerClass({
         this._errorLabel.label = msg;
     }
 
+    _showProgress(msg) {
+        if (msg) {
+            this._progressLabel.visible = true;
+            this._progressLabel.label = msg;
+        } else {
+            this._progressLabel.visible = false;
+        }
+    }
+
     _clearTransitOverview() {
         let listBox = this._transitOverviewListBox;
         listBox.forall(listBox.remove.bind(listBox));


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