Compare commits

..
Author SHA1 Message Date
nvrl 2bf1622793 chore(deps): proton-sdk 0.12.3 and proton-gallery-rs 0.1.5
SDK 0.12.3 fetches a thumbnail with fewer round trips and caches the
thumbnail target per revision. proton-gallery-rs 0.1.5 advances the
Photos revision only when an album changed.
2026-11-21 17:08:41 +01:00
nvrl 2ea189f1d9 Merge pull request #118 from narrrl/chore/gallery-rs-0.1.3
perf(gui): cluster Places markers with proton-gallery-rs 0.1.3
2026-11-20 22:12:51 +01:00
nvrl 8af671d8ed perf(gui): cluster Places markers with proton-gallery-rs 0.1.3
The map kept its own copy of the marker clustering, identical to the one
in proton-gallery-rs. 0.1.3 makes that one fast (a grid of cells instead
of a scan of every bubble so far, same results), so the map now uses it.
2026-11-20 22:09:04 +01:00
nvrl 9047bdd741 Merge pull request #117 from narrrl/perf/photos-main-thread
perf(gui): keep Photos decoding and file access off the main thread
2026-11-20 21:48:52 +01:00
nvrl 61b992cb48 Merge pull request #115 from narrrl/fix/drive-gallery-header
fix(gui): give Drive galleries room under their header
2026-11-20 20:04:38 +01:00
3 changed files with 12 additions and 73 deletions

No files matched your search

Generated
+7 -6
View File
@@ -3952,9 +3952,9 @@ dependencies = [
[[package]]
name = "proton-drive-rs"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdeb7ee7495bc34198c78d7ec569f6371ad01a88f188b5eee418b013b082626a"
checksum = "e9f7e67c864033e2d13ff48f9e0738f22ae6401cc47131b266b90c23e0dcc381"
dependencies = [
"async-trait",
"base64 0.23.1",
@@ -4022,15 +4022,16 @@ dependencies = [
[[package]]
name = "proton-gallery-rs"
version = "0.1.1"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc9c9bbb76a5fba4071ee90de4aada71c292c0e408024ddfb04a12869291404a"
checksum = "e374d2053de5df0e6b0797df65d0d024dbce35f7aedfefd4a656896a0495dc9b"
dependencies = [
"aes-gcm 0.11.1",
"async-trait",
"getrandom 0.4.3",
"hex",
"kamadak-exif",
"proton-base-rs",
"rusqlite",
"serde",
"serde_json",
@@ -4059,9 +4060,9 @@ dependencies = [
[[package]]
name = "proton-sdk"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3189873dcdf0bc0a3d0fa5619cea80594085252d1d66a57459ec6adfd1f35ac1"
checksum = "a443d600225687a92724b455c025a049b8668fe9da52fbf7cb46583a8e4970a7"
dependencies = [
"aes-gcm 0.11.1",
"async-trait",
+3 -3
View File
@@ -15,10 +15,10 @@ keywords = ["proton", "drive", "fuse", "sync", "linux"]
categories = ["filesystem", "command-line-utilities"]
[workspace.dependencies]
proton-sdk = { version = "0.12.2" }
proton-drive-rs = { version = "0.12.2" }
proton-sdk = { version = "0.12.3" }
proton-drive-rs = { version = "0.12.3" }
proton-gallery-app-rs = "0.1.0"
proton-gallery-rs = "0.1.1"
proton-gallery-rs = "0.1.5"
chrono = { version = "0.4", default-features = false, features = ["std"] }
# Internal crates.
+2 -64
View File
@@ -17,6 +17,8 @@
//! a single photo opens it in its town, and photos taken on one spot, which
//! never part, are listed to pick from.
// Markers merge the same way in every Proton gallery app.
use proton_gallery_rs::places::{Bubble, bubble_radius, cluster, compact_count};
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
use std::sync::OnceLock;
@@ -137,13 +139,6 @@ fn parse_ring(line: &str) -> Option<Ring> {
Some(Ring { points, min, max })
}
/// Radius in px of a marker holding `photos` photos: big enough to make the
/// photo out, and growing with the count, but slowly, so a home town with
/// thousands doesn't cover a continent.
fn bubble_radius(photos: usize) -> f64 {
18.0 + 2.0 * (photos.max(1) as f64).ln()
}
/// What the map shows: which part of the world, at what size.
#[derive(Clone, Copy, Debug)]
struct View {
@@ -195,17 +190,6 @@ struct Marker {
target: Target,
}
/// One marker as last drawn, standing for one or more [`Marker`]s: where, how
/// big, and which (indices into [`MapState::markers`], the one with the most
/// photos first).
struct Bubble {
x: f64,
y: f64,
radius: f64,
photos: usize,
members: Vec<usize>,
}
/// A street-map tile ready to draw, and the names on it.
struct CachedTile {
surface: cairo::ImageSurface,
@@ -1648,52 +1632,6 @@ fn spread(points: &[World]) -> f64 {
span(&mut xs.into_iter()).max(span(&mut ys.into_iter()))
}
/// Merge markers whose circles would overlap on screen, the one with the
/// most photos claiming its neighbours (the first of equals, when counts
/// tie). Markers off screen are left out.
fn cluster(screen: &[(f64, f64)], counts: &[usize], width: f64, height: f64) -> Vec<Bubble> {
let mut order: Vec<usize> = (0..screen.len()).collect();
order.sort_by(|a, b| counts[*b].cmp(&counts[*a]));
let mut bubbles: Vec<Bubble> = Vec::new();
for index in order {
let (x, y) = screen[index];
let reach = bubble_radius(counts[index]);
if x < -reach || y < -reach || x > width + reach || y > height + reach {
continue;
}
match bubbles
.iter_mut()
.find(|b| (b.x - x).hypot(b.y - y) < b.radius + reach * 0.5)
{
Some(bubble) => {
bubble.photos += counts[index];
bubble.radius = bubble_radius(bubble.photos);
bubble.members.push(index);
}
None => bubbles.push(Bubble {
x,
y,
radius: reach,
photos: counts[index],
members: vec![index],
}),
}
}
// Smallest last, so a small marker next to a big one stays clickable.
bubbles.sort_by(|a, b| b.radius.total_cmp(&a.radius));
bubbles
}
/// "7", "840", "1.2k", "35k": short enough to fit a marker. Digits and the
/// "k" read the same in every language the app ships.
fn compact_count(n: usize) -> String {
match n {
0..1_000 => n.to_string(),
1_000..10_000 => format!("{:.1}k", n as f64 / 1_000.0),
_ => format!("{}k", n / 1_000),
}
}
fn set_color(cr: &cairo::Context, color: &gtk4::gdk::RGBA, alpha: f32) {
cr.set_source_rgba(
f64::from(color.red()),