[gnome-maps] sidebar: Add spinner to instructionList



commit 227c90dc8686cc17321290173ff053766175545c
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Aug 28 20:52:41 2014 +0200

    sidebar: Add spinner to instructionList
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731068

 data/gnome-maps.css |    4 ----
 src/sidebar.js      |   18 +++++++++++++++++-
 src/sidebar.ui      |   42 ++++++++++++++++++++++++++++++------------
 3 files changed, 47 insertions(+), 17 deletions(-)
---
diff --git a/data/gnome-maps.css b/data/gnome-maps.css
index 9a56bbc..785c168 100644
--- a/data/gnome-maps.css
+++ b/data/gnome-maps.css
@@ -2,10 +2,6 @@
     padding: 5px;
 }
 
-.maps-stack {
-    background-color: @theme_bg_color;
-}
-
 .layer-radio-button {
     background-image: none;
     padding: 0px;
diff --git a/src/sidebar.js b/src/sidebar.js
index 8ac964e..de4c4df 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -51,11 +51,16 @@ const Sidebar = new Lang.Class({
         let ui = Utils.getUIObject('sidebar', [ 'sidebar',
                                                 'sidebar-form',
                                                 'instruction-list-scrolled',
+                                                'instruction-stack',
+                                                'instruction-spinner',
                                                 'instruction-list',
                                                 'mode-pedestrian-toggle',
                                                 'mode-bike-toggle',
                                                 'mode-car-toggle']);
         this._instructionList = ui.instructionList;
+        this._instructionStack = ui.instructionStack;
+        this._instructionWindow = ui.instructionListScrolled;
+        this._instructionSpinner = ui.instructionSpinner;
         this._initInstructionList();
 
         this._initTransportationToggles(ui.modePedestrianToggle,
@@ -107,10 +112,21 @@ const Sidebar = new Lang.Class({
 
     _initInstructionList: function() {
         let route = Application.routeService.route;
+        let query = Application.routeService.query;
+
+        route.connect('reset', (function() {
+            this._clearInstructions();
+            this._instructionStack.visible_child = this._instructionWindow;
+        }).bind(this));
+
+        query.connect('updated', (function() {
+            if (query.from && query.to)
+                this._instructionStack.visible_child = this._instructionSpinner;
+        }).bind(this));
 
-        route.connect('reset', this._clearInstructions.bind(this));
         route.connect('update', (function() {
             this._clearInstructions();
+            this._instructionStack.visible_child = this._instructionWindow;
 
             route.turnPoints.forEach((function(turnPoint) {
                 let row = new InstructionRow({ visible:true,
diff --git a/src/sidebar.ui b/src/sidebar.ui
index 49d6da6..a92813d 100644
--- a/src/sidebar.ui
+++ b/src/sidebar.ui
@@ -135,27 +135,45 @@
             <property name="label" translatable="yes">From</property>
             <property name="ellipsize">end</property>
           </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
         </child>
       </object>
     </child>
     <child>
-      <object class="GtkScrolledWindow" id="instruction-list-scrolled">
-        <property name="name">instruction-list-scrolled</property>
+      <object class="GtkFrame" id="instruction-frame">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">fill</property>
-        <property name="vexpand">True</property>
-        <property name="margin">1</property>
+        <property name="margin_top">10</property>
+        <property name="shadow_type">in</property>
         <child>
-          <object class="GtkListBox" id="instruction-list">
-            <property name="name">instruction-list</property>
+          <object class="GtkStack" id="instruction-stack">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="valign">fill</property>
+            <child>
+              <object class="GtkScrolledWindow" id="instruction-list-scrolled">
+                <property name="name">instruction-list-scrolled</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="valign">fill</property>
+                <property name="vexpand">True</property>
+                <property name="margin">1</property>
+                <property name="hscrollbar_policy">never</property>
+                <child>
+                  <object class="GtkListBox" id="instruction-list">
+                    <property name="name">instruction-list</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="valign">fill</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSpinner" id="instruction-spinner">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="active">True</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>


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