mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-18 01:55:03 +01:00
fix(gui,fuse,core): fill in thumbnails without reopening the folder
Build thumbnails cancelled the requests of the tiles on screen, and those tiles stayed blank until the folder was opened again, or the whole recursive build ended. The daemon now publishes a new Topic::Thumbnails whenever a batch made at least one thumbnail. The app keeps the tiles still showing their icon across a cancel, and asks for them again on that event, whatever page is open. Older front-ends read the topic as Unknown, and older daemons never send it.
This commit is contained in:
1 parent
2308021aa2
commit
3f5001b2d2
5 files changed
+143
-7
No files matched your search
@@ -768,6 +768,9 @@ pub enum Topic {
|
||||
Conflicts,
|
||||
/// The activity log gained entries.
|
||||
Activity,
|
||||
/// File thumbnails were made or fetched. A front-end asks again for the
|
||||
/// tiles it still shows blank; the ones it already painted stay as they are.
|
||||
Thumbnails,
|
||||
/// A topic from a newer daemon, which this front-end cannot act on.
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
@@ -777,7 +780,7 @@ impl Topic {
|
||||
/// Every topic a front-end can act on. A new subscription is told all of
|
||||
/// them have changed, so it catches up on whatever happened while it was
|
||||
/// not connected.
|
||||
pub const ALL: [Topic; 9] = [
|
||||
pub const ALL: [Topic; 10] = [
|
||||
Topic::Files,
|
||||
Topic::Photos,
|
||||
Topic::Trash,
|
||||
@@ -787,6 +790,7 @@ impl Topic {
|
||||
Topic::Queue,
|
||||
Topic::Conflicts,
|
||||
Topic::Activity,
|
||||
Topic::Thumbnails,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2663,6 +2667,16 @@ mod tests {
|
||||
assert!(end.is_none(), "{end:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_thumbnail_change_travels_as_its_own_topic() {
|
||||
let line = serde_json::to_string(&Event::Changed {
|
||||
topics: vec![Topic::Thumbnails],
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(line, r#"{"Changed":{"topics":["thumbnails"]}}"#);
|
||||
assert!(Topic::ALL.contains(&Topic::Thumbnails));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_daemon_without_subscriptions_is_told_apart_from_a_dead_one() {
|
||||
let socket = fake_daemon("legacy", "{\"Error\":{\"message\":\"unknown request\"}}\n");
|
||||
|
||||
Reference in new issue
Block a user