mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-10 20:51:45 +00:00
implement tab loading indicator
This commit is contained in:
parent
5f47253057
commit
472aadb9d3
@ -85,7 +85,11 @@ impl Item {
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
// Update child components
|
||||
self.page.update();
|
||||
|
||||
// Update tab loading indicator
|
||||
self.widget.gobject().set_loading(self.page.is_loading());
|
||||
}
|
||||
|
||||
pub fn clean(
|
||||
|
@ -447,22 +447,31 @@ impl Page {
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
// Update components
|
||||
self.navigation.update(self.progress_fraction());
|
||||
// @TODO self.content.update();
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn progress_fraction(&self) -> Option<f64> {
|
||||
// Interpret status to progress fraction
|
||||
let progress_fraction = match self.meta.borrow().status {
|
||||
match self.meta.borrow().status {
|
||||
Some(Status::Prepare | Status::Reload) => Some(0.0),
|
||||
Some(Status::Connect) => Some(0.25),
|
||||
Some(Status::Request) => Some(0.50),
|
||||
Some(Status::Response) => Some(0.75),
|
||||
Some(Status::Failure | Status::Redirect | Status::Success) => Some(1.0),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
// Update components
|
||||
self.navigation.update(progress_fraction);
|
||||
// @TODO self.content.update();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_loading(&self) -> bool {
|
||||
match self.progress_fraction() {
|
||||
Some(progress_fraction) => progress_fraction < 1.0,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn meta_title(&self) -> Option<GString> {
|
||||
self.meta.borrow().title.clone()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user