2020-11-01 02:23:31 +13:00
|
|
|
mod connect_button_delete;
|
|
|
|
mod connect_button_save;
|
|
|
|
mod connect_button_search;
|
|
|
|
mod connect_button_select;
|
|
|
|
mod connect_button_stop;
|
|
|
|
mod connect_compute_results;
|
|
|
|
mod connect_notebook_tabs;
|
2020-11-09 22:09:22 +13:00
|
|
|
mod connect_popovers;
|
2020-11-01 02:23:31 +13:00
|
|
|
mod connect_upper_notebook;
|
2020-10-16 04:51:47 +13:00
|
|
|
mod create_tree_view;
|
2020-10-15 21:42:27 +13:00
|
|
|
mod double_click_opening;
|
2020-11-01 02:23:31 +13:00
|
|
|
mod gui_data;
|
2020-09-30 05:44:20 +13:00
|
|
|
mod help_functions;
|
2020-11-01 02:23:31 +13:00
|
|
|
mod startup_configuration;
|
2020-09-30 05:44:20 +13:00
|
|
|
|
2020-09-23 22:17:19 +12:00
|
|
|
use czkawka_core::*;
|
2020-10-15 21:42:27 +13:00
|
|
|
|
2020-09-02 05:34:39 +12:00
|
|
|
extern crate gtk;
|
2020-11-01 02:23:31 +13:00
|
|
|
use crate::connect_button_delete::*;
|
|
|
|
use crate::connect_button_save::*;
|
|
|
|
use crate::connect_button_search::*;
|
|
|
|
use crate::connect_button_select::*;
|
|
|
|
use crate::connect_button_stop::*;
|
|
|
|
use crate::connect_compute_results::*;
|
|
|
|
use crate::connect_notebook_tabs::*;
|
2020-11-09 22:09:22 +13:00
|
|
|
use crate::connect_popovers::*;
|
2020-11-01 02:23:31 +13:00
|
|
|
use crate::connect_upper_notebook::*;
|
|
|
|
use crate::gui_data::*;
|
|
|
|
use crate::startup_configuration::*;
|
2020-09-02 05:34:39 +12:00
|
|
|
use gtk::prelude::*;
|
2020-11-01 02:23:31 +13:00
|
|
|
use std::{env, process};
|
2020-10-15 05:41:37 +13:00
|
|
|
|
2020-09-02 05:34:39 +12:00
|
|
|
fn main() {
|
2020-10-04 22:10:17 +13:00
|
|
|
let mut exit_program_after_initialization: bool = false;
|
2020-09-24 21:58:59 +12:00
|
|
|
// Printing version
|
2020-09-23 22:17:19 +12:00
|
|
|
{
|
|
|
|
let all_arguments: Vec<String> = env::args().skip(1).collect(); // Not need to check program name
|
|
|
|
|
|
|
|
for i in all_arguments {
|
2020-10-04 22:10:17 +13:00
|
|
|
if i == "-v" || i == "--version" {
|
2020-10-02 03:54:26 +13:00
|
|
|
println!("Czkawka GUI {}", CZKAWKA_VERSION);
|
2020-09-23 22:17:19 +12:00
|
|
|
process::exit(0);
|
|
|
|
}
|
2020-10-04 22:10:17 +13:00
|
|
|
if i == "-q" || i == "--quit" {
|
|
|
|
exit_program_after_initialization = true;
|
|
|
|
}
|
2020-09-23 22:17:19 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:12:18 +12:00
|
|
|
gtk::init().expect("Failed to initialize GTK.");
|
|
|
|
|
2020-11-01 02:23:31 +13:00
|
|
|
let gui_data: GuiData = GuiData::new();
|
2020-10-10 22:15:20 +13:00
|
|
|
|
|
|
|
// Used for getting data from thread
|
2020-10-08 09:22:39 +13:00
|
|
|
let (sender, receiver) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
|
|
|
|
|
2020-11-01 02:23:31 +13:00
|
|
|
startup_configuration(&gui_data);
|
|
|
|
connect_button_delete(&gui_data);
|
|
|
|
connect_button_save(&gui_data);
|
|
|
|
connect_button_search(&gui_data, sender);
|
|
|
|
connect_button_select(&gui_data);
|
|
|
|
connect_button_stop(&gui_data);
|
|
|
|
connect_notebook_tabs(&gui_data);
|
|
|
|
connect_upper_notebook(&gui_data);
|
2020-11-09 22:09:22 +13:00
|
|
|
connect_popovers(&gui_data);
|
2020-11-01 02:23:31 +13:00
|
|
|
connect_compute_results(&gui_data, receiver);
|
2020-10-08 09:22:39 +13:00
|
|
|
|
2020-09-30 05:44:20 +13:00
|
|
|
// Quit the program when X in main window was clicked
|
2020-11-01 02:23:31 +13:00
|
|
|
gui_data.window_main.connect_delete_event(|_, _| {
|
2020-09-30 05:44:20 +13:00
|
|
|
gtk::main_quit();
|
|
|
|
Inhibit(false)
|
|
|
|
});
|
|
|
|
|
|
|
|
// We start the gtk main loop.
|
|
|
|
gtk::main();
|
2020-10-04 22:10:17 +13:00
|
|
|
|
|
|
|
// Quiting if quit flag was provided
|
|
|
|
if exit_program_after_initialization {
|
|
|
|
gtk::main_quit();
|
|
|
|
}
|
2020-09-26 06:29:09 +12:00
|
|
|
}
|