[gnome-games/wip/exalm/statuspage: 3/6] empty-search: Replace with HdyStatusPage




commit 8ba408dc8adcde601d7db613339ddfb1499a7839
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Dec 29 02:52:26 2020 +0500

    empty-search: Replace with HdyStatusPage

 src/meson.build                   |  1 -
 src/org.gnome.Games.gresource.xml |  1 -
 src/ui/collection-view.ui         |  4 +++-
 src/ui/collection-view.vala       | 23 +++++++++----------
 src/ui/empty-search.ui            | 48 ---------------------------------------
 src/ui/empty-search.vala          | 35 ----------------------------
 6 files changed, 14 insertions(+), 98 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 004b4864..9932ecbf 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -141,7 +141,6 @@ vala_sources = [
   'ui/collections-page.vala',
   'ui/display-bin.vala',
   'ui/display-view.vala',
-  'ui/empty-search.vala',
   'ui/error-display.vala',
   'ui/error-info-bar.vala',
   'ui/flash-box.vala',
diff --git a/src/org.gnome.Games.gresource.xml b/src/org.gnome.Games.gresource.xml
index 9ac98fe3..85a687a9 100644
--- a/src/org.gnome.Games.gresource.xml
+++ b/src/org.gnome.Games.gresource.xml
@@ -47,7 +47,6 @@
     <file preprocess="xml-stripblanks">ui/collections-main-page.ui</file>
     <file preprocess="xml-stripblanks">ui/collections-page.ui</file>
     <file preprocess="xml-stripblanks">ui/display-view.ui</file>
-    <file preprocess="xml-stripblanks">ui/empty-search.ui</file>
     <file preprocess="xml-stripblanks">ui/error-display.ui</file>
     <file preprocess="xml-stripblanks">ui/error-info-bar.ui</file>
     <file preprocess="xml-stripblanks">ui/fullscreen-box.ui</file>
diff --git a/src/ui/collection-view.ui b/src/ui/collection-view.ui
index 719cb5f2..d5c87e7a 100644
--- a/src/ui/collection-view.ui
+++ b/src/ui/collection-view.ui
@@ -418,8 +418,10 @@
               <class name="background"/>
             </style>
             <child>
-              <object class="GamesEmptySearch" id="empty_search">
+              <object class="HdyStatusPage" id="empty_search">
                 <property name="visible">True</property>
+                <property name="icon_name">edit-find-symbolic</property>
+                <property name="description" translatable="yes">Try a different search.</property>
               </object>
             </child>
             <child>
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index 08a26ae4..42b4f540 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -27,7 +27,7 @@ private class Games.CollectionView : Gtk.Box, UiView {
        [GtkChild]
        private Hdy.StatusPage empty_collection;
        [GtkChild]
-       private EmptySearch empty_search;
+       private Hdy.StatusPage empty_search;
        [GtkChild]
        private GamesPage games_page;
        [GtkChild]
@@ -608,24 +608,23 @@ private class Games.CollectionView : Gtk.Box, UiView {
                filtering_text = search_bar.text;
 
                bool is_search_empty;
-               EmptySearch.SearchItem search_item;
-               if (viewstack.visible_child != collections_page) {
+
+               if (viewstack.visible_child != collections_page)
                        is_search_empty = games_page.is_search_empty || platforms_page.is_search_empty;
-                       search_item = EmptySearch.SearchItem.GAME;
-               }
-               else {
+               else
                        is_search_empty = collections_page.is_search_empty;
-                       search_item = collections_page.is_subpage_open ? EmptySearch.SearchItem.GAME:
-                                                                        EmptySearch.SearchItem.COLLECTION;
-               }
 
-               if (is_search_empty) {
+               if (is_search_empty)
                        empty_stack.visible_child = empty_search;
-                       empty_search.search_item = search_item;
-               }
                else
                        empty_stack.visible_child = viewstack;
 
+               if (viewstack.visible_child == collections_page &&
+                   !collections_page.is_subpage_open)
+                       empty_search.title = _("No collections found");
+               else
+                       empty_search.title = _("No games found");
+
                // Changing the filtering_text for the PlatformsPage might
                // cause the currently selected sidebar row to become empty and therefore
                // hidden. In this case the first visible row will become selected and


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