mod widget;

use crate::{Audio, WidgetBuilder};
use gtk4::{Widget, prelude::*};

pub use widget::AudioWidget;

impl WidgetBuilder {
    pub(super) fn create_audio(&self, audio: Audio) -> Widget {
        let widget = AudioWidget::from(&audio).upcast::<Widget>();

        for id in audio.ids {
            tracing::trace!(id, "instert audio into id_map");
            self.id_map.borrow_mut().insert(id, widget.clone());
        }

        widget
    }
}
