From b7d3d16d2862f0103f37ea98977e7f34196bbe6a Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 18 Jun 2025 20:54:58 -0600 Subject: [PATCH] Fix compilation without gfvs feature --- src/tab.rs | 71 ++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/src/tab.rs b/src/tab.rs index f5341ae..669b61d 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -5421,50 +5421,41 @@ impl Tab { }; let metadata = item.metadata.clone(); - match metadata { - ItemMetadata::Path { .. } | ItemMetadata::GvfsPath { .. } => { - let mime = item.mime.clone(); + let can_thumbnail = match metadata { + ItemMetadata::Path { .. } => true, + #[cfg(feature = "gvfs")] + ItemMetadata::GvfsPath { .. } => true, + _ => false, + }; + if can_thumbnail { + let mime = item.mime.clone(); - subscriptions.push(Subscription::run_with_id( - ("thumbnail", path.clone()), - stream::channel(1, |mut output| async move { - let message = { - let path = path.clone(); - tokio::task::spawn_blocking(move || { - let start = Instant::now(); - let thumbnail = ItemThumbnail::new( - &path, - metadata, - mime, - THUMBNAIL_SIZE, - ); - log::debug!( - "thumbnailed {:?} in {:?}", - path, - start.elapsed() - ); - Message::Thumbnail(path.clone(), thumbnail) - }) - .await - .unwrap() - }; + subscriptions.push(Subscription::run_with_id( + ("thumbnail", path.clone()), + stream::channel(1, |mut output| async move { + let message = { + let path = path.clone(); + tokio::task::spawn_blocking(move || { + let start = Instant::now(); + let thumbnail = + ItemThumbnail::new(&path, metadata, mime, THUMBNAIL_SIZE); + log::debug!("thumbnailed {:?} in {:?}", path, start.elapsed()); + Message::Thumbnail(path.clone(), thumbnail) + }) + .await + .unwrap() + }; - match output.send(message).await { - Ok(()) => {} - Err(err) => { - log::warn!( - "failed to send thumbnail for {:?}: {}", - &path, - err - ); - } + match output.send(message).await { + Ok(()) => {} + Err(err) => { + log::warn!("failed to send thumbnail for {:?}: {}", &path, err); } + } - std::future::pending().await - }), - )); - } - _ => {} + std::future::pending().await + }), + )); } if subscriptions.len() >= jobs {