From 35c47b32304fd6715188ef2214c29c7f254488e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mikrut?=
<41945903+qarmin@users.noreply.github.com>
Date: Tue, 23 Feb 2021 09:40:19 +0100
Subject: [PATCH] Add new settings window (#262)
---
czkawka_gui/czkawka.glade | 480 +++++++++++-------
czkawka_gui/src/connect_button_delete.rs | 2 +-
czkawka_gui/src/connect_button_search.rs | 3 +
czkawka_gui/src/connect_compute_results.rs | 4 +-
.../src/connect_hide_text_view_errors.rs | 2 +-
czkawka_gui/src/connect_settings.rs | 28 +-
czkawka_gui/src/gui_data.rs | 8 +-
czkawka_gui/src/gui_options.rs | 10 -
czkawka_gui/src/gui_settings.rs | 59 +++
czkawka_gui/src/gui_upper_notepad.rs | 30 --
czkawka_gui/src/initialize_gui.rs | 8 +-
czkawka_gui/src/main.rs | 2 +-
czkawka_gui/src/saving_loading.rs | 62 ++-
13 files changed, 433 insertions(+), 265 deletions(-)
delete mode 100644 czkawka_gui/src/gui_options.rs
create mode 100644 czkawka_gui/src/gui_settings.rs
diff --git a/czkawka_gui/czkawka.glade b/czkawka_gui/czkawka.glade
index d407334..d9df678 100644
--- a/czkawka_gui/czkawka.glade
+++ b/czkawka_gui/czkawka.glade
@@ -950,148 +950,6 @@ This program is free to use and will always be.
False
-
-
-
-
- 4
-
-
-
-
- True
- False
- Settings
-
-
- 4
- False
-
-
False
@@ -1153,13 +1011,10 @@ This program is free to use and will always be.
True
False
-
- Name (very fast)
+
True
- True
- False
- True
- radio_button_duplicates_hash
+ False
+ Check method:
False
@@ -1168,13 +1023,13 @@ This program is free to use and will always be.
-
- Size (very fast)
+
+ Hash
True
True
False
+ True
True
- radio_button_duplicates_hash
False
@@ -1184,7 +1039,7 @@ This program is free to use and will always be.
- HashMb (fast)
+ HashMb
True
True
False
@@ -1198,13 +1053,13 @@ This program is free to use and will always be.
-
- Hash (slow but accurate)
+
+ Size
True
True
False
- True
True
+ radio_button_duplicates_hash
False
@@ -1212,6 +1067,21 @@ This program is free to use and will always be.
3
+
+
+ Name
+ True
+ True
+ False
+ True
+ radio_button_duplicates_hash
+
+
+ False
+ True
+ 4
+
+
False
@@ -2394,7 +2264,7 @@ This program is free to use and will always be.
vertical
10
-
+
True
False
@@ -2444,21 +2314,6 @@ This program is free to use and will always be.
0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
True
@@ -2479,24 +2334,106 @@ This program is free to use and will always be.
-
+
+ True
+ True
+ True
+ end
+
+
+ True
+ False
+
+
+ True
+ False
+ dialog-cancel
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ Stop
+
+
+ True
+ True
+ 1
+
+
+
+
+
+
+ False
+ False
+ end
+ 2
+
+
+
+
+
+
+ False
+ Czkawka Options
+
+
+ True
+ False
+ vertical
+
+
True
False
- end
+ vertical
-
+
True
- True
- True
+ False
+
+
+ False
+ False
+ 0
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+ left
+
+
+ True
+ False
+ vertical
True
False
+ vertical
-
+
+ Load configuration at start
True
- False
- dialog-cancel
+ True
+ False
+ True
+ True
False
@@ -2505,33 +2442,200 @@ This program is free to use and will always be.
-
+
+ Show confirm dialog when deleting
True
- False
- Stop
+ True
+ False
+ True
+ True
- True
+ False
True
- 1
+ 3
+
+
+
+
+ Show bottom text panel
+ True
+ True
+ False
+ True
+ True
+
+
+ False
+ False
+ 5
+
+
+
+
+ Save configuration at exit
+ True
+ True
+ False
+ True
+ True
+
+
+ False
+ True
+ 6
+
+ False
+ False
+ 1
+
+
+
+
+
+
+ True
+ False
+ General
+
+
+ False
+
+
+
+
+ True
+ False
+ vertical
+
+
+ Hide hard links
+ True
+ True
+ False
+ True
+ True
+
+
+ False
+ True
+ 0
+
- True
- True
+ 1
+
+
+
+
+ True
+ False
+ Duplicate Finder
+
+
+ 1
+ False
+
+
+
+
+ True
+ False
+ vertical
+
+
+ Show image preview
+ True
+ True
+ False
+ True
+ True
+
+
+ False
+ True
+ 0
+
+
+
+
+ 2
+
+
+
+
+ True
+ False
+ Similar Images
+
+
+ 2
+ False
+
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ True
+ False
+ 3
+ 3
+ 3
+
+
+ Load configuration
+ True
+ True
+ True
+
+
+ False
+ False
0
-
+
+ Reset configuration
+ True
+ True
+ True
+
+
+ True
+ False
+ 1
+
+
+
+
+ Save configuration
+ True
+ True
+ True
+
+
+ False
+ False
+ end
+ 2
+
False
- False
+ True
+ 3
2
diff --git a/czkawka_gui/src/connect_button_delete.rs b/czkawka_gui/src/connect_button_delete.rs
index 3856f57..9647b77 100644
--- a/czkawka_gui/src/connect_button_delete.rs
+++ b/czkawka_gui/src/connect_button_delete.rs
@@ -24,7 +24,7 @@ pub fn connect_button_delete(gui_data: &GuiData) {
let tree_view_same_music_finder = gui_data.main_notebook.tree_view_same_music_finder.clone();
let tree_view_invalid_symlinks = gui_data.main_notebook.tree_view_invalid_symlinks.clone();
let tree_view_broken_files = gui_data.main_notebook.tree_view_broken_files.clone();
- let check_button_settings_confirm_deletion = gui_data.upper_notebook.check_button_settings_confirm_deletion.clone();
+ let check_button_settings_confirm_deletion = gui_data.settings.check_button_settings_confirm_deletion.clone();
let image_preview_similar_images = gui_data.main_notebook.image_preview_similar_images.clone();
buttons_delete.connect_clicked(move |_| {
diff --git a/czkawka_gui/src/connect_button_search.rs b/czkawka_gui/src/connect_button_search.rs
index f004a21..e297d62 100644
--- a/czkawka_gui/src/connect_button_search.rs
+++ b/czkawka_gui/src/connect_button_search.rs
@@ -90,6 +90,7 @@ pub fn connect_button_search(
let radio_button_hash_type_blake3 = gui_data.main_notebook.radio_button_hash_type_blake3.clone();
let radio_button_hash_type_crc32 = gui_data.main_notebook.radio_button_hash_type_crc32.clone();
let radio_button_hash_type_xxh3 = gui_data.main_notebook.radio_button_hash_type_xxh3.clone();
+ let check_button_settings_hide_hard_links = gui_data.settings.check_button_settings_hide_hard_links.clone();
buttons_search_clone.connect_clicked(move |_| {
let included_directories = get_path_buf_from_vector_of_strings(get_string_from_list_store(&tree_view_included_directories));
@@ -97,6 +98,7 @@ pub fn connect_button_search(
let recursive_search = check_button_recursive.get_active();
let excluded_items = entry_excluded_items.get_text().as_str().to_string().split(',').map(|e| e.to_string()).collect::>();
let allowed_extensions = entry_allowed_extensions.get_text().as_str().to_string();
+ let hide_hard_links = check_button_settings_hide_hard_links.get_active();
let show_dialog = Arc::new(AtomicBool::new(true));
@@ -164,6 +166,7 @@ pub fn connect_button_search(
df.set_minimal_file_size(minimal_file_size);
df.set_check_method(check_method);
df.set_hash_type(hash_type);
+ df.set_ignore_hard_links(hide_hard_links);
df.find_duplicates(Some(&stop_receiver), Some(&futures_sender_duplicate_files));
let _ = glib_stop_sender.send(Message::Duplicates(df));
});
diff --git a/czkawka_gui/src/connect_compute_results.rs b/czkawka_gui/src/connect_compute_results.rs
index 9f58cd8..fd910a7 100644
--- a/czkawka_gui/src/connect_compute_results.rs
+++ b/czkawka_gui/src/connect_compute_results.rs
@@ -54,7 +54,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
match msg {
Message::Duplicates(df) => {
if df.get_stopped_search() {
- entry_info.set_text("Searching for duplicated was stopped by user");
+ entry_info.set_text("Searching for duplicates was stopped by user");
} else {
let information = df.get_information();
let text_messages = df.get_text_messages();
@@ -426,7 +426,7 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
}
Message::SimilarImages(sf) => {
if sf.get_stopped_search() {
- entry_info.set_text("Searching for duplicated was stopped by user");
+ entry_info.set_text("Searching for similar images was stopped by user");
} else {
//let information = sf.get_information();
let text_messages = sf.get_text_messages();
diff --git a/czkawka_gui/src/connect_hide_text_view_errors.rs b/czkawka_gui/src/connect_hide_text_view_errors.rs
index b40e77a..08311c1 100644
--- a/czkawka_gui/src/connect_hide_text_view_errors.rs
+++ b/czkawka_gui/src/connect_hide_text_view_errors.rs
@@ -3,7 +3,7 @@ use crate::gui_data::GuiData;
use gtk::prelude::*;
pub fn connect_hide_text_view_errors(gui_data: &GuiData) {
- let check_button_settings_show_text_view = gui_data.upper_notebook.check_button_settings_show_text_view.clone();
+ let check_button_settings_show_text_view = gui_data.settings.check_button_settings_show_text_view.clone();
let buttons_show_errors = gui_data.bottom_buttons.buttons_show_errors.clone();
let scrolled_window_errors = gui_data.scrolled_window_errors.clone();
diff --git a/czkawka_gui/src/connect_settings.rs b/czkawka_gui/src/connect_settings.rs
index 025546c..ce126eb 100644
--- a/czkawka_gui/src/connect_settings.rs
+++ b/czkawka_gui/src/connect_settings.rs
@@ -4,10 +4,32 @@ use crate::saving_loading::{load_configuration, reset_configuration, save_config
use gtk::prelude::*;
pub fn connect_settings(gui_data: &GuiData) {
+ // Connect button settings
+ {
+ let button_settings = gui_data.header.button_settings.clone();
+ let window_main = gui_data.window_main.clone();
+ let window_settings = gui_data.settings.window_settings.clone();
+ button_settings.connect_clicked(move |_| {
+ window_main.set_sensitive(false);
+ window_settings.show();
+ });
+
+ let window_main = gui_data.window_main.clone();
+ let window_settings = gui_data.settings.window_settings.clone();
+
+ window_settings.hide_on_delete();
+
+ window_settings.connect_delete_event(move |window, _y| {
+ window.hide();
+ window_main.set_sensitive(true);
+ gtk::Inhibit(true)
+ });
+ }
+
// Connect save configuration button
{
let gui_data = gui_data.clone();
- let button_settings_save_configuration = gui_data.upper_notebook.button_settings_save_configuration.clone();
+ let button_settings_save_configuration = gui_data.settings.button_settings_save_configuration.clone();
button_settings_save_configuration.connect_clicked(move |_| {
save_configuration(&gui_data, true);
});
@@ -15,7 +37,7 @@ pub fn connect_settings(gui_data: &GuiData) {
// Connect load configuration button
{
let gui_data = gui_data.clone();
- let button_settings_load_configuration = gui_data.upper_notebook.button_settings_load_configuration.clone();
+ let button_settings_load_configuration = gui_data.settings.button_settings_load_configuration.clone();
button_settings_load_configuration.connect_clicked(move |_| {
load_configuration(&gui_data, true);
});
@@ -23,7 +45,7 @@ pub fn connect_settings(gui_data: &GuiData) {
// Connect reset configuration button
{
let gui_data = gui_data.clone();
- let button_settings_reset_configuration = gui_data.upper_notebook.button_settings_reset_configuration.clone();
+ let button_settings_reset_configuration = gui_data.settings.button_settings_reset_configuration.clone();
button_settings_reset_configuration.connect_clicked(move |_| {
reset_configuration(&gui_data, true);
});
diff --git a/czkawka_gui/src/gui_data.rs b/czkawka_gui/src/gui_data.rs
index 8fe3e2f..303c31e 100644
--- a/czkawka_gui/src/gui_data.rs
+++ b/czkawka_gui/src/gui_data.rs
@@ -3,9 +3,9 @@ use crate::gui_about::GUIAbout;
use crate::gui_bottom_buttons::GUIBottomButtons;
use crate::gui_header::GUIHeader;
use crate::gui_main_notebook::GUIMainNotebook;
-use crate::gui_options::GUIOptions;
use crate::gui_popovers::GUIPopovers;
use crate::gui_progress_dialog::GUIProgressDialog;
+use crate::gui_settings::GUISettings;
use crate::gui_upper_notepad::GUIUpperNotebook;
use crate::notebook_enums::*;
use crate::taskbar_progress::TaskbarProgress;
@@ -41,7 +41,7 @@ pub struct GuiData {
pub bottom_buttons: GUIBottomButtons,
pub progress_window: GUIProgressDialog,
pub about: GUIAbout,
- pub options: GUIOptions,
+ pub settings: GUISettings,
pub header: GUIHeader,
// Taskbar state
@@ -93,9 +93,9 @@ impl GuiData {
let popovers = GUIPopovers::create_from_builder(&builder);
let bottom_buttons = GUIBottomButtons::create_from_builder(&builder);
let progress_window = GUIProgressDialog::create_from_builder(&builder);
- let options = GUIOptions::create_from_builder(&builder);
let about = GUIAbout::create_from_builder(&builder);
let header = GUIHeader::create_from_builder(&builder);
+ let settings = GUISettings::create_from_builder(&builder);
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -165,7 +165,7 @@ impl GuiData {
bottom_buttons,
progress_window,
about,
- options,
+ settings,
header,
taskbar_state,
shared_buttons,
diff --git a/czkawka_gui/src/gui_options.rs b/czkawka_gui/src/gui_options.rs
deleted file mode 100644
index 661e27f..0000000
--- a/czkawka_gui/src/gui_options.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#[derive(Clone)]
-pub struct GUIOptions {}
-
-impl GUIOptions {
- pub fn create_from_builder(_builder: >k::Builder) -> Self {
- // let notebook_main: gtk::Notebook = builder.get_object("notebook_main").unwrap();
-
- Self {}
- }
-}
diff --git a/czkawka_gui/src/gui_settings.rs b/czkawka_gui/src/gui_settings.rs
new file mode 100644
index 0000000..a36938b
--- /dev/null
+++ b/czkawka_gui/src/gui_settings.rs
@@ -0,0 +1,59 @@
+use gtk::prelude::*;
+
+#[derive(Clone)]
+pub struct GUISettings {
+ pub window_settings: gtk::Window,
+
+ // General
+ pub check_button_settings_save_at_exit: gtk::CheckButton,
+ pub check_button_settings_load_at_start: gtk::CheckButton,
+ pub check_button_settings_confirm_deletion: gtk::CheckButton,
+ pub check_button_settings_show_text_view: gtk::CheckButton,
+
+ // Duplicates
+ pub check_button_settings_hide_hard_links: gtk::CheckButton,
+
+ // Similar Images
+ pub check_button_settings_show_preview_similar_images: gtk::CheckButton,
+
+ // Buttons
+ pub button_settings_save_configuration: gtk::Button,
+ pub button_settings_load_configuration: gtk::Button,
+ pub button_settings_reset_configuration: gtk::Button,
+}
+
+impl GUISettings {
+ pub fn create_from_builder(builder: >k::Builder) -> Self {
+ let window_settings: gtk::Window = builder.get_object("window_settings").unwrap();
+
+ // General
+ let check_button_settings_save_at_exit: gtk::CheckButton = builder.get_object("check_button_settings_save_at_exit").unwrap();
+ let check_button_settings_load_at_start: gtk::CheckButton = builder.get_object("check_button_settings_load_at_start").unwrap();
+ let check_button_settings_confirm_deletion: gtk::CheckButton = builder.get_object("check_button_settings_confirm_deletion").unwrap();
+ let check_button_settings_show_text_view: gtk::CheckButton = builder.get_object("check_button_settings_show_text_view").unwrap();
+
+ // Duplicates
+ let check_button_settings_hide_hard_links: gtk::CheckButton = builder.get_object("check_button_settings_hide_hard_links").unwrap();
+
+ // Similar Images
+ let check_button_settings_show_preview_similar_images: gtk::CheckButton = builder.get_object("check_button_settings_show_preview_similar_images").unwrap();
+
+ // Saving/Loading/Resetting configuration
+ let button_settings_save_configuration: gtk::Button = builder.get_object("button_settings_save_configuration").unwrap();
+ let button_settings_load_configuration: gtk::Button = builder.get_object("button_settings_load_configuration").unwrap();
+ let button_settings_reset_configuration: gtk::Button = builder.get_object("button_settings_reset_configuration").unwrap();
+
+ Self {
+ window_settings,
+ check_button_settings_save_at_exit,
+ check_button_settings_load_at_start,
+ check_button_settings_confirm_deletion,
+ check_button_settings_show_text_view,
+ button_settings_save_configuration,
+ button_settings_load_configuration,
+ button_settings_reset_configuration,
+ check_button_settings_show_preview_similar_images,
+ check_button_settings_hide_hard_links,
+ }
+ }
+}
diff --git a/czkawka_gui/src/gui_upper_notepad.rs b/czkawka_gui/src/gui_upper_notepad.rs
index cb5ffac..20cd9fa 100644
--- a/czkawka_gui/src/gui_upper_notepad.rs
+++ b/czkawka_gui/src/gui_upper_notepad.rs
@@ -14,17 +14,6 @@ pub struct GUIUpperNotebook {
pub entry_excluded_items: gtk::Entry,
pub entry_allowed_extensions: gtk::Entry,
- //// Settings
- pub check_button_settings_save_at_exit: gtk::CheckButton,
- pub check_button_settings_load_at_start: gtk::CheckButton,
- pub check_button_settings_confirm_deletion: gtk::CheckButton,
- pub check_button_settings_show_preview_similar_images: gtk::CheckButton,
- pub check_button_settings_show_text_view: gtk::CheckButton,
-
- pub button_settings_save_configuration: gtk::Button,
- pub button_settings_load_configuration: gtk::Button,
- pub button_settings_reset_configuration: gtk::Button,
-
pub check_button_recursive: gtk::CheckButton,
pub buttons_manual_add_directory: gtk::Button,
@@ -48,17 +37,6 @@ impl GUIUpperNotebook {
let entry_allowed_extensions: gtk::Entry = builder.get_object("entry_allowed_extensions").unwrap();
let entry_excluded_items: gtk::Entry = builder.get_object("entry_excluded_items").unwrap();
- //// Settings
- let check_button_settings_save_at_exit: gtk::CheckButton = builder.get_object("check_button_settings_save_at_exit").unwrap();
- let check_button_settings_load_at_start: gtk::CheckButton = builder.get_object("check_button_settings_load_at_start").unwrap();
- let check_button_settings_confirm_deletion: gtk::CheckButton = builder.get_object("check_button_settings_confirm_deletion").unwrap();
- let check_button_settings_show_preview_similar_images: gtk::CheckButton = builder.get_object("check_button_settings_show_preview_similar_images").unwrap();
- let check_button_settings_show_text_view: gtk::CheckButton = builder.get_object("check_button_settings_show_text_view").unwrap();
-
- let button_settings_save_configuration: gtk::Button = builder.get_object("button_settings_save_configuration").unwrap();
- let button_settings_load_configuration: gtk::Button = builder.get_object("button_settings_load_configuration").unwrap();
- let button_settings_reset_configuration: gtk::Button = builder.get_object("button_settings_reset_configuration").unwrap();
-
let check_button_recursive: gtk::CheckButton = builder.get_object("check_button_recursive").unwrap();
let buttons_manual_add_directory: gtk::Button = builder.get_object("buttons_manual_add_directory").unwrap();
@@ -76,14 +54,6 @@ impl GUIUpperNotebook {
tree_view_excluded_directories,
entry_excluded_items,
entry_allowed_extensions,
- check_button_settings_save_at_exit,
- check_button_settings_load_at_start,
- check_button_settings_confirm_deletion,
- check_button_settings_show_preview_similar_images,
- check_button_settings_show_text_view,
- button_settings_save_configuration,
- button_settings_load_configuration,
- button_settings_reset_configuration,
check_button_recursive,
buttons_manual_add_directory,
buttons_add_included_directory,
diff --git a/czkawka_gui/src/initialize_gui.rs b/czkawka_gui/src/initialize_gui.rs
index 65f3dc2..23c4255 100644
--- a/czkawka_gui/src/initialize_gui.rs
+++ b/czkawka_gui/src/initialize_gui.rs
@@ -27,10 +27,6 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
buttons_delete.hide();
buttons_select.hide();
buttons_symlink.hide();
-
- // TODO Add Option window
- let button_settings = gui_data.header.button_settings.clone();
- button_settings.hide();
}
//// Initialize main scrolled view with notebook
@@ -47,7 +43,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
let scrolled_window_broken_files = gui_data.main_notebook.scrolled_window_broken_files.clone();
let image_preview_similar_images = gui_data.main_notebook.image_preview_similar_images.clone();
- let check_button_settings_show_preview_similar_images = gui_data.upper_notebook.check_button_settings_show_preview_similar_images.clone();
+ let check_button_settings_show_preview_similar_images = gui_data.settings.check_button_settings_show_preview_similar_images.clone();
let text_view_errors = gui_data.text_view_errors.clone();
// Set Main Scrolled Window Treeviews
@@ -243,7 +239,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
let image_preview_similar_images = image_preview_similar_images_clone.clone();
let text_view_errors = gui_data.text_view_errors.clone();
- let check_button_settings_show_preview_similar_images = gui_data.upper_notebook.check_button_settings_show_preview_similar_images.clone();
+ let check_button_settings_show_preview_similar_images = gui_data.settings.check_button_settings_show_preview_similar_images.clone();
let gui_data = gui_data.clone();
tree_view.connect_key_release_event(move |tree_view, e| {
if let Some(button_number) = e.get_keycode() {
diff --git a/czkawka_gui/src/main.rs b/czkawka_gui/src/main.rs
index 9e6ddc5..9c5ca3f 100644
--- a/czkawka_gui/src/main.rs
+++ b/czkawka_gui/src/main.rs
@@ -23,9 +23,9 @@ mod gui_bottom_buttons;
mod gui_data;
mod gui_header;
mod gui_main_notebook;
-mod gui_options;
mod gui_popovers;
mod gui_progress_dialog;
+mod gui_settings;
mod gui_upper_notepad;
mod help_functions;
mod initialize_gui;
diff --git a/czkawka_gui/src/saving_loading.rs b/czkawka_gui/src/saving_loading.rs
index 5c7a6c4..f54f079 100644
--- a/czkawka_gui/src/saving_loading.rs
+++ b/czkawka_gui/src/saving_loading.rs
@@ -13,7 +13,7 @@ use std::{env, fs};
const SAVE_FILE_NAME: &str = "czkawka_gui_config.txt";
pub fn save_configuration(gui_data: &GuiData, manual_execution: bool) {
- let check_button_settings_save_at_exit = gui_data.upper_notebook.check_button_settings_save_at_exit.clone();
+ let check_button_settings_save_at_exit = gui_data.settings.check_button_settings_save_at_exit.clone();
let text_view_errors = gui_data.text_view_errors.clone();
reset_text_view(&text_view_errors);
@@ -89,28 +89,33 @@ pub fn save_configuration(gui_data: &GuiData, manual_execution: bool) {
//// Save at exit
data_to_save.push("--save_at_exit:".to_string());
- let check_button_settings_save_at_exit = gui_data.upper_notebook.check_button_settings_save_at_exit.clone();
+ let check_button_settings_save_at_exit = gui_data.settings.check_button_settings_save_at_exit.clone();
data_to_save.push(check_button_settings_save_at_exit.get_active().to_string());
//// Load at start
data_to_save.push("--load_at_start:".to_string());
- let check_button_settings_load_at_start = gui_data.upper_notebook.check_button_settings_load_at_start.clone();
+ let check_button_settings_load_at_start = gui_data.settings.check_button_settings_load_at_start.clone();
data_to_save.push(check_button_settings_load_at_start.get_active().to_string());
//// Confirm deletion of files
data_to_save.push("--confirm_deletion:".to_string());
- let check_button_settings_confirm_deletion = gui_data.upper_notebook.check_button_settings_confirm_deletion.clone();
+ let check_button_settings_confirm_deletion = gui_data.settings.check_button_settings_confirm_deletion.clone();
data_to_save.push(check_button_settings_confirm_deletion.get_active().to_string());
//// Show image previews in similar images
data_to_save.push("--show_previews:".to_string());
- let check_button_settings_show_preview_similar_images = gui_data.upper_notebook.check_button_settings_show_preview_similar_images.clone();
+ let check_button_settings_show_preview_similar_images = gui_data.settings.check_button_settings_show_preview_similar_images.clone();
data_to_save.push(check_button_settings_show_preview_similar_images.get_active().to_string());
//// Show bottom text panel with errors
data_to_save.push("--bottom_text_panel:".to_string());
- let check_button_settings_show_text_view = gui_data.upper_notebook.check_button_settings_show_text_view.clone();
+ let check_button_settings_show_text_view = gui_data.settings.check_button_settings_show_text_view.clone();
data_to_save.push(check_button_settings_show_text_view.get_active().to_string());
+
+ //// Show bottom text panel with errors
+ data_to_save.push("--hide_hard_links:".to_string());
+ let check_button_settings_hide_hard_links = gui_data.settings.check_button_settings_hide_hard_links.clone();
+ data_to_save.push(check_button_settings_hide_hard_links.get_active().to_string());
}
// Creating/Opening config file
@@ -158,6 +163,7 @@ enum TypeOfLoadedData {
ConfirmDeletion,
ShowPreviews,
BottomTextPanel,
+ HideHardLinks,
}
pub fn load_configuration(gui_data: &GuiData, manual_execution: bool) {
@@ -200,6 +206,7 @@ pub fn load_configuration(gui_data: &GuiData, manual_execution: bool) {
let mut confirm_deletion: bool = true;
let mut show_previews: bool = true;
let mut bottom_text_panel: bool = true;
+ let mut hide_hard_links: bool = true;
let mut current_type = TypeOfLoadedData::None;
for (line_number, line) in loaded_data.replace("\r\n", "\n").split('\n').enumerate() {
@@ -225,6 +232,8 @@ pub fn load_configuration(gui_data: &GuiData, manual_execution: bool) {
current_type = TypeOfLoadedData::ShowPreviews;
} else if line.starts_with("--bottom_text_panel") {
current_type = TypeOfLoadedData::BottomTextPanel;
+ } else if line.starts_with("--hide_hard_links") {
+ current_type = TypeOfLoadedData::HideHardLinks;
} else if line.starts_with("--") {
current_type = TypeOfLoadedData::None;
add_text_to_text_view(
@@ -316,6 +325,19 @@ pub fn load_configuration(gui_data: &GuiData, manual_execution: bool) {
);
}
}
+ TypeOfLoadedData::HideHardLinks => {
+ let line = line.to_lowercase();
+ if line == "1" || line == "true" {
+ hide_hard_links = true;
+ } else if line == "0" || line == "false" {
+ hide_hard_links = false;
+ } else {
+ add_text_to_text_view(
+ &text_view_errors,
+ format!("Found invalid data in line {} \"{}\" isn't proper value(0/1/true/false) when loading file {:?}", line_number, line, config_file).as_str(),
+ );
+ }
+ }
}
}
}
@@ -355,19 +377,20 @@ pub fn load_configuration(gui_data: &GuiData, manual_execution: bool) {
entry_allowed_extensions.set_text(allowed_extensions.iter().map(|e| e.to_string() + ",").collect::().as_str());
//// Buttons
- gui_data.upper_notebook.check_button_settings_load_at_start.set_active(loading_at_start);
- gui_data.upper_notebook.check_button_settings_save_at_exit.set_active(saving_at_exit);
- gui_data.upper_notebook.check_button_settings_confirm_deletion.set_active(confirm_deletion);
- gui_data.upper_notebook.check_button_settings_show_preview_similar_images.set_active(show_previews);
+ gui_data.settings.check_button_settings_load_at_start.set_active(loading_at_start);
+ gui_data.settings.check_button_settings_save_at_exit.set_active(saving_at_exit);
+ gui_data.settings.check_button_settings_confirm_deletion.set_active(confirm_deletion);
+ gui_data.settings.check_button_settings_show_preview_similar_images.set_active(show_previews);
- gui_data.upper_notebook.check_button_settings_show_text_view.set_active(bottom_text_panel);
+ gui_data.settings.check_button_settings_show_text_view.set_active(bottom_text_panel);
if !bottom_text_panel {
- gui_data.text_view_errors.hide();
+ gui_data.scrolled_window_errors.hide();
} else {
- gui_data.text_view_errors.show();
+ gui_data.scrolled_window_errors.show();
}
+ gui_data.settings.check_button_settings_hide_hard_links.set_active(hide_hard_links);
} else {
- gui_data.upper_notebook.check_button_settings_load_at_start.set_active(false);
+ gui_data.settings.check_button_settings_load_at_start.set_active(false);
}
if manual_execution {
@@ -440,11 +463,12 @@ pub fn reset_configuration(gui_data: &GuiData, manual_clearing: bool) {
// Set settings
{
- gui_data.upper_notebook.check_button_settings_save_at_exit.set_active(true);
- gui_data.upper_notebook.check_button_settings_load_at_start.set_active(true);
- gui_data.upper_notebook.check_button_settings_confirm_deletion.set_active(true);
- gui_data.upper_notebook.check_button_settings_show_preview_similar_images.set_active(true);
- gui_data.upper_notebook.check_button_settings_show_text_view.set_active(true);
+ gui_data.settings.check_button_settings_save_at_exit.set_active(true);
+ gui_data.settings.check_button_settings_load_at_start.set_active(true);
+ gui_data.settings.check_button_settings_confirm_deletion.set_active(true);
+ gui_data.settings.check_button_settings_show_preview_similar_images.set_active(true);
+ gui_data.settings.check_button_settings_show_text_view.set_active(true);
+ gui_data.settings.check_button_settings_hide_hard_links.set_active(true);
}
if manual_clearing {
add_text_to_text_view(&text_view_errors, "Current configuration was cleared.");