mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
make arc pointer on construct
This commit is contained in:
parent
b4d1e4eadc
commit
597e472154
2 changed files with 6 additions and 4 deletions
|
|
@ -10,6 +10,8 @@ use gtk::{
|
|||
Align, Box, Orientation,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Label {
|
||||
// Components
|
||||
pin: Pin,
|
||||
|
|
@ -21,7 +23,7 @@ pub struct Label {
|
|||
|
||||
impl Label {
|
||||
// Construct
|
||||
pub fn new(name: GString, is_pinned: bool) -> Label {
|
||||
pub fn new(name: GString, is_pinned: bool) -> Arc<Label> {
|
||||
// Components
|
||||
let pin = Pin::new(is_pinned);
|
||||
let title = Title::new();
|
||||
|
|
@ -37,7 +39,7 @@ impl Label {
|
|||
widget.append(title.widget());
|
||||
|
||||
// Result
|
||||
Self { pin, title, widget }
|
||||
Arc::new(Self { pin, title, widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ impl Tab {
|
|||
let id = uuid_string_random();
|
||||
|
||||
// Init new tab components
|
||||
let label = Arc::new(Label::new(id.clone(), false));
|
||||
let page = Arc::new(Page::new(id.clone()));
|
||||
let label = Label::new(id.clone(), false);
|
||||
let page = Page::new(id.clone());
|
||||
|
||||
// Register dynamically created tab components in the HashMap index
|
||||
self.labels.borrow_mut().insert(id.clone(), label.clone());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue