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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Reload {
|
pub struct Reload {
|
||||||
|
action_tab_page_reload: Arc<SimpleAction>,
|
||||||
widget: Button,
|
widget: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,18 +21,24 @@ impl Reload {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
widget.connect_clicked(move |_| {
|
widget.connect_clicked({
|
||||||
action_tab_page_reload.activate(None);
|
let action_tab_page_reload = action_tab_page_reload.clone();
|
||||||
|
move |_| {
|
||||||
|
action_tab_page_reload.activate(None);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return activated struct
|
// Return activated struct
|
||||||
Self { widget }
|
Self {
|
||||||
|
action_tab_page_reload,
|
||||||
|
widget,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_enabled: bool) {
|
pub fn update(&self, is_enabled: bool) {
|
||||||
|
self.action_tab_page_reload.set_enabled(is_enabled);
|
||||||
self.widget.set_sensitive(is_enabled);
|
self.widget.set_sensitive(is_enabled);
|
||||||
// @TODO deactivate action
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user