[gtk/ebassi/finish-template: 17/24] Port gtk-demo widgets to gtk_widget_clear_template()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/finish-template: 17/24] Port gtk-demo widgets to gtk_widget_clear_template()
- Date: Mon, 11 Jul 2022 16:36:58 +0000 (UTC)
commit 03aaa92a207735628dabe79c5b9591ef4ae20cb6
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jul 6 13:23:54 2022 +0100
Port gtk-demo widgets to gtk_widget_clear_template()
demos/gtk-demo/application.c | 2 ++
demos/gtk-demo/demo3widget.c | 3 ++-
demos/gtk-demo/listbox.c | 10 +++++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c
index f1bca0523d..e0acb60305 100644
--- a/demos/gtk-demo/application.c
+++ b/demos/gtk-demo/application.c
@@ -504,6 +504,8 @@ demo_application_window_dispose (GObject *object)
demo_application_window_store_state (window);
+ gtk_widget_clear_template (GTK_WIDGET (window), demo_application_window_get_type ());
+
G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
}
diff --git a/demos/gtk-demo/demo3widget.c b/demos/gtk-demo/demo3widget.c
index 7a13f698c4..51a820a3ff 100644
--- a/demos/gtk-demo/demo3widget.c
+++ b/demos/gtk-demo/demo3widget.c
@@ -37,7 +37,8 @@ demo3_widget_dispose (GObject *object)
Demo3Widget *self = DEMO3_WIDGET (object);
g_clear_object (&self->paintable);
- g_clear_pointer (&self->menu, gtk_widget_unparent);
+
+ gtk_widget_clear_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
}
diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c
index 98a6a26611..c08cf681b7 100644
--- a/demos/gtk-demo/listbox.c
+++ b/demos/gtk-demo/listbox.c
@@ -260,12 +260,19 @@ gtk_message_row_state_flags_changed (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_message_row_parent_class)->state_flags_changed (widget, previous_state_flags);
}
+static void
+gtk_message_row_dispose (GObject *obj)
+{
+ gtk_widget_clear_template (GTK_WIDGET (obj), GTK_TYPE_MESSAGE_ROW);
+ G_OBJECT_CLASS (gtk_message_row_parent_class)->dispose (obj);
+}
+
static void
gtk_message_row_finalize (GObject *obj)
{
GtkMessageRowPrivate *priv = GTK_MESSAGE_ROW (obj)->priv;
g_object_unref (priv->message);
- G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize(obj);
+ G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize (obj);
}
static void
@@ -274,6 +281,7 @@ gtk_message_row_class_init (GtkMessageRowClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = gtk_message_row_dispose;
object_class->finalize = gtk_message_row_finalize;
gtk_widget_class_set_template_from_resource (widget_class, "/listbox/listbox.ui");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]