mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-11 02:44:15 +00:00
update window on tab page switch
This commit is contained in:
parent
4f4e25381f
commit
18d9d3b4c5
@ -7,7 +7,7 @@ use page::Page;
|
|||||||
use gtk::{
|
use gtk::{
|
||||||
gio::SimpleAction,
|
gio::SimpleAction,
|
||||||
glib::{uuid_string_random, GString},
|
glib::{uuid_string_random, GString},
|
||||||
prelude::WidgetExt,
|
prelude::{ActionExt, WidgetExt},
|
||||||
GestureClick, Notebook,
|
GestureClick, Notebook,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,13 +48,17 @@ impl Tab {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn activate(&self, tab: Arc<Self>) {
|
pub fn activate(&self, tab: Arc<Self>) {
|
||||||
self.widget.connect_page_removed({
|
self.widget.connect_page_removed(move |_, widget, _| {
|
||||||
move |_, widget, _| {
|
// Cleanup HashMap index
|
||||||
// Cleanup HashMap index
|
let id = &widget.widget_name();
|
||||||
let id = &widget.widget_name();
|
tab.labels.borrow_mut().remove(id);
|
||||||
tab.labels.borrow_mut().remove(id);
|
tab.pages.borrow_mut().remove(id);
|
||||||
tab.pages.borrow_mut().remove(id);
|
});
|
||||||
}
|
|
||||||
|
self.widget.connect_switch_page({
|
||||||
|
let action_update = self.action_update.clone();
|
||||||
|
// Update window header with current page title
|
||||||
|
move |_, _, _| action_update.activate(None)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user