mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
remove extra comments
This commit is contained in:
parent
e4f475588b
commit
ef9e82abf9
@ -79,9 +79,7 @@ pub fn new(
|
|||||||
|
|
||||||
action.update.on_activate({
|
action.update.on_activate({
|
||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
move |_, message| {
|
move |_, message| status.set_default(&message)
|
||||||
status.set_default(&message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Init widget events
|
// Init widget events
|
||||||
@ -90,19 +88,15 @@ pub fn new(
|
|||||||
let progress = progress.clone();
|
let progress = progress.clone();
|
||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
move |button| {
|
move |button| {
|
||||||
// cancel all operations
|
button.set_sensitive(false);
|
||||||
cancellable.cancel();
|
|
||||||
// deactivate `spinner`
|
|
||||||
progress.disable();
|
|
||||||
// update `status` text
|
|
||||||
status.set_warning(STATUS_CANCELLED);
|
|
||||||
// hide self
|
|
||||||
button.set_visible(false);
|
button.set_visible(false);
|
||||||
|
cancellable.cancel();
|
||||||
|
progress.disable();
|
||||||
|
status.set_warning(STATUS_CANCELLED);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
choose.on_activate({
|
choose.on_activate({
|
||||||
// init shared references
|
|
||||||
let cancellable = cancellable.clone();
|
let cancellable = cancellable.clone();
|
||||||
let cancel = cancel.clone();
|
let cancel = cancel.clone();
|
||||||
let dialog = dialog.clone();
|
let dialog = dialog.clone();
|
||||||
@ -111,10 +105,8 @@ pub fn new(
|
|||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
let on_choose = Rc::new(on_choose);
|
let on_choose = Rc::new(on_choose);
|
||||||
move |button| {
|
move |button| {
|
||||||
// lock choose button to prevent double click
|
button.set_sensitive(false); // lock
|
||||||
button.set_sensitive(false);
|
|
||||||
dialog.save(Window::NONE, Some(&cancellable), {
|
dialog.save(Window::NONE, Some(&cancellable), {
|
||||||
// delegate shared references
|
|
||||||
let action = action.clone();
|
let action = action.clone();
|
||||||
let cancel = cancel.clone();
|
let cancel = cancel.clone();
|
||||||
let file_launcher = file_launcher.clone();
|
let file_launcher = file_launcher.clone();
|
||||||
@ -126,25 +118,16 @@ pub fn new(
|
|||||||
button.set_sensitive(true); // unlock
|
button.set_sensitive(true); // unlock
|
||||||
match result {
|
match result {
|
||||||
Ok(file) => {
|
Ok(file) => {
|
||||||
// update destination file
|
|
||||||
file_launcher.set_file(Some(&file));
|
file_launcher.set_file(Some(&file));
|
||||||
// update `status` text
|
|
||||||
status.set_default(STATUS_LOADING);
|
status.set_default(STATUS_LOADING);
|
||||||
// show `cancel` button
|
|
||||||
cancel.button.set_visible(true);
|
cancel.button.set_visible(true);
|
||||||
// show spinner
|
|
||||||
progress.enable();
|
progress.enable();
|
||||||
// hide self
|
|
||||||
button.set_visible(false);
|
button.set_visible(false);
|
||||||
// callback
|
|
||||||
on_choose(file, action)
|
on_choose(file, action)
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
// update destination file
|
|
||||||
file_launcher.set_file(File::NONE);
|
file_launcher.set_file(File::NONE);
|
||||||
// hide spinner
|
|
||||||
progress.disable();
|
progress.disable();
|
||||||
// update `status`
|
|
||||||
status.set_warning(e.message());
|
status.set_warning(e.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,10 +146,11 @@ pub fn new(
|
|||||||
let status = status.clone();
|
let status = status.clone();
|
||||||
let button = button.clone();
|
let button = button.clone();
|
||||||
move |result| {
|
move |result| {
|
||||||
if let Err(ref e) = result {
|
if let Err(e) = result {
|
||||||
status.set_error(e.message())
|
status.set_error(e.message())
|
||||||
|
} else {
|
||||||
|
button.set_sensitive(true); // unlock
|
||||||
}
|
}
|
||||||
button.set_sensitive(true); // unlock
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user