diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c index 1c3135f54d..b30b3637fe 100644 --- a/gtk/inspector/inspect-button.c +++ b/gtk/inspector/inspect-button.c @@ -212,9 +212,6 @@ select_widget (GtkInspectorWindow *iw, gtk_notebook_set_current_page (GTK_NOTEBOOK (iw->top_notebook), 0); - gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), - gtk_widget_get_toplevel (widget)); - gtk_inspector_widget_tree_select_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), G_OBJECT (widget)); } diff --git a/gtk/inspector/widget-tree.c b/gtk/inspector/widget-tree.c index 8fd6130866..507513fc42 100644 --- a/gtk/inspector/widget-tree.c +++ b/gtk/inspector/widget-tree.c @@ -497,6 +497,9 @@ gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt, if (g_application_get_default ()) gtk_inspector_widget_tree_append_object (wt, G_OBJECT (g_application_get_default ()), NULL, NULL); + if (window) + gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL, NULL); + inspector_win = gtk_widget_get_toplevel (GTK_WIDGET (wt)); toplevels = gtk_window_list_toplevels (); for (l = toplevels; l; l = l->next) @@ -509,8 +512,6 @@ gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt, } g_list_free (toplevels); - gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL, NULL); - gtk_tree_view_columns_autosize (GTK_TREE_VIEW (wt)); } diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 9957128b09..3e3750dbce 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -152,36 +152,14 @@ gtk_inspector_window_init (GtkInspectorWindow *iw) } } -static void -gtk_inspector_window_select_initially (GtkInspectorWindow *iw) -{ - GList *toplevels, *l; - GtkWidget *widget; - - toplevels = gtk_window_list_toplevels (); - widget = NULL; - for (l = toplevels; l; l = l->next) - { - if (gtk_widget_get_mapped (GTK_WIDGET (l->data)) && - GTK_IS_WINDOW (l->data) && - !GTK_INSPECTOR_IS_WINDOW (l->data)) - { - widget = l->data; - break; - } - } - g_list_free (toplevels); - - if (widget) - gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), widget); -} - static void gtk_inspector_window_constructed (GObject *object) { - gtk_inspector_window_select_initially (GTK_INSPECTOR_WINDOW (object)); + GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (object); G_OBJECT_CLASS (gtk_inspector_window_parent_class)->constructed (object); + + gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), NULL); } static void