From 7db526fbd9739f714f2d563f1fb65ec7695bb1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Fri, 28 Mar 2025 09:59:21 +0100 Subject: [PATCH] sysprof: Always present existing window on activation This fixes the problem that a new greeter window is created on second launch if the greeter window or the recording window is active. --- src/sysprof/sysprof-application.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sysprof/sysprof-application.c b/src/sysprof/sysprof-application.c index 0f430836..a437b365 100644 --- a/src/sysprof/sysprof-application.c +++ b/src/sysprof/sysprof-application.c @@ -42,13 +42,14 @@ static const GOptionEntry option_entries[] = { static void sysprof_application_activate (GApplication *app) { + const GList *windows; GtkWidget *greeter; g_assert (GTK_IS_APPLICATION (app)); - for (const GList *iter = gtk_application_get_windows (GTK_APPLICATION (app)); - iter != NULL; - iter = iter->next) + windows = gtk_application_get_windows (GTK_APPLICATION (app)); + + for (const GList *iter = windows; iter != NULL; iter = iter->next) { if (SYSPROF_IS_WINDOW (iter->data)) { @@ -57,6 +58,12 @@ sysprof_application_activate (GApplication *app) } } + if (windows) + { + gtk_window_present (windows->data); + return; + } + greeter = sysprof_greeter_new (); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (greeter)); gtk_window_present (GTK_WINDOW (greeter));