From cf2e82243549c6e181666bada7a56df934c62671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 27 Nov 2021 20:57:10 +0100 Subject: [PATCH] Reformat code with idea tool --- .github/workflows/linux.yml | 4 ++-- .github/workflows/windows.yml | 6 +++--- .rustfmt.toml | 1 - czkawka_cli/src/commands.rs | 9 +++++---- czkawka_core/Cargo.toml | 2 +- czkawka_core/src/big_file.rs | 1 + czkawka_core/src/broken_files.rs | 4 ++++ czkawka_core/src/common.rs | 2 ++ czkawka_core/src/common_directory.rs | 1 + czkawka_core/src/common_traits.rs | 2 ++ czkawka_core/src/duplicate.rs | 4 ++++ czkawka_core/src/empty_files.rs | 4 ++++ czkawka_core/src/empty_folder.rs | 3 +++ czkawka_core/src/invalid_symlinks.rs | 4 ++++ czkawka_core/src/same_music.rs | 4 ++++ czkawka_core/src/similar_images.rs | 5 +++++ czkawka_core/src/similar_videos.rs | 5 +++++ czkawka_core/src/temporary.rs | 4 ++++ czkawka_gui/src/connect_button_delete.rs | 1 + czkawka_gui/src/connect_button_move.rs | 1 + czkawka_gui/src/connect_button_save.rs | 1 + czkawka_gui/src/connect_popovers.rs | 1 + czkawka_gui/src/help_functions.rs | 10 ++++++++++ czkawka_gui/src/notebook_enums.rs | 4 ++++ czkawka_gui/src/opening_selecting_records.rs | 4 ++++ czkawka_gui/src/taskbar_progress_dummy.rs | 1 + snap/snapcraft.yaml | 4 ++-- 27 files changed, 79 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c572b3a..60805fa 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -55,8 +55,8 @@ jobs: path: target/release/czkawka_cli if: ${{ matrix.type == 'release' }} -# Duplicate finder checks included and excluded directories -# Others are just check delete files number + # Duplicate finder checks included and excluded directories + # Others are just check delete files number - name: Linux Regression Test run: | wget https://github.com/qarmin/czkawka/releases/download/1.1.0/TestSuite.zip diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8ee71fd..8e66280 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -54,9 +54,9 @@ jobs: path: target/release/czkawka_cli.exe if: ${{ matrix.type == 'release' }} -# Duplicate finder checks included and excluded directories -# Others are just check delete files number -# Windows build have some elements changed like powershell before wget and unzip, python instead python3, rm -r instead rm -r and one (at the top) additional test which check size of characyers + # Duplicate finder checks included and excluded directories + # Others are just check delete files number + # Windows build have some elements changed like powershell before wget and unzip, python instead python3, rm -r instead rm -r and one (at the top) additional test which check size of characyers - name: test run: | powershell wget https://github.com/qarmin/czkawka/releases/download/1.1.0/TestSuite.zip -O TestSuite.zip diff --git a/.rustfmt.toml b/.rustfmt.toml index 2098d46..946f142 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,4 +1,3 @@ - newline_style = "Unix" max_width = 250 remove_nested_parens = true diff --git a/czkawka_cli/src/commands.rs b/czkawka_cli/src/commands.rs index 5c7326a..6207646 100644 --- a/czkawka_cli/src/commands.rs +++ b/czkawka_cli/src/commands.rs @@ -30,7 +30,7 @@ pub enum Commands { search_method: CheckingMethod, #[structopt(short = "D", long, default_value = "NONE", parse(try_from_str = parse_delete_method), help = "Delete method (AEN, AEO, ON, OO, HARD)", long_help = "Methods to delete the files.\nAEN - All files except the newest,\nAEO - All files except the oldest,\nON - Only 1 file, the newest,\nOO - Only 1 file, the oldest\nHARD - create hard link\nNONE - not delete files")] delete_method: DeleteMethod, - #[structopt(short = "ht", long, default_value = "BLAKE3", parse(try_from_str = parse_hash_type), help="Hash type (BLAKE3, CRC32, XXH3)")] + #[structopt(short = "ht", long, default_value = "BLAKE3", parse(try_from_str = parse_hash_type), help = "Hash type (BLAKE3, CRC32, XXH3)")] hash_type: HashType, #[structopt(flatten)] file_to_save: FileToSave, @@ -123,11 +123,11 @@ pub enum Commands { file_to_save: FileToSave, #[structopt(flatten)] not_recursive: NotRecursive, - #[structopt(short = "g", long, default_value = "Gradient", parse(try_from_str = parse_similar_hash_algorithm), help="Hash algorithm (allowed: Mean, Gradient, Blockhash, VertGradient, DoubleGradient)")] + #[structopt(short = "g", long, default_value = "Gradient", parse(try_from_str = parse_similar_hash_algorithm), help = "Hash algorithm (allowed: Mean, Gradient, Blockhash, VertGradient, DoubleGradient)")] hash_alg: HashAlg, - #[structopt(short = "z", long, default_value = "Lanczos3", parse(try_from_str = parse_similar_image_filter), help="Hash algorithm (allowed: Lanczos3, Nearest, Triangle, Faussian, Catmullrom)")] + #[structopt(short = "z", long, default_value = "Lanczos3", parse(try_from_str = parse_similar_image_filter), help = "Hash algorithm (allowed: Lanczos3, Nearest, Triangle, Faussian, Catmullrom)")] image_filter: FilterType, - #[structopt(short = "c", long, default_value = "8", parse(try_from_str = parse_image_hash_size), help="Hash size (allowed: 4, 8, 16)")] + #[structopt(short = "c", long, default_value = "8", parse(try_from_str = parse_image_hash_size), help = "Hash size (allowed: 4, 8, 16)")] hash_size: u8, }, #[structopt(name = "music", about = "Finds same music by tags", help_message = HELP_MESSAGE, after_help = "EXAMPLE:\n czkawka music -d /home/rafal -f results.txt")] @@ -366,6 +366,7 @@ fn parse_similar_image_filter(src: &str) -> Result { }; Ok(filter_type) } + fn parse_similar_hash_algorithm(src: &str) -> Result { let algorithm; algorithm = match src.to_lowercase().as_str() { diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index fc11cd8..a9b3d14 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -42,7 +42,7 @@ xxhash-rust = { version = "0.8.2", features = ["xxh3"] } tempfile = "3.2.0" # Video Duplactes -vid_dup_finder_lib = { git = "https://github.com/qarmin/vid_dup_finder_lib"} +vid_dup_finder_lib = { git = "https://github.com/qarmin/vid_dup_finder_lib" } ffmpeg_cmdline_utils = "0.1.0" [features] diff --git a/czkawka_core/src/big_file.rs b/czkawka_core/src/big_file.rs index ede2855..2a76a8f 100644 --- a/czkawka_core/src/big_file.rs +++ b/czkawka_core/src/big_file.rs @@ -38,6 +38,7 @@ pub enum DeleteMethod { None, Delete, } + /// Info struck with helpful information's about results #[derive(Default)] pub struct Info { diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index def5d07..32be68e 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -61,6 +61,7 @@ pub struct Info { pub number_of_removed_files: usize, pub number_of_failed_to_remove_files: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -488,6 +489,7 @@ impl BrokenFiles { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for BrokenFiles { fn default() -> Self { Self::new() @@ -523,6 +525,7 @@ impl DebugPrint for BrokenFiles { println!("-----------------------------------------"); } } + impl SaveResults for BrokenFiles { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -561,6 +564,7 @@ impl SaveResults for BrokenFiles { true } } + impl PrintResults for BrokenFiles { /// Print information's about duplicated entries /// Only needed for CLI diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 6fcb024..a7e6b4b 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -6,6 +6,7 @@ use std::time::SystemTime; /// Class for common functions used across other class/functions pub struct Common(); + impl Common { /// Printing time which took between start and stop point and prints also function name #[allow(unused_variables)] @@ -157,6 +158,7 @@ mod test { assert!(Common::regex_check("*/home", "C:\\home")); } } + #[test] fn test_windows_path() { assert_eq!(PathBuf::from("C:\\path.txt"), Common::normalize_windows_path("c:/PATH.tXt")); diff --git a/czkawka_core/src/common_directory.rs b/czkawka_core/src/common_directory.rs index 0cd1ad0..71f59f5 100644 --- a/czkawka_core/src/common_directory.rs +++ b/czkawka_core/src/common_directory.rs @@ -9,6 +9,7 @@ pub struct Directories { pub excluded_directories: Vec, pub included_directories: Vec, } + impl Directories { pub fn new() -> Self { Default::default() diff --git a/czkawka_core/src/common_traits.rs b/czkawka_core/src/common_traits.rs index 0f98fe2..2e03fed 100644 --- a/czkawka_core/src/common_traits.rs +++ b/czkawka_core/src/common_traits.rs @@ -1,9 +1,11 @@ pub trait DebugPrint { fn debug_print(&self); } + pub trait SaveResults { fn save_results_to_file(&mut self, file_name: &str) -> bool; } + pub trait PrintResults { fn print_results(&self); } diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index c4e8a7c..1ac2fcb 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -1016,6 +1016,7 @@ impl DuplicateFinder { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for DuplicateFinder { fn default() -> Self { Self::new() @@ -1079,6 +1080,7 @@ impl DebugPrint for DuplicateFinder { println!("-----------------------------------------"); } } + impl SaveResults for DuplicateFinder { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -1177,6 +1179,7 @@ impl SaveResults for DuplicateFinder { true } } + impl PrintResults for DuplicateFinder { /// Print information's about duplicated entries /// Only needed for CLI @@ -1496,6 +1499,7 @@ mod tests { fn assert_inode(before: &Metadata, after: &Metadata) { assert_eq!(before.ino(), after.ino()); } + #[cfg(target_family = "windows")] fn assert_inode(_: &Metadata, _: &Metadata) {} diff --git a/czkawka_core/src/empty_files.rs b/czkawka_core/src/empty_files.rs index dc663e8..b3d946c 100644 --- a/czkawka_core/src/empty_files.rs +++ b/czkawka_core/src/empty_files.rs @@ -43,6 +43,7 @@ pub struct Info { pub number_of_removed_files: usize, pub number_of_failed_to_remove_files: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -290,6 +291,7 @@ impl EmptyFiles { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for EmptyFiles { fn default() -> Self { Self::new() @@ -326,6 +328,7 @@ impl DebugPrint for EmptyFiles { println!("-----------------------------------------"); } } + impl SaveResults for EmptyFiles { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -364,6 +367,7 @@ impl SaveResults for EmptyFiles { true } } + impl PrintResults for EmptyFiles { /// Print information's about duplicated entries /// Only needed for CLI diff --git a/czkawka_core/src/empty_folder.rs b/czkawka_core/src/empty_folder.rs index 4f44f76..c42cf7a 100644 --- a/czkawka_core/src/empty_folder.rs +++ b/czkawka_core/src/empty_folder.rs @@ -55,6 +55,7 @@ pub struct EmptyFolder { pub struct Info { pub number_of_empty_folders: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -325,6 +326,7 @@ impl DebugPrint for EmptyFolder { println!("-----------------------------------------"); } } + impl SaveResults for EmptyFolder { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -360,6 +362,7 @@ impl SaveResults for EmptyFolder { true } } + impl PrintResults for EmptyFolder { fn print_results(&self) { if !self.empty_folder_list.is_empty() { diff --git a/czkawka_core/src/invalid_symlinks.rs b/czkawka_core/src/invalid_symlinks.rs index b0df689..6e00065 100644 --- a/czkawka_core/src/invalid_symlinks.rs +++ b/czkawka_core/src/invalid_symlinks.rs @@ -53,6 +53,7 @@ pub struct Info { pub number_of_removed_files: usize, pub number_of_failed_to_remove_files: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -337,6 +338,7 @@ impl InvalidSymlinks { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for InvalidSymlinks { fn default() -> Self { Self::new() @@ -373,6 +375,7 @@ impl DebugPrint for InvalidSymlinks { println!("-----------------------------------------"); } } + impl SaveResults for InvalidSymlinks { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -421,6 +424,7 @@ impl SaveResults for InvalidSymlinks { true } } + impl PrintResults for InvalidSymlinks { /// Print information's about duplicated entries /// Only needed for CLI diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index 478c23f..a39dedf 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -73,6 +73,7 @@ pub struct Info { pub number_of_failed_to_remove_files: usize, pub number_of_duplicates_music_files: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -637,6 +638,7 @@ impl SameMusic { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for SameMusic { fn default() -> Self { Self::new() @@ -675,6 +677,7 @@ impl DebugPrint for SameMusic { println!("-----------------------------------------"); } } + impl SaveResults for SameMusic { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -713,6 +716,7 @@ impl SaveResults for SameMusic { true } } + impl PrintResults for SameMusic { /// Print information's about duplicated entries /// Only needed for CLI diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 6dd5c5f..7e637f6 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -108,6 +108,7 @@ pub struct Info { pub number_of_failed_to_remove_files: usize, pub gained_space: u64, } + impl Info { pub fn new() -> Self { Default::default() @@ -625,6 +626,7 @@ impl SimilarImages { self.excluded_items.set_excluded_items(excluded_items, &mut self.text_messages); } } + impl Default for SimilarImages { fn default() -> Self { Self::new() @@ -645,6 +647,7 @@ impl DebugPrint for SimilarImages { println!("-----------------------------------------"); } } + impl SaveResults for SimilarImages { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -697,6 +700,7 @@ impl SaveResults for SimilarImages { true } } + impl PrintResults for SimilarImages { fn print_results(&self) { if !self.similar_vectors.is_empty() { @@ -761,6 +765,7 @@ fn save_hashes_to_file(hashmap: &BTreeMap, text_messages: &mu } } } + fn load_hashes_from_file(text_messages: &mut Messages, hash_size: u8, hash_alg: HashAlg, image_filter: FilterType) -> Option> { if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") { let cache_dir = PathBuf::from(proj_dirs.cache_dir()); diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index 9f992c1..8834ed8 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -81,6 +81,7 @@ pub struct Info { pub number_of_failed_to_remove_files: usize, pub gained_space: u64, } + impl Info { pub fn new() -> Self { Default::default() @@ -498,6 +499,7 @@ impl SimilarVideos { self.excluded_items.set_excluded_items(excluded_items, &mut self.text_messages); } } + impl Default for SimilarVideos { fn default() -> Self { Self::new() @@ -518,6 +520,7 @@ impl DebugPrint for SimilarVideos { println!("-----------------------------------------"); } } + impl SaveResults for SimilarVideos { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -562,6 +565,7 @@ impl SaveResults for SimilarVideos { true } } + impl PrintResults for SimilarVideos { fn print_results(&self) { if !self.similar_vectors.is_empty() { @@ -624,6 +628,7 @@ fn save_hashes_to_file(hashmap: &BTreeMap, text_messages: &mu } } } + fn load_hashes_from_file(text_messages: &mut Messages) -> Option> { if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") { let cache_dir = PathBuf::from(proj_dirs.cache_dir()); diff --git a/czkawka_core/src/temporary.rs b/czkawka_core/src/temporary.rs index 3e5c496..42e19e1 100644 --- a/czkawka_core/src/temporary.rs +++ b/czkawka_core/src/temporary.rs @@ -42,6 +42,7 @@ pub struct Info { pub number_of_removed_files: usize, pub number_of_failed_to_remove_files: usize, } + impl Info { pub fn new() -> Self { Default::default() @@ -277,6 +278,7 @@ impl Temporary { Common::print_time(start_time, SystemTime::now(), "delete_files".to_string()); } } + impl Default for Temporary { fn default() -> Self { Self::new() @@ -311,6 +313,7 @@ impl DebugPrint for Temporary { println!("-----------------------------------------"); } } + impl SaveResults for Temporary { fn save_results_to_file(&mut self, file_name: &str) -> bool { let start_time: SystemTime = SystemTime::now(); @@ -349,6 +352,7 @@ impl SaveResults for Temporary { true } } + impl PrintResults for Temporary { fn print_results(&self) { let start_time: SystemTime = SystemTime::now(); diff --git a/czkawka_gui/src/connect_button_delete.rs b/czkawka_gui/src/connect_button_delete.rs index f09e7b3..8b9d0fc 100644 --- a/czkawka_gui/src/connect_button_delete.rs +++ b/czkawka_gui/src/connect_button_delete.rs @@ -92,6 +92,7 @@ pub async fn check_if_can_delete_files(check_button_settings_confirm_deletion: & } true } + fn create_dialog_ask_for_deletion(window_main: >k::Window) -> (Dialog, CheckButton) { let confirmation_dialog_delete = gtk::Dialog::with_buttons( Some("Delete confirmation"), diff --git a/czkawka_gui/src/connect_button_move.rs b/czkawka_gui/src/connect_button_move.rs index 514f907..38296eb 100644 --- a/czkawka_gui/src/connect_button_move.rs +++ b/czkawka_gui/src/connect_button_move.rs @@ -82,6 +82,7 @@ fn move_things(tree_view: >k::TreeView, column_file_name: i32, column_path: i3 file_chooser.close(); }); } + fn move_with_tree(tree_view: >k::TreeView, column_file_name: i32, column_path: i32, column_color: i32, column_selection: i32, destination_folder: PathBuf, entry_info: >k::Entry, text_view_errors: >k::TextView) { let model = get_list_store(tree_view); diff --git a/czkawka_gui/src/connect_button_save.rs b/czkawka_gui/src/connect_button_save.rs index ea2d0ef..31e674a 100644 --- a/czkawka_gui/src/connect_button_save.rs +++ b/czkawka_gui/src/connect_button_save.rs @@ -84,6 +84,7 @@ pub fn connect_button_save(gui_data: &GuiData) { post_save_things(file_name, &to_notebook_main_enum(notebook_main.current_page().unwrap()), &shared_buttons, &entry_info, &buttons_save_clone); }); } + fn post_save_things(file_name: &str, type_of_tab: &NotebookMainEnum, shared_buttons: &Rc>>>, entry_info: &Entry, buttons_save: &Button) { entry_info.set_text(format!("Saved results to file {}", file_name).as_str()); // Set state diff --git a/czkawka_gui/src/connect_popovers.rs b/czkawka_gui/src/connect_popovers.rs index 063f4f6..7ac1147 100644 --- a/czkawka_gui/src/connect_popovers.rs +++ b/czkawka_gui/src/connect_popovers.rs @@ -49,6 +49,7 @@ fn popover_unselect_all(popover: >k::Popover, tree_view: >k::TreeView, colum } popover.popdown(); } + fn popover_reverse(popover: >k::Popover, tree_view: >k::TreeView, column_button_selection: u32, column_color: Option) { let model = get_list_store(tree_view); diff --git a/czkawka_gui/src/help_functions.rs b/czkawka_gui/src/help_functions.rs index 64a5877..a8e2f75 100644 --- a/czkawka_gui/src/help_functions.rs +++ b/czkawka_gui/src/help_functions.rs @@ -208,10 +208,12 @@ pub enum ColumnsEmptyFolders { Path, Modification, } + pub enum ColumnsDirectory { // Columns for Included and Excluded Directories in upper Notebook Path = 0, } + pub enum ColumnsBigFiles { SelectionButton = 0, Size, @@ -219,18 +221,21 @@ pub enum ColumnsBigFiles { Path, Modification, } + pub enum ColumnsEmptyFiles { SelectionButton = 0, Name, Path, Modification, } + pub enum ColumnsTemporaryFiles { SelectionButton = 0, Name, Path, Modification, } + pub enum ColumnsSimilarImages { ActivatableSelectButton = 0, SelectionButton, @@ -258,6 +263,7 @@ pub enum ColumnsSimilarVideos { Color, TextColor, } + pub enum ColumnsSameMusic { ActivatableSelectButton = 0, SelectionButton, @@ -275,6 +281,7 @@ pub enum ColumnsSameMusic { Color, TextColor, } + pub enum ColumnsInvalidSymlinks { SelectionButton = 0, Name, @@ -316,6 +323,7 @@ pub fn get_string_from_list_store(tree_view: >k::TreeView) -> Vec { } } } + pub fn get_path_buf_from_vector_of_strings(vec_string: Vec) -> Vec { vec_string.iter().map(PathBuf::from).collect() } @@ -386,6 +394,7 @@ pub fn set_buttons(hashmap: &mut HashMap, buttons_array: &[gtk::Bu } } } + pub fn hide_all_buttons(buttons_array: &[gtk::Button]) { for button in buttons_array { button.hide(); @@ -402,6 +411,7 @@ pub fn get_text_from_invalid_symlink_cause(error: &invalid_symlinks::ErrorType) pub fn get_list_store(tree_view: >k::TreeView) -> ListStore { tree_view.model().unwrap().downcast::().unwrap() } + pub fn get_dialog_box_child(dialog: >k::Dialog) -> gtk::Box { dialog.child().unwrap().downcast::().unwrap() } diff --git a/czkawka_gui/src/notebook_enums.rs b/czkawka_gui/src/notebook_enums.rs index 96ce5e2..b4fa05a 100644 --- a/czkawka_gui/src/notebook_enums.rs +++ b/czkawka_gui/src/notebook_enums.rs @@ -15,6 +15,7 @@ pub enum NotebookMainEnum { Symlinks, BrokenFiles, } + pub fn to_notebook_main_enum(notebook_number: u32) -> NotebookMainEnum { match notebook_number { 0 => NotebookMainEnum::Duplicate, @@ -30,6 +31,7 @@ pub fn to_notebook_main_enum(notebook_number: u32) -> NotebookMainEnum { _ => panic!("Invalid Notebook Tab"), } } + pub fn get_all_main_tabs() -> [NotebookMainEnum; NUMBER_OF_NOTEBOOK_MAIN_TABS] { [ to_notebook_main_enum(0), @@ -52,6 +54,7 @@ pub enum NotebookUpperEnum { ExcludedItems, AllowedExtensions, } + pub fn to_notebook_upper_enum(notebook_number: u32) -> NotebookUpperEnum { match notebook_number { 0 => NotebookUpperEnum::IncludedDirectories, @@ -61,6 +64,7 @@ pub fn to_notebook_upper_enum(notebook_number: u32) -> NotebookUpperEnum { _ => panic!("Invalid Upper Notebook Tab"), } } + pub fn get_all_upper_tabs() -> [NotebookUpperEnum; NUMBER_OF_NOTEBOOK_UPPER_TABS] { [to_notebook_upper_enum(0), to_notebook_upper_enum(1), to_notebook_upper_enum(2), to_notebook_upper_enum(3)] } diff --git a/czkawka_gui/src/opening_selecting_records.rs b/czkawka_gui/src/opening_selecting_records.rs index f2f5d41..2109ab8 100644 --- a/czkawka_gui/src/opening_selecting_records.rs +++ b/czkawka_gui/src/opening_selecting_records.rs @@ -16,6 +16,7 @@ pub fn opening_double_click_function(tree_view: >k::TreeView, event: &gdk::Eve } gtk::Inhibit(false) } + pub fn opening_enter_function(tree_view: >k::TreeView, event: &gdk::EventKey) -> gtk::Inhibit { let nt_object = get_notebook_object_from_tree_view(tree_view); handle_tree_keypress(tree_view, event, nt_object.column_name, nt_object.column_path, nt_object.column_selection) @@ -91,6 +92,7 @@ pub fn select_function_duplicates(_tree_selection: >k::TreeSelection, tree_mod true } + pub fn select_function_same_music(_tree_selection: >k::TreeSelection, tree_model: >k::TreeModel, tree_path: >k::TreePath, _is_path_currently_selected: bool) -> bool { let color = tree_model.value(&tree_model.iter(tree_path).unwrap(), ColumnsSameMusic::Color as i32).get::().unwrap(); @@ -100,6 +102,7 @@ pub fn select_function_same_music(_tree_selection: >k::TreeSelection, tree_mod true } + pub fn select_function_similar_images(_tree_selection: >k::TreeSelection, tree_model: >k::TreeModel, tree_path: >k::TreePath, _is_path_currently_selected: bool) -> bool { let color = tree_model.value(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarImages::Color as i32).get::().unwrap(); @@ -109,6 +112,7 @@ pub fn select_function_similar_images(_tree_selection: >k::TreeSelection, tree true } + pub fn select_function_similar_videos(_tree_selection: >k::TreeSelection, tree_model: >k::TreeModel, tree_path: >k::TreePath, _is_path_currently_selected: bool) -> bool { let color = tree_model.value(&tree_model.iter(tree_path).unwrap(), ColumnsSimilarVideos::Color as i32).get::().unwrap(); diff --git a/czkawka_gui/src/taskbar_progress_dummy.rs b/czkawka_gui/src/taskbar_progress_dummy.rs index 1406423..93739f0 100644 --- a/czkawka_gui/src/taskbar_progress_dummy.rs +++ b/czkawka_gui/src/taskbar_progress_dummy.rs @@ -4,6 +4,7 @@ use std::convert::From; enum HWND__ {} + type HWND = *mut HWND__; #[allow(non_camel_case_types, dead_code)] diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0b001e3..00252ea 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -17,11 +17,11 @@ parts: - curl - gcc - git - rust-path: ["czkawka_gui"] + rust-path: [ "czkawka_gui" ] apps: czkawka: command: bin/czkawka_gui - extensions: [gnome-3-38] + extensions: [ gnome-3-38 ] plugs: - home - removable-media