mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
Port the inspector to gtk_widget_clear_template()
Use clear_template() instead of unparenting widgets manually.
This commit is contained in:
parent
c2ec244b84
commit
103f52bb8a
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user