1
0
Fork 0
mirror of synced 2024-05-09 23:12:29 +12:00
czkawka/czkawka_gui/src/gui_structs/gui_progress_dialog.rs
Rafał Mikrut 378fa1fd6e
Excluded extensions and krokiet new features (#1184)
* AVC

* Import split

* Default thread size

* Hen

* Allowed extensions

* Perf

* Connect

* Excluded

* Zmiany

* Optimization

* 4.10

* At once

* Included

* Chang

* VD

* VD

* Hashes

* Wersja

* SD

* Up

* Up

* 2024

* Dup

* Slint files

* Added  select

* Selections

* Fix

* LTO

* Actions

* Added popup delete

* AB

* V4

* Release

* LTO

* Basic moving

* Commonsy

* Moving probably works

* Popup move
2024-02-14 17:45:25 +01:00

70 lines
2.8 KiB
Rust

use gtk4::prelude::*;
use gtk4::{Builder, EventControllerKey, Window};
use crate::help_functions::{get_custom_label_from_widget, set_icon_of_button};
use crate::{flg, CZK_ICON_STOP};
#[derive(Clone)]
pub struct GuiProgressDialog {
pub window_progress: gtk4::Dialog,
pub progress_bar_current_stage: gtk4::ProgressBar,
pub progress_bar_all_stages: gtk4::ProgressBar,
pub label_stage: gtk4::Label,
pub label_progress_current_stage: gtk4::Label,
pub label_progress_all_stages: gtk4::Label,
pub grid_progress: gtk4::Grid,
pub button_stop_in_dialog: gtk4::Button,
pub evk_button_stop_in_dialog: EventControllerKey,
}
impl GuiProgressDialog {
pub fn create_from_builder(window_main: &Window) -> Self {
let glade_src = include_str!("../../ui/progress.ui").to_string();
let builder = Builder::from_string(glade_src.as_str());
let window_progress: gtk4::Dialog = builder.object("window_progress").unwrap();
window_progress.set_title(Some(&flg!("window_progress_title")));
window_progress.set_transient_for(Some(window_main));
window_progress.set_modal(true);
let progress_bar_current_stage: gtk4::ProgressBar = builder.object("progress_bar_current_stage").unwrap();
let progress_bar_all_stages: gtk4::ProgressBar = builder.object("progress_bar_all_stages").unwrap();
let label_stage: gtk4::Label = builder.object("label_stage").unwrap();
let label_progress_current_stage: gtk4::Label = builder.object("label_progress_current_stage").unwrap();
let label_progress_all_stages: gtk4::Label = builder.object("label_progress_all_stages").unwrap();
let grid_progress: gtk4::Grid = builder.object("grid_progress").unwrap();
let button_stop_in_dialog: gtk4::Button = builder.object("button_stop_in_dialog").unwrap();
let evk_button_stop_in_dialog = EventControllerKey::new();
button_stop_in_dialog.add_controller(evk_button_stop_in_dialog.clone());
set_icon_of_button(&button_stop_in_dialog, CZK_ICON_STOP);
Self {
window_progress,
progress_bar_current_stage,
progress_bar_all_stages,
label_stage,
label_progress_current_stage,
label_progress_all_stages,
grid_progress,
button_stop_in_dialog,
evk_button_stop_in_dialog,
}
}
pub fn update_language(&self) {
self.window_progress.set_title(Some(&flg!("window_progress_title")));
get_custom_label_from_widget(&self.button_stop_in_dialog.clone()).set_text(&flg!("progress_stop_button"));
self.label_progress_current_stage.set_label(&flg!("progress_current_stage"));
self.label_progress_all_stages.set_label(&flg!("progress_all_stages"));
}
}