[gnome-builder] testing: wire test-manager action group to workbench



commit 99b05d3b74b2c68eb0239291388e64fe92139adc
Author: Christian Hergert <chergert redhat com>
Date:   Sun Oct 22 16:52:42 2017 -0700

    testing: wire test-manager action group to workbench
    
    This allows activating things from anywhere in the workbench.

 src/libide/testing/ide-test-editor-addin.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/testing/ide-test-editor-addin.c b/src/libide/testing/ide-test-editor-addin.c
index b3a0173..c8987a0 100644
--- a/src/libide/testing/ide-test-editor-addin.c
+++ b/src/libide/testing/ide-test-editor-addin.c
@@ -43,14 +43,20 @@ ide_test_editor_addin_load (IdeEditorAddin       *addin,
   IdeTestEditorAddin *self = (IdeTestEditorAddin *)addin;
   IdeEditorSidebar *sidebar;
   IdeTestManager *manager;
+  IdeWorkbench *workbench;
   IdeContext *context;
 
   g_assert (IDE_IS_TEST_EDITOR_ADDIN (self));
   g_assert (IDE_IS_EDITOR_PERSPECTIVE (editor));
 
+  workbench = ide_widget_get_workbench (GTK_WIDGET (editor));
   context = ide_widget_get_context (GTK_WIDGET (editor));
   manager = ide_context_get_test_manager (context);
 
+  gtk_widget_insert_action_group (GTK_WIDGET (workbench),
+                                  "test-manager",
+                                  G_ACTION_GROUP (manager));
+
   self->panel = g_object_new (IDE_TYPE_TEST_PANEL,
                               "manager", manager,
                               "visible", TRUE,
@@ -77,10 +83,15 @@ ide_test_editor_addin_unload (IdeEditorAddin       *addin,
                               IdeEditorPerspective *editor)
 {
   IdeTestEditorAddin *self = (IdeTestEditorAddin *)addin;
+  IdeWorkbench *workbench;
 
   g_assert (IDE_IS_TEST_EDITOR_ADDIN (self));
   g_assert (IDE_IS_EDITOR_PERSPECTIVE (editor));
 
+  workbench = ide_widget_get_workbench (GTK_WIDGET (editor));
+  if (workbench != NULL)
+    gtk_widget_insert_action_group (GTK_WIDGET (workbench), "test-manager", NULL);
+
   if (self->panel)
     gtk_widget_destroy (GTK_WIDGET (self->panel));
 }


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