generate unique HashMap keys for children widgets

This commit is contained in:
yggverse 2024-09-24 20:48:31 +03:00
parent 0d89e16622
commit f407117470
3 changed files with 46 additions and 30 deletions

View file

@ -1,11 +1,15 @@
mod pin;
mod title;
use gtk::prelude::{BoxExt, WidgetExt};
use gtk::{Align, Box, Orientation};
use pin::Pin;
use title::Title;
use gtk::{
glib::GString,
prelude::{BoxExt, WidgetExt},
Align, Box, Orientation,
};
pub struct Label {
// Components
pin: Pin,
@ -17,7 +21,7 @@ pub struct Label {
impl Label {
// Construct
pub fn new(is_pinned: bool) -> Label {
pub fn new(name: GString, is_pinned: bool) -> Label {
// Components
let pin = Pin::new(is_pinned);
let title = Title::new();
@ -26,6 +30,7 @@ impl Label {
let widget = Box::builder()
.orientation(Orientation::Horizontal)
.halign(Align::Center)
.name(name)
.build();
widget.append(pin.widget());