Make the Identity Manager a peer of the library and develop
It was reachable only from the library header, which made it a side trip rather than a mode. It is now reachable from develop's header too, beside the way back, because that is the same kind of move -- leaving this photograph for somewhere else in the library -- and a screen you can only reach from one of the other two is not a peer of them. Leaving returns to whichever screen opened it, and the button says which. A back button that read "Library" while returning to develop would be lying about the one thing a back button has to be right about. The develop session is only hidden, never torn down, so returning to it costs nothing and keeps the photographer's place. The header now matches the other two screens rather than using a close cross: three screens whose headers disagree read as three applications. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,13 @@ pub struct IdentityController {
|
||||
/// Images visited so far in the current sweep, and the total it announced.
|
||||
progress: std::cell::Cell<(usize, usize)>,
|
||||
faces_found: std::cell::Cell<usize>,
|
||||
/// Whether opening this screen left the library rather than develop.
|
||||
///
|
||||
/// Recorded so leaving puts the user back where they were. The screen is
|
||||
/// reachable from both other modes, and returning a photographer to the
|
||||
/// grid when they came from an open photograph loses their place for no
|
||||
/// reason.
|
||||
came_from_library: std::cell::Cell<bool>,
|
||||
/// Rail portraits, kept between refreshes.
|
||||
///
|
||||
/// Every mutating action reloads the whole screen, and cutting a portrait
|
||||
@@ -272,6 +279,13 @@ pub fn wire<S, M, P>(
|
||||
let models_present = models.clone();
|
||||
window.on_identity_open(move || {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
let from_library = w.get_show_library();
|
||||
ctl.came_from_library.set(from_library);
|
||||
w.set_identity_back_label(if from_library {
|
||||
"‹ Library".into()
|
||||
} else {
|
||||
"‹ Develop".into()
|
||||
});
|
||||
w.set_show_identity(true);
|
||||
// A fact about the filesystem, so it is re-checked on every open
|
||||
// rather than cached: the user may have just put the models there.
|
||||
@@ -282,8 +296,13 @@ pub fn wire<S, M, P>(
|
||||
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let ctl = ctl.clone();
|
||||
window.on_identity_close(move || {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
// Back to whichever screen this was opened from. The develop
|
||||
// session was never torn down — it was only hidden — so returning
|
||||
// to it costs nothing and keeps the photographer's place.
|
||||
w.set_show_library(ctl.came_from_library.get());
|
||||
w.set_show_identity(false);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user