[perl-Glib] Wrap g_param_spec_override() and g_param_spec_get_redirect_target()



commit b1427b3ab95e669355fbf2cab0344a7b25d2c0d7
Author: Kevin Ryde <user42 zip com au>
Date:   Sat Oct 30 10:43:27 2010 +1100

    Wrap g_param_spec_override() and g_param_spec_get_redirect_target()
    
    Add a GParamSpec_ornull typemap to have the docs come out as "pspec or undef"
    (the code in newSVGParamSpec() already does NULL -> undef).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633517

 GParamSpec.xs |   15 +++++++++++++++
 gperl.h       |    4 +++-
 t/e.t         |   14 +++++++++++++-
 typemap       |    3 ++-
 4 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/GParamSpec.xs b/GParamSpec.xs
index f543f4c..4d62460 100644
--- a/GParamSpec.xs
+++ b/GParamSpec.xs
@@ -583,6 +583,21 @@ scalar (class, name, nick, blurb, flags)
 ###  GParamSpec* g_param_spec_value_array (const gchar *name, const gchar *nick, const gchar *blurb, GParamSpec *element_spec, GParamFlags flags) 
 
 
+#if GLIB_CHECK_VERSION(2, 4, 0)
+
+GParamSpec*
+g_param_spec_override (class, name, overridden)
+	const gchar *name
+	GParamSpec *overridden
+    C_ARGS:
+	name, overridden
+
+GParamSpec_ornull *
+g_param_spec_get_redirect_target (pspec)
+	GParamSpec *pspec
+
+#endif
+
 #if GLIB_CHECK_VERSION(2, 10, 0)
 
 =for apidoc
diff --git a/gperl.h b/gperl.h
index 7df0f87..8afbc23 100644
--- a/gperl.h
+++ b/gperl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for
+ * Copyright (C) 2003-2005, 2010 by the gtk2-perl team (see the file AUTHORS for
  * the full list)
  *
  * This library is free software; you can redistribute it and/or modify it
@@ -212,11 +212,13 @@ typedef gchar *GPerlFilename;
 typedef const gchar *GPerlFilename_const;
 typedef gchar *GPerlFilename_own;
 typedef GPerlFilename GPerlFilename_ornull;
+typedef GParamSpec GParamSpec_ornull;
 
 #define newSVGObject(obj)	(gperl_new_object ((obj), FALSE))
 #define newSVGObject_noinc(obj)	(gperl_new_object ((obj), TRUE))
 #define SvGObject(sv)		(gperl_get_object_check (sv, G_TYPE_OBJECT))
 #define SvGObject_ornull(sv)	(gperl_sv_is_defined (sv) ? SvGObject (sv) : NULL)
+#define newSVGParamSpec_ornull(sv)	newSVGParamSpec(sv)
 
 
 /*
diff --git a/t/e.t b/t/e.t
index 07b1ee6..030e590 100644
--- a/t/e.t
+++ b/t/e.t
@@ -5,7 +5,7 @@
 use strict;
 use utf8;
 use Glib ':constants';
-use Test::More tests => 275;
+use Test::More tests => 278;
 
 # first register some types with which to play below.
 
@@ -217,6 +217,18 @@ foreach (@params) {
 }
 
 
+SKIP: {
+	skip "GParamSpecOverride is new in glib 2.4.0", 3
+		unless Glib->CHECK_VERSION (2, 4, 0);
+
+	my $pbase = Glib::ParamSpec->boolean ('obool','obool', 'Blurb',
+					      0, G_PARAM_READWRITE);
+	is ($pspec->get_redirect_target, undef);
+
+	$pspec = Glib::ParamSpec->override ('over', $pbase);
+	isa_ok ($pspec, 'Glib::Param::Override');
+	is_deeply ($pspec->get_redirect_target, $pbase);
+}
 
 #
 # Since this is conditional on version, we don't want to overcomplicate
diff --git a/typemap b/typemap
index d17b875..5121a7a 100644
--- a/typemap
+++ b/typemap
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for
+# Copyright (C) 2003-2005, 2010 by the gtk2-perl team (see the file AUTHORS for
 # the full list)
 # 
 # This library is free software; you can redistribute it and/or modify it under
@@ -63,6 +63,7 @@ GObject_ornull*	T_GPERL_GENERIC_WRAPPER
 GObject_noinc*	T_GPERL_GENERIC_WRAPPER
 
 GParamSpec*	T_GPERL_GENERIC_WRAPPER
+GParamSpec_ornull*	T_GPERL_GENERIC_WRAPPER
 GParamFlags	T_GPERL_GENERIC_WRAPPER
 
 GSignalFlags	T_GPERL_GENERIC_WRAPPER



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