Subject: | Gtk2::Pango::Layout::set_attributes can't accept undef attrs |
The Pango documentation for pango_layout_set_attributes() says that the
second parameter (PangoAttrList *attr) can be NULL. The Perl bindings
fail to accept undef as a valid attributes list.
A small patch tries to address this issue.
Subject: | PangoLayout.xs.patch |
diff -ru Gtk2-1.202/t/PangoLayout.t Gtk2-patched/t/PangoLayout.t
--- Gtk2-1.202/t/PangoLayout.t 2008-10-22 21:49:03.000000000 +0200
+++ Gtk2-patched/t/PangoLayout.t 2009-01-01 13:54:28.000000000 +0100
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use strict;
-use Gtk2::TestHelper tests => 71;
+use Gtk2::TestHelper tests => 73;
# $Id: PangoLayout.t 2067 2008-10-18 22:24:19Z tsch $
@@ -17,6 +17,10 @@
is($layout -> get_text(), "Bla bla.");
$layout -> set_markup("Bla bla.");
+isa_ok($layout -> get_attributes(), "Gtk2::Pango::AttrList");
+$layout -> set_attributes(undef);
+is($layout -> get_attributes(), undef);
+
is($layout -> set_markup_with_accel("Bla _bla.", "_"), "b");
my $font = Gtk2::Pango::FontDescription -> new();
diff -ru Gtk2-1.202/xs/PangoLayout.xs Gtk2-patched/xs/PangoLayout.xs
--- Gtk2-1.202/xs/PangoLayout.xs 2008-10-22 21:49:01.000000000 +0200
+++ Gtk2-patched/xs/PangoLayout.xs 2009-01-01 13:48:06.000000000 +0100
@@ -192,10 +192,10 @@
void
pango_layout_set_attributes (layout, attrs)
PangoLayout *layout
- PangoAttrList *attrs
+ PangoAttrList_ornull *attrs
## PangoAttrList *pango_layout_get_attributes (PangoLayout *layout)
-PangoAttrList *
+PangoAttrList_ornull *
pango_layout_get_attributes (layout)
PangoLayout *layout