[gnome-builder] foundry: wire up VtePty to test manager run API



commit c83edf942e939973b8cdd7905463be51a173f385
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 20 16:52:26 2019 -0800

    foundry: wire up VtePty to test manager run API

 src/libide/foundry/ide-test-manager.c | 24 ++++++++++++++++++++----
 src/libide/foundry/ide-test-manager.h |  2 ++
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/foundry/ide-test-manager.c b/src/libide/foundry/ide-test-manager.c
index 06e38dc06..c08fc7bf4 100644
--- a/src/libide/foundry/ide-test-manager.c
+++ b/src/libide/foundry/ide-test-manager.c
@@ -57,6 +57,7 @@ struct _IdeTestManager
   PeasExtensionSet *providers;
   GPtrArray        *tests_by_provider;
   GtkTreeStore     *tests_store;
+  VtePty           *pty;
 };
 
 typedef struct
@@ -106,7 +107,7 @@ tests_by_provider_free (gpointer data)
 }
 
 static void
-ide_test_manager_dispose (GObject *object)
+ide_test_manager_destroy (IdeObject *object)
 {
   IdeTestManager *self = (IdeTestManager *)object;
 
@@ -119,7 +120,9 @@ ide_test_manager_dispose (GObject *object)
   g_clear_object (&self->providers);
   g_clear_pointer (&self->tests_by_provider, g_ptr_array_unref);
 
-  G_OBJECT_CLASS (ide_test_manager_parent_class)->dispose (object);
+  g_clear_object (&self->pty);
+
+  IDE_OBJECT_CLASS (ide_test_manager_parent_class)->destroy (object);
 }
 
 static void
@@ -145,10 +148,12 @@ static void
 ide_test_manager_class_init (IdeTestManagerClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  IdeObjectClass *i_object_class = IDE_OBJECT_CLASS (klass);
 
-  object_class->dispose = ide_test_manager_dispose;
   object_class->get_property = ide_test_manager_get_property;
 
+  i_object_class->destroy = ide_test_manager_destroy;
+
   /**
    * IdeTestManager:loading:
    *
@@ -731,10 +736,21 @@ ide_test_manager_run_async (IdeTestManager      *self,
 
   provider = _ide_test_get_provider (test);
 
+  if (self->pty == NULL)
+    {
+      g_autoptr(GError) error = NULL;
+
+      if (!(self->pty = vte_pty_new_sync (VTE_PTY_DEFAULT, cancellable, &error)))
+        {
+          g_task_return_error (task, g_steal_pointer (&error));
+          IDE_EXIT;
+        }
+    }
+
   ide_test_provider_run_async (provider,
                                test,
                                pipeline,
-                               NULL, /* PTY */
+                               self->pty,
                                cancellable,
                                ide_test_manager_run_cb,
                                g_steal_pointer (&task));
diff --git a/src/libide/foundry/ide-test-manager.h b/src/libide/foundry/ide-test-manager.h
index 842d82b3d..5f7a87f5f 100644
--- a/src/libide/foundry/ide-test-manager.h
+++ b/src/libide/foundry/ide-test-manager.h
@@ -41,6 +41,8 @@ IdeTestManager  *ide_test_manager_from_context         (IdeContext           *co
 IDE_AVAILABLE_IN_3_32
 gboolean         ide_test_manager_get_loading          (IdeTestManager       *self);
 IDE_AVAILABLE_IN_3_32
+VtePty          *ide_test_manager_get_pty              (IdeTestManager       *self);
+IDE_AVAILABLE_IN_3_32
 void             ide_test_manager_run_async            (IdeTestManager       *self,
                                                         IdeTest              *test,
                                                         GCancellable         *cancellable,


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