2022-01-04 09:02:56 +13:00
|
|
|
use gdk::gdk_pixbuf::Pixbuf;
|
2021-01-25 00:01:02 +13:00
|
|
|
use gtk::prelude::*;
|
2021-12-01 23:09:47 +13:00
|
|
|
use gtk::{Builder, Window};
|
2021-01-25 00:01:02 +13:00
|
|
|
|
2021-12-20 02:45:10 +13:00
|
|
|
use crate::fl;
|
|
|
|
|
2021-01-25 00:01:02 +13:00
|
|
|
#[derive(Clone)]
|
2021-03-28 01:14:02 +13:00
|
|
|
pub struct GuiAbout {
|
2021-01-25 00:01:02 +13:00
|
|
|
pub about_dialog: gtk::AboutDialog,
|
|
|
|
|
|
|
|
pub button_repository: gtk::Button,
|
|
|
|
pub button_donation: gtk::Button,
|
|
|
|
pub button_instruction: gtk::Button,
|
2021-12-27 18:11:45 +13:00
|
|
|
pub button_translation: gtk::Button,
|
2021-01-25 00:01:02 +13:00
|
|
|
}
|
|
|
|
|
2021-03-28 01:14:02 +13:00
|
|
|
impl GuiAbout {
|
2022-01-04 09:02:56 +13:00
|
|
|
pub fn create_from_builder(window_main: &Window, logo: &Pixbuf) -> Self {
|
2021-07-08 07:13:36 +12:00
|
|
|
let glade_src = include_str!("../ui/about_dialog.glade").to_string();
|
|
|
|
let builder = Builder::from_string(glade_src.as_str());
|
|
|
|
|
2021-06-26 04:07:13 +12:00
|
|
|
let about_dialog: gtk::AboutDialog = builder.object("about_dialog").unwrap();
|
2021-12-04 08:27:59 +13:00
|
|
|
about_dialog.set_modal(true);
|
2021-12-01 23:09:47 +13:00
|
|
|
about_dialog.set_transient_for(Some(window_main));
|
2021-01-25 00:01:02 +13:00
|
|
|
|
2022-01-04 09:02:56 +13:00
|
|
|
about_dialog.set_logo(Some(logo));
|
|
|
|
|
2022-01-04 07:14:37 +13:00
|
|
|
// Taken from command - "git shortlog -s -n -e" - remember to remove duplicates
|
|
|
|
// This should be updated only before releasing new version
|
|
|
|
about_dialog.set_authors(&vec![
|
|
|
|
"Rafał Mikrut",
|
|
|
|
"Thomas Andreas Jung",
|
|
|
|
"Alexis Lefebvre",
|
|
|
|
"Ben Bodenmiller",
|
|
|
|
"Dan Dascalescu",
|
|
|
|
"Igor",
|
|
|
|
"Peter Blackson",
|
|
|
|
"Shriraj Hegde",
|
|
|
|
"krzysdz",
|
|
|
|
"0xflotus",
|
|
|
|
"Adam Boguszewski",
|
|
|
|
"Caduser2020",
|
|
|
|
"Danny Kirkham",
|
|
|
|
"Dariusz Niedoba",
|
|
|
|
"Douman",
|
|
|
|
"Elazar Fine",
|
|
|
|
"Farmadupe",
|
|
|
|
"Jan Jurec",
|
|
|
|
"Jona",
|
|
|
|
"Meir Klemfner",
|
|
|
|
"Mek101",
|
|
|
|
"Michael Grigoryan",
|
|
|
|
"Nikita Karamov",
|
|
|
|
"Proprietary Chrome-chan",
|
|
|
|
"Sbgodin",
|
|
|
|
"Spirit",
|
|
|
|
"Stefan Seering",
|
|
|
|
"Syfaro",
|
|
|
|
"Yuri Slobodyanyuk",
|
|
|
|
"bellrise",
|
|
|
|
"endolith",
|
|
|
|
"jann",
|
|
|
|
"kamilek96",
|
|
|
|
"kuskov",
|
|
|
|
"tecome",
|
|
|
|
"tenninjas",
|
|
|
|
]);
|
|
|
|
|
2021-06-26 04:07:13 +12:00
|
|
|
let button_repository: gtk::Button = builder.object("button_repository").unwrap();
|
|
|
|
let button_donation: gtk::Button = builder.object("button_donation").unwrap();
|
|
|
|
let button_instruction: gtk::Button = builder.object("button_instruction").unwrap();
|
2021-12-27 18:11:45 +13:00
|
|
|
let button_translation: gtk::Button = builder.object("button_translation").unwrap();
|
2021-01-25 00:01:02 +13:00
|
|
|
|
|
|
|
Self {
|
|
|
|
about_dialog,
|
|
|
|
button_repository,
|
|
|
|
button_donation,
|
|
|
|
button_instruction,
|
2021-12-27 18:11:45 +13:00
|
|
|
button_translation,
|
2021-01-25 00:01:02 +13:00
|
|
|
}
|
|
|
|
}
|
2021-12-12 04:16:14 +13:00
|
|
|
pub fn update_language(&self) {
|
2022-01-04 07:14:37 +13:00
|
|
|
let mut comment_text: String = "2020 - 2022 Rafał Mikrut(qarmin)\n\n".to_string();
|
2021-12-20 09:42:14 +13:00
|
|
|
comment_text += &fl!("about_window_motto");
|
|
|
|
self.about_dialog.set_comments(Some(&comment_text));
|
|
|
|
|
2021-12-12 04:16:14 +13:00
|
|
|
self.button_repository.set_tooltip_text(Some(&fl!("about_repository_button_tooltip")));
|
|
|
|
self.button_donation.set_tooltip_text(Some(&fl!("about_donation_button_tooltip")));
|
|
|
|
self.button_instruction.set_tooltip_text(Some(&fl!("about_instruction_button_tooltip")));
|
2021-12-27 18:11:45 +13:00
|
|
|
self.button_translation.set_tooltip_text(Some(&fl!("about_translation_button_tooltip")));
|
2021-12-12 04:16:14 +13:00
|
|
|
|
|
|
|
self.button_repository.set_label(&fl!("about_repository_button"));
|
|
|
|
self.button_donation.set_label(&fl!("about_donation_button"));
|
|
|
|
self.button_instruction.set_label(&fl!("about_instruction_button"));
|
2021-12-27 18:11:45 +13:00
|
|
|
self.button_translation.set_label(&fl!("about_translation_button"));
|
2021-12-12 04:16:14 +13:00
|
|
|
}
|
2021-01-25 00:01:02 +13:00
|
|
|
}
|