Count the whole library in "All photographs" whatever is scoped (#76)

The sidebar's "All photographs" row was bound to library-total, which
is the scope's count: the header's "412 images" and the scrollbar's
size. Under a collection, and now under an album, the row read as the
album's size — 4 where the library holds 70.

It reads a separate library-whole-total now: the same number as the
scope's when nothing is scoped (no second count), and otherwise the
unscoped count under the same filter, read only when the view's facts
move, so scrolling inside an album does not recount the library.
This commit is contained in:
2026-09-26 16:19:54 -04:00
parent 5baaf9bac2
commit 7a56d16df1
5 changed files with 73 additions and 53 deletions
+15
View File
@@ -356,6 +356,21 @@ pub(super) fn load_window(window: &AppWindow, ctl: &Rc<LibraryController>) {
// signal that something was deleted out from under the view.
let was = window.global::<Library>().get_library_total().max(0) as usize;
window.global::<Library>().set_library_total(total as i32);
// TRACES: FR-CAT-7 | FR-EXP-10
// The sidebar's "All photographs" is the whole library whatever is
// scoped. The same number as `total` when nothing is — no second count
// then — and otherwise read only when the facts above moved, so a
// scroll inside an album does not recount the library.
if scope.is_none() && !trash {
window
.global::<Library>()
.set_library_whole_total(total as i32);
} else if describes_something_new {
let whole = library::total_images_scoped(catalog, None, &filter).unwrap_or(0);
window
.global::<Library>()
.set_library_whole_total(whole as i32);
}
let shrank = total < was;
// Clamp so a scrub to the very end still fills the window rather than