[gnome-builder/wip/gtk4-port] plugins/editorui: explicitly check for current workspace



commit 56826bfcab9dd153628b34d33166442fe950b059
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 7 12:57:12 2022 -0700

    plugins/editorui: explicitly check for current workspace
    
    We sort of relied on this being right before, but I want to make it more
    obvious in casual reading.

 src/plugins/editorui/gbp-editorui-workbench-addin.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/editorui/gbp-editorui-workbench-addin.c 
b/src/plugins/editorui/gbp-editorui-workbench-addin.c
index 21c954d0e..1f5a43c45 100644
--- a/src/plugins/editorui/gbp-editorui-workbench-addin.c
+++ b/src/plugins/editorui/gbp-editorui-workbench-addin.c
@@ -149,7 +149,7 @@ gbp_editorui_workbench_addin_open_cb (GObject      *object,
   g_autoptr(IdeTask) task = user_data;
   g_autoptr(GError) error = NULL;
   OpenFileTaskData *state;
-  IdeWorkspace *workspace = NULL;
+  IdeWorkspace *workspace;
 
   IDE_ENTRY;
 
@@ -173,9 +173,16 @@ gbp_editorui_workbench_addin_open_cb (GObject      *object,
   if (self->workbench == NULL)
     IDE_GOTO (failure);
 
-  ide_workbench_foreach_workspace (self->workbench,
-                                   find_preferred_workspace_cb,
-                                   &workspace);
+  workspace = ide_workbench_get_current_workspace (self->workbench);
+
+  if (!IDE_IS_PRIMARY_WORKSPACE (workspace) &&
+      !IDE_IS_EDITOR_WORKSPACE (workspace))
+    {
+      workspace = NULL;
+      ide_workbench_foreach_workspace (self->workbench,
+                                       find_preferred_workspace_cb,
+                                       &workspace);
+    }
 
   if (workspace == NULL)
     IDE_GOTO (failure);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]