mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +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 *swin;
|
||||
GtkWidget *list;
|
||||
GtkWidget *button;
|
||||
|
||||
@ -446,6 +447,7 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
|
||||
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_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, name);
|
||||
gtk_widget_class_bind_template_callback (widget_class, setup_name_cb);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<class name="view"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
|
@ -36,6 +36,8 @@ struct _GtkInspectorListData
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *box;
|
||||
GtkWidget *swin;
|
||||
GListModel *object;
|
||||
GtkColumnView *view;
|
||||
GtkWidget *items_label;
|
||||
@ -205,6 +207,8 @@ gtk_inspector_list_data_class_init (GtkInspectorListDataClass *klass)
|
||||
object_class->dispose = dispose;
|
||||
|
||||
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, items_label);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkInspectorListData" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
@ -16,7 +16,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
|
@ -47,6 +47,7 @@ struct _GtkInspectorLogs
|
||||
{
|
||||
GtkWidget parent;
|
||||
|
||||
GtkWidget *box;
|
||||
GtkWidget *events;
|
||||
GtkWidget *misc;
|
||||
GtkWidget *dnd;
|
||||
@ -185,6 +186,7 @@ gtk_inspector_logs_class_init (GtkInspectorLogsClass *klass)
|
||||
object_class->dispose = dispose;
|
||||
|
||||
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, misc);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, dnd);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkInspectorLogs" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
|
@ -35,6 +35,8 @@ struct _GtkInspectorTreeData
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *box;
|
||||
GtkWidget *swin;
|
||||
GtkTreeModel *object;
|
||||
GtkTreeModel *types;
|
||||
GtkTreeView *view;
|
||||
@ -190,6 +192,8 @@ gtk_inspector_tree_data_class_init (GtkInspectorTreeDataClass *klass)
|
||||
object_class->dispose = dispose;
|
||||
|
||||
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, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, toggle_show);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkInspectorTreeData" parent="GtkWidget">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="box">
|
||||
<style>
|
||||
<class name="toolbar"/>
|
||||
</style>
|
||||
@ -21,7 +21,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
|
Loading…
Reference in New Issue
Block a user