[gnome-builder/wip/gtk4-port] libide/foundry: delete some runner usage



commit ac3423db4d2a3ade5caf72604d60f6b093d98358
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 24 05:01:26 2022 -0700

    libide/foundry: delete some runner usage

 src/libide/foundry/ide-deploy-strategy.c          |  96 -----
 src/libide/foundry/ide-deploy-strategy.h          |  64 ++--
 src/libide/foundry/ide-device-manager.c           |  98 -----
 src/libide/foundry/ide-device-manager.h           |  10 -
 src/libide/foundry/ide-local-deploy-strategy.c    |  51 ---
 src/plugins/deviced/gbp-deviced-deploy-strategy.c |  51 ---
 src/plugins/deviced/gbp-deviced-runner.c          | 435 ----------------------
 src/plugins/deviced/gbp-deviced-runner.h          |  39 --
 src/plugins/deviced/meson.build                   |   1 -
 9 files changed, 23 insertions(+), 822 deletions(-)
---
diff --git a/src/libide/foundry/ide-deploy-strategy.c b/src/libide/foundry/ide-deploy-strategy.c
index ec9483b32..84a2d4e18 100644
--- a/src/libide/foundry/ide-deploy-strategy.c
+++ b/src/libide/foundry/ide-deploy-strategy.c
@@ -89,39 +89,6 @@ ide_deploy_strategy_real_deploy_finish (IdeDeployStrategy  *self,
   return g_task_propagate_boolean (G_TASK (result), error);
 }
 
-static void
-ide_deploy_strategy_real_create_runner_async (IdeDeployStrategy   *self,
-                                              IdePipeline         *pipeline,
-                                              GCancellable        *cancellable,
-                                              GAsyncReadyCallback  callback,
-                                              gpointer             user_data)
-{
-  g_autoptr(IdeTask) task = NULL;
-
-  g_return_if_fail (IDE_IS_DEPLOY_STRATEGY (self));
-  g_return_if_fail (IDE_IS_PIPELINE (pipeline));
-  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  task = ide_task_new (self, cancellable, callback, user_data);
-  ide_task_return_new_error (task,
-                             G_IO_ERROR,
-                             G_IO_ERROR_NOT_SUPPORTED,
-                             "Not supported");
-
-}
-
-static IdeRunner *
-ide_deploy_strategy_real_create_runner_finish (IdeDeployStrategy  *self,
-                                               GAsyncResult       *result,
-                                               GError            **error)
-{
-  g_assert (IDE_IS_DEPLOY_STRATEGY (self));
-  g_assert (IDE_IS_TASK (result));
-  g_assert (ide_task_is_valid (G_TASK (result), self));
-
-  return ide_task_propagate_pointer (IDE_TASK (result), error);
-}
-
 static void
 ide_deploy_strategy_real_prepare_run_context (IdeDeployStrategy *self,
                                               IdePipeline       *pipeline,
@@ -153,8 +120,6 @@ ide_deploy_strategy_class_init (IdeDeployStrategyClass *klass)
   klass->load_finish = ide_deploy_strategy_real_load_finish;
   klass->deploy_async = ide_deploy_strategy_real_deploy_async;
   klass->deploy_finish = ide_deploy_strategy_real_deploy_finish;
-  klass->create_runner_async = ide_deploy_strategy_real_create_runner_async;
-  klass->create_runner_finish = ide_deploy_strategy_real_create_runner_finish;
   klass->prepare_run_context = ide_deploy_strategy_real_prepare_run_context;
 }
 
@@ -304,67 +269,6 @@ ide_deploy_strategy_deploy_finish (IdeDeployStrategy  *self,
   IDE_RETURN (ret);
 }
 
