From 04161284a79bd58f9062ad4eb7714f8f55cfe68e Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sun, 19 Aug 2018 14:31:27 +0300 Subject: [PATCH] Headerbar: Make the switcher insensitive if empty If there are no shows/episodes to display, there isn't any point to being able to hit the switcher. --- podcasts-gtk/src/app.rs | 2 ++ podcasts-gtk/src/headerbar.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/podcasts-gtk/src/app.rs b/podcasts-gtk/src/app.rs index 4806a39..23247ed 100644 --- a/podcasts-gtk/src/app.rs +++ b/podcasts-gtk/src/app.rs @@ -356,6 +356,7 @@ impl App { // Disable refresh action .map(|action| action.set_enabled(false)); + self.headerbar.switch.set_sensitive(false); self.content.switch_to_empty_views(); } Action::PopulatedState => { @@ -365,6 +366,7 @@ impl App { // Enable refresh action .map(|action| action.set_enabled(true)); + self.headerbar.switch.set_sensitive(true); self.content.switch_to_populated(); } } diff --git a/podcasts-gtk/src/headerbar.rs b/podcasts-gtk/src/headerbar.rs index 6deb7c4..b68d5bc 100644 --- a/podcasts-gtk/src/headerbar.rs +++ b/podcasts-gtk/src/headerbar.rs @@ -21,7 +21,7 @@ use i18n::i18n; // TODO: Make a proper state machine for the headerbar states pub(crate) struct Header { pub(crate) container: gtk::HeaderBar, - switch: gtk::StackSwitcher, + pub(crate) switch: gtk::StackSwitcher, back: gtk::Button, show_title: gtk::Label, hamburger: gtk::MenuButton,