1
0
Fork 0
mirror of synced 2024-05-17 10:54:04 +12:00
czkawka/czkawka_gui/src/gui_about.rs

49 lines
1.8 KiB
Rust
Raw Normal View History

2021-01-25 00:01:02 +13:00
use gtk::prelude::*;
use gtk::{Builder, Window};
2021-01-25 00:01:02 +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-03-28 01:14:02 +13:00
impl GuiAbout {
pub fn create_from_builder(window_main: &Window) -> 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());
let about_dialog: gtk::AboutDialog = builder.object("about_dialog").unwrap();
about_dialog.set_modal(true);
about_dialog.set_transient_for(Some(window_main));
2021-01-25 00:01:02 +13: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-01-25 00:01:02 +13:00
Self {
about_dialog,
button_repository,
button_donation,
button_instruction,
}
}
pub fn update_language(&self) {
let mut comment_text: String = "2020 - 2021 Rafał Mikrut(qarmin)\n\n".to_string();
comment_text += &fl!("about_window_motto");
self.about_dialog.set_comments(Some(&comment_text));
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")));
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-01-25 00:01:02 +13:00
}