Merge branch 'greeter-activate' into 'master'

sysprof: Always present existing window on activation

See merge request GNOME/sysprof!130
This commit is contained in:
Christian Hergert
2025-03-28 23:50:17 +00:00

View File

@ -42,13 +42,14 @@ static const GOptionEntry option_entries[] = {
static void static void
sysprof_application_activate (GApplication *app) sysprof_application_activate (GApplication *app)
{ {
const GList *windows;
GtkWidget *greeter; GtkWidget *greeter;
g_assert (GTK_IS_APPLICATION (app)); g_assert (GTK_IS_APPLICATION (app));
for (const GList *iter = gtk_application_get_windows (GTK_APPLICATION (app)); windows = gtk_application_get_windows (GTK_APPLICATION (app));
iter != NULL;
iter = iter->next) for (const GList *iter = windows; iter != NULL; iter = iter->next)
{ {
if (SYSPROF_IS_WINDOW (iter->data)) 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 (); greeter = sysprof_greeter_new ();
gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (greeter)); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (greeter));
gtk_window_present (GTK_WINDOW (greeter)); gtk_window_present (GTK_WINDOW (greeter));