From f96c9e0056fa65e7a12151509659c7876978019b Mon Sep 17 00:00:00 2001 From: Caleb Gartner Date: Fri, 26 Apr 2024 12:34:28 -0600 Subject: [PATCH 1/2] libide/gui: fix lack of preference window reuse Unconditionally add the preferences window to the application so that the reuse logic at the top of the function is triggered. Without this, multiple identical preferences windows can be opened, contrary to the expectation that the currently open preferences window would be focused instead. --- src/libide/gui/ide-application-tweaks.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libide/gui/ide-application-tweaks.c b/src/libide/gui/ide-application-tweaks.c index 80f0a5cc1..9e353881e 100644 --- a/src/libide/gui/ide-application-tweaks.c +++ b/src/libide/gui/ide-application-tweaks.c @@ -241,15 +241,12 @@ ide_show_tweaks (IdeContext *context, "tweaks", tweaks, NULL); + gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window)); if (app->workbenches->len > 0) { IdeWorkbench *workbench = g_ptr_array_index (app->workbenches, 0); gtk_window_group_add_window (GTK_WINDOW_GROUP (workbench), GTK_WINDOW (window)); } - else - { - gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window)); - } /* Switch pages before we display if necessary */ if (page != NULL) -- GitLab From e38dd207697a9e26ea8b63fa9eb42378f6f2d841 Mon Sep 17 00:00:00 2001 From: Caleb Gartner Date: Mon, 28 Oct 2024 19:44:27 -0600 Subject: [PATCH 2/2] libide/gui: remove dead code Remove unused code from ide_show_tweaks() --- src/libide/gui/ide-application-tweaks.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libide/gui/ide-application-tweaks.c b/src/libide/gui/ide-application-tweaks.c index 9e353881e..6036ab520 100644 --- a/src/libide/gui/ide-application-tweaks.c +++ b/src/libide/gui/ide-application-tweaks.c @@ -196,7 +196,6 @@ ide_show_tweaks (IdeContext *context, g_autoptr(IdeTweaks) tweaks = NULL; IdeTweaksWindow *window; const GList *windows; - GtkWindow *toplevel = NULL; g_return_if_fail (IDE_IS_MAIN_THREAD ()); g_return_if_fail (IDE_IS_APPLICATION (app)); @@ -213,9 +212,6 @@ ide_show_tweaks (IdeContext *context, if (IDE_IS_TWEAKS_WINDOW (win) && try_reuse_window (IDE_TWEAKS_WINDOW (win), context, page)) return; - - if (toplevel && IDE_IS_PRIMARY_WORKSPACE (win)) - toplevel = win; } tweaks = ide_tweaks_new_for_context (context); -- GitLab