[perl-Glib] Move all custom enum/flags GTypes into gperl-gtypes.[hc]



commit 261019b52d59905e45845018d2b5e7b13529c2fc
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Nov 26 23:15:22 2013 +0100

    Move all custom enum/flags GTypes into gperl-gtypes.[hc]

 GKeyFile.xs    |   32 +--------
 GLog.xs        |   34 ++---------
 GOption.xs     |   52 +---------------
 GParamSpec.xs  |   35 +---------
 GSignal.xs     |   50 ++-------------
 GUtils.xs      |   28 +-------
 gperl-gtypes.c |  193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 gperl-gtypes.h |   77 +++++++++++++++++------
 8 files changed, 270 insertions(+), 231 deletions(-)
---
diff --git a/GKeyFile.xs b/GKeyFile.xs
index 92483c8..debf2b3 100644
--- a/GKeyFile.xs
+++ b/GKeyFile.xs
@@ -19,42 +19,18 @@
  */
 
 #include "gperl.h"
-
-#ifndef G_TYPE_KEY_FILE_FLAGS
-#define G_TYPE_KEY_FILE_FLAGS gperl_g_key_file_flags_get_type()
-static GType gperl_g_key_file_flags_get_type (void) G_GNUC_CONST;
-
-static const GFlagsValue _gperl_g_key_file_flags_values[] = {
-  { G_KEY_FILE_NONE, "G_KEY_FILE_NONE", "none" },
-  { G_KEY_FILE_KEEP_COMMENTS, "G_KEY_FILE_KEEP_COMMENTS", "keep-comments" },
-  { G_KEY_FILE_KEEP_TRANSLATIONS, "G_KEY_FILE_KEEP_TRANSLATIONS", "keep-translations" },
-  { 0, NULL, NULL }
-};
-
-static GType
-gperl_g_key_file_flags_get_type ()
-{
-  static GType type = 0;
-
-  if (! type)
-    type = g_flags_register_static ("GKeyFileFlags",
-                                   _gperl_g_key_file_flags_values);
-
-  return type;
-}
-
-#endif
+#include "gperl-gtypes.h"
 
 SV *
 newSVGKeyFileFlags (GKeyFileFlags flags)
 {
-       return gperl_convert_back_flags (G_TYPE_KEY_FILE_FLAGS, flags);
+       return gperl_convert_back_flags (GPERL_TYPE_KEY_FILE_FLAGS, flags);
 }
 
 GKeyFileFlags
 SvGKeyFileFlags (SV * sv)
 {
-       return gperl_convert_flags (G_TYPE_KEY_FILE_FLAGS, sv);
+       return gperl_convert_flags (GPERL_TYPE_KEY_FILE_FLAGS, sv);
 }
 
 SV *
@@ -133,7 +109,7 @@ key-value pairs, interspersed with comments.
 =cut
 
 BOOT:
-       gperl_register_fundamental (gperl_g_key_file_flags_get_type (),
+       gperl_register_fundamental (GPERL_TYPE_KEY_FILE_FLAGS,
                                    "Glib::KeyFileFlags");
 
 void
diff --git a/GLog.xs b/GLog.xs
index 76accc6..8e0ec3f 100644
--- a/GLog.xs
+++ b/GLog.xs
@@ -20,6 +20,7 @@
  */
 
 #include "gperl.h"
+#include "gperl-gtypes.h"
 #include "gperl-private.h" /* for GPERL_SET_CONTEXT */
 
 =head2 GLog
@@ -48,41 +49,16 @@ before GLib abort()s on them...]
 #define G_LOG_FATAL_MASK        (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR)
 #endif
 
