implement is_attention tab state decorator

This commit is contained in:
yggverse 2024-11-11 14:47:51 +02:00
parent f6d015c8c1
commit 8f9f5d3eaa
5 changed files with 87 additions and 22 deletions

View file

@ -85,6 +85,8 @@ impl Tab {
item.update();
}
}
// Reset attention decorator
page.set_needs_attention(false);
}
}
});
@ -105,6 +107,7 @@ impl Tab {
request: Option<String>,
is_pinned: bool,
is_selected: bool,
is_attention: bool,
is_load: bool,
) -> Rc<Item> {
// Init new tab item
@ -113,9 +116,19 @@ impl Tab {
self.browser_action.clone(),
self.window_action.clone(),
// Options tuple
(position, request, is_pinned, is_selected, is_load),
(
position,
request,
is_pinned,
is_selected,
is_attention,
is_load,
),
));
// Apply tab attention request
item.widget().gobject().set_needs_attention(is_attention);
// Register dynamically created tab components in the HashMap index
self.index
.borrow_mut()
@ -310,7 +323,7 @@ impl Tab {
pub fn init(&self) {
// Append just one blank page if no tabs available after last session restore
if self.index.borrow().is_empty() {
self.append(None, None, false, true, false);
self.append(None, None, false, true, false, false);
}
// @TODO other/child features..