[gnome-builder] subprocess-launcher: add get_argv() helper



commit 2f6afb3fdb51dfd8003c683f6c4d9332d760b65c
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 28 22:33:56 2016 -0700

    subprocess-launcher: add get_argv() helper
    
    This allows consumers to access the list of arguments in the launcher.

 libide/subprocess/ide-subprocess-launcher.c |   24 ++++++++++++++++++++++++
 libide/subprocess/ide-subprocess-launcher.h |   12 ++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/libide/subprocess/ide-subprocess-launcher.c b/libide/subprocess/ide-subprocess-launcher.c
index 1a90aa4..756f7b3 100644
--- a/libide/subprocess/ide-subprocess-launcher.c
+++ b/libide/subprocess/ide-subprocess-launcher.c
@@ -798,3 +798,27 @@ ide_subprocess_launcher_take_stderr_fd (IdeSubprocessLauncher *self,
       priv->stderr_fd = stderr_fd;
     }
 }
+
+const gchar * const *
+ide_subprocess_launcher_get_argv (IdeSubprocessLauncher *self)
+{
+  IdeSubprocessLauncherPrivate *priv = ide_subprocess_launcher_get_instance_private (self);
+
+  g_return_val_if_fail (IDE_IS_SUBPROCESS_LAUNCHER (self), NULL);
+
+  return (const gchar * const *)priv->argv->pdata;
+}
+
+void
+ide_subprocess_launcher_insert_argv (IdeSubprocessLauncher *self,
+                                     guint                  index,
+                                     const gchar           *arg)
+{
+  IdeSubprocessLauncherPrivate *priv = ide_subprocess_launcher_get_instance_private (self);
+
+  g_return_if_fail (IDE_IS_SUBPROCESS_LAUNCHER (self));
+  g_return_if_fail (index < priv->argv->len);
+  g_return_if_fail (arg != NULL);
+
+  g_ptr_array_insert (priv->argv, index, g_strdup (arg));
+}
diff --git a/libide/subprocess/ide-subprocess-launcher.h b/libide/subprocess/ide-subprocess-launcher.h
index 0e775ce..bf389b8 100644
--- a/libide/subprocess/ide-subprocess-launcher.h
+++ b/libide/subprocess/ide-subprocess-launcher.h
@@ -33,9 +33,9 @@ struct _IdeSubprocessLauncherClass
 {
   GObjectClass parent_class;
 
-  IdeSubprocess *(*spawn)   (IdeSubprocessLauncher  *self,
-                                  GCancellable           *cancellable,
-                                  GError                **error);
+  IdeSubprocess *(*spawn) (IdeSubprocessLauncher  *self,
+                           GCancellable           *cancellable,
+                           GError                **error);
 
   gpointer _reserved1;
   gpointer _reserved2;
@@ -69,14 +69,18 @@ void                   ide_subprocess_launcher_setenv              (IdeSubproces
                                                                     const gchar            *key,
                                                                     const gchar            *value,
                                                                     gboolean                replace);
+void                   ide_subprocess_launcher_insert_argv         (IdeSubprocessLauncher  *self,
+                                                                    guint                   index,
+                                                                    const gchar            *arg);
 void                   ide_subprocess_launcher_overlay_environment (IdeSubprocessLauncher  *self,
                                                                     IdeEnvironment         *environment);
+const gchar * const   *ide_subprocess_launcher_get_argv            (IdeSubprocessLauncher  *self);
 void                   ide_subprocess_launcher_push_args           (IdeSubprocessLauncher  *self,
                                                                     const gchar * const    *args);
 void                   ide_subprocess_launcher_push_argv           (IdeSubprocessLauncher  *self,
                                                                     const gchar            *argv);
 gchar                 *ide_subprocess_launcher_pop_argv            (IdeSubprocessLauncher  *self) 
G_GNUC_WARN_UNUSED_RESULT;
-IdeSubprocess         *ide_subprocess_launcher_spawn          (IdeSubprocessLauncher  *self,
+IdeSubprocess         *ide_subprocess_launcher_spawn               (IdeSubprocessLauncher  *self,
                                                                     GCancellable           *cancellable,
                                                                     GError                **error);
 void                   ide_subprocess_launcher_take_stdin_fd       (IdeSubprocessLauncher  *self,


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