mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
use arc on construct
This commit is contained in:
parent
793d179164
commit
e514312f84
@ -91,7 +91,7 @@ impl Tab {
|
|||||||
is_initially_current: bool,
|
is_initially_current: bool,
|
||||||
) -> Arc<Item> {
|
) -> Arc<Item> {
|
||||||
// Init new tab item
|
// Init new tab item
|
||||||
let item = Arc::new(Item::new(
|
let item = Item::new(
|
||||||
page_navigation_request_text.clone(),
|
page_navigation_request_text.clone(),
|
||||||
is_initially_current,
|
is_initially_current,
|
||||||
// Actions
|
// Actions
|
||||||
@ -100,7 +100,7 @@ impl Tab {
|
|||||||
self.action_tab_page_navigation_history_forward.clone(),
|
self.action_tab_page_navigation_history_forward.clone(),
|
||||||
self.action_tab_page_navigation_reload.clone(),
|
self.action_tab_page_navigation_reload.clone(),
|
||||||
self.action_update.clone(),
|
self.action_update.clone(),
|
||||||
));
|
);
|
||||||
|
|
||||||
// Register dynamically created tab components in the HashMap index
|
// Register dynamically created tab components in the HashMap index
|
||||||
self.index.borrow_mut().insert(item.id(), item.clone());
|
self.index.borrow_mut().insert(item.id(), item.clone());
|
||||||
|
@ -38,14 +38,14 @@ impl Item {
|
|||||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||||
action_update: Arc<SimpleAction>,
|
action_update: Arc<SimpleAction>,
|
||||||
) -> Self {
|
) -> Arc<Self> {
|
||||||
// Generate unique ID for new page components
|
// Generate unique ID for new page components
|
||||||
let id = uuid_string_random();
|
let id = uuid_string_random();
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
let label = Label::new(id.clone(), false);
|
let label = Label::new(id.clone(), false);
|
||||||
|
|
||||||
let page = Arc::new(Page::new(
|
let page = Page::new(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
page_navigation_request_text.clone(),
|
page_navigation_request_text.clone(),
|
||||||
action_tab_page_navigation_base.clone(),
|
action_tab_page_navigation_base.clone(),
|
||||||
@ -53,15 +53,15 @@ impl Item {
|
|||||||
action_tab_page_navigation_history_forward.clone(),
|
action_tab_page_navigation_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_tab_page_navigation_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
));
|
);
|
||||||
|
|
||||||
// Return struct
|
// Return struct
|
||||||
Self {
|
Arc::new(Self {
|
||||||
id,
|
id,
|
||||||
is_initially_current,
|
is_initially_current,
|
||||||
label,
|
label,
|
||||||
page,
|
page,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
@ -142,7 +142,7 @@ impl Item {
|
|||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
for record in records {
|
for record in records {
|
||||||
// Construct new item object
|
// Construct new item object
|
||||||
let item = Arc::new(Item::new(
|
let item = Item::new(
|
||||||
None,
|
None,
|
||||||
record.is_initially_current,
|
record.is_initially_current,
|
||||||
// Actions
|
// Actions
|
||||||
@ -151,7 +151,7 @@ impl Item {
|
|||||||
action_tab_page_navigation_history_forward.clone(),
|
action_tab_page_navigation_history_forward.clone(),
|
||||||
action_tab_page_navigation_reload.clone(),
|
action_tab_page_navigation_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
));
|
);
|
||||||
|
|
||||||
// Delegate restore action to the item childs
|
// Delegate restore action to the item childs
|
||||||
item.label.restore(transaction, &record.id)?;
|
item.label.restore(transaction, &record.id)?;
|
||||||
|
@ -44,7 +44,7 @@ impl Page {
|
|||||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||||
action_update: Arc<SimpleAction>,
|
action_update: Arc<SimpleAction>,
|
||||||
) -> Page {
|
) -> Arc<Self> {
|
||||||
// Init actions
|
// Init actions
|
||||||
let action_page_open = Arc::new(SimpleAction::new(
|
let action_page_open = Arc::new(SimpleAction::new(
|
||||||
"open",
|
"open",
|
||||||
@ -102,7 +102,7 @@ impl Page {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Return activated structure
|
// Return activated structure
|
||||||
Self {
|
Arc::new(Self {
|
||||||
// GTK
|
// GTK
|
||||||
widget,
|
widget,
|
||||||
// Actions
|
// Actions
|
||||||
@ -114,7 +114,7 @@ impl Page {
|
|||||||
navigation,
|
navigation,
|
||||||
// Extras
|
// Extras
|
||||||
meta,
|
meta,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user