From 1b6f45152a9c2c708b62792726394318d6db8f1e Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 14 Nov 2024 16:24:48 +0200 Subject: [PATCH] use tuple for actions --- src/app/browser/window/tab.rs | 14 ++++++-------- src/app/browser/window/tab/item.rs | 10 +++------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 432a7502..43386df5 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -24,8 +24,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; // Main pub struct Tab { profile: Rc, - browser_action: Rc, - window_action: Rc, + actions: (Rc, Rc), index: Rc>>>, widget: Rc, } @@ -100,8 +99,7 @@ impl Tab { // Return activated `Self` Self { profile, - browser_action: action.0, - window_action: action.1, + actions: (action.0, action.1), index, widget, } @@ -121,9 +119,9 @@ impl Tab { let item = Rc::new(Item::new( self.widget.gobject(), self.profile.clone(), - self.browser_action.clone(), - self.window_action.clone(), - // Options tuple + // Actions + (self.actions.0.clone(), self.actions.1.clone()), + // Options ( position, request, @@ -294,7 +292,7 @@ impl Tab { transaction, &record.id, self.profile.clone(), - (self.browser_action.clone(), self.window_action.clone()), + (self.actions.0.clone(), self.actions.1.clone()), ) { Ok(items) => { for item in items { diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index b51c2ea8..fdd49efb 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -34,10 +34,7 @@ impl Item { pub fn new( tab_view: &TabView, profile: Rc, - // Actions - browser_action: Rc, - window_action: Rc, - // Options tuple @TODO struct? + actions: (Rc, Rc), options: (Position, Option, bool, bool, bool, bool), ) -> Self { // Get item options from tuple @@ -53,7 +50,7 @@ impl Item { let page = Rc::new(Page::new( id.clone(), profile, - (browser_action, window_action, action.clone()), + (actions.0, actions.1, action.clone()), )); let widget = Rc::new(Widget::new( @@ -154,8 +151,7 @@ impl Item { tab_view, profile.clone(), // Actions - action.0.clone(), - action.1.clone(), + (action.0.clone(), action.1.clone()), // Options tuple ( Position::End,