fn populate_similar_scrolled_view(
    scrolled_window: &ScrolledWindow,
    image_cache: &[(String, String, Image, Image, TreePath)],
    image_compare_left: &Image,
    image_compare_right: &Image,
    shared_using_for_preview: Rc<RefCell<(Option<TreePath>, Option<TreePath>)>>,
    shared_image_cache: Rc<RefCell<Vec<(String, String, Image, Image, TreePath)>>>,
    check_button_left_preview_text: &CheckButton,
    check_button_right_preview_text: &CheckButton,
    model: &TreeModel,
    column_selection: i32,
) {
    scrolled_window.set_child(None::<&Widget>);
    scrolled_window.set_propagate_natural_height(true);

    let all_gtk_box = gtk4::Box::new(Orientation::Horizontal, 5);
    all_gtk_box.set_widget_name("all_box");

    for (number, (path, _name, big_thumbnail, small_thumbnail, tree_path)) in image_cache.iter().enumerate() {
        let small_box = gtk4::Box::new(Orientation::Vertical, 3);

        let smaller_box = gtk4::Box::new(Orientation::Horizontal, 2);

        let button_left = gtk4::Button::builder().label(&flg!("compare_move_left_button")).build();
        let label = gtk4::Label::builder().label(&(number + 1).to_string()).build();
        let button_right = gtk4::Button::builder().label(&flg!("compare_move_right_button")).build();

        let image_compare_left = image_compare_left.clone();
        let image_compare_right = image_compare_right.clone();

        let big_thumbnail_clone = big_thumbnail.clone();
        let tree_path_clone = tree_path.clone();
        let all_gtk_box_clone = all_gtk_box.clone();
        let shared_using_for_preview_clone = shared_using_for_preview.clone();
        let shared_image_cache_clone = shared_image_cache.clone();
        let check_button_left_preview_text_clone = check_button_left_preview_text.clone();
        let model_clone = model.clone();
        let path_clone = path.clone();

        button_left.connect_clicked(move |_button_left| {
            shared_using_for_preview_clone.borrow_mut().0 = Some(tree_path_clone.clone());
            update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
            image_compare_left.set_paintable(big_thumbnail_clone.paintable().as_ref());

            let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
            check_button_left_preview_text_clone.set_active(is_active);
            check_button_left_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
        });

        let big_thumbnail_clone = big_thumbnail.clone();
        let tree_path_clone = tree_path.clone();
        let all_gtk_box_clone = all_gtk_box.clone();
        let shared_using_for_preview_clone = shared_using_for_preview.clone();
        let shared_image_cache_clone = shared_image_cache.clone();
        let check_button_right_preview_text_clone = check_button_right_preview_text.clone();
        let model_clone = model.clone();
        let path_clone = path.clone();

        button_right.connect_clicked(move |_button_right| {
            shared_using_for_preview_clone.borrow_mut().1 = Some(tree_path_clone.clone());
            update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
            image_compare_right.set_paintable(big_thumbnail_clone.paintable().as_ref());

            let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
            check_button_right_preview_text_clone.set_active(is_active);
            check_button_right_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
        });

        smaller_box.append(&button_left);
        smaller_box.append(&label);
        smaller_box.append(&button_right);

        small_box.append(&smaller_box);
        small_box.append(small_thumbnail);

        all_gtk_box.append(&small_box);
    }

    all_gtk_box.show();
    scrolled_window.set_child(Some(&all_gtk_box));
}
/// Populate bottom Scrolled View with small thumbnails
Populate bottom Scrolled View with small thumbnails
Populate bottom Scrolled View with small thumbnails
fn populate_similar_scrolled_view(
    scrolled_window: &ScrolledWindow,
    image_cache: &[(String, String, Image, Image, TreePath)],
    image_compare_left: &Image,
    image_compare_right: &Image,
    shared_using_for_preview: Rc<RefCell<(Option<TreePath>, Option<TreePath>)>>,
    shared_image_cache: Rc<RefCell<Vec<(String, String, Image, Image, TreePath)>>>,
    check_button_left_preview_text: &CheckButton,
    check_button_right_preview_text: &CheckButton,
    model: &TreeModel,
    column_selection: i32,
) {
    scrolled_window.set_child(None::<&Widget>);
    scrolled_window.set_propagate_natural_height(true);
    let all_gtk_box = gtk4::Box::new(Orientation::Horizontal, 5);
    all_gtk_box.set_widget_name("all_box");
    for (number, (path, _name, big_thumbnail, small_thumbnail, tree_path)) in image_cache.iter().enumerate() {
        let small_box = gtk4::Box::new(Orientation::Vertical, 3);
        let smaller_box = gtk4::Box::new(Orientation::Horizontal, 2);
        let button_left = gtk4::Button::builder().label(&flg!("compare_move_left_button")).build();
        let label = gtk4::Label::builder().label(&(number + 1).to_string()).build();
        let button_right = gtk4::Button::builder().label(&flg!("compare_move_right_button")).build();
        let image_compare_left = image_compare_left.clone();
        let image_compare_right = image_compare_right.clone();
        let big_thumbnail_clone = big_thumbnail.clone();
        let tree_path_clone = tree_path.clone();
        let all_gtk_box_clone = all_gtk_box.clone();
        let shared_using_for_preview_clone = shared_using_for_preview.clone();
        let shared_image_cache_clone = shared_image_cache.clone();
        let check_button_left_preview_text_clone = check_button_left_preview_text.clone();
        let model_clone = model.clone();
        let path_clone = path.clone();
        button_left.connect_clicked(move |_button_left| {
            shared_using_for_preview_clone.borrow_mut().0 = Some(tree_path_clone.clone());
            update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
            image_compare_left.set_paintable(big_thumbnail_clone.paintable().as_ref());
            let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
            check_button_left_preview_text_clone.set_active(is_active);
            check_button_left_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
        });
        let big_thumbnail_clone = big_thumbnail.clone();
        let tree_path_clone = tree_path.clone();
        let all_gtk_box_clone = all_gtk_box.clone();
        let shared_using_for_preview_clone = shared_using_for_preview.clone();
        let shared_image_cache_clone = shared_image_cache.clone();
        let check_button_right_preview_text_clone = check_button_right_preview_text.clone();
        let model_clone = model.clone();
        let path_clone = path.clone();
        button_right.connect_clicked(move |_button_right| {
            shared_using_for_preview_clone.borrow_mut().1 = Some(tree_path_clone.clone());
            update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
            image_compare_right.set_paintable(big_thumbnail_clone.paintable().as_ref());
            let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
            check_button_right_preview_text_clone.set_active(is_active);
            check_button_right_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
        });
        smaller_box.append(&button_left);
        smaller_box.append(&label);
        smaller_box.append(&button_right);
        small_box.append(&smaller_box);
        small_box.append(small_thumbnail);
        all_gtk_box.append(&small_box);
    }
    all_gtk_box.show();
    scrolled_window.set_child(Some(&all_gtk_box));
}
fn populate_similar_scrolled_view ( scrolled_window : & ScrolledWindow , image_cache : & [ ( String , String , Image , Image , TreePath ) ] , image_compare_left : & Image , image_compare_right : & Image , shared_using_for_preview : Rc < RefCell < ( Option < TreePath > , Option < TreePath > ) > > , shared_image_cache : Rc < RefCell < Vec < ( String , String , Image , Image , TreePath ) > > > , check_button_left_preview_text : & CheckButton , check_button_right_preview_text : & CheckButton , model : & TreeModel , column_selection : i32 , ) { scrolled_window . set_child ( None :: < & Widget > ) ; scrolled_window . set_propagate_natural_height ( true ) ; let all_gtk_box = gtk4 :: Box :: new ( Orientation :: Horizontal , 5 ) ; all_gtk_box . set_widget_name ( " " ) ; for ( number , ( path , _name , big_thumbnail , small_thumbnail , tree_path ) ) in image_cache . iter ( ) . enumerate ( ) { let small_box = gtk4 :: Box :: new ( Orientation :: Vertical , 3 ) ; let smaller_box = gtk4 :: Box :: new ( Orientation :: Horizontal , 2 ) ; let button_left = gtk4 :: Button :: builder ( ) . label ( & flg ! ( " " ) ) . build ( ) ; let label = gtk4 :: Label :: builder ( ) . label ( & ( number + 1 ) . to_string ( ) ) . build ( ) ; let button_right = gtk4 :: Button :: builder ( ) . label ( & flg ! ( " " ) ) . build ( ) ; let image_compare_left = image_compare_left . clone ( ) ; let image_compare_right = image_compare_right . clone ( ) ; let big_thumbnail_clone = big_thumbnail . clone ( ) ; let tree_path_clone = tree_path . clone ( ) ; let all_gtk_box_clone = all_gtk_box . clone ( ) ; let shared_using_for_preview_clone = shared_using_for_preview . clone ( ) ; let shared_image_cache_clone = shared_image_cache . clone ( ) ; let check_button_left_preview_text_clone = check_button_left_preview_text . clone ( ) ; let model_clone = model . clone ( ) ; let path_clone = path . clone ( ) ; button_left . connect_clicked ( move | _button_left | { shared_using_for_preview_clone . borrow_mut ( ) . 0 = Some ( tree_path_clone . clone ( ) ) ; update_bottom_buttons ( & all_gtk_box_clone , shared_using_for_preview_clone . clone ( ) , shared_image_cache_clone . clone ( ) ) ; image_compare_left . set_paintable ( big_thumbnail_clone . paintable ( ) . as_ref ( ) ) ; let is_active = model_clone . get :: < bool > ( & model_clone . iter ( & tree_path_clone ) . unwrap ( ) , column_selection ) ; check_button_left_preview_text_clone . set_active ( is_active ) ; check_button_left_preview_text_clone . set_label ( Some ( & format ! ( " " number 1 get_max_file_name ( path_clone 60 ) ) ) ) ; } ) ; let big_thumbnail_clone = big_thumbnail . clone ( ) ; let tree_path_clone = tree_path . clone ( ) ; let all_gtk_box_clone = all_gtk_box . clone ( ) ; let shared_using_for_preview_clone = shared_using_for_preview . clone ( ) ; let shared_image_cache_clone = shared_image_cache . clone ( ) ; let check_button_right_preview_text_clone = check_button_right_preview_text . clone ( ) ; let model_clone = model . clone ( ) ; let path_clone = path . clone ( ) ; button_right . connect_clicked ( move | _button_right | { shared_using_for_preview_clone . borrow_mut ( ) . 1 = Some ( tree_path_clone . clone ( ) ) ; update_bottom_buttons ( & all_gtk_box_clone , shared_using_for_preview_clone . clone ( ) , shared_image_cache_clone . clone ( ) ) ; image_compare_right . set_paintable ( big_thumbnail_clone . paintable ( ) . as_ref ( ) ) ; let is_active = model_clone . get :: < bool > ( & model_clone . iter ( & tree_path_clone ) . unwrap ( ) , column_selection ) ; check_button_right_preview_text_clone . set_active ( is_active ) ; check_button_right_preview_text_clone . set_label ( Some ( & format ! ( " " number 1 get_max_file_name ( path_clone 60 ) ) ) ) ; } ) ; smaller_box . append ( & button_left ) ; smaller_box . append ( & label ) ; smaller_box . append ( & button_right ) ; small_box . append ( & smaller_box ) ; small_box . append ( small_thumbnail ) ; all_gtk_box . append ( & small_box ) ; } all_gtk_box . show ( ) ; scrolled_window . set_child ( Some ( & all_gtk_box ) ) ; }
Populate bottom Scrolled View with small thumbnails
Populate bottom Scrolled View with small thumbnails
scrolled_window
&ScrolledWindow
image_cache
&[(String, String, Image, Image, TreePath)]
image_compare_left
&Image
image_compare_right
&Image
shared_using_for_preview
Rc<RefCell<(Option<TreePath>, Option<TreePath>)>>
shared_image_cache
Rc<RefCell<Vec<(String, String, Image, Image, TreePath)>>>
check_button_left_preview_text
&CheckButton
check_button_right_preview_text
&CheckButton
model
&TreeModel
column_selection
i32
scrolled_window
&ScrolledWindow
image_cache
&[(String, String, Image, Image, TreePath)]
image_compare_left
&Image
image_compare_right
&Image
shared_using_for_preview
Rc<RefCell<(Option<TreePath>, Option<TreePath>)>>
shared_image_cache
Rc<RefCell<Vec<(String, String, Image, Image, TreePath)>>>
check_button_left_preview_text
&CheckButton
check_button_right_preview_text
&CheckButton
model
&TreeModel
column_selection
i32