From bd156606e3271bbd528dfd69a1c47496e1c70647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 26 Oct 2023 12:45:48 +0200 Subject: [PATCH] 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. --- src/components/loading_row.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/components/loading_row.rs b/src/components/loading_row.rs index 8d558009..b2908e0b 100644 --- a/src/components/loading_row.rs +++ b/src/components/loading_row.rs @@ -47,8 +47,7 @@ mod imp { static PROPERTIES: Lazy> = 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 { let message = self.imp().error_label.text();