-GType
-g_log_level_flags_get_type (void)
-{
-  static GType etype = 0;
-  if ( etype == 0 ) {
-    static const GFlagsValue values[] = {
-      { G_LOG_FLAG_RECURSION,  "G_LOG_FLAG_RECURSION", "recursion" },
-      { G_LOG_FLAG_FATAL,      "G_LOG_FLAG_FATAL",     "fatal" },
-
-      { G_LOG_LEVEL_ERROR,     "G_LOG_LEVEL_ERROR",    "error" },
-      { G_LOG_LEVEL_CRITICAL,  "G_LOG_LEVEL_CRITICAL", "critical" },
-      { G_LOG_LEVEL_WARNING,   "G_LOG_LEVEL_WARNING",  "warning" },
-      { G_LOG_LEVEL_MESSAGE,   "G_LOG_LEVEL_MESSAGE",  "message" },
-      { G_LOG_LEVEL_INFO,      "G_LOG_LEVEL_INFO",     "info" },
-      { G_LOG_LEVEL_DEBUG,     "G_LOG_LEVEL_DEBUG",    "debug" },
-
-      { G_LOG_FATAL_MASK,      "G_LOG_FATAL_MASK",     "fatal-mask" },
-
-      { 0, NULL, NULL }
-    };
-    etype = g_flags_register_static ("GLogLevelFlags", values);
-  }
-  return etype;
-}
-
 SV *
 newSVGLogLevelFlags (GLogLevelFlags flags)
 {
-       return gperl_convert_back_flags (g_log_level_flags_get_type (), flags);
+       return gperl_convert_back_flags (GPERL_TYPE_LOG_LEVEL_FLAGS, flags);
 }
 
 GLogLevelFlags
 SvGLogLevelFlags (SV * sv)
 {
-       return gperl_convert_flags (g_log_level_flags_get_type (), sv);
+       return gperl_convert_flags (GPERL_TYPE_LOG_LEVEL_FLAGS, sv);
 }
 
 /* for GLogFunc style, to be invoked by gperl_log_func() below */
