2022-05-22 20:59:09 +12:00
|
|
|
use gtk4::prelude::*;
|
2021-01-25 00:01:02 +13:00
|
|
|
|
2022-01-14 03:58:33 +13:00
|
|
|
use crate::gui_structs::gui_data::GuiData;
|
2021-11-28 08:49:20 +13:00
|
|
|
|
2021-01-25 00:01:02 +13:00
|
|
|
const SPONSOR_SITE: &str = "https://github.com/sponsors/qarmin";
|
|
|
|
const REPOSITORY_SITE: &str = "https://github.com/qarmin/czkawka";
|
|
|
|
const INSTRUCTION_SITE: &str = "https://github.com/qarmin/czkawka/blob/master/instructions/Instruction.md";
|
2021-12-27 18:11:45 +13:00
|
|
|
const TRANSLATION_SITE: &str = "https://crwd.in/czkawka";
|
2021-01-25 00:01:02 +13:00
|
|
|
|
|
|
|
pub fn connect_about_buttons(gui_data: &GuiData) {
|
|
|
|
let button_donation = gui_data.about.button_donation.clone();
|
|
|
|
button_donation.connect_clicked(move |_| {
|
2022-06-18 20:59:46 +12:00
|
|
|
if let Err(e) = open::that(SPONSOR_SITE) {
|
|
|
|
println!("Failed to open sponsor site: {}, reason {}", SPONSOR_SITE, e)
|
|
|
|
};
|
2021-01-25 00:01:02 +13:00
|
|
|
});
|
|
|
|
|
|
|
|
let button_instruction = gui_data.about.button_instruction.clone();
|
|
|
|
button_instruction.connect_clicked(move |_| {
|
2022-06-18 20:59:46 +12:00
|
|
|
if let Err(e) = open::that(INSTRUCTION_SITE) {
|
|
|
|
println!("Failed to open instruction site: {}, reason {}", INSTRUCTION_SITE, e)
|
|
|
|
};
|
2021-01-25 00:01:02 +13:00
|
|
|
});
|
|
|
|
|
|
|
|
let button_repository = gui_data.about.button_repository.clone();
|
|
|
|
button_repository.connect_clicked(move |_| {
|
2022-06-18 20:59:46 +12:00
|
|
|
if let Err(e) = open::that(REPOSITORY_SITE) {
|
|
|
|
println!("Failed to open repository site: {}, reason {}", REPOSITORY_SITE, e)
|
|
|
|
};
|
2021-01-25 00:01:02 +13:00
|
|
|
});
|
2021-12-27 18:11:45 +13:00
|
|
|
|
|
|
|
let button_translation = gui_data.about.button_translation.clone();
|
|
|
|
button_translation.connect_clicked(move |_| {
|
2022-06-18 20:59:46 +12:00
|
|
|
if let Err(e) = open::that(TRANSLATION_SITE) {
|
|
|
|
println!("Failed to open repository site: {}, reason {}", TRANSLATION_SITE, e)
|
|
|
|
};
|
2021-12-27 18:11:45 +13:00
|
|
|
});
|
2021-01-25 00:01:02 +13:00
|
|
|
}
|