Verified Commit 14d48188 authored by Jordan Petridis's avatar Jordan Petridis 🌱

App: Disable refresh action while in empty state

Close #71
parent 9f42e910
......@@ -349,8 +349,24 @@ impl App {
let menu = &s.get().container;
self.headerbar.set_secondary_menu(menu);
}
Action::EmptyState => self.content.switch_to_empty_views(),
Action::PopulatedState => self.content.switch_to_populated(),
Action::EmptyState => {
self.window
.lookup_action("refresh")
.and_then(|action| action.downcast::<gio::SimpleAction>().ok())
// Disable refresh action
.map(|action| action.set_enabled(false));
self.content.switch_to_empty_views();
}
Action::PopulatedState => {
self.window
.lookup_action("refresh")
.and_then(|action| action.downcast::<gio::SimpleAction>().ok())
// Enable refresh action
.map(|action| action.set_enabled(true));
self.content.switch_to_populated();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment