[gnome-games] empty-search: Add search_item prop to make page more reusable
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] empty-search: Add search_item prop to make page more reusable
- Date: Tue, 25 Aug 2020 11:11:56 +0000 (UTC)
commit 9fad33ea9ef66be0864f0e5d7eee282cd015492b
Author: Neville <nevilleantony98 gmail com>
Date: Sat Aug 22 15:59:30 2020 +0530
empty-search: Add search_item prop to make page more reusable
This will be used in the upcoming commits to show a "No collections
found" page when no matches are found for search.
data/ui/empty-search.ui | 3 +--
src/ui/empty-search.vala | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/empty-search.ui b/data/ui/empty-search.ui
index e366e293b..8e7cc3c55 100644
--- a/data/ui/empty-search.ui
+++ b/data/ui/empty-search.ui
@@ -20,9 +20,8 @@
</object>
</child>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id="title">
<property name="visible">True</property>
- <property name="label" translatable="yes">No games found</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<style>
diff --git a/src/ui/empty-search.vala b/src/ui/empty-search.vala
index 2464e7efb..3efcceb86 100644
--- a/src/ui/empty-search.vala
+++ b/src/ui/empty-search.vala
@@ -2,4 +2,34 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/empty-search.ui")]
private class Games.EmptySearch : Gtk.Box {
+ public enum SearchItem {
+ GAME,
+ COLLECTION;
+
+ public string get_title () {
+ switch (this) {
+ case GAME:
+ return _("No games found");
+
+ case COLLECTION:
+ return _("No collections found");
+
+ default:
+ assert_not_reached ();
+ }
+ }
+ }
+
+ [GtkChild]
+ private Gtk.Label title;
+
+ private SearchItem _search_item;
+ public SearchItem search_item {
+ get { return _search_item; }
+ set {
+ _search_item = value;
+
+ title.label = search_item.get_title ();
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]