Skip to content

Commit

Permalink
make it wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Oct 16, 2024
1 parent 65c988b commit 3ea192a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ pub fn build_ui(app: &Application) {

let flowbox = FlowBox::builder()
.valign(gtk::Align::Start)
.halign(gtk::Align::Start)
.max_children_per_line(3)
.min_children_per_line(3)
.halign(gtk::Align::Fill)
.selection_mode(gtk::SelectionMode::None)
.hexpand(true)
.vexpand(true)
.homogeneous(true)
.row_spacing(10)
.column_spacing(10)
.build();

scrolled_window.set_child(Some(&flowbox));
Expand Down Expand Up @@ -90,10 +91,11 @@ fn load_images(folder: &PathBuf, flowbox: &Rc<RefCell<FlowBox>>) {
|| path.ends_with(".jpeg")
{
let image = Image::from_file(path);
image.set_pixel_size(200);
image.set_pixel_size(150); // Slightly smaller images

let button = Button::new();
button.set_child(Some(&image));
let button = Button::builder()
.child(&image)
.build();

let path_clone = path.to_string();
button.connect_clicked(move |_| {
Expand Down

0 comments on commit 3ea192a

Please sign in to comment.