From d93e0c39372835a339ab42e028155a31d9ea15b9 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Tue, 21 Jan 2025 13:39:53 +0100 Subject: [PATCH] implement mz_files_view_dispose to cleanup child widgets --- mizunara/gtk-filesview.c | 6 ++++++ mizunara/gtk-filesview.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/mizunara/gtk-filesview.c b/mizunara/gtk-filesview.c index 9a80839..6a3afe5 100644 --- a/mizunara/gtk-filesview.c +++ b/mizunara/gtk-filesview.c @@ -57,6 +57,7 @@ static void mz_files_view_class_init(MzFilesViewClass *klass) { klass->parent_class.snapshot = mz_files_view_snapshot; klass->parent_class.measure = mz_files_view_measure; klass->parent_class.size_allocate = mz_files_view_size_allocate; + klass->parent_class.parent_class.dispose = mz_files_view_dispose; } static void mz_files_view_init(MzFilesView *self) { @@ -76,6 +77,11 @@ static void mz_files_view_init(MzFilesView *self) { gtk_widget_add_controller(GTK_WIDGET(self), GTK_EVENT_CONTROLLER(drag)); } +void mz_files_view_dispose(GObject *object) { + MzFilesView *view = (MzFilesView*)object; + mz_files_view_remove_items(view); +} + MzFilesView* mz_files_view_new(void) { MzFilesView *obj = g_object_new(mz_files_view_get_type(), NULL); return obj; diff --git a/mizunara/gtk-filesview.h b/mizunara/gtk-filesview.h index 1bbd085..30fbb4d 100644 --- a/mizunara/gtk-filesview.h +++ b/mizunara/gtk-filesview.h @@ -68,6 +68,8 @@ typedef struct MzFilesViewClass { MzFilesView* mz_files_view_new(void); +void mz_files_view_dispose(GObject *object); + void mz_files_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot); void mz_files_view_measure(GtkWidget *widget, -- 2.43.5