summaryrefslogtreecommitdiff
path: root/gtk/inspector
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2022-07-06 13:53:22 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2022-07-11 18:24:37 +0100
commit103f52bb8ac4d70dcb8275bf5033f1829a69a7f4 (patch)
tree4b6b41af37ac689c9a8ae5af1f31887d86590183 /gtk/inspector
parentc2ec244b840b1a5e9a2969ecf2b4c917e24fd14c (diff)
downloadgtk+-103f52bb8ac4d70dcb8275bf5033f1829a69a7f4.tar.gz
Port the inspector to gtk_widget_clear_template()
Use clear_template() instead of unparenting widgets manually.
Diffstat (limited to 'gtk/inspector')
-rw-r--r--gtk/inspector/a11y.c2
-rw-r--r--gtk/inspector/actions.c4
-rw-r--r--gtk/inspector/clipboard.c4
-rw-r--r--gtk/inspector/general.c4
-rw-r--r--gtk/inspector/list-data.c4
-rw-r--r--gtk/inspector/logs.c5
-rw-r--r--gtk/inspector/misc-info.c4
-rw-r--r--gtk/inspector/recorder.c3
-rw-r--r--gtk/inspector/resource-list.c9
-rw-r--r--gtk/inspector/tree-data.c6
-rw-r--r--gtk/inspector/visual.c16
-rw-r--r--gtk/inspector/window.c3
12 files changed, 29 insertions, 35 deletions
diff --git a/gtk/inspector/a11y.c b/gtk/inspector/a11y.c
index f4b1bdafca..178b5d138a 100644
--- a/gtk/inspector/a11y.c
+++ b/gtk/inspector/a11y.c
@@ -462,7 +462,7 @@ dispose (GObject *o)
g_clear_object (&sl->object);
- g_clear_pointer (&sl->box, gtk_widget_unparent);
+ gtk_widget_clear_template (GTK_WIDGET (o), GTK_TYPE_INSPECTOR_A11Y);
G_OBJECT_CLASS (gtk_inspector_a11y_parent_class)->dispose (o);
}
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c
index 1f8a46ca5a..be621b28f9 100644
--- a/gtk/inspector/actions.c
+++ b/gtk/inspector/actions.c
@@ -420,14 +420,12 @@ static void
dispose (GObject *object)
{
GtkInspectorActions *sl = GTK_INSPECTOR_ACTIONS (object);
- GtkWidget *child;
g_clear_object (&sl->sorted);
g_clear_object (&sl->actions);
g_clear_object (&sl->object);
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (sl))))
- gtk_widget_unparent (child);
+ gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_ACTIONS);
G_OBJECT_CLASS (gtk_inspector_actions_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/clipboard.c b/gtk/inspector/clipboard.c
index 155862474f..dd85dcb736 100644
--- a/gtk/inspector/clipboard.c
+++ b/gtk/inspector/clipboard.c
@@ -221,7 +221,7 @@ add_content_type_row (GtkInspectorClipboard *self,
{
GtkEventController *controller = gtk_drop_controller_motion_new ();
g_signal_connect (controller, "enter", G_CALLBACK (on_drop_row_enter), viewer);
- gtk_widget_add_controller (vbox, controller);
+ gtk_widget_add_controller (vbox, controller);
gtk_widget_set_visible (viewer, FALSE);
@@ -355,7 +355,7 @@ gtk_inspector_clipboard_dispose (GObject *object)
gtk_inspector_clipboard_unset_display (self);
- g_clear_pointer (&self->swin, gtk_widget_unparent);
+ gtk_widget_clear_template (GTK_WIDGET (self), GTK_TYPE_INSPECTOR_CLIPBOARD);
G_OBJECT_CLASS (gtk_inspector_clipboard_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index f456ea0da4..485a98cea1 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -1087,8 +1087,6 @@ gtk_inspector_general_dispose (GObject *object)
GtkInspectorGeneral *gen = GTK_INSPECTOR_GENERAL (object);
GList *list, *l;
- g_clear_pointer (&gen->swin, gtk_widget_unparent);
-
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (seat_added), gen);
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (seat_removed), gen);
g_signal_handlers_disconnect_by_func (gen->display, G_CALLBACK (populate_display_notify_cb), gen);
@@ -1099,6 +1097,8 @@ gtk_inspector_general_dispose (GObject *object)
disconnect_seat (gen, GDK_SEAT (l->data));
g_list_free (list);
+ gtk_widget_clear_template (GTK_WIDGET (gen), GTK_TYPE_INSPECTOR_GENERAL);
+
G_OBJECT_CLASS (gtk_inspector_general_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/list-data.c b/gtk/inspector/list-data.c
index fcf9807adb..3978bf1784 100644
--- a/gtk/inspector/list-data.c
+++ b/gtk/inspector/list-data.c
@@ -190,10 +190,8 @@ static void
dispose (GObject *object)
{
GtkInspectorListData *sl = GTK_INSPECTOR_LIST_DATA (object);
- GtkWidget *child;
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (sl))))
- gtk_widget_unparent (child);
+ gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_LIST_DATA);
G_OBJECT_CLASS (gtk_inspector_list_data_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/logs.c b/gtk/inspector/logs.c
index 79f0f7e904..ac9b88b076 100644
--- a/gtk/inspector/logs.c
+++ b/gtk/inspector/logs.c
@@ -99,10 +99,7 @@ gtk_inspector_logs_init (GtkInspectorLogs *logs)
static void
dispose (GObject *object)
{
- GtkWidget *child;
-
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
- gtk_widget_unparent (child);
+ gtk_widget_clear_template (GTK_WIDGET (object), GTK_TYPE_INSPECTOR_LOGS);
G_OBJECT_CLASS (gtk_inspector_logs_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 1bace8ae36..ba9358147a 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -120,7 +120,7 @@ format_state_flags (GtkStateFlags state)
g_string_append (str, " | ");
g_string_append (str, fclass->values[i].value_nick);
}
- }
+ }
g_type_class_unref (fclass);
}
else
@@ -603,7 +603,7 @@ dispose (GObject *o)
{
GtkInspectorMiscInfo *sl = GTK_INSPECTOR_MISC_INFO (o);
- g_clear_pointer (&sl->swin, gtk_widget_unparent);
+ gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_MISC_INFO);
G_OBJECT_CLASS (gtk_inspector_misc_info_parent_class)->dispose (o);
}
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index 05078eb71b..9e4ed37ca0 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -2039,11 +2039,12 @@ gtk_inspector_recorder_dispose (GObject *object)
{
GtkInspectorRecorder *recorder = GTK_INSPECTOR_RECORDER (object);
- g_clear_pointer (&recorder->box, gtk_widget_unparent);
g_clear_object (&recorder->render_node_model);
g_clear_object (&recorder->render_node_root_model);
g_clear_object (&recorder->render_node_selection);
+ gtk_widget_clear_template (GTK_WIDGET (recorder), GTK_TYPE_INSPECTOR_RECORDER);
+
G_OBJECT_CLASS (gtk_inspector_recorder_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/resource-list.c b/gtk/inspector/resource-list.c
index ded5a1d3fb..86112ac487 100644
--- a/gtk/inspector/resource-list.c
+++ b/gtk/inspector/resource-list.c
@@ -695,12 +695,12 @@ constructed (GObject *object)
GListModel *sort_model;
GtkSorter *column_sorter;
GtkSorter *sorter;
-
+
g_signal_connect (rl->open_details_button, "clicked",
G_CALLBACK (open_details), rl);
g_signal_connect (rl->close_details_button, "clicked",
G_CALLBACK (close_details), rl);
-
+
rl->tree_model = gtk_tree_list_model_new (load_resources (),
FALSE,
FALSE,
@@ -745,7 +745,7 @@ set_property (GObject *object,
GParamSpec *pspec)
{
GtkInspectorResourceList *rl = GTK_INSPECTOR_RESOURCE_LIST (object);
-
+
switch (param_id)
{
case PROP_BUTTONS:
@@ -765,10 +765,11 @@ dispose (GObject *object)
{
GtkInspectorResourceList *rl = GTK_INSPECTOR_RESOURCE_LIST (object);
- g_clear_pointer (&rl->stack, gtk_widget_unparent);
g_clear_object (&rl->selection);
g_clear_object (&rl->tree_model);
+ gtk_widget_clear_template (GTK_WIDGET (rl), GTK_TYPE_INSPECTOR_RESOURCE_LIST);
+
G_OBJECT_CLASS (gtk_inspector_resource_list_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/tree-data.c b/gtk/inspector/tree-data.c
index 08ca475b77..a4fd0b72e4 100644
--- a/gtk/inspector/tree-data.c
+++ b/gtk/inspector/tree-data.c
@@ -100,7 +100,7 @@ add_columns (GtkInspectorTreeData *sl)
gtk_tree_view_column_set_cell_data_func (col, cell, cell_data_func, sl, NULL);
gtk_tree_view_append_column (sl->view, col);
g_free (title);
- }
+ }
}
static void
@@ -175,10 +175,8 @@ static void
dispose (GObject *object)
{
GtkInspectorTreeData *sl = GTK_INSPECTOR_TREE_DATA (object);
- GtkWidget *child;
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (sl))))
- gtk_widget_unparent (child);
+ gtk_widget_clear_template (GTK_WIDGET (sl), GTK_TYPE_INSPECTOR_TREE_DATA);
G_OBJECT_CLASS (gtk_inspector_tree_data_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index c3b53bf56d..4b4d44c62e 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -1077,7 +1077,7 @@ inspect_inspector (GtkButton *button,
inspector_window = gtk_inspector_window_get (gtk_widget_get_display (GTK_WIDGET (button)));
gtk_window_present (GTK_WINDOW (inspector_window));
}
-
+
static void
gtk_inspector_visual_init (GtkInspectorVisual *vis)
{
@@ -1091,12 +1091,12 @@ gtk_inspector_visual_constructed (GObject *object)
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->constructed (object);
- g_signal_connect (vis->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
- g_signal_connect (vis->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
- g_signal_connect (vis->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
- g_signal_connect (vis->visual_box, "row-activated", G_CALLBACK (row_activated), vis);
- g_signal_connect (vis->debug_box, "row-activated", G_CALLBACK (row_activated), vis);
- g_signal_connect (vis->misc_box, "row-activated", G_CALLBACK (row_activated), vis);
+ g_signal_connect (vis->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
+ g_signal_connect (vis->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
+ g_signal_connect (vis->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
+ g_signal_connect (vis->visual_box, "row-activated", G_CALLBACK (row_activated), vis);
+ g_signal_connect (vis->debug_box, "row-activated", G_CALLBACK (row_activated), vis);
+ g_signal_connect (vis->misc_box, "row-activated", G_CALLBACK (row_activated), vis);
}
static void
@@ -1134,7 +1134,7 @@ gtk_inspector_visual_dispose (GObject *object)
{
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object);
- g_clear_pointer (&vis->swin, gtk_widget_unparent);
+ gtk_widget_clear_template (GTK_WIDGET (vis), GTK_TYPE_INSPECTOR_VISUAL);
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->dispose (object);
}
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 29d079e4c1..8a0d198fa1 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -311,10 +311,11 @@ gtk_inspector_window_dispose (GObject *object)
g_object_set_data (G_OBJECT (iw->inspected_display), "-gtk-inspector", NULL);
- g_clear_pointer (&iw->top_stack, gtk_widget_unparent);
g_clear_object (&iw->flash_overlay);
g_clear_pointer (&iw->objects, g_array_unref);
+ gtk_widget_clear_template (GTK_WIDGET (iw), GTK_TYPE_INSPECTOR_WINDOW);
+
G_OBJECT_CLASS (gtk_inspector_window_parent_class)->dispose (object);
}