[perl-Glib] Create a GType for GSpawnFlags and register it with the bindings



commit 771dbe10464c7884ecfb8b5008f78762d189e307
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Wed Dec 4 21:42:27 2013 +0100

    Create a GType for GSpawnFlags and register it with the bindings
    
    Needed for libvte.

 GType.xs       |    4 ++++
 NEWS           |    1 +
 gperl-gtypes.c |   23 +++++++++++++++++++++++
 gperl-gtypes.h |    3 +++
 4 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/GType.xs b/GType.xs
index 471a4ee..b06f203 100644
--- a/GType.xs
+++ b/GType.xs
@@ -28,6 +28,7 @@
 #include "gperl.h"
 #include "gperl_marshal.h"
 
+#include "gperl-gtypes.h"
 #include "gperl-private.h" /* for _gperl_fetch_wrapper_key */
 
 /* for fundamental types */
@@ -1979,6 +1980,9 @@ BOOT:
         */
        gperl_register_fundamental_alias (G_TYPE_UINT, "Glib::Uint");
 
+       /* register custom GTypes that do not have a better home. */
+       gperl_register_fundamental (GPERL_TYPE_SPAWN_FLAGS, "Glib::SpawnFlags");
+
 
 =for apidoc
 =for arg parent_class (package) type from which to derive
diff --git a/NEWS b/NEWS
index 31c1e67..4873564 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Overview of changes in Glib 1.302 (stable)
   conjunction with certain XS modules, among them XML::Parser and
   String::Approx.
 * Avoid memory corruption when registering boxed synonyms repeatedly.
+* Create a GType for GSpawnFlags and register it with the bindings.
 
 Overview of changes in Glib 1.301 (stable)
 ==========================================
diff --git a/gperl-gtypes.c b/gperl-gtypes.c
index c541c29..2cdd89c 100644
--- a/gperl-gtypes.c
+++ b/gperl-gtypes.c
@@ -171,6 +171,29 @@ gperl_signal_flags_get_type (void)
 
 /* -------------------------------------------------------------------------- */
 
+GType
+gperl_spawn_flags_get_type (void)
+{
+  static GType etype = 0;
+  if (G_UNLIKELY(etype == 0)) {
+    static const GFlagsValue values[] = {
+      { G_SPAWN_LEAVE_DESCRIPTORS_OPEN, "G_SPAWN_LEAVE_DESCRIPTORS_OPEN", "leave-descriptors-open" },
+      { G_SPAWN_DO_NOT_REAP_CHILD, "G_SPAWN_DO_NOT_REAP_CHILD", "do-not-reap-child" },
+      { G_SPAWN_SEARCH_PATH, "G_SPAWN_SEARCH_PATH", "search-path" },
+      { G_SPAWN_STDOUT_TO_DEV_NULL, "G_SPAWN_STDOUT_TO_DEV_NULL", "stdout-to-dev-null" },
+      { G_SPAWN_STDERR_TO_DEV_NULL, "G_SPAWN_STDERR_TO_DEV_NULL", "stderr-to-dev-null" },
+      { G_SPAWN_CHILD_INHERITS_STDIN, "G_SPAWN_CHILD_INHERITS_STDIN", "child-inherits-stdin" },
+      { G_SPAWN_FILE_AND_ARGV_ZERO, "G_SPAWN_FILE_AND_ARGV_ZERO", "file-and-argv-zero" },
+      { G_SPAWN_SEARCH_PATH_FROM_ENVP, "G_SPAWN_SEARCH_PATH_FROM_ENVP", "search-path-from-envp" },
+      { 0, NULL, NULL }
+    };
+    etype = g_flags_register_static (g_intern_static_string ("GSpawnFlags"), values);
+  }
+  return etype;
+}
+
+/* -------------------------------------------------------------------------- */
+
 #if GLIB_CHECK_VERSION (2, 14, 0)
 GType gperl_user_directory_get_type (void)
 {
diff --git a/gperl-gtypes.h b/gperl-gtypes.h
index e6eace6..b51f448 100644
--- a/gperl-gtypes.h
+++ b/gperl-gtypes.h
@@ -35,6 +35,9 @@ GType gperl_param_flags_get_type (void) G_GNUC_CONST;
 #define GPERL_TYPE_SIGNAL_FLAGS gperl_signal_flags_get_type ()
 GType gperl_signal_flags_get_type (void) G_GNUC_CONST;
 
+#define GPERL_TYPE_SPAWN_FLAGS gperl_spawn_flags_get_type ()
+GType gperl_spawn_flags_get_type (void) G_GNUC_CONST;
+
 #if GLIB_CHECK_VERSION (2, 14, 0)
 #define GPERL_TYPE_USER_DIRECTORY gperl_user_directory_get_type ()
 GType gperl_user_directory_get_type (void) G_GNUC_CONST;


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