[gtk/ebassi/finish-template] Port constraint editor to gtk_widget_clear_template()



commit 2535bf63f8ce42fc99fd440d6ef27d8997870fe5
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jul 6 13:22:54 2022 +0100

    Port constraint editor to gtk_widget_clear_template()

 demos/constraint-editor/constraint-editor-window.c | 8 ++++----
 demos/constraint-editor/constraint-editor.c        | 3 ++-
 demos/constraint-editor/guide-editor.c             | 3 ++-
 3 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/demos/constraint-editor/constraint-editor-window.c 
b/demos/constraint-editor/constraint-editor-window.c
index ca18e27cf8..80dc10c1c3 100644
--- a/demos/constraint-editor/constraint-editor-window.c
+++ b/demos/constraint-editor/constraint-editor-window.c
@@ -361,11 +361,11 @@ save_cb (GtkWidget              *button,
 }
 
 static void
-constraint_editor_window_finalize (GObject *object)
+constraint_editor_window_dispose (GObject *object)
 {
-  //ConstraintEditorWindow *self = (ConstraintEditorWindow *)object;
+  gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
 
-  G_OBJECT_CLASS (constraint_editor_window_parent_class)->finalize (object);
+  G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
 }
 
 static int child_counter;
@@ -497,7 +497,7 @@ constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
-  object_class->finalize = constraint_editor_window_finalize;
+  object_class->dispose = constraint_editor_window_dispose;
 
   gtk_widget_class_set_template_from_resource (widget_class,
                                                
"/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
diff --git a/demos/constraint-editor/constraint-editor.c b/demos/constraint-editor/constraint-editor.c
index 6f897b2d8a..17407bb439 100644
--- a/demos/constraint-editor/constraint-editor.c
+++ b/demos/constraint-editor/constraint-editor.c
@@ -607,10 +607,11 @@ constraint_editor_dispose (GObject *object)
 {
   ConstraintEditor *self = (ConstraintEditor *)object;
 
-  g_clear_pointer (&self->grid, gtk_widget_unparent);
   g_clear_object (&self->model);
   g_clear_object (&self->constraint);
 
+  gtk_widget_clear_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
+
   G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
 }
 
diff --git a/demos/constraint-editor/guide-editor.c b/demos/constraint-editor/guide-editor.c
index 74dfe22f09..f7bc039378 100644
--- a/demos/constraint-editor/guide-editor.c
+++ b/demos/constraint-editor/guide-editor.c
@@ -294,9 +294,10 @@ guide_editor_dispose (GObject *object)
 {
   GuideEditor *self = (GuideEditor *)object;
 
-  g_clear_pointer (&self->grid, gtk_widget_unparent);
   g_clear_object (&self->guide);
 
+  gtk_widget_clear_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
+
   G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]