mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
use shared reference for tab item id
This commit is contained in:
parent
e66b065fc3
commit
ea3aab4d68
@ -25,7 +25,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||
pub struct Tab {
|
||||
profile: Rc<Profile>,
|
||||
actions: (Rc<BrowserAction>, Rc<WindowAction>),
|
||||
index: Rc<RefCell<HashMap<GString, Rc<Item>>>>,
|
||||
index: Rc<RefCell<HashMap<Rc<GString>, Rc<Item>>>>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
@ -33,7 +33,8 @@ impl Tab {
|
||||
// Construct
|
||||
pub fn new(profile: Rc<Profile>, action: (Rc<BrowserAction>, Rc<WindowAction>)) -> Self {
|
||||
// Init empty HashMap index
|
||||
let index: Rc<RefCell<HashMap<GString, Rc<Item>>>> = Rc::new(RefCell::new(HashMap::new()));
|
||||
let index: Rc<RefCell<HashMap<Rc<GString>, Rc<Item>>>> =
|
||||
Rc::new(RefCell::new(HashMap::new()));
|
||||
|
||||
// Init context menu
|
||||
let menu = Menu::new(action.1.clone());
|
||||
|
@ -24,7 +24,7 @@ use std::rc::Rc;
|
||||
pub struct Item {
|
||||
// Auto-generated unique item ID
|
||||
// useful as widget name in GTK actions callback
|
||||
pub id: GString,
|
||||
pub id: Rc<GString>,
|
||||
// Components
|
||||
pub page: Rc<Page>,
|
||||
pub widget: Rc<Widget>,
|
||||
@ -42,7 +42,7 @@ impl Item {
|
||||
let (position, request, is_pinned, is_selected, is_attention, is_load) = options;
|
||||
|
||||
// Generate unique ID for new page components
|
||||
let id = uuid_string_random();
|
||||
let id = Rc::new(uuid_string_random());
|
||||
|
||||
// Init components
|
||||
|
||||
|
@ -36,7 +36,7 @@ use sqlite::Transaction;
|
||||
use std::{rc::Rc, time::Duration};
|
||||
|
||||
pub struct Page {
|
||||
id: GString,
|
||||
id: Rc<GString>,
|
||||
profile: Rc<Profile>,
|
||||
// Actions
|
||||
browser_action: Rc<BrowserAction>,
|
||||
@ -54,7 +54,7 @@ impl Page {
|
||||
// Constructors
|
||||
|
||||
pub fn new(
|
||||
id: GString,
|
||||
id: Rc<GString>,
|
||||
profile: Rc<Profile>,
|
||||
action: (Rc<BrowserAction>, Rc<WindowAction>, Rc<TabAction>),
|
||||
) -> Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user