Change check if it is header to bool from string
This commit is contained in:
parent
3c15b726d4
commit
24635a0334
|
@ -167,7 +167,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
|
||||
// HEADER
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&base_file_entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -179,6 +179,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -187,7 +188,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
// MEAT
|
||||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -199,6 +200,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -224,7 +226,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
|
||||
// HEADER
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&base_file_entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -236,6 +238,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -244,7 +247,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -256,6 +259,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -282,7 +286,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
|
||||
// HEADER
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&base_file_entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -294,6 +298,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -301,7 +306,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
list_store.set(&list_store.append(), &values);
|
||||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -313,6 +318,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -341,7 +347,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
vector.clone()
|
||||
};
|
||||
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&"".to_string())),
|
||||
|
@ -350,13 +356,14 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsDuplicates::Modification as u32, (&"".to_string())), // No text in 3 column
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, (&(0))), // Not used here
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
list_store.set(&list_store.append(), &values);
|
||||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -372,6 +379,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -395,7 +403,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
vector.clone()
|
||||
};
|
||||
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&"".to_string())),
|
||||
|
@ -404,6 +412,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsDuplicates::Modification as u32, &"".to_string()), // No text in 3 column
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(0)),
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -411,7 +420,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -423,6 +432,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
|
@ -446,7 +456,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
} else {
|
||||
vector.clone()
|
||||
};
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&"".to_string())),
|
||||
|
@ -455,13 +465,14 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsDuplicates::Modification as u32, &"".to_string()), // No text in 3 column
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(0)), // Not used here
|
||||
(ColumnsDuplicates::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &true),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
|
||||
list_store.set(&list_store.append(), &values);
|
||||
for entry in vector {
|
||||
let (directory, file) = split_path(&entry.path);
|
||||
let values: [(u32, &dyn ToValue); 9] = [
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
(ColumnsDuplicates::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsDuplicates::SelectionButton as u32, &false),
|
||||
(ColumnsDuplicates::Size as u32, (&entry.size.file_size(options::BINARY).unwrap())),
|
||||
|
@ -473,6 +484,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsDuplicates::ModificationAsSecs as u32, &(entry.modified_date)),
|
||||
(ColumnsDuplicates::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsDuplicates::IsHeader as u32, &false),
|
||||
(ColumnsDuplicates::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -807,8 +819,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
let list_store = get_list_store(&tree_view_similar_images_finder);
|
||||
|
||||
if sf.get_use_reference() {
|
||||
let vec_struct_similar: &Vec<(czkawka_core::similar_images::FileEntry, Vec<czkawka_core::similar_images::FileEntry>)> =
|
||||
sf.get_similar_images_referenced();
|
||||
let vec_struct_similar: &Vec<(similar_images::FileEntry, Vec<similar_images::FileEntry>)> = sf.get_similar_images_referenced();
|
||||
for (base_file_entry, vec_file_entry) in vec_struct_similar.iter() {
|
||||
// Sort
|
||||
let vec_file_entry = if vec_file_entry.len() >= 2 {
|
||||
|
@ -824,7 +835,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
|
||||
// Header
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 12] = [
|
||||
let values: [(u32, &dyn ToValue); 13] = [
|
||||
(ColumnsSimilarImages::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSimilarImages::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarImages::Similarity as u32, &"".to_string()),
|
||||
|
@ -839,6 +850,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarImages::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsSimilarImages::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarImages::IsHeader as u32, &true),
|
||||
(ColumnsSimilarImages::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -846,7 +858,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
// Meat
|
||||
for file_entry in vec_file_entry.iter() {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 12] = [
|
||||
let values: [(u32, &dyn ToValue); 13] = [
|
||||
(ColumnsSimilarImages::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSimilarImages::SelectionButton as u32, &false),
|
||||
(
|
||||
|
@ -864,6 +876,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarImages::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSimilarImages::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarImages::IsHeader as u32, &false),
|
||||
(ColumnsSimilarImages::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -885,7 +898,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
};
|
||||
|
||||
// Header
|
||||
let values: [(u32, &dyn ToValue); 12] = [
|
||||
let values: [(u32, &dyn ToValue); 13] = [
|
||||
(ColumnsSimilarImages::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSimilarImages::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarImages::Similarity as u32, &"".to_string()),
|
||||
|
@ -897,6 +910,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsSimilarImages::Modification as u32, &"".to_string()),
|
||||
(ColumnsSimilarImages::ModificationAsSecs as u32, &(0)),
|
||||
(ColumnsSimilarImages::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarImages::IsHeader as u32, &true),
|
||||
(ColumnsSimilarImages::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -904,7 +918,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
// Meat
|
||||
for file_entry in vec_file_entry.iter() {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 12] = [
|
||||
let values: [(u32, &dyn ToValue); 13] = [
|
||||
(ColumnsSimilarImages::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSimilarImages::SelectionButton as u32, &false),
|
||||
(
|
||||
|
@ -922,6 +936,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarImages::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSimilarImages::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarImages::IsHeader as u32, &false),
|
||||
(ColumnsSimilarImages::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1005,7 +1020,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
|
||||
// Header
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
let values: [(u32, &dyn ToValue); 11] = [
|
||||
(ColumnsSimilarVideos::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSimilarVideos::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarVideos::Size as u32, &base_file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1018,6 +1033,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarVideos::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsSimilarVideos::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarVideos::IsHeader as u32, &true),
|
||||
(ColumnsSimilarVideos::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1025,7 +1041,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
// Meat
|
||||
for file_entry in vec_file_entry.iter() {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
let values: [(u32, &dyn ToValue); 11] = [
|
||||
(ColumnsSimilarVideos::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSimilarVideos::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarVideos::Size as u32, &file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1038,6 +1054,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarVideos::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSimilarVideos::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarVideos::IsHeader as u32, &false),
|
||||
(ColumnsSimilarVideos::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1060,7 +1077,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
};
|
||||
|
||||
// Header
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
let values: [(u32, &dyn ToValue); 11] = [
|
||||
(ColumnsSimilarVideos::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSimilarVideos::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarVideos::Size as u32, &"".to_string()),
|
||||
|
@ -1070,6 +1087,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsSimilarVideos::Modification as u32, &"".to_string()),
|
||||
(ColumnsSimilarVideos::ModificationAsSecs as u32, &(0)),
|
||||
(ColumnsSimilarVideos::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarVideos::IsHeader as u32, &true),
|
||||
(ColumnsSimilarVideos::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1077,7 +1095,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
// Meat
|
||||
for file_entry in vec_file_entry.iter() {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 10] = [
|
||||
let values: [(u32, &dyn ToValue); 11] = [
|
||||
(ColumnsSimilarVideos::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSimilarVideos::SelectionButton as u32, &false),
|
||||
(ColumnsSimilarVideos::Size as u32, &file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1090,6 +1108,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSimilarVideos::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSimilarVideos::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSimilarVideos::IsHeader as u32, &false),
|
||||
(ColumnsSimilarVideos::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1182,7 +1201,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
};
|
||||
|
||||
let (directory, file) = split_path(&base_file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 17] = [
|
||||
let values: [(u32, &dyn ToValue); 18] = [
|
||||
(ColumnsSameMusic::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSameMusic::SelectionButton as u32, &false),
|
||||
(ColumnsSameMusic::Size as u32, &base_file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1202,12 +1221,13 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSameMusic::ModificationAsSecs as u32, &(base_file_entry.modified_date)),
|
||||
(ColumnsSameMusic::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSameMusic::IsHeader as u32, &true),
|
||||
(ColumnsSameMusic::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
for file_entry in vec_file_entry {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 17] = [
|
||||
let values: [(u32, &dyn ToValue); 18] = [
|
||||
(ColumnsSameMusic::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSameMusic::SelectionButton as u32, &false),
|
||||
(ColumnsSameMusic::Size as u32, &file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1227,6 +1247,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSameMusic::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSameMusic::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSameMusic::IsHeader as u32, &false),
|
||||
(ColumnsSameMusic::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
@ -1250,7 +1271,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
vec_file_entry.clone()
|
||||
};
|
||||
|
||||
let values: [(u32, &dyn ToValue); 17] = [
|
||||
let values: [(u32, &dyn ToValue); 18] = [
|
||||
(ColumnsSameMusic::ActivatableSelectButton as u32, &false),
|
||||
(ColumnsSameMusic::SelectionButton as u32, &false),
|
||||
(ColumnsSameMusic::Size as u32, &"".to_string()),
|
||||
|
@ -1303,12 +1324,13 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
(ColumnsSameMusic::Modification as u32, &"".to_string()),
|
||||
(ColumnsSameMusic::ModificationAsSecs as u32, &(0)),
|
||||
(ColumnsSameMusic::Color as u32, &(HEADER_ROW_COLOR.to_string())),
|
||||
(ColumnsSameMusic::IsHeader as u32, &true),
|
||||
(ColumnsSameMusic::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
for file_entry in vec_file_entry {
|
||||
let (directory, file) = split_path(&file_entry.path);
|
||||
let values: [(u32, &dyn ToValue); 17] = [
|
||||
let values: [(u32, &dyn ToValue); 18] = [
|
||||
(ColumnsSameMusic::ActivatableSelectButton as u32, &true),
|
||||
(ColumnsSameMusic::SelectionButton as u32, &false),
|
||||
(ColumnsSameMusic::Size as u32, &file_entry.size.file_size(options::BINARY).unwrap()),
|
||||
|
@ -1328,6 +1350,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
|
|||
),
|
||||
(ColumnsSameMusic::ModificationAsSecs as u32, &(file_entry.modified_date)),
|
||||
(ColumnsSameMusic::Color as u32, &(MAIN_ROW_COLOR.to_string())),
|
||||
(ColumnsSameMusic::IsHeader as u32, &false),
|
||||
(ColumnsSameMusic::TextColor as u32, &(TEXT_COLOR.to_string())),
|
||||
];
|
||||
list_store.set(&list_store.append(), &values);
|
||||
|
|
|
@ -44,14 +44,14 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let model = tree_view.model().unwrap();
|
||||
|
||||
let group_number = count_number_of_groups(tree_view, nb_object.column_color.unwrap());
|
||||
let group_number = count_number_of_groups(tree_view, nb_object.column_header.unwrap());
|
||||
|
||||
if group_number == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check selected items
|
||||
let (current_group, tree_path) = get_current_group_and_iter_from_selection(&model, tree_view.selection(), nb_object.column_color.unwrap());
|
||||
let (current_group, tree_path) = get_current_group_and_iter_from_selection(&model, tree_view.selection(), nb_object.column_header.unwrap());
|
||||
|
||||
*shared_current_of_groups.borrow_mut() = current_group;
|
||||
*shared_numbers_of_groups.borrow_mut() = group_number;
|
||||
|
@ -128,7 +128,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
let current_group = *shared_current_of_groups.borrow();
|
||||
let group_number = *shared_numbers_of_groups.borrow();
|
||||
|
||||
let tree_path = move_iter(&model, shared_current_path.borrow().as_ref().unwrap(), nb_object.column_color.unwrap(), false);
|
||||
let tree_path = move_iter(&model, shared_current_path.borrow().as_ref().unwrap(), nb_object.column_header.unwrap(), false);
|
||||
|
||||
populate_groups_at_start(
|
||||
nb_object,
|
||||
|
@ -180,7 +180,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
let current_group = *shared_current_of_groups.borrow();
|
||||
let group_number = *shared_numbers_of_groups.borrow();
|
||||
|
||||
let tree_path = move_iter(&model, shared_current_path.borrow().as_ref().unwrap(), nb_object.column_color.unwrap(), true);
|
||||
let tree_path = move_iter(&model, shared_current_path.borrow().as_ref().unwrap(), nb_object.column_header.unwrap(), true);
|
||||
|
||||
populate_groups_at_start(
|
||||
nb_object,
|
||||
|
@ -279,7 +279,7 @@ fn populate_groups_at_start(
|
|||
button_go_next_compare_group.set_sensitive(true);
|
||||
}
|
||||
|
||||
let all_vec = get_all_path(model, &tree_path, nb_object.column_color.unwrap(), nb_object.column_path, nb_object.column_name);
|
||||
let all_vec = get_all_path(model, &tree_path, nb_object.column_header.unwrap(), nb_object.column_path, nb_object.column_name);
|
||||
*shared_current_path.borrow_mut() = Some(tree_path);
|
||||
|
||||
let cache_all_images = generate_cache_for_results(all_vec);
|
||||
|
@ -382,10 +382,10 @@ fn generate_cache_for_results(vector_with_path: Vec<(String, String, gtk4::TreeP
|
|||
}
|
||||
|
||||
/// Takes info about current items in groups like path
|
||||
fn get_all_path(model: &TreeModel, current_path: &TreePath, column_color: i32, column_path: i32, column_name: i32) -> Vec<(String, String, gtk4::TreePath)> {
|
||||
fn get_all_path(model: &TreeModel, current_path: &TreePath, column_header: i32, column_path: i32, column_name: i32) -> Vec<(String, String, gtk4::TreePath)> {
|
||||
let used_iter = model.iter(current_path).unwrap();
|
||||
|
||||
assert_eq!(model.get::<String>(&used_iter, column_color), HEADER_ROW_COLOR);
|
||||
assert!(model.get::<bool>(&used_iter, column_header));
|
||||
let using_reference = !model.get::<String>(&used_iter, column_path).is_empty();
|
||||
|
||||
let mut returned_vector = Vec::new();
|
||||
|
@ -415,9 +415,7 @@ fn get_all_path(model: &TreeModel, current_path: &TreePath, column_color: i32, c
|
|||
break;
|
||||
}
|
||||
|
||||
let color = model.get::<String>(&used_iter, column_color);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&used_iter, column_header) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -428,10 +426,10 @@ fn get_all_path(model: &TreeModel, current_path: &TreePath, column_color: i32, c
|
|||
}
|
||||
|
||||
/// Moves iterator to previous/next header
|
||||
fn move_iter(model: >k4::TreeModel, tree_path: &TreePath, column_color: i32, go_next: bool) -> TreePath {
|
||||
fn move_iter(model: >k4::TreeModel, tree_path: &TreePath, column_header: i32, go_next: bool) -> TreePath {
|
||||
let tree_iter = model.iter(tree_path).unwrap();
|
||||
|
||||
assert_eq!(model.get::<String>(&tree_iter, column_color), HEADER_ROW_COLOR);
|
||||
assert!(model.get::<bool>(&tree_iter, column_header));
|
||||
|
||||
if go_next {
|
||||
if !model.iter_next(&tree_iter) {
|
||||
|
@ -454,9 +452,7 @@ fn move_iter(model: >k4::TreeModel, tree_path: &TreePath, column_color: i32, g
|
|||
}
|
||||
}
|
||||
|
||||
let color = model.get::<String>(&tree_iter, column_color);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&tree_iter, column_header) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +565,7 @@ fn update_bottom_buttons(
|
|||
}
|
||||
}
|
||||
|
||||
fn get_current_group_and_iter_from_selection(model: &TreeModel, selection: TreeSelection, column_color: i32) -> (u32, TreePath) {
|
||||
fn get_current_group_and_iter_from_selection(model: &TreeModel, selection: TreeSelection, column_header: i32) -> (u32, TreePath) {
|
||||
let mut current_group = 1;
|
||||
let mut possible_group = 1;
|
||||
let mut header_clone: TreeIter;
|
||||
|
@ -580,7 +576,7 @@ fn get_current_group_and_iter_from_selection(model: &TreeModel, selection: TreeS
|
|||
let iter = model.iter_first().unwrap(); // Checking that treeview is not empty should be done before
|
||||
header_clone = iter; // if nothing selected, use first group
|
||||
possible_header = iter; // if nothing selected, use first group
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
|
||||
if !selected_records.is_empty() {
|
||||
let first_selected_record = selected_records[0].clone();
|
||||
|
@ -589,7 +585,7 @@ fn get_current_group_and_iter_from_selection(model: &TreeModel, selection: TreeS
|
|||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
possible_group += 1;
|
||||
possible_header = iter;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ pub async fn delete_things(gui_data: GuiData) {
|
|||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
|
||||
let (number_of_selected_items, number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_color, nb_object.column_selection);
|
||||
let (number_of_selected_items, number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_header, nb_object.column_selection);
|
||||
|
||||
// Nothing is selected
|
||||
if number_of_selected_items == 0 {
|
||||
|
@ -57,11 +57,11 @@ pub async fn delete_things(gui_data: GuiData) {
|
|||
return;
|
||||
}
|
||||
|
||||
if let Some(column_color) = nb_object.column_color {
|
||||
if let Some(column_header) = nb_object.column_header {
|
||||
if !check_button_settings_confirm_group_deletion.is_active()
|
||||
|| !check_if_deleting_all_files_in_group(
|
||||
tree_view,
|
||||
column_color,
|
||||
column_header,
|
||||
nb_object.column_selection,
|
||||
nb_object.column_path,
|
||||
&window_main,
|
||||
|
@ -73,7 +73,7 @@ pub async fn delete_things(gui_data: GuiData) {
|
|||
tree_view,
|
||||
nb_object.column_name,
|
||||
nb_object.column_path,
|
||||
column_color,
|
||||
column_header,
|
||||
nb_object.column_selection,
|
||||
&check_button_settings_use_trash,
|
||||
&text_view_errors,
|
||||
|
@ -200,7 +200,7 @@ fn create_dialog_group_deletion(window_main: >k4::Window) -> (Dialog, CheckBut
|
|||
|
||||
pub async fn check_if_deleting_all_files_in_group(
|
||||
tree_view: >k4::TreeView,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_selection: i32,
|
||||
column_path: i32,
|
||||
window_main: >k4::Window,
|
||||
|
@ -211,7 +211,7 @@ pub async fn check_if_deleting_all_files_in_group(
|
|||
let mut selected_all_records: bool = true;
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
|
||||
// It is safe to remove any number of files in reference mode
|
||||
if !model.get::<String>(&iter, column_path).is_empty() {
|
||||
|
@ -223,7 +223,7 @@ pub async fn check_if_deleting_all_files_in_group(
|
|||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if selected_all_records {
|
||||
break;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ pub fn tree_remove(
|
|||
tree_view: >k4::TreeView,
|
||||
column_file_name: i32,
|
||||
column_path: i32,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_selection: i32,
|
||||
check_button_settings_use_trash: &CheckButton,
|
||||
text_view_errors: &TextView,
|
||||
|
@ -473,7 +473,7 @@ pub fn tree_remove(
|
|||
if let Some(iter) = model.iter_first() {
|
||||
loop {
|
||||
if model.get::<bool>(&iter, column_selection) {
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR {
|
||||
if !model.get::<bool>(&iter, column_header) {
|
||||
selected_rows.push(model.path(&iter));
|
||||
} else {
|
||||
panic!("Header row shouldn't be selected, please report bug.");
|
||||
|
@ -530,7 +530,7 @@ pub fn tree_remove(
|
|||
}
|
||||
}
|
||||
|
||||
clean_invalid_headers(&model, column_color, column_path);
|
||||
clean_invalid_headers(&model, column_header, column_path);
|
||||
|
||||
text_view_errors.buffer().set_text(messages.as_str());
|
||||
}
|
||||
|
|
|
@ -57,11 +57,11 @@ async fn sym_hard_link_things(gui_data: GuiData, hardlinking: TypeOfTool) {
|
|||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
|
||||
let column_color = nb_object.column_color.expect("Linking can be only used for tree views with grouped results");
|
||||
let column_header = nb_object.column_header.expect("Linking can be only used for tree views with grouped results");
|
||||
|
||||
let check_button_settings_confirm_link = gui_data.settings.check_button_settings_confirm_link.clone();
|
||||
|
||||
if !check_if_anything_is_selected_async(tree_view, column_color, nb_object.column_selection).await {
|
||||
if !check_if_anything_is_selected_async(tree_view, column_header, nb_object.column_selection).await {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ async fn sym_hard_link_things(gui_data: GuiData, hardlinking: TypeOfTool) {
|
|||
return;
|
||||
}
|
||||
|
||||
if !check_if_changing_one_item_in_group_and_continue(tree_view, column_color, nb_object.column_selection, &window_main).await {
|
||||
if !check_if_changing_one_item_in_group_and_continue(tree_view, column_header, nb_object.column_selection, &window_main).await {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ async fn sym_hard_link_things(gui_data: GuiData, hardlinking: TypeOfTool) {
|
|||
tree_view,
|
||||
nb_object.column_name,
|
||||
nb_object.column_path,
|
||||
column_color,
|
||||
column_header,
|
||||
nb_object.column_selection,
|
||||
hardlinking,
|
||||
&text_view_errors,
|
||||
|
@ -100,7 +100,7 @@ fn hardlink_symlink(
|
|||
tree_view: >k4::TreeView,
|
||||
column_file_name: i32,
|
||||
column_path: i32,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_selection: i32,
|
||||
hardlinking: TypeOfTool,
|
||||
text_view_errors: &TextView,
|
||||
|
@ -126,7 +126,7 @@ fn hardlink_symlink(
|
|||
if let Some(iter) = model.iter_first() {
|
||||
loop {
|
||||
if model.get::<bool>(&iter, column_selection) {
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR {
|
||||
if !model.get::<bool>(&iter, column_header) {
|
||||
selected_rows.push(model.path(&iter));
|
||||
} else {
|
||||
panic!("Header row shouldn't be selected, please report bug.");
|
||||
|
@ -145,7 +145,7 @@ fn hardlink_symlink(
|
|||
let mut current_symhardlink_data: Option<SymHardlinkData> = None;
|
||||
let mut current_selected_index = 0;
|
||||
loop {
|
||||
if model.get::<String>(¤t_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(¤t_iter, column_header) {
|
||||
if let Some(current_symhardlink_data) = current_symhardlink_data {
|
||||
if !current_symhardlink_data.files_to_symhardlink.is_empty() {
|
||||
vec_symhardlink_data.push(current_symhardlink_data);
|
||||
|
@ -257,7 +257,7 @@ fn hardlink_symlink(
|
|||
model.remove(&model.iter(tree_path).unwrap());
|
||||
}
|
||||
|
||||
clean_invalid_headers(&model, column_color, column_path);
|
||||
clean_invalid_headers(&model, column_header, column_path);
|
||||
}
|
||||
|
||||
fn create_dialog_non_group(window_main: >k4::Window) -> Dialog {
|
||||
|
@ -284,20 +284,20 @@ fn create_dialog_non_group(window_main: >k4::Window) -> Dialog {
|
|||
dialog
|
||||
}
|
||||
|
||||
pub async fn check_if_changing_one_item_in_group_and_continue(tree_view: >k4::TreeView, column_color: i32, column_selection: i32, window_main: >k4::Window) -> bool {
|
||||
pub async fn check_if_changing_one_item_in_group_and_continue(tree_view: >k4::TreeView, column_header: i32, column_selection: i32, window_main: >k4::Window) -> bool {
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
let mut selected_values_in_group = 0;
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
|
||||
loop {
|
||||
if !model.iter_next(&iter) {
|
||||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if selected_values_in_group == 1 {
|
||||
break;
|
||||
}
|
||||
|
@ -328,18 +328,18 @@ pub async fn check_if_changing_one_item_in_group_and_continue(tree_view: >k4::
|
|||
true
|
||||
}
|
||||
|
||||
pub async fn check_if_anything_is_selected_async(tree_view: >k4::TreeView, column_color: i32, column_selection: i32) -> bool {
|
||||
pub async fn check_if_anything_is_selected_async(tree_view: >k4::TreeView, column_header: i32, column_selection: i32) -> bool {
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
|
||||
loop {
|
||||
if !model.iter_next(&iter) {
|
||||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR && model.get::<bool>(&iter, column_selection) {
|
||||
if !model.get::<bool>(&iter, column_header) && model.get::<bool>(&iter, column_selection) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ pub fn connect_button_move(gui_data: &GuiData) {
|
|||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
|
||||
let (number_of_selected_items, _number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_color, nb_object.column_selection);
|
||||
let (number_of_selected_items, _number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_header, nb_object.column_selection);
|
||||
|
||||
// Nothing is selected
|
||||
if number_of_selected_items == 0 {
|
||||
|
@ -41,7 +41,7 @@ pub fn connect_button_move(gui_data: &GuiData) {
|
|||
tree_view,
|
||||
nb_object.column_name,
|
||||
nb_object.column_path,
|
||||
nb_object.column_color,
|
||||
nb_object.column_header,
|
||||
nb_object.column_selection,
|
||||
&entry_info,
|
||||
&text_view_errors,
|
||||
|
@ -67,7 +67,7 @@ fn move_things(
|
|||
tree_view: >k4::TreeView,
|
||||
column_file_name: i32,
|
||||
column_path: i32,
|
||||
column_color: Option<i32>,
|
||||
column_header: Option<i32>,
|
||||
column_selection: i32,
|
||||
entry_info: >k4::Entry,
|
||||
text_view_errors: >k4::TextView,
|
||||
|
@ -97,7 +97,6 @@ fn move_things(
|
|||
for index in 0..g_files.n_items() {
|
||||
let file = &g_files.item(index);
|
||||
if let Some(file) = file {
|
||||
println!("{:?}", file);
|
||||
let ss = file.clone().downcast::<gtk4::gio::File>().unwrap();
|
||||
if let Some(path_buf) = ss.path() {
|
||||
folders.push(path_buf);
|
||||
|
@ -116,12 +115,12 @@ fn move_things(
|
|||
);
|
||||
} else {
|
||||
let folder = folders[0].clone();
|
||||
if let Some(column_color) = column_color {
|
||||
if let Some(column_header) = column_header {
|
||||
move_with_tree(
|
||||
&tree_view,
|
||||
column_file_name,
|
||||
column_path,
|
||||
column_color,
|
||||
column_header,
|
||||
column_selection,
|
||||
folder,
|
||||
&entry_info,
|
||||
|
@ -140,7 +139,7 @@ fn move_with_tree(
|
|||
tree_view: >k4::TreeView,
|
||||
column_file_name: i32,
|
||||
column_path: i32,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_selection: i32,
|
||||
destination_folder: PathBuf,
|
||||
entry_info: >k4::Entry,
|
||||
|
@ -153,7 +152,7 @@ fn move_with_tree(
|
|||
if let Some(iter) = model.iter_first() {
|
||||
loop {
|
||||
if model.get::<bool>(&iter, column_selection) {
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR {
|
||||
if !model.get::<bool>(&iter, column_header) {
|
||||
selected_rows.push(model.path(&iter));
|
||||
} else {
|
||||
panic!("Header row shouldn't be selected, please report bug.");
|
||||
|
@ -172,7 +171,7 @@ fn move_with_tree(
|
|||
|
||||
move_files_common(&selected_rows, &model, column_file_name, column_path, &destination_folder, entry_info, text_view_errors);
|
||||
|
||||
clean_invalid_headers(&model, column_color, column_path);
|
||||
clean_invalid_headers(&model, column_header, column_path);
|
||||
}
|
||||
|
||||
fn move_with_list(
|
||||
|
|
|
@ -11,13 +11,13 @@ use crate::help_functions::*;
|
|||
// File length variable allows users to choose duplicates which have shorter file name
|
||||
// e.g. 'tar.gz' will be selected instead 'tar.gz (copy)' etc.
|
||||
|
||||
fn popover_select_all(popover: >k4::Popover, tree_view: >k4::TreeView, column_button_selection: u32, column_color: Option<i32>) {
|
||||
fn popover_select_all(popover: >k4::Popover, tree_view: >k4::TreeView, column_button_selection: u32, column_header: Option<i32>) {
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
if let Some(column_color) = column_color {
|
||||
if let Some(column_header) = column_header {
|
||||
loop {
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR {
|
||||
if !model.get::<bool>(&iter, column_header) {
|
||||
model.set_value(&iter, column_button_selection, &true.to_value());
|
||||
}
|
||||
if !model.iter_next(&iter) {
|
||||
|
@ -52,13 +52,13 @@ fn popover_unselect_all(popover: >k4::Popover, tree_view: >k4::TreeView, col
|
|||
popover.popdown();
|
||||
}
|
||||
|
||||
fn popover_reverse(popover: >k4::Popover, tree_view: >k4::TreeView, column_button_selection: u32, column_color: Option<i32>) {
|
||||
fn popover_reverse(popover: >k4::Popover, tree_view: >k4::TreeView, column_button_selection: u32, column_header: Option<i32>) {
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
if let Some(column_color) = column_color {
|
||||
if let Some(column_header) = column_header {
|
||||
loop {
|
||||
if model.get::<String>(&iter, column_color) == MAIN_ROW_COLOR {
|
||||
if !model.get::<bool>(&iter, column_header) {
|
||||
let current_value: bool = model.get::<bool>(&iter, column_button_selection as i32);
|
||||
model.set_value(&iter, column_button_selection, &(!current_value).to_value());
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ fn popover_reverse(popover: >k4::Popover, tree_view: >k4::TreeView, column_b
|
|||
fn popover_all_except_oldest_newest(
|
||||
popover: >k4::Popover,
|
||||
tree_view: >k4::TreeView,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_modification_as_secs: i32,
|
||||
column_file_name: i32,
|
||||
column_button_selection: u32,
|
||||
|
@ -105,8 +105,7 @@ fn popover_all_except_oldest_newest(
|
|||
let mut file_length: usize = 0;
|
||||
|
||||
loop {
|
||||
let color = model.get::<String>(&iter, column_color);
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if !model.iter_next(&iter) {
|
||||
end = true;
|
||||
}
|
||||
|
@ -158,7 +157,7 @@ fn popover_all_except_oldest_newest(
|
|||
fn popover_one_oldest_newest(
|
||||
popover: >k4::Popover,
|
||||
tree_view: >k4::TreeView,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_modification_as_secs: i32,
|
||||
column_file_name: i32,
|
||||
column_button_selection: u32,
|
||||
|
@ -180,8 +179,7 @@ fn popover_one_oldest_newest(
|
|||
let mut file_length: usize = 0;
|
||||
|
||||
loop {
|
||||
let color = model.get::<String>(&iter, column_color);
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if !model.iter_next(&iter) {
|
||||
end = true;
|
||||
}
|
||||
|
@ -235,7 +233,7 @@ fn popover_custom_select_unselect(
|
|||
popover: >k4::Popover,
|
||||
window_main: &Window,
|
||||
tree_view: >k4::TreeView,
|
||||
column_color: Option<i32>,
|
||||
column_header: Option<i32>,
|
||||
column_file_name: i32,
|
||||
column_path: i32,
|
||||
column_button_selection: u32,
|
||||
|
@ -409,9 +407,8 @@ fn popover_custom_select_unselect(
|
|||
let mut number_of_already_selected_things = 0;
|
||||
let mut vec_of_iters: Vec<TreeIter> = Vec::new();
|
||||
loop {
|
||||
if let Some(column_color) = column_color {
|
||||
let color = model.get::<String>(&iter, column_color);
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if let Some(column_header) = column_header {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if select_things {
|
||||
if check_all_selected && (number_of_all_things - number_of_already_selected_things == vec_of_iters.len()) {
|
||||
vec_of_iters.pop();
|
||||
|
@ -512,7 +509,7 @@ fn popover_custom_select_unselect(
|
|||
fn popover_all_except_biggest_smallest(
|
||||
popover: >k4::Popover,
|
||||
tree_view: >k4::TreeView,
|
||||
column_color: i32,
|
||||
column_header: i32,
|
||||
column_size_as_bytes: i32,
|
||||
column_dimensions: Option<i32>,
|
||||
column_button_selection: u32,
|
||||
|
@ -536,8 +533,7 @@ fn popover_all_except_biggest_smallest(
|
|||
};
|
||||
|
||||
loop {
|
||||
let color = model.get::<String>(&iter, column_color);
|
||||
if color == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
if !model.iter_next(&iter) {
|
||||
end = true;
|
||||
}
|
||||
|
@ -618,7 +614,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
|
||||
popover_select_all(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_color);
|
||||
popover_select_all(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_header);
|
||||
});
|
||||
|
||||
let popover_select = gui_data.popovers.popover_select.clone();
|
||||
|
@ -642,7 +638,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
|
||||
popover_reverse(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_color);
|
||||
popover_reverse(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_header);
|
||||
});
|
||||
|
||||
let popover_select = gui_data.popovers.popover_select.clone();
|
||||
|
@ -657,7 +653,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_all_except_oldest_newest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("AEO can't be used without headers"),
|
||||
nb_object.column_header.expect("AEO can't be used without headers"),
|
||||
nb_object.column_modification_as_secs.expect("AEO needs modification as secs column"),
|
||||
nb_object.column_name,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -677,7 +673,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_all_except_oldest_newest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("AEN can't be used without headers"),
|
||||
nb_object.column_header.expect("AEN can't be used without headers"),
|
||||
nb_object.column_modification_as_secs.expect("AEN needs modification as secs column"),
|
||||
nb_object.column_name,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -697,7 +693,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_one_oldest_newest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("OO can't be used without headers"),
|
||||
nb_object.column_header.expect("OO can't be used without headers"),
|
||||
nb_object.column_modification_as_secs.expect("OO needs modification as secs column"),
|
||||
nb_object.column_name,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -717,7 +713,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_one_oldest_newest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("ON can't be used without headers"),
|
||||
nb_object.column_header.expect("ON can't be used without headers"),
|
||||
nb_object.column_modification_as_secs.expect("ON needs modification as secs column"),
|
||||
nb_object.column_name,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -739,7 +735,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
&popover_select,
|
||||
&window_main,
|
||||
tree_view,
|
||||
nb_object.column_color,
|
||||
nb_object.column_header,
|
||||
nb_object.column_name,
|
||||
nb_object.column_path,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -761,7 +757,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
&popover_select,
|
||||
&window_main,
|
||||
tree_view,
|
||||
nb_object.column_color,
|
||||
nb_object.column_header,
|
||||
nb_object.column_name,
|
||||
nb_object.column_path,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -781,7 +777,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_all_except_biggest_smallest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("AEB can't be used without headers"),
|
||||
nb_object.column_header.expect("AEB can't be used without headers"),
|
||||
nb_object.column_size_as_bytes.expect("AEB needs size as bytes column"),
|
||||
nb_object.column_dimensions,
|
||||
nb_object.column_selection as u32,
|
||||
|
@ -801,7 +797,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
popover_all_except_biggest_smallest(
|
||||
&popover_select,
|
||||
tree_view,
|
||||
nb_object.column_color.expect("AES can't be used without headers"),
|
||||
nb_object.column_header.expect("AES can't be used without headers"),
|
||||
nb_object.column_size_as_bytes.expect("AES needs size as bytes column"),
|
||||
nb_object.column_dimensions,
|
||||
nb_object.column_selection as u32,
|
||||
|
|
|
@ -106,7 +106,6 @@ fn add_chosen_directories(window_main: &Window, tree_view: &TreeView, excluded_i
|
|||
for index in 0..g_files.n_items() {
|
||||
let file = &g_files.item(index);
|
||||
if let Some(file) = file {
|
||||
println!("{:?}", file);
|
||||
let ss = file.clone().downcast::<gtk4::gio::File>().unwrap();
|
||||
if let Some(path_buf) = ss.path() {
|
||||
folders.push(path_buf);
|
||||
|
|
|
@ -68,7 +68,7 @@ pub struct NotebookObject {
|
|||
pub column_path: i32,
|
||||
pub column_name: i32,
|
||||
pub column_selection: i32,
|
||||
pub column_color: Option<i32>,
|
||||
pub column_header: Option<i32>,
|
||||
pub column_dimensions: Option<i32>,
|
||||
pub column_size: Option<i32>,
|
||||
pub column_size_as_bytes: Option<i32>,
|
||||
|
@ -83,7 +83,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsDuplicates::Path as i32,
|
||||
column_name: ColumnsDuplicates::Name as i32,
|
||||
column_selection: ColumnsDuplicates::SelectionButton as i32,
|
||||
column_color: Some(ColumnsDuplicates::Color as i32),
|
||||
column_header: Some(ColumnsDuplicates::Color as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None, // Do not add, useless in hash and size mode
|
||||
column_size_as_bytes: None, // Do not add, useless in hash and size mode
|
||||
|
@ -96,7 +96,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsEmptyFolders::Path as i32,
|
||||
column_name: ColumnsEmptyFolders::Name as i32,
|
||||
column_selection: ColumnsEmptyFolders::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -109,7 +109,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsBigFiles::Path as i32,
|
||||
column_name: ColumnsBigFiles::Name as i32,
|
||||
column_selection: ColumnsBigFiles::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -122,7 +122,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsEmptyFiles::Path as i32,
|
||||
column_name: ColumnsEmptyFiles::Name as i32,
|
||||
column_selection: ColumnsEmptyFiles::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -135,7 +135,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsTemporaryFiles::Path as i32,
|
||||
column_name: ColumnsTemporaryFiles::Name as i32,
|
||||
column_selection: ColumnsTemporaryFiles::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -148,7 +148,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSimilarImages::Path as i32,
|
||||
column_name: ColumnsSimilarImages::Name as i32,
|
||||
column_selection: ColumnsSimilarImages::SelectionButton as i32,
|
||||
column_color: Some(ColumnsSimilarImages::Color as i32),
|
||||
column_header: Some(ColumnsSimilarImages::Color as i32),
|
||||
column_dimensions: Some(ColumnsSimilarImages::Dimensions as i32),
|
||||
column_size: Some(ColumnsSimilarImages::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarImages::SizeAsBytes as i32),
|
||||
|
@ -161,7 +161,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSimilarVideos::Path as i32,
|
||||
column_name: ColumnsSimilarVideos::Name as i32,
|
||||
column_selection: ColumnsSimilarVideos::SelectionButton as i32,
|
||||
column_color: Some(ColumnsSimilarVideos::Color as i32),
|
||||
column_header: Some(ColumnsSimilarVideos::Color as i32),
|
||||
column_dimensions: None,
|
||||
column_size: Some(ColumnsSimilarVideos::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarVideos::SizeAsBytes as i32),
|
||||
|
@ -174,7 +174,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSameMusic::Path as i32,
|
||||
column_name: ColumnsSameMusic::Name as i32,
|
||||
column_selection: ColumnsSameMusic::SelectionButton as i32,
|
||||
column_color: Some(ColumnsSameMusic::Color as i32),
|
||||
column_header: Some(ColumnsSameMusic::Color as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: Some(ColumnsSameMusic::SizeAsBytes as i32),
|
||||
|
@ -187,7 +187,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsInvalidSymlinks::Path as i32,
|
||||
column_name: ColumnsInvalidSymlinks::Name as i32,
|
||||
column_selection: ColumnsInvalidSymlinks::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -200,7 +200,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsBrokenFiles::Path as i32,
|
||||
column_name: ColumnsBrokenFiles::Name as i32,
|
||||
column_selection: ColumnsBrokenFiles::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -213,7 +213,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsBadExtensions::Path as i32,
|
||||
column_name: ColumnsBadExtensions::Name as i32,
|
||||
column_selection: ColumnsBadExtensions::SelectionButton as i32,
|
||||
column_color: None,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
|
@ -245,6 +245,7 @@ pub enum ColumnsDuplicates {
|
|||
Modification,
|
||||
ModificationAsSecs,
|
||||
Color,
|
||||
IsHeader,
|
||||
TextColor,
|
||||
}
|
||||
|
||||
|
@ -305,6 +306,7 @@ pub enum ColumnsSimilarImages {
|
|||
Modification,
|
||||
ModificationAsSecs,
|
||||
Color,
|
||||
IsHeader,
|
||||
TextColor,
|
||||
}
|
||||
|
||||
|
@ -318,6 +320,7 @@ pub enum ColumnsSimilarVideos {
|
|||
Modification,
|
||||
ModificationAsSecs,
|
||||
Color,
|
||||
IsHeader,
|
||||
TextColor,
|
||||
}
|
||||
|
||||
|
@ -338,6 +341,7 @@ pub enum ColumnsSameMusic {
|
|||
Modification,
|
||||
ModificationAsSecs,
|
||||
Color,
|
||||
IsHeader,
|
||||
TextColor,
|
||||
}
|
||||
|
||||
|
@ -370,11 +374,9 @@ pub enum ColumnsBadExtensions {
|
|||
ModificationAsSecs,
|
||||
}
|
||||
|
||||
pub const MAIN_ROW_COLOR: &str = "#222222";
|
||||
pub const HEADER_ROW_COLOR: &str = "#111111";
|
||||
pub const TEXT_COLOR: &str = "#ffffff";
|
||||
pub const MAIN_ROW_COLOR: &str = "#343434";
|
||||
pub const HEADER_ROW_COLOR: &str = "#272727";
|
||||
//pub const MAIN_ROW_COLOR: &str = "#f4f434"; // TEST
|
||||
//pub const HEADER_ROW_COLOR: &str = "#010101"; // TEST
|
||||
|
||||
pub fn get_string_from_list_store(tree_view: >k4::TreeView, column_full_path: i32, column_selection: Option<i32>) -> Vec<String> {
|
||||
let list_store: gtk4::ListStore = get_list_store(tree_view);
|
||||
|
@ -550,12 +552,12 @@ pub fn get_full_name_from_path_name(path: &str, name: &str) -> String {
|
|||
}
|
||||
|
||||
// After e.g. deleting files, header may become orphan or have one child, so should be deleted in this case
|
||||
pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_path: i32) {
|
||||
pub fn clean_invalid_headers(model: >k4::ListStore, column_header: i32, column_path: i32) {
|
||||
// Remove only child from header
|
||||
if let Some(first_iter) = model.iter_first() {
|
||||
let mut vec_tree_path_to_delete: Vec<gtk4::TreePath> = Vec::new();
|
||||
let mut current_iter = first_iter;
|
||||
if model.get::<String>(¤t_iter, column_color) != HEADER_ROW_COLOR {
|
||||
if !model.get::<bool>(¤t_iter, column_header) {
|
||||
panic!("First deleted element, should be a header"); // First element should be header
|
||||
};
|
||||
|
||||
|
@ -565,7 +567,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
// Empty means default check type
|
||||
if model.get::<String>(¤t_iter, column_path).is_empty() {
|
||||
'main: loop {
|
||||
if model.get::<String>(¤t_iter, column_color) != HEADER_ROW_COLOR {
|
||||
if !model.get::<bool>(¤t_iter, column_header) {
|
||||
panic!("First deleted element, should be a header"); // First element should be header
|
||||
};
|
||||
|
||||
|
@ -576,7 +578,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'main;
|
||||
}
|
||||
|
||||
if model.get::<String>(&next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_iter, column_header) {
|
||||
// There are two headers each others(we remove just first) -> (H1 -> H2) -> (H2)
|
||||
vec_tree_path_to_delete.push(model.path(¤t_iter));
|
||||
current_iter = next_iter;
|
||||
|
@ -591,7 +593,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'main;
|
||||
}
|
||||
|
||||
if model.get::<String>(&next_next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_next_iter, column_header) {
|
||||
// One child between two headers, we can remove them (H1 -> C1 -> H2) -> (H2)
|
||||
vec_tree_path_to_delete.push(model.path(¤t_iter));
|
||||
vec_tree_path_to_delete.push(model.path(&next_iter));
|
||||
|
@ -605,7 +607,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'main;
|
||||
}
|
||||
// Move to next header
|
||||
if model.get::<String>(&next_next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_next_iter, column_header) {
|
||||
current_iter = next_next_iter;
|
||||
continue 'main;
|
||||
}
|
||||
|
@ -618,7 +620,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
// Non empty means that header points at reference folder
|
||||
else {
|
||||
'reference: loop {
|
||||
if model.get::<String>(¤t_iter, column_color) != HEADER_ROW_COLOR {
|
||||
if !model.get::<bool>(¤t_iter, column_header) {
|
||||
panic!("First deleted element, should be a header"); // First element should be header
|
||||
};
|
||||
|
||||
|
@ -629,7 +631,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'reference;
|
||||
}
|
||||
|
||||
if model.get::<String>(&next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_iter, column_header) {
|
||||
// There are two headers each others(we remove just first) -> (H1 -> H2) -> (H2)
|
||||
vec_tree_path_to_delete.push(model.path(¤t_iter));
|
||||
current_iter = next_iter;
|
||||
|
@ -642,7 +644,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'reference;
|
||||
}
|
||||
|
||||
if model.get::<String>(&next_next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_next_iter, column_header) {
|
||||
// One child between two headers, we can remove them (H1 -> C1 -> H2) -> (H2)
|
||||
current_iter = next_next_iter;
|
||||
continue 'reference;
|
||||
|
@ -654,7 +656,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
break 'reference;
|
||||
}
|
||||
// Move to next header
|
||||
if model.get::<String>(&next_next_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&next_next_iter, column_header) {
|
||||
current_iter = next_next_iter;
|
||||
continue 'reference;
|
||||
}
|
||||
|
@ -673,7 +675,7 @@ pub fn clean_invalid_headers(model: >k4::ListStore, column_color: i32, column_
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn check_how_much_elements_is_selected(tree_view: &TreeView, column_color: Option<i32>, column_selection: i32) -> (u64, u64) {
|
||||
pub fn check_how_much_elements_is_selected(tree_view: &TreeView, column_header: Option<i32>, column_selection: i32) -> (u64, u64) {
|
||||
let mut number_of_selected_items: u64 = 0;
|
||||
let mut number_of_selected_groups: u64 = 0;
|
||||
|
||||
|
@ -683,15 +685,15 @@ pub fn check_how_much_elements_is_selected(tree_view: &TreeView, column_color: O
|
|||
|
||||
// First iter
|
||||
if let Some(iter) = model.iter_first() {
|
||||
if let Some(column_color) = column_color {
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
if let Some(column_header) = column_header {
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
|
||||
loop {
|
||||
if !model.iter_next(&iter) {
|
||||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
is_item_currently_selected_in_group = false;
|
||||
} else {
|
||||
if model.get::<bool>(&iter, column_selection) {
|
||||
|
@ -721,13 +723,13 @@ pub fn check_how_much_elements_is_selected(tree_view: &TreeView, column_color: O
|
|||
}
|
||||
|
||||
/// Counts how much headers/groups is in treeview
|
||||
pub fn count_number_of_groups(tree_view: &TreeView, column_color: i32) -> u32 {
|
||||
pub fn count_number_of_groups(tree_view: &TreeView, column_header: i32) -> u32 {
|
||||
let mut number_of_selected_groups = 0;
|
||||
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
if let Some(iter) = model.iter_first() {
|
||||
assert_eq!(model.get::<String>(&iter, column_color), HEADER_ROW_COLOR); // First element should be header
|
||||
assert!(model.get::<bool>(&iter, column_header)); // First element should be header
|
||||
number_of_selected_groups += 1;
|
||||
|
||||
loop {
|
||||
|
@ -735,7 +737,7 @@ pub fn count_number_of_groups(tree_view: &TreeView, column_color: i32) -> u32 {
|
|||
break;
|
||||
}
|
||||
|
||||
if model.get::<String>(&iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&iter, column_header) {
|
||||
number_of_selected_groups += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let image_preview = gui_data.main_notebook.image_preview_duplicates.clone();
|
||||
image_preview.hide();
|
||||
|
||||
let col_types: [glib::types::Type; 9] = [
|
||||
let col_types: [glib::types::Type; 10] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
|
@ -133,6 +133,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
|
@ -249,7 +250,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let image_preview = gui_data.main_notebook.image_preview_similar_images.clone();
|
||||
image_preview.hide();
|
||||
|
||||
let col_types: [glib::types::Type; 12] = [
|
||||
let col_types: [glib::types::Type; 13] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Similarity
|
||||
|
@ -261,6 +262,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
|
@ -280,7 +282,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_similar_videos_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_similar_videos_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 10] = [
|
||||
let col_types: [glib::types::Type; 11] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
|
@ -290,6 +292,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
|
@ -309,7 +312,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_same_music_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_same_music_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 17] = [
|
||||
let col_types: [glib::types::Type; 18] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
|
@ -326,6 +329,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
|
|
|
@ -39,9 +39,9 @@ pub fn opening_middle_mouse_function(gesture_click: &GestureClick, number_of_cli
|
|||
let tree_view = gesture_click.widget().downcast::<gtk4::TreeView>().unwrap();
|
||||
|
||||
let nt_object = get_notebook_object_from_tree_view(&tree_view);
|
||||
if let Some(column_color) = nt_object.column_color {
|
||||
if let Some(column_header) = nt_object.column_header {
|
||||
if gesture_click.current_button() == 2 {
|
||||
reverse_selection(&tree_view, column_color, nt_object.column_selection);
|
||||
reverse_selection(&tree_view, column_header, nt_object.column_selection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ pub fn opening_enter_function_ported(event_controller: >k4::EventControllerKey
|
|||
nt_object.column_name,
|
||||
nt_object.column_path,
|
||||
nt_object.column_selection,
|
||||
nt_object.column_color,
|
||||
nt_object.column_header,
|
||||
);
|
||||
Inhibit(false) // True catches signal, and don't send it to function, e.g. up button is catched and don't move selection
|
||||
}
|
||||
|
@ -101,15 +101,15 @@ enum OpenMode {
|
|||
PathAndName,
|
||||
}
|
||||
|
||||
fn common_mark_function(tree_view: >k4::TreeView, column_selection: i32, column_color: Option<i32>) {
|
||||
fn common_mark_function(tree_view: >k4::TreeView, column_selection: i32, column_header: Option<i32>) {
|
||||
let selection = tree_view.selection();
|
||||
let (selected_rows, tree_model) = selection.selected_rows();
|
||||
|
||||
let model = get_list_store(tree_view);
|
||||
|
||||
for tree_path in selected_rows.iter().rev() {
|
||||
if let Some(column_color) = column_color {
|
||||
if model.get::<String>(&model.iter(tree_path).unwrap(), column_color) == HEADER_ROW_COLOR {
|
||||
if let Some(column_header) = column_header {
|
||||
if model.get::<bool>(&model.iter(tree_path).unwrap(), column_header) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ fn common_open_function(tree_view: >k4::TreeView, column_name: i32, column_pat
|
|||
// }
|
||||
}
|
||||
}
|
||||
fn reverse_selection(tree_view: >k4::TreeView, column_color: i32, column_selection: i32) {
|
||||
fn reverse_selection(tree_view: >k4::TreeView, column_header: i32, column_selection: i32) {
|
||||
let (selected_rows, model) = tree_view.selection().selected_rows();
|
||||
let model = model.downcast::<gtk4::ListStore>().unwrap();
|
||||
|
||||
|
@ -148,7 +148,7 @@ fn reverse_selection(tree_view: >k4::TreeView, column_color: i32, column_selec
|
|||
let tree_path = selected_rows[0].clone();
|
||||
let current_iter = model.iter(&tree_path).unwrap();
|
||||
|
||||
if model.get::<String>(¤t_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(¤t_iter, column_header) {
|
||||
return; // Selecting header is not supported(this is available by using reference)
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ fn reverse_selection(tree_view: >k4::TreeView, column_color: i32, column_selec
|
|||
if !model.iter_previous(&to_upper_iter) {
|
||||
break;
|
||||
}
|
||||
if model.get::<String>(&to_upper_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&to_upper_iter, column_header) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ fn reverse_selection(tree_view: >k4::TreeView, column_color: i32, column_selec
|
|||
if !model.iter_next(&to_lower_iter) {
|
||||
break;
|
||||
}
|
||||
if model.get::<String>(&to_lower_iter, column_color) == HEADER_ROW_COLOR {
|
||||
if model.get::<bool>(&to_lower_iter, column_header) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -208,56 +208,32 @@ fn handle_tree_keypress_upper_directories(tree_view: >k4::TreeView, key_code:
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_tree_keypress(tree_view: >k4::TreeView, key_code: u32, name_column: i32, path_column: i32, mark_column: i32, column_color: Option<i32>) {
|
||||
fn handle_tree_keypress(tree_view: >k4::TreeView, key_code: u32, name_column: i32, path_column: i32, mark_column: i32, column_header: Option<i32>) {
|
||||
match key_code {
|
||||
KEY_ENTER => {
|
||||
common_open_function(tree_view, name_column, path_column, OpenMode::PathAndName);
|
||||
}
|
||||
KEY_SPACE => {
|
||||
common_mark_function(tree_view, mark_column, column_color);
|
||||
common_mark_function(tree_view, mark_column, column_header);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn select_function_duplicates(_tree_selection: >k4::TreeSelection, tree_model: >k4::TreeModel, tree_path: >k4::TreePath, _is_path_currently_selected: bool) -> bool {
|
||||
let color = tree_model.get::<String>(&tree_model.iter(tree_path).unwrap(), ColumnsDuplicates::Color as i32);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
return !tree_model.get::<bool>(&tree_model.iter(tree_path).unwrap(), ColumnsDuplicates::IsHeader as i32);
|
||||
}
|
||||
|
||||
pub fn select_function_same_music(_tree_selection: >k4::TreeSelection, tree_model: >k4::TreeModel, tree_path: >k4::TreePath, _is_path_currently_selected: bool) -> bool {
|
||||
let color = tree_model.get::<String>(&tree_model.iter(tree_path).unwrap(), ColumnsSameMusic::Color as i32);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
return !tree_model.get::<bool>(&tree_model.iter(tree_path).unwrap(), ColumnsSameMusic::IsHeader as i32);
|
||||
}
|
||||
|
||||
pub fn select_function_similar_images(_tree_selection: >k4::TreeSelection, tree_model: >k4::TreeModel, tree_path: >k4::TreePath, _is_path_currently_selected: bool) -> bool {
|
||||
let color = tree_model.get::<String>(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarImages::Color as i32);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
return !tree_model.get::<bool>(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarImages::IsHeader as i32);
|
||||
}
|
||||
|
||||
pub fn select_function_similar_videos(_tree_selection: >k4::TreeSelection, tree_model: >k4::TreeModel, tree_path: >k4::TreePath, _is_path_currently_selected: bool) -> bool {
|
||||
let color = tree_model.get::<String>(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarVideos::Color as i32);
|
||||
|
||||
if color == HEADER_ROW_COLOR {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
return !tree_model.get::<bool>(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarVideos::IsHeader as i32);
|
||||
}
|
||||
pub fn select_function_always_true(_tree_selection: >k4::TreeSelection, _tree_model: >k4::TreeModel, _tree_path: >k4::TreePath, _is_path_currently_selected: bool) -> bool {
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue