On Sat, 2007-01-06 at 11:36 -0500, muppet wrote:

> It looks like you actually got a copy of the font description from  
> Gtk2::Style::font_desc, which means your changes aren't happening to  
> the object in place.  Odd.

Yeah.  We're using newSVPangoFontDescription_copy in
Gtk2::Style::font_desc, so we actually hand out a copy.  I think that's
not necessary.  Proposed patch attached.

-- 
Bye,
-Torsten
Index: t/GtkStyle.t
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkStyle.t,v
retrieving revision 1.9
diff -u -d -p -r1.9 GtkStyle.t
--- t/GtkStyle.t	7 Aug 2006 18:36:06 -0000	1.9
+++ t/GtkStyle.t	6 Jan 2007 16:53:39 -0000
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 # vim: set ft=perl expandtab shiftwidth=2 softtabstop=2 :
 use strict;
-use Gtk2::TestHelper tests => 113;
+use Gtk2::TestHelper tests => 114;
 
 # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/t/GtkStyle.t,v 1.9 2006/08/07 18:36:06 kaffeetisch Exp $
 
@@ -55,6 +55,10 @@ isa_ok($style -> black_gc(), "Gtk2::Gdk:
 isa_ok($style -> white_gc(), "Gtk2::Gdk::GC");
 isa_ok($style -> font_desc(), "Gtk2::Pango::FontDescription");
 
+# make sure we get the real thing, not a copy.
+$style -> font_desc() -> set_weight("bold");
+is($style -> font_desc() -> get_weight(), "bold");
+
 $style -> set_background($window -> window(), "normal");
 $style -> apply_default_background($window -> window(), 1, "active", Gtk2::Gdk::Rectangle -> new(10, 10, 5, 5), 10, 10, 5, 5);
 
Index: xs/GtkStyle.xs
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkStyle.xs,v
retrieving revision 1.26
diff -u -d -p -r1.26 GtkStyle.xs
--- xs/GtkStyle.xs	7 Aug 2006 18:36:10 -0000	1.26
+++ xs/GtkStyle.xs	6 Jan 2007 16:53:39 -0000
@@ -46,7 +46,7 @@ black (style)
 	switch (ix) {
 	    case 0: RETVAL = newSVGdkColor (&(style->black)); break;
 	    case 1: RETVAL = newSVGdkColor (&(style->white)); break;
-	    case 2: RETVAL = newSVPangoFontDescription_copy (style->font_desc); break;
+	    case 2: RETVAL = newSVPangoFontDescription (style->font_desc); break;
 	    case 3: RETVAL = newSViv (style->xthickness); break;
 	    case 4: RETVAL = newSViv (style->ythickness); break;
 	    case 5: RETVAL = newSVGdkGC (style->black_gc); break;
_______________________________________________
gtk-perl-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to