update navigation request on middle click the link

This commit is contained in:
yggverse 2024-10-14 06:42:06 +03:00
parent ee92777039
commit 6ccaf9d4c5
3 changed files with 19 additions and 2 deletions

View File

@ -85,7 +85,7 @@ impl Tab {
action_tab_page_navigation_history_forward.clone(); action_tab_page_navigation_history_forward.clone();
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone(); let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
let action_update = action_update.clone(); let action_update = action_update.clone();
move |_, _| { move |_, request| {
// Init new tab item // Init new tab item
let item = Item::new_arc( let item = Item::new_arc(
&gobject, &gobject,
@ -99,11 +99,18 @@ impl Tab {
action_update.clone(), action_update.clone(),
// Options // Options
false, false,
false, // open on background false,
); );
// Register dynamically created tab components in the HashMap index // Register dynamically created tab components in the HashMap index
index.borrow_mut().insert(item.id(), item.clone()); index.borrow_mut().insert(item.id(), item.clone());
// Set navigation request
if let Some(variant) = request {
if let Some(value) = variant.get::<String>() {
item.set_page_navigation_request_text(value.as_str())
}
}
} }
}); });

View File

@ -195,6 +195,11 @@ impl Item {
Ok(()) Ok(())
} }
// Setters
pub fn set_page_navigation_request_text(&self, value: &str) {
self.page.set_navigation_request_text(value);
}
// Getters // Getters
pub fn id(&self) -> GString { pub fn id(&self) -> GString {
self.id.clone() self.id.clone()

View File

@ -522,6 +522,11 @@ impl Page {
Ok(()) Ok(())
} }
// Setters
pub fn set_navigation_request_text(&self, value: &str) {
self.navigation.set_request_text(value);
}
// Getters // Getters
pub fn progress_fraction(&self) -> Option<f64> { pub fn progress_fraction(&self) -> Option<f64> {
// Interpret status to progress fraction // Interpret status to progress fraction