rename wrapper mod to window

This commit is contained in:
yggverse 2024-10-05 17:10:31 +03:00
parent 992ecfc0f6
commit d5101a6465
26 changed files with 8 additions and 8 deletions

View file

@ -0,0 +1,49 @@
use gtk::{
gio::SimpleAction,
prelude::{ActionExt, ButtonExt, WidgetExt},
Button,
};
use std::sync::Arc;
pub struct Reload {
action_tab_page_navigation_reload: Arc<SimpleAction>,
widget: Button,
}
impl Reload {
// Construct
pub fn new(action_tab_page_navigation_reload: Arc<SimpleAction>) -> Self {
// Init widget
let widget = Button::builder()
.icon_name("view-refresh-symbolic")
.tooltip_text("Reload")
.sensitive(false)
.build();
// Init events
widget.connect_clicked({
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
move |_| {
action_tab_page_navigation_reload.activate(None);
}
});
// Return activated struct
Self {
action_tab_page_navigation_reload,
widget,
}
}
// Actions
pub fn update(&self, is_enabled: bool) {
self.action_tab_page_navigation_reload
.set_enabled(is_enabled);
self.widget.set_sensitive(is_enabled);
}
// Getters
pub fn widget(&self) -> &Button {
&self.widget
}
}