mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
toggle action status on update
This commit is contained in:
parent
9a199dc32d
commit
49c912a094
@ -6,6 +6,7 @@ use gtk::{
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Reload {
|
||||
action_tab_page_reload: Arc<SimpleAction>,
|
||||
widget: Button,
|
||||
}
|
||||
|
||||
@ -20,18 +21,24 @@ impl Reload {
|
||||
.build();
|
||||
|
||||
// Init events
|
||||
widget.connect_clicked(move |_| {
|
||||
widget.connect_clicked({
|
||||
let action_tab_page_reload = action_tab_page_reload.clone();
|
||||
move |_| {
|
||||
action_tab_page_reload.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
// Return activated struct
|
||||
Self { widget }
|
||||
Self {
|
||||
action_tab_page_reload,
|
||||
widget,
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, is_enabled: bool) {
|
||||
self.action_tab_page_reload.set_enabled(is_enabled);
|
||||
self.widget.set_sensitive(is_enabled);
|
||||
// @TODO deactivate action
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
Loading…
x
Reference in New Issue
Block a user