1
0
Fork 0
mirror of synced 2024-04-28 01:22:53 +12:00
czkawka/czkawka_gui/src/connect_settings.rs
Rafał Mikrut c9719758c7
Clean GUI code, make it easier to understand and change (#462)
* Add static variable for basic notebook data

* Opening, selecting results by space, enter and mouse

* Now hard/symbolic links

* Now deleting

* Now popovers

* Move tests to different function

* Don't crash when there is no selected records

* Button symlinks

* Now move

* Compute results

* Move again

* Again Popovers

* More popovers and more

* Key clicking, removing

* KEY_DELETE

* No more GuiData clone

* Adding directories

* Reorganize a little files
2021-11-25 08:36:49 +01:00

62 lines
2.6 KiB
Rust

use crate::gui_data::GuiData;
use crate::saving_loading::{load_configuration, reset_configuration, save_configuration};
use gtk::prelude::*;
use gtk::WindowPosition;
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();
window_settings.set_position(WindowPosition::Center);
});
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 upper_notebook = gui_data.upper_notebook.clone();
let settings = gui_data.settings.clone();
let text_view_errors = gui_data.text_view_errors.clone();
let button_settings_save_configuration = gui_data.settings.button_settings_save_configuration.clone();
button_settings_save_configuration.connect_clicked(move |_| {
save_configuration(true, &upper_notebook, &settings, &text_view_errors);
});
}
// Connect load configuration button
{
let upper_notebook = gui_data.upper_notebook.clone();
let settings = gui_data.settings.clone();
let text_view_errors = gui_data.text_view_errors.clone();
let button_settings_load_configuration = gui_data.settings.button_settings_load_configuration.clone();
let scrolled_window_errors = gui_data.scrolled_window_errors.clone();
button_settings_load_configuration.connect_clicked(move |_| {
load_configuration(true, &upper_notebook, &settings, &text_view_errors, &scrolled_window_errors);
});
}
// Connect reset configuration button
{
let upper_notebook = gui_data.upper_notebook.clone();
let settings = gui_data.settings.clone();
let text_view_errors = gui_data.text_view_errors.clone();
let button_settings_reset_configuration = gui_data.settings.button_settings_reset_configuration.clone();
button_settings_reset_configuration.connect_clicked(move |_| {
reset_configuration(true, &upper_notebook, &settings, &text_view_errors);
});
}
}