gtk-demo: Use dispose instead of destroy

The destroy vfunc is going away.
This commit is contained in:
Matthias Clasen 2020-05-05 16:57:28 -04:00
parent 1086acce92
commit 84944f1c63
4 changed files with 19 additions and 16 deletions

View File

@ -503,13 +503,13 @@ demo_application_window_unrealize (GtkWidget *widget)
} }
static void 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); 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 static void
@ -519,11 +519,11 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->constructed = demo_application_window_constructed; 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->size_allocate = demo_application_window_size_allocate;
widget_class->realize = demo_application_window_realize; widget_class->realize = demo_application_window_realize;
widget_class->unrealize = demo_application_window_unrealize; 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_set_template_from_resource (widget_class, "/application_demo/application.ui");
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message); gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message);

View File

@ -21,23 +21,24 @@ struct _SimpleGrid
G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET) G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET)
static void 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->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, 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 static void
simple_grid_class_init (SimpleGridClass *klass) simple_grid_class_init (SimpleGridClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_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); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
} }

View File

@ -22,23 +22,24 @@ struct _InteractiveGrid
G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET) G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET)
static void 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->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, 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 static void
interactive_grid_class_init (InteractiveGridClass *klass) interactive_grid_class_init (InteractiveGridClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_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); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
} }

View File

@ -20,23 +20,24 @@ struct _VflGrid
G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET) G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET)
static void 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->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy); g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, 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 static void
vfl_grid_class_init (VflGridClass *klass) vfl_grid_class_init (VflGridClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_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); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
} }