fix(photos): keep hidden albums open after unlock

This commit is contained in:
nvrl committed 2026-11-19 20:44:44 +01:00
1 parent 834684f6d7
commit 1e6043d12a
7 files changed
+30 -8

No files matched your search

+3 -3
View File
@@ -396,10 +396,10 @@ fn touched_topics(request: &CtlRequest) -> &'static [Topic] {
use CtlRequest as R;
match request {
R::Pin { .. } | R::Unpin { .. } => &[Topic::Files],
// Unlock affects private requests only. Publishing the lock notification
// here for Unlock as well could close the view that just opened.
R::DriveGallery {
action:
pdfs_core::control::GalleryAction::Lock
| pdfs_core::control::GalleryAction::Unlock { .. },
action: pdfs_core::control::GalleryAction::Lock,
} => &[Topic::GalleryVisibility],
R::CreateAlbum { .. }
| R::RenameAlbum { .. }
+3
View File
@@ -118,6 +118,9 @@ scale.browser-status-meter trough { min-width: 140px; min-height: 6px; }
.memory-card { padding: 0; border-radius: 12px; }
.memory-cover { border-radius: 12px; background: alpha(currentColor, 0.06); }
.memory-label { font-weight: 700; color: white; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); padding: 22px 10px 6px 10px; background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)); }
/* The button handles hover and clicks. The FlowBox cell can be wider than it. */
flowbox.photo-album-grid > flowboxchild:hover,
flowbox.photo-album-grid > flowboxchild:active { background: transparent; }
.album-card { padding: 0; border-radius: 16px; transition: background 180ms ease; }
.album-card:hover { background: alpha(currentColor, 0.07); }
.album-cover { border-radius: 16px; background: alpha(currentColor, 0.06); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32); transition: box-shadow 180ms ease; }
+1 -1
View File
@@ -138,7 +138,7 @@ fn follow_changes(ui: &Rc<Ui>, state: &FeedState, topics: &[Topic]) {
let page = ui.stack.visible_child_name();
if changed(Topic::GalleryVisibility) || changed(Topic::GalleryVisibilitySynced) {
if let Some(browser) = ui.drive_galleries.borrow().upgrade() {
browser.refresh_visibility();
browser.refresh_visibility(changed(Topic::GalleryVisibility));
}
for window in gtk4::Window::list_toplevels() {
if let Ok(window) = window.downcast::<gtk4::Window>()
+4 -1
View File
@@ -180,7 +180,10 @@ pub(crate) fn collection_card(
card.append(&name);
card.append(&count);
let button = gtk4::Button::builder().child(&card).build();
let button = gtk4::Button::builder()
.child(&card)
.halign(gtk4::Align::Start)
.build();
button.add_css_class("flat");
button.add_css_class("album-card");
button.set_tooltip_text(Some(title));
@@ -113,7 +113,7 @@ impl Browser {
sync_header(&self.ui);
}
pub(crate) fn refresh_visibility(self: &Rc<Self>) {
pub(crate) fn refresh_visibility(self: &Rc<Self>, locked: bool) {
self.thumbnails.borrow_mut().clear();
self.root.remove_all();
self.load_root();
@@ -124,7 +124,17 @@ impl Browser {
preview.force_close();
}
if self.unlocked.get() {
self.close();
if locked {
self.close();
} else {
// The first private listing can also discover a newer visibility
// snapshot. Rebuild from the private root so a folder that is no
// longer hidden cannot leave its title or contents on screen.
self.trail.borrow_mut().clear();
self.cover.borrow_mut().take();
self.thumb_pending.borrow_mut().clear();
self.load(0, 0.0);
}
} else {
self.load(0, self.scroll.vadjustment().value());
}
@@ -214,7 +224,6 @@ impl Browser {
},
(width, width.min(200)),
);
button.set_halign(gtk4::Align::Start);
wire_thumbnail(self, &picture, album.cover.as_deref(), private, None);
button
}
+2
View File
@@ -845,6 +845,7 @@ pub(crate) fn build_gallery_page() -> (gtk4::Widget, GalleryWidgets) {
.max_children_per_line(8)
.valign(gtk4::Align::Start)
.build();
albums.add_css_class("photo-album-grid");
let albums_status = adw::StatusPage::builder()
.icon_name("pdfs-album-symbolic")
.vexpand(true)
@@ -874,6 +875,7 @@ pub(crate) fn build_gallery_page() -> (gtk4::Widget, GalleryWidgets) {
.max_children_per_line(8)
.valign(gtk4::Align::Start)
.build();
drive_galleries.add_css_class("photo-album-grid");
let drive_status = gtk4::Label::builder().xalign(0.0).wrap(true).build();
drive_status.add_css_class("dim-label");
let add_gallery = gtk4::Button::with_label(&gettext("Add gallery"));