format request, begin download feature implementation

This commit is contained in:
yggverse 2024-12-09 14:55:20 +02:00
parent 88b3adaf2d
commit 09f2a17f22
6 changed files with 533 additions and 187 deletions

View file

@ -9,9 +9,10 @@ use text::Text;
use crate::app::browser::window::{tab::item::Action as TabAction, Action as WindowAction};
use gtk::{
gdk::Paintable,
gio::{Cancellable, File},
glib::Uri,
prelude::{BoxExt, IsA, WidgetExt},
Box, Orientation,
Box, Label, Orientation,
};
use std::{rc::Rc, time::Duration};
@ -45,6 +46,21 @@ impl Content {
image
}
/// Set new `content::Status` component for `Self` with new `status::Download` preset
///
/// * action removes previous children component from `Self`
pub fn to_status_download(
&self,
initial_filename: &str,
cancellable: &Cancellable,
on_choose: impl Fn(File, Label) + 'static,
) -> Status {
self.clean();
let status = Status::new_download(initial_filename, cancellable, on_choose);
self.gobject.append(status.gobject());
status
}
/// Set new `content::Status` component for `Self` with new `status::Failure` preset
///
/// * action removes previous children component from `Self`