mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-21 10:23:48 +01:00
fix(gui): give Drive galleries room under their header
An open Drive gallery kept Add This Folder, Unlock and its options button in a row of their own above the grid. The row took height from the photos and left the options button touching the first row of tiles. They now sit in the page's header bar, where the timeline keeps its own menu. Rows in a Drive gallery also lose their extra side inset and use the timeline's tile gap vertically too, and the options menu no longer lists Refresh twice while hidden albums are locked.
This commit is contained in:
1 parent
0488ccd5f6
commit
08e0e80f34
12 files changed
+2490
-2427
No files matched your search
@@ -652,6 +652,7 @@ fn build_window(app: &adw::Application) {
|
||||
select_btn: gallery_widgets.select_btn.clone(),
|
||||
selection: gallery_widgets.selection.clone(),
|
||||
more: gallery_widgets.more.clone(),
|
||||
gallery_actions: gallery_widgets.gallery_actions.clone(),
|
||||
upload_face: gallery_widgets.upload_face.clone(),
|
||||
float_heading: gallery_widgets.float_heading.clone(),
|
||||
float_label: gallery_widgets.float_label.clone(),
|
||||
|
||||
@@ -552,7 +552,7 @@ impl Browser {
|
||||
if self.chooser.borrow().is_some() {
|
||||
return;
|
||||
}
|
||||
let width = (self.width.get() - 24).max(240);
|
||||
let width = self.width.get().max(240);
|
||||
let columns = ((width + 8) / 216).max(1);
|
||||
let card = (width - 8 * (columns - 1)) / columns;
|
||||
let mut rows = Vec::new();
|
||||
@@ -683,13 +683,15 @@ pub(crate) fn wire(
|
||||
hidden: >k4::Button,
|
||||
) {
|
||||
let title = ui.gallery.title.clone();
|
||||
let header = gtk4::Box::new(gtk4::Orientation::Horizontal, 8);
|
||||
header.set_halign(gtk4::Align::End);
|
||||
// The page's header bar holds these, beside Select (see `sync_header`).
|
||||
let header = &ui.gallery.gallery_actions;
|
||||
let choose = gtk4::Button::with_label(&gettext("Add This Folder"));
|
||||
choose.set_visible(false);
|
||||
choose.add_css_class("suggested-action");
|
||||
header.append(&choose);
|
||||
let more = gtk4::Button::from_icon_name("view-more-symbolic");
|
||||
more.set_tooltip_text(Some(&gettext("Gallery Options")));
|
||||
more.add_css_class("flat");
|
||||
let unlock = gtk4::Button::with_label(&gettext("Unlock"));
|
||||
unlock.set_visible(false);
|
||||
header.append(&unlock);
|
||||
@@ -709,7 +711,6 @@ pub(crate) fn wire(
|
||||
let status = gtk4::Label::new(None);
|
||||
status.set_wrap(true);
|
||||
let content = gtk4::Box::new(gtk4::Orientation::Vertical, 0);
|
||||
content.append(&header);
|
||||
content.append(&status);
|
||||
content.append(&scroll);
|
||||
ui.gallery
|
||||
@@ -794,12 +795,13 @@ pub(crate) fn wire(
|
||||
return;
|
||||
};
|
||||
let row = data.borrow::<Row>();
|
||||
// The page around the list already keeps its margins, so rows run edge
|
||||
// to edge like the timeline's.
|
||||
let line = gtk4::Box::new(gtk4::Orientation::Horizontal, 8);
|
||||
line.set_margin_start(12);
|
||||
line.set_margin_end(12);
|
||||
line.set_margin_bottom(8);
|
||||
match &*row {
|
||||
Row::Heading(label) => {
|
||||
line.set_margin_top(12);
|
||||
let label = gtk4::Label::new(Some(label));
|
||||
label.add_css_class("heading");
|
||||
line.append(&label);
|
||||
@@ -841,7 +843,9 @@ pub(crate) fn wire(
|
||||
}
|
||||
}
|
||||
Row::Media(items) => {
|
||||
// The same gap down as across, as in the timeline.
|
||||
line.set_spacing(super::photos::TILE_GAP);
|
||||
line.set_margin_bottom(super::photos::TILE_GAP);
|
||||
for (item, (width, height)) in items {
|
||||
let button = tile(
|
||||
&browser,
|
||||
@@ -918,11 +922,6 @@ pub(crate) fn wire(
|
||||
let browser = browser.clone();
|
||||
move || browser.close()
|
||||
});
|
||||
} else {
|
||||
menu.item(&gettext("Refresh galleries"), {
|
||||
let browser = browser.clone();
|
||||
move || browser.change(GalleryAction::Refresh)
|
||||
});
|
||||
}
|
||||
if let Some(album) = browser.current().filter(|album| !album.proton) {
|
||||
menu.item(&gettext("Choose Cover"), {
|
||||
|
||||
@@ -225,6 +225,9 @@ pub(crate) struct GalleryState {
|
||||
/// The header's page menu and the Upload button's face, which drops its
|
||||
/// label in a narrow window.
|
||||
pub(crate) more: gtk4::MenuButton,
|
||||
/// The header's end slot for an open Drive gallery's own buttons (Add
|
||||
/// This Folder, Unlock, options), filled by the Drive gallery browser.
|
||||
pub(crate) gallery_actions: gtk4::Box,
|
||||
pub(crate) upload_face: adw::ButtonContent,
|
||||
/// The section the top of the timeline is in, floating over the grid
|
||||
/// once its own heading has scrolled away.
|
||||
@@ -524,6 +527,7 @@ pub(crate) struct GalleryWidgets {
|
||||
pub(crate) select_btn: gtk4::Button,
|
||||
pub(crate) selection: SelectionBar,
|
||||
pub(crate) more: gtk4::MenuButton,
|
||||
pub(crate) gallery_actions: gtk4::Box,
|
||||
pub(crate) upload_face: adw::ButtonContent,
|
||||
pub(crate) float_heading: gtk4::Revealer,
|
||||
pub(crate) float_label: gtk4::Label,
|
||||
@@ -694,6 +698,12 @@ pub(crate) fn build_gallery_page() -> (gtk4::Widget, GalleryWidgets) {
|
||||
.build();
|
||||
more.add_css_class("flat");
|
||||
|
||||
// An open Drive gallery's own buttons live in the header too, not in a row
|
||||
// of their own above its grid: that row took height from the photos and
|
||||
// left its button touching the first row of tiles.
|
||||
let gallery_actions = gtk4::Box::new(gtk4::Orientation::Horizontal, 6);
|
||||
gallery_actions.set_visible(false);
|
||||
|
||||
// Picking photos is a mode: the button enters it, and the header then
|
||||
// trades the page's own controls for Cancel and a count, as GNOME apps do.
|
||||
let select_btn = gtk4::Button::builder()
|
||||
@@ -1002,6 +1012,7 @@ pub(crate) fn build_gallery_page() -> (gtk4::Widget, GalleryWidgets) {
|
||||
header.pack_start(&back);
|
||||
header.pack_start(&upload);
|
||||
header.pack_end(&more);
|
||||
header.pack_end(&gallery_actions);
|
||||
header.pack_end(&select_btn);
|
||||
header.pack_end(&selection.cancel);
|
||||
|
||||
@@ -1031,6 +1042,7 @@ pub(crate) fn build_gallery_page() -> (gtk4::Widget, GalleryWidgets) {
|
||||
select_btn,
|
||||
selection,
|
||||
more,
|
||||
gallery_actions,
|
||||
upload_face,
|
||||
float_heading,
|
||||
float_label,
|
||||
@@ -1141,6 +1153,7 @@ pub(crate) fn sync_header(ui: &Rc<Ui>) {
|
||||
gallery.back.set_visible(!selecting && collection);
|
||||
gallery.upload.set_visible(!selecting && !collection);
|
||||
gallery.more.set_visible(!selecting && !galleries);
|
||||
gallery.gallery_actions.set_visible(!selecting && galleries);
|
||||
gallery.select_btn.set_visible(!selecting && timeline);
|
||||
gallery.selection.title.set_visible(selecting);
|
||||
gallery.selection.cancel.set_visible(selecting);
|
||||
|
||||
+273
-268
File diff suppressed because it is too large.
Load diff
+266
-267
File diff suppressed because it is too large.
Load diff
+273
-268
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user