[gnome-software: 4/5] search-page: Add a page for the empty search status




commit 2c7fbfcf016200fea1b395cfbc61f1cf3c675384
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Aug 5 13:55:13 2021 +0200

    search-page: Add a page for the empty search status
    
    This avoids saying there is no result when really there is no search.

 src/gs-search-page.c  | 10 ++++++++--
 src/gs-search-page.ui | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index abaa358a1..9503f9040 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -105,14 +105,20 @@ gs_search_page_get_search_cb (GObject *source_object,
                }
                g_warning ("failed to get search apps: %s", error->message);
                gs_stop_spinner (GTK_SPINNER (self->spinner_search));
-               gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
+               if (self->value && self->value[0])
+                       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
+               else
+                       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-search");
                return;
        }
 
        /* no results */
        if (gs_app_list_length (list) == 0) {
                g_debug ("no search results to show");
-               gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
+               if (self->value && self->value[0])
+                       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-results");
+               else
+                       gtk_stack_set_visible_child_name (GTK_STACK (self->stack_search), "no-search");
                return;
        }
 
diff --git a/src/gs-search-page.ui b/src/gs-search-page.ui
index d1511149f..f03c7193b 100644
--- a/src/gs-search-page.ui
+++ b/src/gs-search-page.ui
@@ -10,6 +10,16 @@
     <child>
       <object class="GtkStack" id="stack_search">
         <property name="visible">True</property>
+        <child>
+          <object class="HdyStatusPage">
+            <property name="visible">True</property>
+            <property name="icon_name">org.gnome.Software-symbolic</property>
+            <property name="title" translatable="yes">Search for Apps</property>
+          </object>
+          <packing>
+            <property name="name">no-search</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkSpinner" id="spinner_search">
             <property name="visible">True</property>


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