[gnome-maps/gnome-3-38] placePopover: Add error state



commit bea84c33e21f41b70f6042fe6da8f8abee6b0b68
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Sep 21 22:44:56 2020 +0200

    placePopover: Add error state
    
    Add an error state and a function to display
    the error state when a search has failed.

 data/ui/place-popover.ui | 12 ++++++++++++
 src/placePopover.js      | 10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/place-popover.ui b/data/ui/place-popover.ui
index ae663a17..e04114bb 100644
--- a/data/ui/place-popover.ui
+++ b/data/ui/place-popover.ui
@@ -59,6 +59,18 @@
                 </style>
               </object>
             </child>
+            <child>
+              <object class="GtkLabel" id="errorLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">An error has occurred</property>
+                <property name="width_request">16</property>
+                <property name="height_request">16</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+            </child>
           </object>
         </child>
       </object>
diff --git a/src/placePopover.js b/src/placePopover.js
index d3c1d006..72917423 100644
--- a/src/placePopover.js
+++ b/src/placePopover.js
@@ -36,7 +36,8 @@ var PlacePopover = GObject.registerClass({
                         'stack',
                         'spinner',
                         'list',
-                        'noResultsLabel' ],
+                        'noResultsLabel',
+                        'errorLabel' ],
 }, class PlacePopover extends SearchPopover.SearchPopover {
 
     _init(props) {
@@ -101,6 +102,13 @@ var PlacePopover = GObject.registerClass({
         this._stack.visible_child = this._noResultsLabel;
     }
 
+    showError() {
+        if (this._spinner.active)
+            this._spinner.stop();
+
+        this._stack.visible_child = this._errorLabel;
+    }
+
     updateResult(places, searchString) {
         let i = 0;
 


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