@@ -91,7 +67,7 @@ gperl_log_callback_new (SV *log_func, SV *user_data)
 {
        GType param_types[3];
        param_types[0] = G_TYPE_STRING;
-       param_types[1] = g_log_level_flags_get_type ();
+       param_types[1] = GPERL_TYPE_LOG_LEVEL_FLAGS;
        param_types[2] = G_TYPE_STRING;
        return gperl_callback_new (log_func, user_data,
                                   3, param_types, G_TYPE_NONE);
@@ -191,7 +167,7 @@ BOOT:
        /* gperl_handle_logs_for ("main"); */
        gperl_handle_logs_for ("GLib");
        gperl_handle_logs_for ("GLib-GObject");
-       gperl_register_fundamental (g_log_level_flags_get_type (),
+       gperl_register_fundamental (GPERL_TYPE_LOG_LEVEL_FLAGS,
                                    "Glib::LogLevelFlags");
 
 =for flags Glib::LogLevelFlags
diff --git a/GOption.xs b/GOption.xs
index 12b4c1e..cae3b6b 100644
--- a/GOption.xs
+++ b/GOption.xs
@@ -7,6 +7,7 @@
  */
 
 #include "gperl.h"
+#include "gperl-gtypes.h"
 
 /* ------------------------------------------------------------------------- */
 
@@ -75,30 +76,6 @@ gperl_option_group_get_type (void)
 
 /* ------------------------------------------------------------------------- */
 
-#define GPERL_TYPE_OPTION_FLAGS (g_option_flags_get_type ())
-
-static GType
-g_option_flags_get_type (void)
-{
-       static GType t = 0;
-       if (t == 0) {
-               static const GFlagsValue values[] = {
-                       {G_OPTION_FLAG_HIDDEN,       "G_OPTION_FLAG_HIDDEN",       "hidden"},
-                       {G_OPTION_FLAG_IN_MAIN,      "G_OPTION_FLAG_IN_MAIN",      "in-main"},
-                       {G_OPTION_FLAG_REVERSE,      "G_OPTION_FLAG_REVERSE",      "reverse"},
-#if GLIB_CHECK_VERSION (2, 8, 0)
-                       {G_OPTION_FLAG_NO_ARG,       "G_OPTION_FLAG_NO_ARG",       "no-arg"},
-                       {G_OPTION_FLAG_FILENAME,     "G_OPTION_FLAG_FILENAME",     "filename"},
-                       {G_OPTION_FLAG_OPTIONAL_ARG, "G_OPTION_FLAG_OPTIONAL_ARG", "optional-arg"},
-                       {G_OPTION_FLAG_NOALIAS,      "G_OPTION_FLAG_NOALIAS",      "noalias"},
-#endif
-                       {0, NULL, NULL}
-               };
-               t = g_flags_register_static ("GOptionFlags", values);
-       }
-       return t;
-}
-
 #if 0
 static SV *
 newSVGOptionFlags (GOptionFlags flags)
@@ -115,33 +92,6 @@ SvGOptionFlags (SV *sv)
 
 /* ------------------------------------------------------------------------- */
 
-#define GPERL_TYPE_OPTION_ARG (g_option_arg_get_type ())
-
-static GType
-g_option_arg_get_type (void)
-{
-       static GType t = 0;
-       if (t == 0) {
-               static const GEnumValue values[] = {
-                       {G_OPTION_ARG_NONE,             "G_OPTION_ARG_NONE",            "none"},
-                       {G_OPTION_ARG_STRING,           "G_OPTION_ARG_STRING",          "string"},
-                       {G_OPTION_ARG_INT,              "G_OPTION_ARG_INT",             "int"},
-                       /* Not supported:
-                       {G_OPTION_ARG_CALLBACK,         "G_OPTION_ARG_CALLBACK",        "callback"}, */
-                       {G_OPTION_ARG_FILENAME,         "G_OPTION_ARG_FILENAME",        "filename"},
-                       {G_OPTION_ARG_STRING_ARRAY,     "G_OPTION_ARG_STRING_ARRAY",    "string-array"},
-                       {G_OPTION_ARG_FILENAME_ARRAY,   "G_OPTION_ARG_FILENAME_ARRAY",  "filename-array"},
-#if GLIB_CHECK_VERSION (2, 12, 0)
-                       {G_OPTION_ARG_DOUBLE,           "G_OPTION_ARG_DOUBLE",          "double"},
-                       {G_OPTION_ARG_INT64,            "G_OPTION_ARG_INT64",           "int64"},
-#endif
-                       {0, NULL, NULL}
-               };
-               t = g_enum_register_static ("GOptionArg", values);
-       }
-       return t;
-}
-
 #if 0
 static SV *
 newSVGOptionArg (GOptionArg arg)
diff --git a/GParamSpec.xs b/GParamSpec.xs
index 718f2bd..909deb5 100644
--- a/GParamSpec.xs
+++ b/GParamSpec.xs
@@ -20,45 +20,19 @@
  */
 
 #include "gperl.h"
+#include "gperl-gtypes.h"
 #include "gperl-private.h" /* for _gperl_sv_from_value_internal() */
 
-/*
- * this isn't already done for us.  :-(
- *
- * interestingly, the obvious G_TYPE_PARAM_FLAGS is taken by the 
- * GParamSpecFlags.
- */
-
-static GType
-g_param_flags_get_type (void)
-{
-  static GType etype = 0;
-  if (etype == 0) {
-    static const GFlagsValue values[] = {
-      {G_PARAM_READABLE,       "G_PARAM_READABLE",       "readable"},
-      {G_PARAM_WRITABLE,       "G_PARAM_WRITABLE",       "writable"},
-      {G_PARAM_CONSTRUCT,      "G_PARAM_CONSTRUCT",      "construct"},
-      {G_PARAM_CONSTRUCT_ONLY, "G_PARAM_CONSTRUCT_ONLY", "construct-only"},
-      {G_PARAM_LAX_VALIDATION, "G_PARAM_LAX_VALIDATION", "lax-validation"},
-      {G_PARAM_PRIVATE,        "G_PARAM_PRIVATE",        "private"},
-      {0, NULL, NULL}
-    };
-    etype = g_flags_register_static ("GPerlParamFlags", values);
-  }
-  return etype;
-}
-
-
 SV *
 newSVGParamFlags (GParamFlags flags)
 {
-       return gperl_convert_back_flags (g_param_flags_get_type (), flags);
+       return gperl_convert_back_flags (GPERL_TYPE_PARAM_FLAGS, flags);
 }
 
 GParamFlags
 SvGParamFlags (SV * sv)
 {
-       return gperl_convert_flags (g_param_flags_get_type (), sv);
+       return gperl_convert_flags (GPERL_TYPE_PARAM_FLAGS, sv);
 }
 
 static GHashTable * param_package_by_type = NULL;
@@ -240,8 +214,7 @@ the underlying C libraries.
 =cut
 
 BOOT:
-       gperl_register_fundamental (g_param_flags_get_type (),
-                                   "Glib::ParamFlags");
+       gperl_register_fundamental (GPERL_TYPE_PARAM_FLAGS, "Glib::ParamFlags");
        gperl_register_param_spec (G_TYPE_PARAM_CHAR, "Glib::Param::Char");
        gperl_register_param_spec (G_TYPE_PARAM_UCHAR, "Glib::Param::UChar");
        gperl_register_param_spec (G_TYPE_PARAM_UNICHAR, "Glib::Param::Unichar");
diff --git a/GSignal.xs b/GSignal.xs
index a94b112..df7f56d 100644
--- a/GSignal.xs
+++ b/GSignal.xs
@@ -28,6 +28,7 @@
 /* #define NOISY */
 
 #include "gperl.h"
+#include "gperl-gtypes.h"
 #include "gperl-private.h" /* for SAVED_STACK_SV */
 
 /*
@@ -49,59 +50,18 @@
 #endif
 
 
-/*
-GLib doesn't include a GFlags type for GSignalFlags, so we have to do
-this by hand.  watch for fallen cruft.
-*/
-
-static GType
-gperl_signal_flags_get_type (void)
-{
-  static GType etype = 0;
-  if ( etype == 0 ) {
-    static const GFlagsValue values[] = {
-      { G_SIGNAL_RUN_FIRST,    "G_SIGNAL_RUN_FIRST",   "run-first" },
-      { G_SIGNAL_RUN_LAST,     "G_SIGNAL_RUN_LAST",    "run-last" },
-      { G_SIGNAL_RUN_CLEANUP,  "G_SIGNAL_RUN_CLEANUP", "run-cleanup" },
-      { G_SIGNAL_NO_RECURSE,   "G_SIGNAL_NO_RECURSE",  "no-recurse" },
-      { G_SIGNAL_DETAILED,     "G_SIGNAL_DETAILED",    "detailed" },
-      { G_SIGNAL_ACTION,       "G_SIGNAL_ACTION",      "action" },
-      { G_SIGNAL_NO_HOOKS,     "G_SIGNAL_NO_HOOKS",    "no-hooks" },
-      { 0, NULL, NULL }
-    };
-    etype = g_flags_register_static ("GSignalFlags", values);
-  }
-  return etype;
-}
-
 SV *
 newSVGSignalFlags (GSignalFlags flags)
 {
-       return gperl_convert_back_flags (gperl_signal_flags_get_type (), flags);
+       return gperl_convert_back_flags (GPERL_TYPE_SIGNAL_FLAGS, flags);
 }
 
 GSignalFlags
 SvGSignalFlags (SV * sv)
 {
-       return gperl_convert_flags (gperl_signal_flags_get_type (), sv);
+       return gperl_convert_flags (GPERL_TYPE_SIGNAL_FLAGS, sv);
 }
 
-/* GConnectFlags doesn't come with a GType either.  We don't use it in Glib
- * directly, but other bindings might need it. */
-static GType
-gperl_connect_flags_get_type (void)
-{
-  static GType etype = 0;
-  if ( etype == 0 ) {
-    static const GFlagsValue values[] = {
-      { G_CONNECT_AFTER,   "G_CONNECT_AFTER",   "after" },
-      { G_CONNECT_SWAPPED, "G_CONNECT_SWAPPED", "swapped" },
-      { 0, NULL, NULL }
-    };
-    etype = g_flags_register_static ("GConnectFlags", values);
-  }
-  return etype;
-}
 
 SV *
 newSVGSignalInvocationHint (GSignalInvocationHint * ihint)
@@ -578,9 +538,9 @@ directly.
 =cut
 
 BOOT:
-       gperl_register_fundamental (gperl_signal_flags_get_type (),
+       gperl_register_fundamental (GPERL_TYPE_SIGNAL_FLAGS,
                                    "Glib::SignalFlags");
-       gperl_register_fundamental (gperl_connect_flags_get_type (),
+       gperl_register_fundamental (GPERL_TYPE_CONNECT_FLAGS,
                                    "Glib::ConnectFlags");
 
 =for flags Glib::SignalFlags
diff --git a/GUtils.xs b/GUtils.xs
index c98f7e6..c59f704 100644
--- a/GUtils.xs
+++ b/GUtils.xs
@@ -20,40 +20,20 @@
  * $Id$
  */
 #include "gperl.h"
+#include "gperl-gtypes.h"
 
 #if GLIB_CHECK_VERSION (2, 14, 0)
 
-static GType
-gperl_user_directory_get_type (void)
-{
-       static GType etype = 0;
-       if (etype == 0) {
-               static const GEnumValue values[] = {
-                       { G_USER_DIRECTORY_DESKTOP, "G_USER_DIRECTORY_DESKTOP", "desktop" },
-                       { G_USER_DIRECTORY_DOCUMENTS, "G_USER_DIRECTORY_DOCUMENTS", "documents" },
-                       { G_USER_DIRECTORY_DOWNLOAD, "G_USER_DIRECTORY_DOWNLOAD", "download" },
-                       { G_USER_DIRECTORY_MUSIC, "G_USER_DIRECTORY_MUSIC", "music" },
-                       { G_USER_DIRECTORY_PICTURES, "G_USER_DIRECTORY_PICTURES", "pictures" },
-                       { G_USER_DIRECTORY_PUBLIC_SHARE, "G_USER_DIRECTORY_PUBLIC_SHARE", "public-share" },
-                       { G_USER_DIRECTORY_TEMPLATES, "G_USER_DIRECTORY_TEMPLATES", "templates" },
-                       { G_USER_DIRECTORY_VIDEOS, "G_USER_DIRECTORY_VIDEOS", "videos" },
-                       { 0, NULL, NULL }
-               };
-               etype = g_enum_register_static ("GUserDirectory", values);
-       }
-       return etype;
-}
-
 GUserDirectory
 SvGUserDirectory (SV *sv)
 {
-       return gperl_convert_enum (gperl_user_directory_get_type (), sv);
+       return gperl_convert_enum (GPERL_TYPE_USER_DIRECTORY, sv);
 }
 
 SV *
 newSVGUserDirectory (GUserDirectory dir)
 {
-       return gperl_convert_back_enum (gperl_user_directory_get_type (), dir);
+       return gperl_convert_back_enum (GPERL_TYPE_USER_DIRECTORY, dir);
 }
 
 #endif
@@ -62,7 +42,7 @@ MODULE = Glib::Utils  PACKAGE = Glib  PREFIX = g_
 
 BOOT:
 #if GLIB_CHECK_VERSION (2, 14, 0)
-       gperl_register_fundamental (gperl_user_directory_get_type (),
+       gperl_register_fundamental (GPERL_TYPE_USER_DIRECTORY,
                                    "Glib::UserDirectory");
 #endif
 
diff --git a/gperl-gtypes.c b/gperl-gtypes.c
index f1114d9..c541c29 100644
--- a/gperl-gtypes.c
+++ b/gperl-gtypes.c
@@ -5,8 +5,198 @@
 
 #include "gperl.h"
 
+/* --------------------------------------------------------------------------
+ * --- Enums/Flags: ---------------------------------------------------------
+ * -------------------------------------------------------------------------- */
+
+GType
+gperl_connect_flags_get_type (void)
+{
+  static GType etype = 0;
+  if ( etype == 0 ) {
+    static const GFlagsValue values[] = {
+      { G_CONNECT_AFTER,   "G_CONNECT_AFTER",   "after" },
+      { G_CONNECT_SWAPPED, "G_CONNECT_SWAPPED", "swapped" },
+      { 0, NULL, NULL }
+    };
+    etype = g_flags_register_static ("GConnectFlags", values);
+  }
+  return etype;
+}
+
+/* -------------------------------------------------------------------------- */
+
+#if GLIB_CHECK_VERSION (2, 6, 0)
+GType
+gperl_key_file_flags_get_type ()
+{
+  static GType type = 0;
+  if (! type) {
+    static const GFlagsValue values[] = {
+      { G_KEY_FILE_NONE,              "G_KEY_FILE_NONE",              "none" },
+      { G_KEY_FILE_KEEP_COMMENTS,     "G_KEY_FILE_KEEP_COMMENTS",     "keep-comments" },
+      { G_KEY_FILE_KEEP_TRANSLATIONS, "G_KEY_FILE_KEEP_TRANSLATIONS", "keep-translations" },
+      { 0, NULL, NULL }
+    };
+    type = g_flags_register_static ("GKeyFileFlags", values);
+  }
+  return type;
+}
+#endif
+
+/* -------------------------------------------------------------------------- */
+
+GType
+gperl_log_level_flags_get_type (void)
+{
+  static GType etype = 0;
+  if ( etype == 0 ) {
+    static const GFlagsValue values[] = {
+      { G_LOG_FLAG_RECURSION,  "G_LOG_FLAG_RECURSION", "recursion" },
+      { G_LOG_FLAG_FATAL,      "G_LOG_FLAG_FATAL",     "fatal" },
+
+      { G_LOG_LEVEL_ERROR,     "G_LOG_LEVEL_ERROR",    "error" },
+      { G_LOG_LEVEL_CRITICAL,  "G_LOG_LEVEL_CRITICAL", "critical" },
+      { G_LOG_LEVEL_WARNING,   "G_LOG_LEVEL_WARNING",  "warning" },
+      { G_LOG_LEVEL_MESSAGE,   "G_LOG_LEVEL_MESSAGE",  "message" },
+      { G_LOG_LEVEL_INFO,      "G_LOG_LEVEL_INFO",     "info" },
+      { G_LOG_LEVEL_DEBUG,     "G_LOG_LEVEL_DEBUG",    "debug" },
+
+      { G_LOG_FATAL_MASK,      "G_LOG_FATAL_MASK",     "fatal-mask" },
+
+      { 0, NULL, NULL }
+    };
+    etype = g_flags_register_static ("GLogLevelFlags", values);
+  }
+  return etype;
+}
+
+/* -------------------------------------------------------------------------- */
+
+#if GLIB_CHECK_VERSION (2, 6, 0)
+GType
+gperl_option_arg_get_type (void)
+{
+  static GType t = 0;
+  if (t == 0) {
+    static const GEnumValue values[] = {
+      {G_OPTION_ARG_NONE,           "G_OPTION_ARG_NONE",           "none"},
+      {G_OPTION_ARG_STRING,         "G_OPTION_ARG_STRING",         "string"},
+      {G_OPTION_ARG_INT,            "G_OPTION_ARG_INT",            "int"},
+      {G_OPTION_ARG_CALLBACK,       "G_OPTION_ARG_CALLBACK",       "callback"},
+      {G_OPTION_ARG_FILENAME,       "G_OPTION_ARG_FILENAME",       "filename"},
+      {G_OPTION_ARG_STRING_ARRAY,   "G_OPTION_ARG_STRING_ARRAY",   "string-array"},
+      {G_OPTION_ARG_FILENAME_ARRAY, "G_OPTION_ARG_FILENAME_ARRAY", "filename-array"},
+#if GLIB_CHECK_VERSION (2, 12, 0)
+      {G_OPTION_ARG_DOUBLE,         "G_OPTION_ARG_DOUBLE",         "double"},
+      {G_OPTION_ARG_INT64,          "G_OPTION_ARG_INT64",          "int64"},
+#endif
+      {0, NULL, NULL}
+    };
+    t = g_enum_register_static ("GOptionArg", values);
+  }
+  return t;
+}
+#endif
+
+/* -------------------------------------------------------------------------- */
+
+#if GLIB_CHECK_VERSION (2, 6, 0)
+GType
+gperl_option_flags_get_type (void)
+{
+  static GType t = 0;
+  if (t == 0) {
+    static const GFlagsValue values[] = {
+      {G_OPTION_FLAG_HIDDEN,       "G_OPTION_FLAG_HIDDEN",       "hidden"},
+      {G_OPTION_FLAG_IN_MAIN,      "G_OPTION_FLAG_IN_MAIN",      "in-main"},
+      {G_OPTION_FLAG_REVERSE,      "G_OPTION_FLAG_REVERSE",      "reverse"},
+#if GLIB_CHECK_VERSION (2, 8, 0)
+      {G_OPTION_FLAG_NO_ARG,       "G_OPTION_FLAG_NO_ARG",       "no-arg"},
+      {G_OPTION_FLAG_FILENAME,     "G_OPTION_FLAG_FILENAME",     "filename"},
+      {G_OPTION_FLAG_OPTIONAL_ARG, "G_OPTION_FLAG_OPTIONAL_ARG", "optional-arg"},
+      {G_OPTION_FLAG_NOALIAS,      "G_OPTION_FLAG_NOALIAS",      "noalias"},
+#endif
+      {0, NULL, NULL}
+    };
+    t = g_flags_register_static ("GOptionFlags", values);
+  }
+  return t;
+}
+#endif
+
+/* -------------------------------------------------------------------------- */
+
+/* the obvious GParamFlags is taken by GParamSpecFlags. */
+GType
+gperl_param_flags_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GFlagsValue values[] = {
+      {G_PARAM_READABLE,       "G_PARAM_READABLE",       "readable"},
+      {G_PARAM_WRITABLE,       "G_PARAM_WRITABLE",       "writable"},
+      {G_PARAM_CONSTRUCT,      "G_PARAM_CONSTRUCT",      "construct"},
+      {G_PARAM_CONSTRUCT_ONLY, "G_PARAM_CONSTRUCT_ONLY", "construct-only"},
+      {G_PARAM_LAX_VALIDATION, "G_PARAM_LAX_VALIDATION", "lax-validation"},
+      {G_PARAM_PRIVATE,        "G_PARAM_PRIVATE",        "private"},
+      {0, NULL, NULL}
+    };
+    etype = g_flags_register_static ("GPerlParamFlags", values);
+  }
+  return etype;
+}
+
 /* -------------------------------------------------------------------------- */
 
+GType
+gperl_signal_flags_get_type (void)
+{
+  static GType etype = 0;
+  if ( etype == 0 ) {
+    static const GFlagsValue values[] = {
+      { G_SIGNAL_RUN_FIRST,    "G_SIGNAL_RUN_FIRST",   "run-first" },
+      { G_SIGNAL_RUN_LAST,     "G_SIGNAL_RUN_LAST",    "run-last" },
+      { G_SIGNAL_RUN_CLEANUP,  "G_SIGNAL_RUN_CLEANUP", "run-cleanup" },
+      { G_SIGNAL_NO_RECURSE,   "G_SIGNAL_NO_RECURSE",  "no-recurse" },
+      { G_SIGNAL_DETAILED,     "G_SIGNAL_DETAILED",    "detailed" },
+      { G_SIGNAL_ACTION,       "G_SIGNAL_ACTION",      "action" },
+      { G_SIGNAL_NO_HOOKS,     "G_SIGNAL_NO_HOOKS",    "no-hooks" },
+      { 0, NULL, NULL }
+    };
+    etype = g_flags_register_static ("GSignalFlags", values);
+  }
+  return etype;
+}
+
+/* -------------------------------------------------------------------------- */
+
+#if GLIB_CHECK_VERSION (2, 14, 0)
+GType gperl_user_directory_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      { G_USER_DIRECTORY_DESKTOP, "G_USER_DIRECTORY_DESKTOP", "desktop" },
+      { G_USER_DIRECTORY_DOCUMENTS, "G_USER_DIRECTORY_DOCUMENTS", "documents" },
+      { G_USER_DIRECTORY_DOWNLOAD, "G_USER_DIRECTORY_DOWNLOAD", "download" },
+      { G_USER_DIRECTORY_MUSIC, "G_USER_DIRECTORY_MUSIC", "music" },
+      { G_USER_DIRECTORY_PICTURES, "G_USER_DIRECTORY_PICTURES", "pictures" },
+      { G_USER_DIRECTORY_PUBLIC_SHARE, "G_USER_DIRECTORY_PUBLIC_SHARE", "public-share" },
+      { G_USER_DIRECTORY_TEMPLATES, "G_USER_DIRECTORY_TEMPLATES", "templates" },
+      { G_USER_DIRECTORY_VIDEOS, "G_USER_DIRECTORY_VIDEOS", "videos" },
+      { 0, NULL, NULL }
+    };
+    etype = g_enum_register_static ("GUserDirectory", values);
+  }
+  return etype;
+}
+#endif
+
+/* --------------------------------------------------------------------------
+ * --- Error values: --------------------------------------------------------
+ * -------------------------------------------------------------------------- */
+
 static const GEnumValue _gperl_convert_error_values[] = {
   { G_CONVERT_ERROR_NO_CONVERSION, "G_CONVERT_ERROR_NO_CONVERSION", "no-conversion" },
   { G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "G_CONVERT_ERROR_ILLEGAL_SEQUENCE", "illegal-sequence" },
@@ -28,9 +218,6 @@ gperl_convert_error_get_type (void)
   return type;
 }
 
