mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +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 {
|
impl Base {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
let widget = Button::builder()
|
||||||
widget: Button::builder()
|
|
||||||
.action_name("win.tab_page_base")
|
.action_name("win.tab_page_base")
|
||||||
.icon_name("go-home-symbolic")
|
.icon_name("go-home-symbolic")
|
||||||
.tooltip_text("Base")
|
.tooltip_text("Base")
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build(),
|
.build();
|
||||||
}
|
|
||||||
|
Self { widget }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, uri: Option<Uri>) {
|
pub fn update(&self, uri: Option<Uri>) {
|
||||||
self.widget.set_sensitive(match uri {
|
let status = match uri {
|
||||||
Some(uri) => "/" != uri.path(),
|
Some(uri) => "/" != uri.path(),
|
||||||
None => false,
|
None => false,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
self.widget.action_set_enabled("win.tab_page_base", status);
|
||||||
|
self.widget.set_sensitive(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue