mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
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:
@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user