mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
sync tab action status with global actions
This commit is contained in:
parent
5247cfee44
commit
0061320050
1 changed files with 41 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ use action::Action;
|
|||
use adw::TabPage;
|
||||
use client::Client;
|
||||
use gtk::{
|
||||
prelude::{ActionMapExt, BoxExt},
|
||||
prelude::{ActionExt, ActionMapExt, BoxExt},
|
||||
Box,
|
||||
};
|
||||
use page::Page;
|
||||
|
|
@ -71,6 +71,16 @@ impl Item {
|
|||
let client = Rc::new(Client::init(profile, &page));
|
||||
|
||||
// Connect events
|
||||
action.home.connect_enabled_notify({
|
||||
let window_action = window_action.clone();
|
||||
move |this| {
|
||||
window_action
|
||||
.home
|
||||
.simple_action
|
||||
.set_enabled(this.is_enabled())
|
||||
}
|
||||
});
|
||||
|
||||
action.home.connect_activate({
|
||||
let client = client.clone();
|
||||
let page = page.clone();
|
||||
|
|
@ -108,6 +118,36 @@ impl Item {
|
|||
}
|
||||
});
|
||||
|
||||
action.reload.connect_enabled_notify({
|
||||
let window_action = window_action.clone();
|
||||
move |this| {
|
||||
window_action
|
||||
.reload
|
||||
.simple_action
|
||||
.set_enabled(this.is_enabled())
|
||||
}
|
||||
});
|
||||
|
||||
action.history.back.connect_enabled_notify({
|
||||
let window_action = window_action.clone();
|
||||
move |this| {
|
||||
window_action
|
||||
.history_back
|
||||
.simple_action
|
||||
.set_enabled(this.is_enabled())
|
||||
}
|
||||
});
|
||||
|
||||
action.history.forward.connect_enabled_notify({
|
||||
let window_action = window_action.clone();
|
||||
move |this| {
|
||||
window_action
|
||||
.history_forward
|
||||
.simple_action
|
||||
.set_enabled(this.is_enabled())
|
||||
}
|
||||
});
|
||||
|
||||
// Handle immediately on request
|
||||
if let Some(text) = request {
|
||||
page.navigation.set_request(text);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue