1
0
Fork 0
mirror of synced 2024-06-18 18:34:54 +12:00
This commit is contained in:
Rafał Mikrut 2023-10-21 15:13:27 +02:00
parent 0c3dd22b0e
commit 0f56ca0187
2 changed files with 38 additions and 34 deletions

View file

@ -2,7 +2,7 @@ use crate::{split_path, CurrentTab, MainWindow};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use czkawka_core::common_tool::CommonData; use czkawka_core::common_tool::CommonData;
use czkawka_core::empty_folder::EmptyFolder; use czkawka_core::empty_folder::EmptyFolder;
use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak};
use std::path::PathBuf; use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;
use std::thread; use std::thread;
@ -16,6 +16,14 @@ pub fn connect_scan_button(app: &MainWindow) {
let a = app.as_weak(); let a = app.as_weak();
match active_tab { match active_tab {
CurrentTab::EmptyFolders => { CurrentTab::EmptyFolders => {
scan_empty_folders(a);
}
_ => panic!(),
}
});
}
fn scan_empty_folders(a: Weak<MainWindow>) {
thread::spawn(move || { thread::spawn(move || {
let mut ef = EmptyFolder::new(); let mut ef = EmptyFolder::new();
ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]);
@ -48,7 +56,3 @@ pub fn connect_scan_button(app: &MainWindow) {
}) })
}); });
} }
_ => panic!(),
}
});
}

View file

@ -24,9 +24,9 @@ fn main() {
items.push(slint::format!("Item {r}.{c}").into()); items.push(slint::format!("Item {r}.{c}").into());
} }
row_data.push((r % 4 == 0, r % 3 == 0, r % 2 == 0, ModelRc::new(items))); row_data.push((r % 2 == 0, false, true, ModelRc::new(items)));
} }
// app.set_empty_folder_model(row_data.into()); app.set_empty_folder_model(row_data.into());
connect_delete_button(&app); connect_delete_button(&app);
connect_scan_button(&app); connect_scan_button(&app);