mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20: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 progress = progress.clone();
|
||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
move |_, button| {
|
move |_, button| {
|
||||||
// apply cancellable
|
// cancel all operations
|
||||||
cancellable.cancel();
|
cancellable.cancel();
|
||||||
|
|
||||||
// deactivate `spinner`
|
// deactivate `spinner`
|
||||||
progress.spinner.set_visible(false);
|
progress.disable();
|
||||||
progress.spinner.stop();
|
|
||||||
|
|
||||||
// update `status`
|
// update `status`
|
||||||
status.label.set_css_classes(&["warning"]);
|
status.label.set_css_classes(&["warning"]);
|
||||||
@ -94,8 +93,7 @@ pub fn new(
|
|||||||
cancel.button.set_visible(true);
|
cancel.button.set_visible(true);
|
||||||
|
|
||||||
// show `spinner`
|
// show `spinner`
|
||||||
progress.spinner.set_visible(true);
|
progress.enable();
|
||||||
progress.spinner.start();
|
|
||||||
|
|
||||||
// hide self
|
// hide self
|
||||||
button.set_visible(false);
|
button.set_visible(false);
|
||||||
@ -108,8 +106,7 @@ pub fn new(
|
|||||||
file_launcher.set_file(File::NONE);
|
file_launcher.set_file(File::NONE);
|
||||||
|
|
||||||
// update `spinner`
|
// update `spinner`
|
||||||
progress.spinner.set_visible(false);
|
progress.disable();
|
||||||
progress.spinner.stop();
|
|
||||||
|
|
||||||
// update `status`
|
// update `status`
|
||||||
status.label.set_css_classes(&["warning"]);
|
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
|
// Defaults
|
||||||
|
|
||||||
@ -22,4 +22,16 @@ impl Progress {
|
|||||||
.build(),
|
.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