mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-11 02:44:15 +00:00
make arc pointer on construct
This commit is contained in:
parent
b4d1e4eadc
commit
597e472154
@ -10,6 +10,8 @@ use gtk::{
|
|||||||
Align, Box, Orientation,
|
Align, Box, Orientation,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Label {
|
pub struct Label {
|
||||||
// Components
|
// Components
|
||||||
pin: Pin,
|
pin: Pin,
|
||||||
@ -21,7 +23,7 @@ pub struct Label {
|
|||||||
|
|
||||||
impl Label {
|
impl Label {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(name: GString, is_pinned: bool) -> Label {
|
pub fn new(name: GString, is_pinned: bool) -> Arc<Label> {
|
||||||
// Components
|
// Components
|
||||||
let pin = Pin::new(is_pinned);
|
let pin = Pin::new(is_pinned);
|
||||||
let title = Title::new();
|
let title = Title::new();
|
||||||
@ -37,7 +39,7 @@ impl Label {
|
|||||||
widget.append(title.widget());
|
widget.append(title.widget());
|
||||||
|
|
||||||
// Result
|
// Result
|
||||||
Self { pin, title, widget }
|
Arc::new(Self { pin, title, widget })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
@ -57,8 +57,8 @@ impl Tab {
|
|||||||
let id = uuid_string_random();
|
let id = uuid_string_random();
|
||||||
|
|
||||||
// Init new tab components
|
// Init new tab components
|
||||||
let label = Arc::new(Label::new(id.clone(), false));
|
let label = Label::new(id.clone(), false);
|
||||||
let page = Arc::new(Page::new(id.clone()));
|
let page = Page::new(id.clone());
|
||||||
|
|
||||||
// Register dynamically created tab components in the HashMap index
|
// Register dynamically created tab components in the HashMap index
|
||||||
self.labels.borrow_mut().insert(id.clone(), label.clone());
|
self.labels.borrow_mut().insert(id.clone(), label.clone());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user