remove extra lines, update comments

This commit is contained in:
yggverse 2024-12-10 21:11:02 +02:00
parent 09c1655301
commit 59777a556f

View File

@ -26,7 +26,7 @@ const TITLE: &str = "Download";
/// Create new [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html) /// Create new [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
/// with progress indication and UI controls /// with progress indication and UI controls
/// * applies callback function once on destination [File](https://docs.gtk.org/gio/iface.File.html) selected /// * applies callback function once on destination [File](https://docs.gtk.org/gio/iface.File.html) selected
/// * requires external IOStream read/write implementation, depending of protocol driver in use /// * requires external IOStream read/write implementation (depending of protocol)
pub fn new( pub fn new(
initial_filename: &str, initial_filename: &str,
cancellable: &Cancellable, cancellable: &Cancellable,
@ -50,13 +50,10 @@ pub fn new(
move |_, button| { move |_, button| {
// cancel all operations // cancel all operations
cancellable.cancel(); cancellable.cancel();
// deactivate `spinner` // deactivate `spinner`
progress.disable(); progress.disable();
// update `status` text
// update `status`
status.set_warning(STATUS_CANCELLED); status.set_warning(STATUS_CANCELLED);
// hide self // hide self
button.set_visible(false); button.set_visible(false);
} }
@ -88,29 +85,22 @@ pub fn new(
Ok(file) => { Ok(file) => {
// update destination file // update destination file
file_launcher.set_file(Some(&file)); file_launcher.set_file(Some(&file));
// update `status` text // update `status` text
status.set_default(STATUS_LOADING); status.set_default(STATUS_LOADING);
// show `cancel` button // show `cancel` button
cancel.button.set_visible(true); cancel.button.set_visible(true);
// show spinner // show spinner
progress.enable(); progress.enable();
// hide self // hide self
button.set_visible(false); button.set_visible(false);
// callback // callback
on_choose(file, status.label.clone()) on_choose(file, status.label.clone())
} }
Err(e) => { Err(e) => {
// update destination file // update destination file
file_launcher.set_file(File::NONE); file_launcher.set_file(File::NONE);
// hide spinner // hide spinner
progress.disable(); progress.disable();
// update `status` // update `status`
status.set_warning(e.message()); status.set_warning(e.message());
} }