mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35: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()),
|
Err(e) => return Err(e.to_string()),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use super::{Action as WindowAction, BrowserAction, Position};
|
||||||
use crate::Profile;
|
use crate::Profile;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
glib::{DateTime, GString, Propagation},
|
glib::{DateTime, GString, Propagation},
|
||||||
prelude::{EditableExt, WidgetExt},
|
prelude::{ActionExt, EditableExt, WidgetExt},
|
||||||
};
|
};
|
||||||
use sqlite::Transaction;
|
use sqlite::Transaction;
|
||||||
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||||
|
|
@ -123,15 +123,30 @@ impl Tab {
|
||||||
});
|
});
|
||||||
|
|
||||||
widget.tab_view.connect_selected_page_notify({
|
widget.tab_view.connect_selected_page_notify({
|
||||||
|
let window_action = window_action.clone();
|
||||||
let index = index.clone();
|
let index = index.clone();
|
||||||
move |this| {
|
move |this| {
|
||||||
if let Some(page) = this.selected_page() {
|
if let Some(page) = this.selected_page() {
|
||||||
if let Some(id) = page.keyword() {
|
if let Some(id) = page.keyword() {
|
||||||
if let Some(item) = index.borrow().get(&id) {
|
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);
|
page.set_needs_attention(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue