mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
update window actions on tab change
This commit is contained in:
parent
81cea44302
commit
49c1f5923b
2 changed files with 18 additions and 4 deletions
|
|
@ -158,7 +158,6 @@ impl Window {
|
|||
}
|
||||
Err(e) => return Err(e.to_string()),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use super::{Action as WindowAction, BrowserAction, Position};
|
|||
use crate::Profile;
|
||||
use gtk::{
|
||||
glib::{DateTime, GString, Propagation},
|
||||
prelude::{EditableExt, WidgetExt},
|
||||
prelude::{ActionExt, EditableExt, WidgetExt},
|
||||
};
|
||||
use sqlite::Transaction;
|
||||
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||
|
|
@ -123,15 +123,30 @@ impl Tab {
|
|||
});
|
||||
|
||||
widget.tab_view.connect_selected_page_notify({
|
||||
let window_action = window_action.clone();
|
||||
let index = index.clone();
|
||||
move |this| {
|
||||
if let Some(page) = this.selected_page() {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = index.borrow().get(&id) {
|
||||
item.update();
|
||||
window_action
|
||||
.home
|
||||
.simple_action
|
||||
.set_enabled(item.action.home.is_enabled());
|
||||
window_action
|
||||
.reload
|
||||
.simple_action
|
||||
.set_enabled(item.action.reload.is_enabled());
|
||||
window_action
|
||||
.history_back
|
||||
.simple_action
|
||||
.set_enabled(item.action.history.back.is_enabled());
|
||||
window_action
|
||||
.history_forward
|
||||
.simple_action
|
||||
.set_enabled(item.action.history.forward.is_enabled());
|
||||
}
|
||||
}
|
||||
// Reset attention decorator
|
||||
page.set_needs_attention(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue