From 84944f1c6381e164dc1f04d8a9979ce05e4a5e79 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 5 May 2020 16:57:28 -0400 Subject: [PATCH] gtk-demo: Use dispose instead of destroy The destroy vfunc is going away. --- demos/gtk-demo/application.c | 8 ++++---- demos/gtk-demo/constraints.c | 9 +++++---- demos/gtk-demo/constraints2.c | 9 +++++---- demos/gtk-demo/constraints3.c | 9 +++++---- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c index e1aae430b2..53be2b10d0 100644 --- a/demos/gtk-demo/application.c +++ b/demos/gtk-demo/application.c @@ -503,13 +503,13 @@ demo_application_window_unrealize (GtkWidget *widget) } static void -demo_application_window_destroy (GtkWidget *widget) +demo_application_window_dispose (GObject *object) { - DemoApplicationWindow *window = (DemoApplicationWindow *)widget; + DemoApplicationWindow *window = (DemoApplicationWindow *)object; demo_application_window_store_state (window); - GTK_WIDGET_CLASS (demo_application_window_parent_class)->destroy (widget); + G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object); } static void @@ -519,11 +519,11 @@ demo_application_window_class_init (DemoApplicationWindowClass *class) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); object_class->constructed = demo_application_window_constructed; + object_class->dispose = demo_application_window_dispose; widget_class->size_allocate = demo_application_window_size_allocate; widget_class->realize = demo_application_window_realize; widget_class->unrealize = demo_application_window_unrealize; - widget_class->destroy = demo_application_window_destroy; gtk_widget_class_set_template_from_resource (widget_class, "/application_demo/application.ui"); gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message); diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c index f2f9076fa3..306d4b340c 100644 --- a/demos/gtk-demo/constraints.c +++ b/demos/gtk-demo/constraints.c @@ -21,23 +21,24 @@ struct _SimpleGrid G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET) static void -simple_grid_destroy (GtkWidget *widget) +simple_grid_dispose (GObject *object) { - SimpleGrid *self = SIMPLE_GRID (widget); + SimpleGrid *self = SIMPLE_GRID (object); g_clear_pointer (&self->button1, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button3, gtk_widget_destroy); - GTK_WIDGET_CLASS (simple_grid_parent_class)->destroy (widget); + G_OBJECT_CLASS (simple_grid_parent_class)->dispose (object); } static void simple_grid_class_init (SimpleGridClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->destroy = simple_grid_destroy; + object_class->dispose = simple_grid_dispose; gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT); } diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints2.c index cdaaa85088..bd2f373e0f 100644 --- a/demos/gtk-demo/constraints2.c +++ b/demos/gtk-demo/constraints2.c @@ -22,23 +22,24 @@ struct _InteractiveGrid G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET) static void -interactive_grid_destroy (GtkWidget *widget) +interactive_grid_dispose (GObject *object) { - InteractiveGrid *self = INTERACTIVE_GRID (widget); + InteractiveGrid *self = INTERACTIVE_GRID (object); g_clear_pointer (&self->button1, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button3, gtk_widget_destroy); - GTK_WIDGET_CLASS (interactive_grid_parent_class)->destroy (widget); + G_OBJECT_CLASS (interactive_grid_parent_class)->dispose (object); } static void interactive_grid_class_init (InteractiveGridClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->destroy = interactive_grid_destroy; + object_class->dispose = interactive_grid_dispose; gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT); } diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints3.c index 01d81a48d2..a534a905f7 100644 --- a/demos/gtk-demo/constraints3.c +++ b/demos/gtk-demo/constraints3.c @@ -20,23 +20,24 @@ struct _VflGrid G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET) static void -vfl_grid_destroy (GtkWidget *widget) +vfl_grid_dispose (GObject *object) { - VflGrid *self = VFL_GRID (widget); + VflGrid *self = VFL_GRID (object); g_clear_pointer (&self->button1, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button3, gtk_widget_destroy); - GTK_WIDGET_CLASS (vfl_grid_parent_class)->destroy (widget); + G_OBJECT_CLASS (vfl_grid_parent_class)->dispose (object); } static void vfl_grid_class_init (VflGridClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->destroy = vfl_grid_destroy; + object_class->dispose = vfl_grid_dispose; gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT); }