diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 5d4e221e..b72ccefb 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -86,6 +86,8 @@ impl Tab { self.action_tab_page_navigation_history_forward.clone(), self.action_tab_page_navigation_reload.clone(), self.action_update.clone(), + // Options + true, ); // Register dynamically created tab components in the HashMap index diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 2fc9d9b5..ce6a9601 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -34,6 +34,8 @@ impl Item { action_tab_page_navigation_history_forward: Arc, action_tab_page_navigation_reload: Arc, action_update: Arc, + // Options + is_selected_page: bool, ) -> Arc { // Generate unique ID for new page components let id = uuid_string_random(); @@ -48,7 +50,7 @@ impl Item { action_update.clone(), ); - let widget = Widget::new_arc(tab_view, page.gobject(), Some("New page")); // @TODO + let widget = Widget::new_arc(tab_view, page.gobject(), Some("New page"), is_selected_page); // @TODO // Return struct Arc::new(Self { id, page, widget }) @@ -129,11 +131,14 @@ impl Item { // Construct new item object let item = Item::new_arc( tab_view, + // Actions action_tab_page_navigation_base.clone(), action_tab_page_navigation_history_back.clone(), action_tab_page_navigation_history_forward.clone(), action_tab_page_navigation_reload.clone(), action_update.clone(), + // Options + true, ); // Delegate restore action to the item childs diff --git a/src/app/browser/window/tab/item/widget.rs b/src/app/browser/window/tab/item/widget.rs index ca415206..72a51564 100644 --- a/src/app/browser/window/tab/item/widget.rs +++ b/src/app/browser/window/tab/item/widget.rs @@ -8,13 +8,22 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(tab_view: &TabView, page: &Box, title: Option<&str>) -> Arc { + pub fn new_arc( + tab_view: &TabView, + page: &Box, + title: Option<&str>, + is_selected_page: bool, + ) -> Arc { let gobject = tab_view.append(page); if let Some(value) = title { gobject.set_title(value); } + if is_selected_page { + tab_view.set_selected_page(&gobject); + } + Arc::new(Self { gobject }) } diff --git a/src/app/browser/window/tab/widget.rs b/src/app/browser/window/tab/widget.rs index c13e2739..8e03a806 100644 --- a/src/app/browser/window/tab/widget.rs +++ b/src/app/browser/window/tab/widget.rs @@ -14,10 +14,6 @@ impl Widget { } // Actions - pub fn append(&self, page: &Box) -> TabPage { - self.gobject.append(page) - } - pub fn close(&self) { if let Some(selected_page) = self.gobject.selected_page() { self.gobject.close_page(&selected_page);