mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
inspector: Fix some lifecycle issues
The template use in the inspector was not properly disposing all widgets. gtk_widget_dispose_template will only unparent widgets that have been named as template children, so we need to make the toplevel elements in the ui file named children, or manually dispose them. This commit does the former.
This commit is contained in:
parent
3867f9b8ea
commit
e68b365fa1
@ -40,6 +40,7 @@ struct _GtkInspectorActions
|
|||||||
{
|
{
|
||||||
GtkWidget parent;
|
GtkWidget parent;
|
||||||
|
|
||||||
|
GtkWidget *swin;
|
||||||
GtkWidget *list;
|
GtkWidget *list;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
|
||||||
@ -446,6 +447,7 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
|
|||||||
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/actions.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/actions.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorActions, swin);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorActions, list);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorActions, list);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorActions, name);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorActions, name);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, setup_name_cb);
|
gtk_widget_class_bind_template_callback (widget_class, setup_name_cb);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<class name="view"/>
|
<class name="view"/>
|
||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow" id="swin">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<property name="hscrollbar-policy">never</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
@ -36,6 +36,8 @@ struct _GtkInspectorListData
|
|||||||
{
|
{
|
||||||
GtkWidget parent_instance;
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkWidget *swin;
|
||||||
GListModel *object;
|
GListModel *object;
|
||||||
GtkColumnView *view;
|
GtkColumnView *view;
|
||||||
GtkWidget *items_label;
|
GtkWidget *items_label;
|
||||||
@ -205,6 +207,8 @@ gtk_inspector_list_data_class_init (GtkInspectorListDataClass *klass)
|
|||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/list-data.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/list-data.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, box);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, swin);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, view);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, view);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, items_label);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorListData, items_label);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<interface domain="gtk40">
|
<interface domain="gtk40">
|
||||||
<template class="GtkInspectorListData" parent="GtkWidget">
|
<template class="GtkInspectorListData" parent="GtkWidget">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox" id="box">
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<property name="margin-start">6</property>
|
<property name="margin-start">6</property>
|
||||||
<property name="margin-end">6</property>
|
<property name="margin-end">6</property>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow" id="swin">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<property name="vscrollbar-policy">always</property>
|
<property name="vscrollbar-policy">always</property>
|
||||||
|
@ -47,6 +47,7 @@ struct _GtkInspectorLogs
|
|||||||
{
|
{
|
||||||
GtkWidget parent;
|
GtkWidget parent;
|
||||||
|
|
||||||
|
GtkWidget *box;
|
||||||
GtkWidget *events;
|
GtkWidget *events;
|
||||||
GtkWidget *misc;
|
GtkWidget *misc;
|
||||||
GtkWidget *dnd;
|
GtkWidget *dnd;
|
||||||
@ -185,6 +186,7 @@ gtk_inspector_logs_class_init (GtkInspectorLogsClass *klass)
|
|||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/logs.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/logs.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, box);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, events);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, events);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, misc);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, misc);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, dnd);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, dnd);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<interface domain="gtk40">
|
<interface domain="gtk40">
|
||||||
<template class="GtkInspectorLogs" parent="GtkWidget">
|
<template class="GtkInspectorLogs" parent="GtkWidget">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox" id="box">
|
||||||
<property name="margin-start">20</property>
|
<property name="margin-start">20</property>
|
||||||
<property name="margin-end">20</property>
|
<property name="margin-end">20</property>
|
||||||
<property name="margin-top">20</property>
|
<property name="margin-top">20</property>
|
||||||
|
@ -35,6 +35,8 @@ struct _GtkInspectorTreeData
|
|||||||
{
|
{
|
||||||
GtkWidget parent_instance;
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *box;
|
||||||
|
GtkWidget *swin;
|
||||||
GtkTreeModel *object;
|
GtkTreeModel *object;
|
||||||
GtkTreeModel *types;
|
GtkTreeModel *types;
|
||||||
GtkTreeView *view;
|
GtkTreeView *view;
|
||||||
@ -190,6 +192,8 @@ gtk_inspector_tree_data_class_init (GtkInspectorTreeDataClass *klass)
|
|||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/tree-data.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/tree-data.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, box);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, swin);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, view);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, view);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, object_title);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorTreeData, object_title);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, toggle_show);
|
gtk_widget_class_bind_template_callback (widget_class, toggle_show);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<interface domain="gtk40">
|
<interface domain="gtk40">
|
||||||
<template class="GtkInspectorTreeData" parent="GtkWidget">
|
<template class="GtkInspectorTreeData" parent="GtkWidget">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox" id="box">
|
||||||
<style>
|
<style>
|
||||||
<class name="toolbar"/>
|
<class name="toolbar"/>
|
||||||
</style>
|
</style>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow" id="swin">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<property name="vscrollbar-policy">always</property>
|
<property name="vscrollbar-policy">always</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user