-/**
- * ide_deploy_strategy_create_runner_async:
- * @self: a #IdeDeployStrategy
- * @pipeline: an #IdePipeline
- * @cancellable: (nullable): a #GCancellable or %NULL
- * @callback: (closure user_data): a callback to execute upon completion
- * @user_data: closure data for @callback
- *
- * Gets an #IdeRunner that runs apps deployed to the device, if a
- * runner other than the default is needed.
- */
-void
-ide_deploy_strategy_create_runner_async (IdeDeployStrategy   *self,
-                                         IdePipeline         *pipeline,
-                                         GCancellable        *cancellable,
-                                         GAsyncReadyCallback  callback,
-                                         gpointer             user_data)
-{
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_DEPLOY_STRATEGY (self));
-  g_assert (IDE_IS_PIPELINE (pipeline));
-  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  IDE_DEPLOY_STRATEGY_GET_CLASS (self)->create_runner_async (self,
-                                                             pipeline,
-                                                             cancellable,
-                                                             callback,
-                                                             user_data);
-
-  IDE_EXIT;
-}
-
-/**
- * ide_deploy_strategy_create_runner_finish:
- * @self: an #IdeDeployStrategy
- * @result: a #GAsyncResult provided to callback
- * @error: a location for a #GError, or %NULL
- *
- * Completes an asynchronous request to get an #IdeRunner for the current
- * device.
- *
- * Returns: (transfer full): An #IdeRunner or %NULL
- */
-IdeRunner *
-ide_deploy_strategy_create_runner_finish (IdeDeployStrategy  *self,
-                                          GAsyncResult       *result,
-                                          GError            **error)
-{
-  IdeRunner *ret;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_DEPLOY_STRATEGY (self));
-  g_assert (G_IS_ASYNC_RESULT (result));
-
-  ret = IDE_DEPLOY_STRATEGY_GET_CLASS (self)->create_runner_finish (self, result, error);
-
-  IDE_RETURN (ret);
-}
-
 /**
  * ide_deploy_strategy_prepare_run_context:
  * @self: a #IdeDeployStrategy
diff --git a/src/libide/foundry/ide-deploy-strategy.h b/src/libide/foundry/ide-deploy-strategy.h
index c78e7cc46..546260da3 100644
--- a/src/libide/foundry/ide-deploy-strategy.h
+++ b/src/libide/foundry/ide-deploy-strategy.h
@@ -59,56 +59,38 @@ struct _IdeDeployStrategyClass
   gboolean       (*deploy_finish)        (IdeDeployStrategy      *self,
                                           GAsyncResult           *result,
                                           GError                **error);
-  void           (*create_runner_async)  (IdeDeployStrategy      *self,
-                                          IdePipeline            *pipeline,
-                                          GCancellable           *cancellable,
-                                          GAsyncReadyCallback     callback,
-                                          gpointer                user_data);
-  IdeRunner     *(*create_runner_finish) (IdeDeployStrategy      *self,
-                                          GAsyncResult           *result,
-                                          GError                **error);
   void           (*prepare_run_context)  (IdeDeployStrategy      *self,
                                           IdePipeline            *pipeline,
                                           IdeRunContext          *run_context);
 };
 
 IDE_AVAILABLE_IN_ALL
-void     ide_deploy_strategy_load_async    (IdeDeployStrategy      *self,
-                                            IdePipeline       *pipeline,
-                                            GCancellable           *cancellable,
-                                            GAsyncReadyCallback     callback,
-                                            gpointer                user_data);
-IDE_AVAILABLE_IN_ALL
-gboolean ide_deploy_strategy_load_finish   (IdeDeployStrategy      *self,
-                                            GAsyncResult           *result,
-                                            int                    *priority,
-                                            GError                **error);
-IDE_AVAILABLE_IN_ALL
-void     ide_deploy_strategy_deploy_async  (IdeDeployStrategy      *self,
-                                            IdePipeline       *pipeline,
-                                            GFileProgressCallback   progress,
-                                            gpointer                progress_data,
-                                            GDestroyNotify          progress_data_destroy,
-                                            GCancellable           *cancellable,
-                                            GAsyncReadyCallback     callback,
-                                            gpointer                user_data);
+void     ide_deploy_strategy_load_async          (IdeDeployStrategy      *self,
+                                                  IdePipeline            *pipeline,
+                                                  GCancellable           *cancellable,
+                                                  GAsyncReadyCallback     callback,
+                                                  gpointer                user_data);
 IDE_AVAILABLE_IN_ALL
-gboolean ide_deploy_strategy_deploy_finish (IdeDeployStrategy      *self,
-                                            GAsyncResult           *result,
-                                            GError                **error);
+gboolean ide_deploy_strategy_load_finish         (IdeDeployStrategy      *self,
+                                                  GAsyncResult           *result,
+                                                  int                    *priority,
+                                                  GError                **error);
 IDE_AVAILABLE_IN_ALL
-void       ide_deploy_strategy_create_runner_async  (IdeDeployStrategy   *self,
-                                                     IdePipeline         *pipeline,
-                                                     GCancellable        *cancellable,
-                                                     GAsyncReadyCallback  callback,
-                                                     gpointer             user_data);
+void     ide_deploy_strategy_deploy_async        (IdeDeployStrategy      *self,
+                                                  IdePipeline            *pipeline,
+                                                  GFileProgressCallback   progress,
+                                                  gpointer                progress_data,
+                                                  GDestroyNotify          progress_data_destroy,
+                                                  GCancellable           *cancellable,
+                                                  GAsyncReadyCallback     callback,
+                                                  gpointer                user_data);
 IDE_AVAILABLE_IN_ALL
-IdeRunner *ide_deploy_strategy_create_runner_finish (IdeDeployStrategy  *self,
-                                                     GAsyncResult       *result,
-                                                     GError            **error);
+gboolean ide_deploy_strategy_deploy_finish       (IdeDeployStrategy      *self,
+                                                  GAsyncResult           *result,
+                                                  GError                **error);
 IDE_AVAILABLE_IN_ALL
-void       ide_deploy_strategy_prepare_run_context  (IdeDeployStrategy  *self,
-                                                     IdePipeline        *pipeline,
-                                                     IdeRunContext      *run_context);
+void     ide_deploy_strategy_prepare_run_context (IdeDeployStrategy      *self,
+                                                  IdePipeline            *pipeline,
+                                                  IdeRunContext          *run_context);
 
 G_END_DECLS
diff --git a/src/libide/foundry/ide-device-manager.c b/src/libide/foundry/ide-device-manager.c
index 129fdb853..e6a2100b5 100644
--- a/src/libide/foundry/ide-device-manager.c
+++ b/src/libide/foundry/ide-device-manager.c
@@ -37,7 +37,6 @@
 #include "ide-device.h"
 #include "ide-foundry-compat.h"
 #include "ide-local-device.h"
-#include "ide-runner.h"
 #include "ide-triplet.h"
 
 struct _IdeDeviceManager
@@ -862,103 +861,6 @@ ide_device_manager_deploy_finish (IdeDeviceManager  *self,
   IDE_RETURN (ret);
 }
 
-static void
-ide_device_manager_create_runner_cb (GObject      *object,
-                                     GAsyncResult *result,
-                                     gpointer      user_data)
-{
-  IdeDeployStrategy *strategy = (IdeDeployStrategy *)object;
-  g_autoptr(IdeRunner) runner = NULL;
-  g_autoptr(IdeTask) task = user_data;
-  g_autoptr(GError) error = NULL;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_DEPLOY_STRATEGY (strategy));
-  g_assert (G_IS_ASYNC_RESULT (result));
-  g_assert (IDE_IS_TASK (task));
-
-  if (!(runner = ide_deploy_strategy_create_runner_finish (strategy, result, &error)))
-    ide_task_return_error (task, g_steal_pointer (&error));
-  else
-    ide_task_return_pointer (task, g_steal_pointer (&runner), g_object_unref);
-
-  IDE_EXIT;
-}
-
-/**
- * ide_device_manager_create_runner_async:
- * @self: a #IdeDeviceManager
- * @pipeline: an #IdePipeline
- * @cancellable: a #GCancellable, or %NULL
- * @callback: a #GAsyncReadyCallback
- * @user_data: closure data for @callback
- *
- * Requests an #IdeRunner that runs on the current device, if a runner
- * other than the default is required.
- */
-void
-ide_device_manager_create_runner_async (IdeDeviceManager    *self,
-                                        IdePipeline         *pipeline,
-                                        GCancellable        *cancellable,
-                                        GAsyncReadyCallback  callback,
-                                        gpointer             user_data)
-{
-  g_autoptr(IdeTask) task = NULL;
-  IdeDeployStrategy *strategy;
-
-  IDE_ENTRY;
-
-  g_return_if_fail (IDE_IS_DEVICE_MANAGER (self));
-  g_return_if_fail (IDE_IS_PIPELINE (pipeline));
-  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  task = ide_task_new (self, cancellable, callback, user_data);
-  ide_task_set_source_tag (task, ide_device_manager_create_runner_async);
-
-  if (!(strategy = ide_pipeline_get_deploy_strategy (pipeline)))
-    ide_task_return_new_error (task,
-                               G_IO_ERROR,
-                               G_IO_ERROR_FAILED,
-                               "Missing device in pipeline");
-  else
-    ide_deploy_strategy_create_runner_async (strategy,
-                                             pipeline,
-                                             cancellable,
-                                             ide_device_manager_create_runner_cb,
-                                             g_steal_pointer (&task));
-
-  IDE_EXIT;
-}
-
-/**
- * ide_device_manager_create_runner_finish:
- * @self: a #IdeDeviceManager
- * @result: a #GAsyncResult provided to callback
- * @error: a location for a #GError, or %NULL
- *
- * Completes a request to create an #IdeRunner to run on the device.
- *
- * Returns: (transfer full): An #IdeRunner or %NULL.
- */
-IdeRunner *
-ide_device_manager_create_runner_finish (IdeDeviceManager  *self,
-                                         GAsyncResult      *result,
-                                         GError           **error)
-{
-  IdeRunner *ret;
-
-  IDE_ENTRY;
-
-  g_return_val_if_fail (IDE_IS_DEVICE_MANAGER (self), FALSE);
-  g_return_val_if_fail (IDE_IS_TASK (result), FALSE);
-  g_return_val_if_fail (ide_task_is_valid (IDE_TASK (result), self), FALSE);
-
-  ret = ide_task_propagate_pointer (IDE_TASK (result), error);
-
-  IDE_RETURN (ret);
-}
-
 gdouble
 ide_device_manager_get_progress (IdeDeviceManager *self)
 {
diff --git a/src/libide/foundry/ide-device-manager.h b/src/libide/foundry/ide-device-manager.h
index f3ede77e3..e3f680f06 100644
--- a/src/libide/foundry/ide-device-manager.h
+++ b/src/libide/foundry/ide-device-manager.h
@@ -57,15 +57,5 @@ IDE_AVAILABLE_IN_ALL
 gboolean          ide_device_manager_deploy_finish        (IdeDeviceManager     *self,
                                                            GAsyncResult         *result,
                                                            GError              **error);
-IDE_AVAILABLE_IN_ALL
-void              ide_device_manager_create_runner_async  (IdeDeviceManager     *self,
-                                                           IdePipeline          *pipeline,
-                                                           GCancellable         *cancellable,
-                                                           GAsyncReadyCallback   callback,
-                                                           gpointer              user_data);
-IDE_AVAILABLE_IN_ALL
-IdeRunner        *ide_device_manager_create_runner_finish (IdeDeviceManager     *self,
-                                                           GAsyncResult         *result,
-                                                           GError              **error);
 
 G_END_DECLS
diff --git a/src/libide/foundry/ide-local-deploy-strategy.c b/src/libide/foundry/ide-local-deploy-strategy.c
index e947f3daf..7e6260076 100644
--- a/src/libide/foundry/ide-local-deploy-strategy.c
+++ b/src/libide/foundry/ide-local-deploy-strategy.c
@@ -143,55 +143,6 @@ ide_local_deploy_strategy_deploy_finish (IdeDeployStrategy  *strategy,
   IDE_RETURN (ret);
 }
 
-static void
-ide_local_deploy_strategy_create_runner_async (IdeDeployStrategy   *strategy,
-                                               IdePipeline         *pipeline,
-                                               GCancellable        *cancellable,
-                                               GAsyncReadyCallback  callback,
-                                               gpointer             user_data)
-{
-  g_autoptr(IdeRunner) runner = NULL;
-  g_autoptr(IdeTask) task = NULL;
-  IdeRuntime *runtime;
-
-  IDE_ENTRY;
-
-  g_return_if_fail (IDE_IS_LOCAL_DEPLOY_STRATEGY (strategy));
-  g_return_if_fail (IDE_IS_PIPELINE (pipeline));
-  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  task = ide_task_new (strategy, cancellable, callback, user_data);
-  ide_task_set_source_tag (task, ide_local_deploy_strategy_create_runner_async);
-
-  if (!(runtime = ide_pipeline_get_runtime (pipeline)) ||
-      !(runner = ide_runtime_create_runner (runtime, NULL)))
-    ide_task_return_new_error (task,
-                               G_IO_ERROR,
-                               G_IO_ERROR_FAILED,
-                               "Failed to create IdeRunner for pipeline");
-  else
-    ide_task_return_pointer (task, g_steal_pointer (&runner), g_object_unref);
-
-  IDE_EXIT;
-}
-
-static IdeRunner *
-ide_local_deploy_strategy_create_runner_finish (IdeDeployStrategy  *strategy,
-                                                GAsyncResult       *result,
-                                                GError            **error)
-{
-  IdeRunner *ret;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_DEPLOY_STRATEGY (strategy));
-  g_assert (IDE_IS_TASK (result));
-
-  ret = ide_task_propagate_pointer (IDE_TASK (result), error);
-
-  IDE_RETURN (ret);
-}
-
 static void
 ide_local_deploy_strategy_class_init (IdeLocalDeployStrategyClass *klass)
 {
@@ -201,8 +152,6 @@ ide_local_deploy_strategy_class_init (IdeLocalDeployStrategyClass *klass)
   deploy_strategy_class->load_finish = ide_local_deploy_strategy_load_finish;
   deploy_strategy_class->deploy_async = ide_local_deploy_strategy_deploy_async;
   deploy_strategy_class->deploy_finish = ide_local_deploy_strategy_deploy_finish;
-  deploy_strategy_class->create_runner_async = ide_local_deploy_strategy_create_runner_async;
-  deploy_strategy_class->create_runner_finish = ide_local_deploy_strategy_create_runner_finish;
 }
 
 static void
