Browse Source

loading-row: Remove set_loading

It can lead to an inconsistent state where loading is false but the
spinner is showing.
Let's stick with a single API to show the spinner, when there is no
error.
merge-requests/1461/head
Kévin Commaille 2 years ago
parent
commit
bd156606e3
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
  1. 20
      src/components/loading_row.rs

20
src/components/loading_row.rs

@ -47,8 +47,7 @@ mod imp {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpecBoolean::builder("loading")
.default_value(true)
.explicit_notify()
.read_only()
.build(),
glib::ParamSpecString::builder("error")
.explicit_notify()
@ -63,9 +62,6 @@ mod imp {
let obj = self.obj();
match pspec.name() {
"loading" => {
obj.set_loading(value.get().unwrap());
}
"error" => {
obj.set_error(value.get().unwrap());
}
@ -122,20 +118,6 @@ impl LoadingRow {
!self.imp().is_error.get()
}
/// Set whether to show the loading spinner.
pub fn set_loading(&self, loading: bool) {
let imp = self.imp();
if self.is_loading() == loading {
return;
}
imp.stack.set_visible_child(&*imp.spinner);
imp.is_error.set(false);
self.notify("loading");
}
/// The error message to display.
pub fn error(&self) -> Option<glib::GString> {
let message = self.imp().error_label.text();

Loading…
Cancel
Save