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.
This commit is contained in:
Balló György
2025-03-28 09:59:21 +01:00
parent 21c9fd4f8c
commit 7db526fbd9

View File

@ -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));