[connections/search-ux-fixups: 1/2] topbar: Only show search button when collection isn't empty
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/search-ux-fixups: 1/2] topbar: Only show search button when collection isn't empty
- Date: Mon, 3 May 2021 13:46:09 +0000 (UTC)
commit ddbb3e08c68e00221bd84e766f49deefa5e201dc
Author: Felipe Borges <felipeborges gnome org>
Date: Mon May 3 15:42:51 2021 +0200
topbar: Only show search button when collection isn't empty
Fixes #40
src/ui/topbar.ui | 2 +-
src/window.vala | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/topbar.ui b/src/ui/topbar.ui
index 946365f..71048a0 100644
--- a/src/ui/topbar.ui
+++ b/src/ui/topbar.ui
@@ -58,7 +58,7 @@
<child>
<object class="GtkToggleButton" id="search_button">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="use-underline">True</property>
<property name="valign">center</property>
<style>
diff --git a/src/window.vala b/src/window.vala
index 00b4435..df70030 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -71,6 +71,10 @@ namespace Connections {
public void bind_model (ListModel model) {
collection_view.bind_model (model);
+
+ model.items_changed.connect (() => {
+ topbar.search_button.visible = model.get_n_items () > 0;
+ });
}
public void items_changed () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]