From 6ccaf9d4c5dcb618e7c2ad7e8e0647c5713f119b Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 14 Oct 2024 06:42:06 +0300 Subject: [PATCH] update navigation request on middle click the link --- src/app/browser/window/tab.rs | 11 +++++++++-- src/app/browser/window/tab/item.rs | 5 +++++ src/app/browser/window/tab/item/page.rs | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 264738a6..20f9ada0 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -85,7 +85,7 @@ impl Tab { action_tab_page_navigation_history_forward.clone(); let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone(); let action_update = action_update.clone(); - move |_, _| { + move |_, request| { // Init new tab item let item = Item::new_arc( &gobject, @@ -99,11 +99,18 @@ impl Tab { action_update.clone(), // Options false, - false, // open on background + false, ); // Register dynamically created tab components in the HashMap index index.borrow_mut().insert(item.id(), item.clone()); + + // Set navigation request + if let Some(variant) = request { + if let Some(value) = variant.get::() { + item.set_page_navigation_request_text(value.as_str()) + } + } } }); diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index c4a8328f..3d4ebe8a 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -195,6 +195,11 @@ impl Item { Ok(()) } + // Setters + pub fn set_page_navigation_request_text(&self, value: &str) { + self.page.set_navigation_request_text(value); + } + // Getters pub fn id(&self) -> GString { self.id.clone() diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index cb4c6aa8..75ce64b2 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -522,6 +522,11 @@ impl Page { Ok(()) } + // Setters + pub fn set_navigation_request_text(&self, value: &str) { + self.navigation.set_request_text(value); + } + // Getters pub fn progress_fraction(&self) -> Option { // Interpret status to progress fraction