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 text::Text;
use gtk::{prelude::BoxExt, Box, Orientation}; use gtk::{
prelude::{BoxExt, WidgetExt},
Box, Orientation,
};
pub enum Mime { pub enum Mime {
Undefined, Undefined,
@ -27,7 +30,12 @@ impl Content {
// Actions // Actions
pub fn reset(&self, mime: Mime, data: &str) { 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 { match mime {
Mime::TextGemini => { Mime::TextGemini => {
let child = Text::gemini(data); let child = Text::gemini(data);