-#define GPERL_TYPE_CONVERT_ERROR gperl_convert_error_get_type()
-GType gperl_convert_error_get_type (void);
-
 /* -------------------------------------------------------------------------- */
 
 static const GEnumValue _gperl_file_error_values[] = {
diff --git a/gperl-gtypes.h b/gperl-gtypes.h
index 9b1df3d..e6eace6 100644
--- a/gperl-gtypes.h
+++ b/gperl-gtypes.h
@@ -5,39 +5,76 @@
 
 G_BEGIN_DECLS
 
+/* --- Enums/Flags: --------------------------------------------------------- */
+
+#define GPERL_TYPE_CONNECT_FLAGS gperl_connect_flags_get_type ()
+GType gperl_connect_flags_get_type (void) G_GNUC_CONST;
+
+#if GLIB_CHECK_VERSION (2, 6, 0)
+#define GPERL_TYPE_KEY_FILE_FLAGS gperl_key_file_flags_get_type()
+GType gperl_key_file_flags_get_type (void) G_GNUC_CONST;
+#endif
+
+#define GPERL_TYPE_LOG_LEVEL_FLAGS gperl_log_level_flags_get_type ()
+GType gperl_log_level_flags_get_type (void) G_GNUC_CONST;
+
+#if GLIB_CHECK_VERSION (2, 6, 0)
+#define GPERL_TYPE_OPTION_FLAGS gperl_option_flags_get_type ()
+GType gperl_option_flags_get_type (void) G_GNUC_CONST;
+#endif
+
+#if GLIB_CHECK_VERSION (2, 12, 0)
+#define GPERL_TYPE_OPTION_ARG gperl_option_arg_get_type ()
+GType gperl_option_arg_get_type (void) G_GNUC_CONST;
+#endif
+
+/* the obvious G_TYPE_PARAM_FLAGS is taken by GParamSpecFlags. */
+#define GPERL_TYPE_PARAM_FLAGS gperl_param_flags_get_type ()
+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;
+
+#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;
+#endif
+
+/* --- Error values: -------------------------------------------------------- */
+
 #if GLIB_CHECK_VERSION (2, 12, 0)
-#define GPERL_TYPE_BOOKMARK_FILE_ERROR gperl_bookmark_file_error_get_type()
-GType gperl_bookmark_file_error_get_type (void);
+#define GPERL_TYPE_BOOKMARK_FILE_ERROR gperl_bookmark_file_error_get_type ()
+GType gperl_bookmark_file_error_get_type (void) G_GNUC_CONST;
 #endif /* GLIB_CHECK_VERSION (2, 12, 0) */
 
-#define GPERL_TYPE_CONVERT_ERROR gperl_convert_error_get_type()
-GType gperl_convert_error_get_type (void);
+#define GPERL_TYPE_CONVERT_ERROR gperl_convert_error_get_type ()
+GType gperl_convert_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_FILE_ERROR gperl_file_error_get_type()
-GType gperl_file_error_get_type (void);
+#define GPERL_TYPE_FILE_ERROR gperl_file_error_get_type ()
+GType gperl_file_error_get_type (void) G_GNUC_CONST;
 
 #if GLIB_CHECK_VERSION (2, 6, 0)
-#define GPERL_TYPE_KEY_FILE_ERROR gperl_key_file_error_get_type()
-GType gperl_key_file_error_get_type (void);
+#define GPERL_TYPE_KEY_FILE_ERROR gperl_key_file_error_get_type ()
+GType gperl_key_file_error_get_type (void) G_GNUC_CONST;
 #endif /* GLIB_CHECK_VERSION (2, 6, 0) */
 
-#define GPERL_TYPE_IO_ERROR gperl_io_error_get_type()
-GType gperl_io_error_get_type (void);
+#define GPERL_TYPE_IO_ERROR gperl_io_error_get_type ()
+GType gperl_io_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_IO_CHANNEL_ERROR gperl_io_channel_error_get_type()
-GType gperl_io_channel_error_get_type (void);
+#define GPERL_TYPE_IO_CHANNEL_ERROR gperl_io_channel_error_get_type ()
+GType gperl_io_channel_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_MARKUP_ERROR gperl_markup_error_get_type()
-GType gperl_markup_error_get_type (void);
+#define GPERL_TYPE_MARKUP_ERROR gperl_markup_error_get_type ()
+GType gperl_markup_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_SHELL_ERROR gperl_shell_error_get_type()
-GType gperl_shell_error_get_type (void);
+#define GPERL_TYPE_SHELL_ERROR gperl_shell_error_get_type ()
+GType gperl_shell_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_SPAWN_ERROR gperl_spawn_error_get_type()
-GType gperl_spawn_error_get_type (void);
+#define GPERL_TYPE_SPAWN_ERROR gperl_spawn_error_get_type ()
+GType gperl_spawn_error_get_type (void) G_GNUC_CONST;
 
-#define GPERL_TYPE_THREAD_ERROR gperl_thread_error_get_type()
-GType gperl_thread_error_get_type (void);
+#define GPERL_TYPE_THREAD_ERROR gperl_thread_error_get_type ()
+GType gperl_thread_error_get_type (void) G_GNUC_CONST;
 
 G_END_DECLS
 


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