mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
toggle action status
This commit is contained in:
parent
98f88c5464
commit
832b90d37d
1 changed files with 13 additions and 10 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue