diff --git a/src/app/browser/window/tab/item/page/content/status/download.rs b/src/app/browser/window/tab/item/page/content/status/download.rs index f50fe6f1..8837f013 100644 --- a/src/app/browser/window/tab/item/page/content/status/download.rs +++ b/src/app/browser/window/tab/item/page/content/status/download.rs @@ -43,12 +43,11 @@ pub fn new( let progress = progress.clone(); let status = status.clone(); move |_, button| { - // apply cancellable + // cancel all operations cancellable.cancel(); // deactivate `spinner` - progress.spinner.set_visible(false); - progress.spinner.stop(); + progress.disable(); // update `status` status.label.set_css_classes(&["warning"]); @@ -94,8 +93,7 @@ pub fn new( cancel.button.set_visible(true); // show `spinner` - progress.spinner.set_visible(true); - progress.spinner.start(); + progress.enable(); // hide self button.set_visible(false); @@ -108,8 +106,7 @@ pub fn new( file_launcher.set_file(File::NONE); // update `spinner` - progress.spinner.set_visible(false); - progress.spinner.stop(); + progress.disable(); // update `status` status.label.set_css_classes(&["warning"]); diff --git a/src/app/browser/window/tab/item/page/content/status/download/progress.rs b/src/app/browser/window/tab/item/page/content/status/download/progress.rs index 044c7619..2e862fb3 100644 --- a/src/app/browser/window/tab/item/page/content/status/download/progress.rs +++ b/src/app/browser/window/tab/item/page/content/status/download/progress.rs @@ -1,4 +1,4 @@ -use gtk::Spinner; // use adw::Spinner; @TODO adw 1.6 / ubuntu 24.10+ +use gtk::{prelude::WidgetExt, Spinner}; // use adw::Spinner; @TODO adw 1.6 / ubuntu 24.10+ // Defaults @@ -22,4 +22,16 @@ impl Progress { .build(), } } + + // Actions + + pub fn enable(&self) { + self.spinner.set_visible(true); + self.spinner.start(); + } + + pub fn disable(&self) { + self.spinner.set_visible(false); + self.spinner.stop(); + } }