[gnome-builder/gnome-builder-3-20] launcher: allow pop of argv items
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-20] launcher: allow pop of argv items
- Date: Mon, 9 May 2016 10:28:18 +0000 (UTC)
commit 1d28a976094403202f43def002b6668136f08283
Author: Christian Hergert <chergert redhat com>
Date: Mon May 9 13:25:21 2016 +0300
launcher: allow pop of argv items
libide/ide-subprocess-launcher.c | 18 ++++++++++++++++++
libide/ide-subprocess-launcher.h | 5 +++--
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-subprocess-launcher.c b/libide/ide-subprocess-launcher.c
index d8441cc..1006a6c 100644
--- a/libide/ide-subprocess-launcher.c
+++ b/libide/ide-subprocess-launcher.c
@@ -571,3 +571,21 @@ ide_subprocess_launcher_push_args (IdeSubprocessLauncher *self,
for (guint i = 0; args [i] != NULL; i++)
ide_subprocess_launcher_push_argv (self, args [i]);
}
+
+gchar *
+ide_subprocess_launcher_pop_argv (IdeSubprocessLauncher *self)
+{
+ IdeSubprocessLauncherPrivate *priv = ide_subprocess_launcher_get_instance_private (self);
+ gchar *ret = NULL;
+
+ g_return_val_if_fail (IDE_IS_SUBPROCESS_LAUNCHER (self), NULL);
+
+ if (priv->argv->len > 0)
+ {
+ ret = g_ptr_array_index (priv->argv, priv->argv->len - 1);
+ g_ptr_array_index (priv->argv, priv->argv->len - 1) = NULL;
+ g_ptr_array_set_size (priv->argv, priv->argv->len - 1);
+ }
+
+ return ret;
+}
diff --git a/libide/ide-subprocess-launcher.h b/libide/ide-subprocess-launcher.h
index d733244..a72a099 100644
--- a/libide/ide-subprocess-launcher.h
+++ b/libide/ide-subprocess-launcher.h
@@ -65,8 +65,9 @@ void ide_subprocess_launcher_push_args (IdeSubproces
const gchar * const *args);
void ide_subprocess_launcher_push_argv (IdeSubprocessLauncher *self,
const gchar *argv);
-GSubprocess *ide_subprocess_launcher_spawn_sync (IdeSubprocessLauncher *self,
- GCancellable *cancellable,
+gchar *ide_subprocess_launcher_pop_argv (IdeSubprocessLauncher *self)
G_GNUC_WARN_UNUSED_RESULT;
+GSubprocess *ide_subprocess_launcher_spawn_sync (IdeSubprocessLauncher *self,
+ GCancellable *cancellable,
GError **error);
void ide_subprocess_launcher_spawn_async (IdeSubprocessLauncher *self,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]