make update action by item id

This commit is contained in:
yggverse 2024-10-15 08:45:44 +03:00
parent c92a5406f5
commit 6c4137f2b6
7 changed files with 48 additions and 41 deletions

View file

@ -26,7 +26,7 @@ pub struct Tab {
action_tab_page_navigation_reload: Arc<SimpleAction>,
action_update: Arc<SimpleAction>,
// Dynamically allocated reference index
index: Arc<RefCell<HashMap<Arc<GString>, Arc<Item>>>>,
index: Arc<RefCell<HashMap<GString, Arc<Item>>>>,
// GTK
widget: Arc<Widget>,
}
@ -208,18 +208,16 @@ impl Tab {
}
}
pub fn update(&self) {
if let Some(id) = self.widget.current_page_keyword() {
if let Some(item) = self.index.borrow().get(&id) {
// Update item components
item.update();
pub fn update(&self, id: &str) {
if let Some(item) = self.index.borrow().get(id) {
// Update item components
item.update();
// Update tab title on loading indicator inactive
if !item.page_is_loading() {
if let Some(title) = item.page_meta_title() {
item.gobject().set_title(title.as_str())
};
}
// Update tab title on loading indicator inactive
if !item.page_is_loading() {
if let Some(title) = item.page_meta_title() {
item.gobject().set_title(title.as_str())
};
}
}
}