cargo: Drop two dependencies
This commit is contained in:
parent
9ae694c760
commit
4370be282d
5 changed files with 10 additions and 13 deletions
|
|
@ -24,9 +24,9 @@ pub mod tiling;
|
|||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use async_channel as mpsc;
|
||||
pub use formats::RSVG_MAX_SIZE;
|
||||
use formats::*;
|
||||
use futures_channel::mpsc;
|
||||
|
||||
use self::tiling::SharedFrameBuffer;
|
||||
use crate::deps::*;
|
||||
|
|
@ -45,7 +45,7 @@ pub struct TileRequest {
|
|||
#[derive(Debug, Clone)]
|
||||
/// Signals update to the renderer
|
||||
pub struct UpdateSender {
|
||||
sender: mpsc::UnboundedSender<DecoderUpdate>,
|
||||
sender: mpsc::Sender<DecoderUpdate>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -97,10 +97,12 @@ impl glib::value::ToValueOptional for DecoderError {
|
|||
|
||||
impl UpdateSender {
|
||||
pub fn send(&self, update: DecoderUpdate) {
|
||||
let result = self.sender.unbounded_send(update);
|
||||
let result = self.sender.force_send(update);
|
||||
|
||||
if let Err(err) = result {
|
||||
log::error!("Failed to send update: {err}");
|
||||
match result {
|
||||
Err(err) => log::error!("Failed to send update: {err}"),
|
||||
Ok(Some(msg)) => log::error!("Unexpectedly replaced the message {msg:?}"),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +161,7 @@ impl Decoder {
|
|||
file: gio::File,
|
||||
mime_type: Option<String>,
|
||||
tiles: Arc<SharedFrameBuffer>,
|
||||
) -> (Self, mpsc::UnboundedReceiver<DecoderUpdate>) {
|
||||
) -> (Self, mpsc::Receiver<DecoderUpdate>) {
|
||||
let (sender, receiver) = mpsc::unbounded();
|
||||
|
||||
let update_sender = UpdateSender { sender };
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ use std::sync::{Arc, LazyLock};
|
|||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use futures_lite::StreamExt;
|
||||
use glib::subclass::Signal;
|
||||
use glib::{Properties, SignalGroup};
|
||||
|
||||
|
|
|
|||
|
|
@ -324,12 +324,12 @@ impl LpImage {
|
|||
// Reset background color for reloads
|
||||
imp.set_background_color(None);
|
||||
|
||||
let (decoder, mut decoder_update) =
|
||||
let (decoder, decoder_update) =
|
||||
Decoder::new(file.clone(), self.metadata().mime_type(), tiles.clone()).await;
|
||||
|
||||
let weak_obj = self.downgrade();
|
||||
glib::spawn_future_local(async move {
|
||||
while let Some(update) = decoder_update.next().await {
|
||||
while let Ok(update) = decoder_update.recv().await {
|
||||
if let Some(obj) = weak_obj.upgrade() {
|
||||
obj.imp().update(update);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue