mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
make Pixbuf init async
This commit is contained in:
parent
66dc0ecfe8
commit
1d03e98b89
1 changed files with 34 additions and 32 deletions
|
|
@ -559,17 +559,17 @@ impl Page {
|
||||||
Priority::DEFAULT,
|
Priority::DEFAULT,
|
||||||
0x400, // 1024 bytes per chunk, optional step for images download tracking
|
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?
|
0xA00000, // 10M bytes max to prevent memory overflow if server play with promises @TODO optional?
|
||||||
move |(_, total)| {
|
move |(_, _total)| {
|
||||||
println!("{total}");
|
|
||||||
// Update loading progress
|
// Update loading progress
|
||||||
// description = gformat!("{total}");
|
// description = gformat!("{total}");
|
||||||
},
|
},
|
||||||
move |result| match result {
|
move |result| match result {
|
||||||
Ok(memory_input_stream) => {
|
Ok(memory_input_stream) => {
|
||||||
match Pixbuf::from_stream( // @TODO async
|
Pixbuf::from_stream_async(
|
||||||
&memory_input_stream,
|
&memory_input_stream,
|
||||||
None::<&Cancellable>,
|
None::<&Cancellable>,
|
||||||
) {
|
move |result| {
|
||||||
|
match result {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
// Update page meta
|
// Update page meta
|
||||||
meta.borrow_mut().status = Some(Status::Success);
|
meta.borrow_mut().status = Some(Status::Success);
|
||||||
|
|
@ -601,6 +601,8 @@ impl Page {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
Err((error, reason)) => {
|
Err((error, reason)) => {
|
||||||
// Define common data
|
// Define common data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue