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
+1 -1
View File
@@ -1404,7 +1404,7 @@ in property <bool> panel-visible: true;
height: 100%;
rows: Collections.collection-rows;
selected-id: root.collection-selected;
total-images: Library.library-total;
total-images: Library.library-whole-total;
error: Collections.collection-error;
// TRACES: FR-NC-6a
+5
View File
@@ -500,6 +500,11 @@ export struct LibraryCell {
export global Library {
in-out property <[LibraryCell]> library-cells;
in property <int> library-total: 0;
/// The whole library under the current filter, whatever the grid is
/// narrowed to — what the sidebar's "All photographs" row counts.
/// `library-total` is the scope's, which under a collection or an album
/// made that row read as the album's size.
in property <int> library-whole-total: 0;
// Narrows the grid to images whose RAW is stored locally — the ones that
// can actually be opened while offline. Off by default: the catalog is the
// library, and hiding most of it the moment a connection drops would read