mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
implement progress spinner actions
This commit is contained in:
parent
df99760d0f
commit
7bdf38d327
@ -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"]);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user