mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
toggle action status
This commit is contained in:
parent
98f88c5464
commit
832b90d37d
@ -7,22 +7,25 @@ pub struct Base {
|
||||
impl Base {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
widget: Button::builder()
|
||||
.action_name("win.tab_page_base")
|
||||
.icon_name("go-home-symbolic")
|
||||
.tooltip_text("Base")
|
||||
.sensitive(false)
|
||||
.build(),
|
||||
}
|
||||
let widget = Button::builder()
|
||||
.action_name("win.tab_page_base")
|
||||
.icon_name("go-home-symbolic")
|
||||
.tooltip_text("Base")
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
Self { widget }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, uri: Option<Uri>) {
|
||||
self.widget.set_sensitive(match uri {
|
||||
let status = match uri {
|
||||
Some(uri) => "/" != uri.path(),
|
||||
None => false,
|
||||
});
|
||||
};
|
||||
|
||||
self.widget.action_set_enabled("win.tab_page_base", status);
|
||||
self.widget.set_sensitive(status);
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
Loading…
x
Reference in New Issue
Block a user