cleanup previous content data

This commit is contained in:
yggverse 2024-09-26 15:59:57 +03:00
parent ae6fff72ac
commit 1d673029c0

View File

@ -3,7 +3,10 @@ mod text;
use text::Text;
use gtk::{prelude::BoxExt, Box, Orientation};
use gtk::{
prelude::{BoxExt, WidgetExt},
Box, Orientation,
};
pub enum Mime {
Undefined,
@ -27,7 +30,12 @@ impl Content {
// Actions
pub fn reset(&self, mime: Mime, data: &str) {
//self.widget.remove(self.child.widget());
// Cleanup
while let Some(child) = self.widget.last_child() {
self.widget.remove(&child)
}
// Compose
match mime {
Mime::TextGemini => {
let child = Text::gemini(data);