1
0
Fork 0
mirror of synced 2024-05-19 03:43:00 +12:00

Make settings and progress window a dialog (#481)

This will fix issue with showing windows in random position after removing Window::Position
Settings are modal, so entire app is frozen and this needs to be closed to be able to use e.g. minimize button.
This commit is contained in:
Rafał Mikrut 2021-12-03 20:27:59 +01:00 committed by GitHub
parent b496809410
commit c8549b3810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 632 additions and 561 deletions

View file

@ -50,6 +50,9 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let notebook_upper = gui_data.upper_notebook.notebook_upper.clone();
let button_settings = gui_data.header.button_settings.clone();
let button_app_info = gui_data.header.button_app_info.clone();
let main_context = glib::MainContext::default();
let _guard = main_context.acquire().unwrap();
@ -57,13 +60,15 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
glib_stop_receiver.attach(None, move |msg| {
buttons_search.show();
notebook_main.set_sensitive(true);
notebook_upper.set_sensitive(true);
button_settings.set_sensitive(true);
button_app_info.set_sensitive(true);
window_progress.hide();
taskbar_state.borrow().hide();
// Restore clickability to main notebook
notebook_main.set_sensitive(true);
let hash_size;
if radio_button_similar_hash_size_8.is_active() {
hash_size = 8;

View file

@ -38,80 +38,83 @@ pub fn connect_button_search(
futures_sender_invalid_symlinks: futures::channel::mpsc::UnboundedSender<invalid_symlinks::ProgressData>,
futures_sender_broken_files: futures::channel::mpsc::UnboundedSender<broken_files::ProgressData>,
) {
let entry_info = gui_data.entry_info.clone();
let notebook_main = gui_data.main_notebook.notebook_main.clone();
let tree_view_included_directories = gui_data.upper_notebook.tree_view_included_directories.clone();
let tree_view_excluded_directories = gui_data.upper_notebook.tree_view_excluded_directories.clone();
let buttons_search_clone = gui_data.bottom_buttons.buttons_search.clone();
let buttons_array = gui_data.bottom_buttons.buttons_array.clone();
let check_button_recursive = gui_data.upper_notebook.check_button_recursive.clone();
let entry_excluded_items = gui_data.upper_notebook.entry_excluded_items.clone();
let entry_same_music_minimal_size = gui_data.main_notebook.entry_same_music_minimal_size.clone();
let entry_same_music_maximal_size = gui_data.main_notebook.entry_same_music_maximal_size.clone();
let entry_allowed_extensions = gui_data.upper_notebook.entry_allowed_extensions.clone();
let buttons_names = gui_data.bottom_buttons.buttons_names.clone();
let buttons_search_clone = gui_data.bottom_buttons.buttons_search.clone();
let check_button_duplicates_use_prehash_cache = gui_data.settings.check_button_duplicates_use_prehash_cache.clone();
let check_button_music_album_artist: gtk::CheckButton = gui_data.main_notebook.check_button_music_album_artist.clone();
let check_button_music_album_title: gtk::CheckButton = gui_data.main_notebook.check_button_music_album_title.clone();
let check_button_music_artist: gtk::CheckButton = gui_data.main_notebook.check_button_music_artist.clone();
let check_button_music_title: gtk::CheckButton = gui_data.main_notebook.check_button_music_title.clone();
let check_button_music_year: gtk::CheckButton = gui_data.main_notebook.check_button_music_year.clone();
let check_button_recursive = gui_data.upper_notebook.check_button_recursive.clone();
let check_button_settings_duplicates_delete_outdated_cache = gui_data.settings.check_button_settings_duplicates_delete_outdated_cache.clone();
let check_button_settings_hide_hard_links = gui_data.settings.check_button_settings_hide_hard_links.clone();
let check_button_settings_similar_images_delete_outdated_cache = gui_data.settings.check_button_settings_similar_images_delete_outdated_cache.clone();
let check_button_settings_similar_videos_delete_outdated_cache = gui_data.settings.check_button_settings_similar_videos_delete_outdated_cache.clone();
let check_button_settings_use_cache = gui_data.settings.check_button_settings_use_cache.clone();
let entry_allowed_extensions = gui_data.upper_notebook.entry_allowed_extensions.clone();
let entry_big_files_number = gui_data.main_notebook.entry_big_files_number.clone();
let entry_duplicate_maximal_size = gui_data.main_notebook.entry_duplicate_maximal_size.clone();
let entry_duplicate_minimal_size = gui_data.main_notebook.entry_duplicate_minimal_size.clone();
let entry_excluded_items = gui_data.upper_notebook.entry_excluded_items.clone();
let entry_same_music_maximal_size = gui_data.main_notebook.entry_same_music_maximal_size.clone();
let entry_same_music_minimal_size = gui_data.main_notebook.entry_same_music_minimal_size.clone();
let entry_settings_cache_file_minimal_size = gui_data.settings.entry_settings_cache_file_minimal_size.clone();
let entry_settings_prehash_cache_file_minimal_size = gui_data.settings.entry_settings_prehash_cache_file_minimal_size.clone();
let entry_similar_images_maximal_size = gui_data.main_notebook.entry_similar_images_maximal_size.clone();
let entry_similar_images_minimal_size = gui_data.main_notebook.entry_similar_images_minimal_size.clone();
let entry_similar_videos_maximal_size = gui_data.main_notebook.entry_similar_videos_maximal_size.clone();
let entry_similar_videos_minimal_size = gui_data.main_notebook.entry_similar_videos_minimal_size.clone();
let grid_progress_stages = gui_data.progress_window.grid_progress_stages.clone();
let image_preview_similar_images = gui_data.main_notebook.image_preview_similar_images.clone();
let label_stage = gui_data.progress_window.label_stage.clone();
let notebook_main = gui_data.main_notebook.notebook_main.clone();
let notebook_upper = gui_data.upper_notebook.notebook_upper.clone();
let progress_bar_all_stages = gui_data.progress_window.progress_bar_all_stages.clone();
let progress_bar_current_stage = gui_data.progress_window.progress_bar_current_stage.clone();
let radio_button_duplicates_hash = gui_data.main_notebook.radio_button_duplicates_hash.clone();
let radio_button_duplicates_name = gui_data.main_notebook.radio_button_duplicates_name.clone();
let radio_button_duplicates_size = gui_data.main_notebook.radio_button_duplicates_size.clone();
let radio_button_duplicates_hash = gui_data.main_notebook.radio_button_duplicates_hash.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
let scale_similarity_similar_videos = gui_data.main_notebook.scale_similarity_similar_videos.clone();
let entry_duplicate_minimal_size = gui_data.main_notebook.entry_duplicate_minimal_size.clone();
let entry_duplicate_maximal_size = gui_data.main_notebook.entry_duplicate_maximal_size.clone();
let stop_receiver = gui_data.stop_receiver.clone();
let entry_big_files_number = gui_data.main_notebook.entry_big_files_number.clone();
let entry_similar_images_minimal_size = gui_data.main_notebook.entry_similar_images_minimal_size.clone();
let entry_similar_images_maximal_size = gui_data.main_notebook.entry_similar_images_maximal_size.clone();
let entry_similar_videos_minimal_size = gui_data.main_notebook.entry_similar_videos_minimal_size.clone();
let entry_similar_videos_maximal_size = gui_data.main_notebook.entry_similar_videos_maximal_size.clone();
let check_button_music_title: gtk::CheckButton = gui_data.main_notebook.check_button_music_title.clone();
let check_button_music_artist: gtk::CheckButton = gui_data.main_notebook.check_button_music_artist.clone();
let check_button_music_album_title: gtk::CheckButton = gui_data.main_notebook.check_button_music_album_title.clone();
let check_button_music_album_artist: gtk::CheckButton = gui_data.main_notebook.check_button_music_album_artist.clone();
let check_button_music_year: gtk::CheckButton = gui_data.main_notebook.check_button_music_year.clone();
let shared_buttons = gui_data.shared_buttons.clone();
let tree_view_empty_folder_finder = gui_data.main_notebook.tree_view_empty_folder_finder.clone();
let tree_view_empty_files_finder = gui_data.main_notebook.tree_view_empty_files_finder.clone();
let tree_view_big_files_finder = gui_data.main_notebook.tree_view_big_files_finder.clone();
let tree_view_duplicate_finder = gui_data.main_notebook.tree_view_duplicate_finder.clone();
let tree_view_temporary_files_finder = gui_data.main_notebook.tree_view_temporary_files_finder.clone();
let tree_view_same_music_finder = gui_data.main_notebook.tree_view_same_music_finder.clone();
let tree_view_similar_images_finder = gui_data.main_notebook.tree_view_similar_images_finder.clone();
let tree_view_similar_videos_finder = gui_data.main_notebook.tree_view_similar_videos_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 text_view_errors = gui_data.text_view_errors.clone();
let window_progress = gui_data.progress_window.window_progress.clone();
let label_stage = gui_data.progress_window.label_stage.clone();
let grid_progress_stages = gui_data.progress_window.grid_progress_stages.clone();
let progress_bar_current_stage = gui_data.progress_window.progress_bar_current_stage.clone();
let progress_bar_all_stages = gui_data.progress_window.progress_bar_all_stages.clone();
let taskbar_state = gui_data.taskbar_state.clone();
let image_preview_similar_images = gui_data.main_notebook.image_preview_similar_images.clone();
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();
let check_button_settings_use_cache = gui_data.settings.check_button_settings_use_cache.clone();
let check_button_duplicates_use_prehash_cache = gui_data.settings.check_button_duplicates_use_prehash_cache.clone();
let entry_settings_cache_file_minimal_size = gui_data.settings.entry_settings_cache_file_minimal_size.clone();
let entry_settings_prehash_cache_file_minimal_size = gui_data.settings.entry_settings_prehash_cache_file_minimal_size.clone();
let radio_button_similar_hash_size_8 = gui_data.main_notebook.radio_button_similar_hash_size_8.clone();
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let radio_button_resize_algorithm_catmullrom = gui_data.main_notebook.radio_button_resize_algorithm_catmullrom.clone();
let radio_button_resize_algorithm_gaussian = gui_data.main_notebook.radio_button_resize_algorithm_gaussian.clone();
let radio_button_resize_algorithm_lanczos3 = gui_data.main_notebook.radio_button_resize_algorithm_lanczos3.clone();
let radio_button_resize_algorithm_nearest = gui_data.main_notebook.radio_button_resize_algorithm_nearest.clone();
let radio_button_resize_algorithm_triangle = gui_data.main_notebook.radio_button_resize_algorithm_triangle.clone();
let radio_button_resize_algorithm_gaussian = gui_data.main_notebook.radio_button_resize_algorithm_gaussian.clone();
let radio_button_similar_hash_algorithm_gradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_gradient.clone();
let radio_button_similar_hash_algorithm_blockhash = gui_data.main_notebook.radio_button_similar_hash_algorithm_blockhash.clone();
let radio_button_similar_hash_algorithm_doublegradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_doublegradient.clone();
let radio_button_similar_hash_algorithm_gradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_gradient.clone();
let radio_button_similar_hash_algorithm_mean = gui_data.main_notebook.radio_button_similar_hash_algorithm_mean.clone();
let radio_button_similar_hash_algorithm_vertgradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_vertgradient.clone();
let radio_button_similar_hash_algorithm_doublegradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_doublegradient.clone();
let check_button_settings_duplicates_delete_outdated_cache = gui_data.settings.check_button_settings_duplicates_delete_outdated_cache.clone();
let check_button_settings_similar_videos_delete_outdated_cache = gui_data.settings.check_button_settings_similar_videos_delete_outdated_cache.clone();
let check_button_settings_similar_images_delete_outdated_cache = gui_data.settings.check_button_settings_similar_images_delete_outdated_cache.clone();
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let radio_button_similar_hash_size_8 = gui_data.main_notebook.radio_button_similar_hash_size_8.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
let scale_similarity_similar_videos = gui_data.main_notebook.scale_similarity_similar_videos.clone();
let shared_buttons = gui_data.shared_buttons.clone();
let stop_receiver = gui_data.stop_receiver.clone();
let taskbar_state = gui_data.taskbar_state.clone();
let text_view_errors = gui_data.text_view_errors.clone();
let tree_view_big_files_finder = gui_data.main_notebook.tree_view_big_files_finder.clone();
let tree_view_broken_files = gui_data.main_notebook.tree_view_broken_files.clone();
let tree_view_duplicate_finder = gui_data.main_notebook.tree_view_duplicate_finder.clone();
let tree_view_empty_files_finder = gui_data.main_notebook.tree_view_empty_files_finder.clone();
let tree_view_empty_folder_finder = gui_data.main_notebook.tree_view_empty_folder_finder.clone();
let tree_view_excluded_directories = gui_data.upper_notebook.tree_view_excluded_directories.clone();
let tree_view_included_directories = gui_data.upper_notebook.tree_view_included_directories.clone();
let tree_view_invalid_symlinks = gui_data.main_notebook.tree_view_invalid_symlinks.clone();
let tree_view_same_music_finder = gui_data.main_notebook.tree_view_same_music_finder.clone();
let tree_view_similar_images_finder = gui_data.main_notebook.tree_view_similar_images_finder.clone();
let tree_view_similar_videos_finder = gui_data.main_notebook.tree_view_similar_videos_finder.clone();
let tree_view_temporary_files_finder = gui_data.main_notebook.tree_view_temporary_files_finder.clone();
let window_progress = gui_data.progress_window.window_progress.clone();
let entry_info = gui_data.entry_info.clone();
let button_settings = gui_data.header.button_settings.clone();
let button_app_info = gui_data.header.button_app_info.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));
@ -127,8 +130,10 @@ pub fn connect_button_search(
hide_all_buttons(&buttons_array);
// Disable main notebook from any iteration until search will end
notebook_main.set_sensitive(false);
notebook_upper.set_sensitive(false);
button_settings.set_sensitive(false);
button_app_info.set_sensitive(false);
entry_info.set_text("Searching data, it may take a while, please wait...");
@ -440,7 +445,6 @@ pub fn connect_button_search(
let _ = glib_stop_sender.send(Message::SameMusic(mf));
});
} else {
notebook_main.set_sensitive(true);
set_buttons(&mut *shared_buttons.borrow_mut().get_mut(&NotebookMainEnum::SameMusic).unwrap(), &buttons_array, &buttons_names);
entry_info.set_text("ERROR: You must select at least one checkbox with music searching types.");
show_dialog.store(false, Ordering::Relaxed);

View file

@ -16,19 +16,15 @@ 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.connect_delete_event(move |window, _| {
window.hide();
window_main.set_sensitive(true);
gtk::Inhibit(true)
});
}

View file

@ -16,6 +16,7 @@ impl GuiAbout {
let builder = Builder::from_string(glade_src.as_str());
let about_dialog: gtk::AboutDialog = builder.object("about_dialog").unwrap();
about_dialog.set_modal(true);
about_dialog.set_transient_for(Some(window_main));
let button_repository: gtk::Button = builder.object("button_repository").unwrap();

View file

@ -3,7 +3,7 @@ use gtk::{Builder, EventControllerKey, Window};
#[derive(Clone)]
pub struct GuiProgressDialog {
pub window_progress: gtk::Window,
pub window_progress: gtk::Dialog,
pub progress_bar_current_stage: gtk::ProgressBar,
pub progress_bar_all_stages: gtk::ProgressBar,
@ -21,7 +21,7 @@ impl GuiProgressDialog {
let glade_src = include_str!("../ui/progress.glade").to_string();
let builder = Builder::from_string(glade_src.as_str());
let window_progress: gtk::Window = builder.object("window_progress").unwrap();
let window_progress: gtk::Dialog = builder.object("window_progress").unwrap();
window_progress.set_transient_for(Some(window_main));
let progress_bar_current_stage: gtk::ProgressBar = builder.object("progress_bar_current_stage").unwrap();

View file

@ -32,9 +32,32 @@ Author: Rafał Mikrut
<!-- interface-name Czkawka -->
<!-- interface-description Czkawka is simple and fast app to find duplicates, empty folders, similar images etc. -->
<!-- interface-authors Rafa\305\202 Mikrut -->
<object class="GtkWindow" id="window_progress">
<object class="GtkDialog" id="window_progress">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Czkawka Progress Window</property>
<property name="type-hint">dialog</property>
<property name="gravity">center</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -165,6 +188,13 @@ Author: Rafał Mikrut
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -32,9 +32,33 @@ Author: Rafał Mikrut
<!-- interface-name Czkawka -->
<!-- interface-description Czkawka is simple and fast app to find duplicates, empty folders, similar images etc. -->
<!-- interface-authors Rafa\305\202 Mikrut -->
<object class="GtkWindow" id="window_settings">
<object class="GtkDialog" id="window_settings">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Czkawka Options</property>
<property name="modal">True</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -295,6 +319,8 @@ Author: Rafał Mikrut
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">4</property>
<property name="margin-right">4</property>
<property name="margin-start">4</property>
<property name="margin-end">4</property>
<child>
@ -544,6 +570,8 @@ Author: Rafał Mikrut
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">3</property>
<property name="margin-right">3</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>
<property name="spacing">3</property>
@ -596,6 +624,13 @@ Author: Rafał Mikrut
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>