shell/perf-handler: Use app to track window

GtkApplication already tracks its windows, so we don't have to
maintain our own list.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
This commit is contained in:
Florian Müllner 2023-04-15 01:35:42 +02:00 committed by Marge Bot
parent 12fafec141
commit 3f9fcf418b

View File

@ -47,7 +47,6 @@ struct _PerfHelperApp {
GtkApplication parent; GtkApplication parent;
guint timeout_id; guint timeout_id;
GList *our_windows;
GList *wait_windows_invocations; GList *wait_windows_invocations;
}; };
@ -99,12 +98,11 @@ establish_timeout (PerfHelperApp *app)
static void static void
destroy_windows (PerfHelperApp *app) destroy_windows (PerfHelperApp *app)
{ {
GList *l; GtkApplication *gtk_app = GTK_APPLICATION (app);
GtkWindow *window;
for (l = app->our_windows; l; l = l->next) while ((window = gtk_application_get_active_window (gtk_app)))
gtk_widget_destroy (GTK_WIDGET (l->data)); gtk_widget_destroy (GTK_WIDGET (window));
g_clear_list (&app->our_windows, NULL);
check_finish_wait_windows (app); check_finish_wait_windows (app);
} }
@ -266,8 +264,6 @@ create_window (PerfHelperApp *app,
if (redraws) if (redraws)
gtk_widget_add_tick_callback (GTK_WIDGET (window), tick_callback, NULL, NULL); gtk_widget_add_tick_callback (GTK_WIDGET (window), tick_callback, NULL, NULL);
app->our_windows = g_list_prepend (app->our_windows, window);
} }
static void static void
@ -287,7 +283,7 @@ check_finish_wait_windows (PerfHelperApp *app)
GList *l; GList *l;
gboolean have_pending = FALSE; gboolean have_pending = FALSE;
for (l = app->our_windows; l; l = l->next) for (l = gtk_application_get_windows (GTK_APPLICATION (app)); l; l = l->next)
{ {
PerfHelperWindow *window = l->data; PerfHelperWindow *window = l->data;
if (window->pending) if (window->pending)