make Pixbuf init async

This commit is contained in:
yggverse 2024-10-29 18:41:05 +02:00
parent 66dc0ecfe8
commit 1d03e98b89

View file

@ -559,17 +559,17 @@ impl Page {
Priority::DEFAULT,
0x400, // 1024 bytes per chunk, optional step for images download tracking
0xA00000, // 10M bytes max to prevent memory overflow if server play with promises @TODO optional?
move |(_, total)| {
println!("{total}");
move |(_, _total)| {
// Update loading progress
// description = gformat!("{total}");
},
move |result| match result {
Ok(memory_input_stream) => {
match Pixbuf::from_stream( // @TODO async
Pixbuf::from_stream_async(
&memory_input_stream,
None::<&Cancellable>,
) {
move |result| {
match result {
Ok(buffer) => {
// Update page meta
meta.borrow_mut().status = Some(Status::Success);
@ -601,6 +601,8 @@ impl Page {
});
}
}
}
);
},
Err((error, reason)) => {
// Define common data