diff --git a/src/plugins/deviced/gbp-deviced-deploy-strategy.c 
b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
index 8e9108a97..3d1f6d636 100644
--- a/src/plugins/deviced/gbp-deviced-deploy-strategy.c
+++ b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
@@ -25,7 +25,6 @@
 
 #include "gbp-deviced-deploy-strategy.h"
 #include "gbp-deviced-device.h"
-#include "gbp-deviced-runner.h"
 
 struct _GbpDevicedDeployStrategy
 {
@@ -376,54 +375,6 @@ gbp_deviced_deploy_strategy_deploy_finish (IdeDeployStrategy *self,
   return ide_task_propagate_boolean (IDE_TASK (result), error);
 }
 
-static void
-gbp_deviced_deploy_strategy_create_runner_async (IdeDeployStrategy   *strategy,
-                                                 IdePipeline         *pipeline,
-                                                 GCancellable        *cancellable,
-                                                 GAsyncReadyCallback  callback,
-                                                 gpointer             user_data)
-{
-  GbpDevicedDeployStrategy *self = (GbpDevicedDeployStrategy *)strategy;
-  g_autoptr(IdeTask) task = NULL;
-  IdeDevice *device = NULL;
-  IdeConfig *config = NULL;
-  GbpDevicedRunner *runner;
-
-  IDE_ENTRY;
-
-  g_assert (GBP_IS_DEVICED_DEPLOY_STRATEGY (self));
-  g_assert (IDE_IS_PIPELINE (pipeline));
-  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
-
-  task = ide_task_new (self, cancellable, callback, user_data);
-  ide_task_set_source_tag (task, gbp_deviced_deploy_strategy_create_runner_async);
-
-  device = ide_pipeline_get_device (pipeline);
-  config = ide_pipeline_get_config (pipeline);
-
-  g_assert (GBP_IS_FLATPAK_MANIFEST (config));
-  g_assert (GBP_IS_DEVICED_DEVICE (device));
-
-  g_assert (IDE_IS_CONTEXT (ide_object_get_context (IDE_OBJECT (self))));
-
-  runner = gbp_deviced_runner_new (GBP_DEVICED_DEVICE (device));
-  ide_object_append (IDE_OBJECT (pipeline), IDE_OBJECT (runner));
-  ide_task_return_object (task, runner);
-
-  IDE_EXIT;
-}
-
-static IdeRunner *
-gbp_deviced_deploy_strategy_create_runner_finish (IdeDeployStrategy  *self,
-                                                  GAsyncResult       *result,
-                                                  GError            **error)
-{
-  g_return_val_if_fail (GBP_IS_DEVICED_DEPLOY_STRATEGY (self), FALSE);
-  g_return_val_if_fail (ide_task_is_valid (result, self), FALSE);
-
-  return ide_task_propagate_object (IDE_TASK (result), error);
-}
-
 static void
 gbp_deviced_deploy_strategy_class_init (GbpDevicedDeployStrategyClass *klass)
 {
@@ -433,8 +384,6 @@ gbp_deviced_deploy_strategy_class_init (GbpDevicedDeployStrategyClass *klass)
   strategy_class->load_finish = gbp_deviced_deploy_strategy_load_finish;
   strategy_class->deploy_async = gbp_deviced_deploy_strategy_deploy_async;
   strategy_class->deploy_finish = gbp_deviced_deploy_strategy_deploy_finish;
-  strategy_class->create_runner_async = gbp_deviced_deploy_strategy_create_runner_async;
-  strategy_class->create_runner_finish = gbp_deviced_deploy_strategy_create_runner_finish;
 }
 
 static void
diff --git a/src/plugins/deviced/meson.build b/src/plugins/deviced/meson.build
index 78ace2727..adf533266 100644
--- a/src/plugins/deviced/meson.build
+++ b/src/plugins/deviced/meson.build
@@ -11,7 +11,6 @@ plugins_sources += files([
   'gbp-deviced-deploy-strategy.c',
   'gbp-deviced-device.c',
   'gbp-deviced-device-provider.c',
-  'gbp-deviced-runner.c',
 ])
 
 plugin_deviced_resources = gnome.compile_resources(


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