From 1293da79558257516b8ee695f7c7f14045e186c8 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 11 Oct 2024 01:44:44 +0300 Subject: [PATCH] activate tab on construct --- src/app/browser/window.rs | 1 - src/app/browser/window/tab.rs | 35 ++++++++++++++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 332b5418..50f4c5de 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -70,7 +70,6 @@ impl Window { action_tab_page_navigation_reload, action_update, ); - tab.activate(tab.clone()); // GTK let widget = Arc::new(Widget::new(header.gobject(), tab.gobject())); diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index f6498859..5b4b821a 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -45,7 +45,22 @@ impl Tab { // Init widget let widget = Arc::new(Widget::new()); - // Return non activated struct + // Init events + widget.gobject().connect_close_page(move |_, tab_page| { + /* @TODO + // Cleanup HashMap index + let id = tab_page.widget_name(); + + // Check for required value as raw access to gobject @TODO + if id.is_empty() { + panic!("Undefined tab index!") + } + + tab.index.borrow_mut().remove(&id); */ + Propagation::Proceed + }); + + // Return activated struct Arc::new(Self { // Define action links action_tab_page_navigation_base, @@ -61,24 +76,6 @@ impl Tab { } // Actions - pub fn activate(&self, tab: Arc) { - self.widget - .gobject() - .connect_close_page(move |_, tab_page| { - /* @TODO - // Cleanup HashMap index - let id = tab_page.widget_name(); - - // Check for required value as raw access to gobject @TODO - if id.is_empty() { - panic!("Undefined tab index!") - } - - tab.index.borrow_mut().remove(&id); */ - Propagation::Proceed - }); - } - pub fn append( &self, page_navigation_request_text: Option,