[glib/wip/gsubprocess] GSubprocess: [rebase] Add cwd property



commit bb886f8a464f213c58459741446e403c62d7f898
Author: Colin Walters <walters verbum org>
Date:   Mon Jun 11 15:58:06 2012 -0400

    GSubprocess: [rebase] Add cwd property

 gio/gsubprocess.c |   28 +++++++++++++++++++++++++++-
 gio/gsubprocess.h |    6 ------
 2 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c
index d0e4bac..91e56e1 100644
--- a/gio/gsubprocess.c
+++ b/gio/gsubprocess.c
@@ -112,7 +112,8 @@ G_DEFINE_TYPE (GSubprocess, g_subprocess, G_TYPE_OBJECT);
 enum
 {
   PROP_0,
-  PROP_EXECUTABLE
+  PROP_EXECUTABLE,
+  PROP_WORKING_DIRECTORY
 };
 
 static void
@@ -188,6 +189,11 @@ g_subprocess_set_property (GObject      *object,
       g_ptr_array_add (self->child_argv, g_value_dup_string (value));
       break;
 
+    case PROP_WORKING_DIRECTORY:
+      g_free (self->working_directory);
+      self->working_directory = g_value_dup_string (value);
+      break;
+
     default:
       g_assert_not_reached ();
     }
@@ -211,6 +217,10 @@ g_subprocess_get_property (GObject    *object,
 	g_value_set_string (value, NULL);
       break;
 
+    case PROP_WORKING_DIRECTORY:
+      g_subprocess_set_working_directory (self, g_value_get_string (value));
+      break;
+
     default:
       g_assert_not_reached ();
     }
@@ -241,6 +251,22 @@ g_subprocess_class_init (GSubprocessClass *class)
 							P_("Path to executable"),
 							NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
 							G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GSubprocess:working-directory:
+   *
+   * Used for child's initial current working directory. %NULL will
+   * cause the child to inherit the parent's working directory; this
+   * is the default.
+   *
+   * Since: 2.34
+   */
+  g_object_class_install_property (gobject_class, PROP_WORKING_DIRECTORY,
+				   g_param_spec_string ("working-directory",
+							P_("Working Directory"),
+							P_("Path to working directory"),
+							NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
+							G_PARAM_STATIC_STRINGS));
 }
 
 /**** Creation ****/
diff --git a/gio/gsubprocess.h b/gio/gsubprocess.h
index 50a18cd..4392a1f 100644
--- a/gio/gsubprocess.h
+++ b/gio/gsubprocess.h
@@ -219,12 +219,6 @@ GLIB_AVAILABLE_IN_2_34
 gint             g_subprocess_get_status_code (GSubprocess   *self);
 
 GLIB_AVAILABLE_IN_2_34
-gint             g_subprocess_get_unix_exit_status (GSubprocess   *self,
-						    gboolean      *out_exited,
-						    gboolean      *out_signaled,
-						    gint          *out_code);
-
-GLIB_AVAILABLE_IN_2_34
 gboolean         g_subprocess_wait_sync (GSubprocess   *self,
 					 GCancellable  *cancellable,
 					 GError       **error);



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