On 22/12/2007, muppet <scott asofyet org> wrote:
interactive.pl: a quick transliteration of gtkimageview/tests/ interactive.c. Note that the way this program uses the GtkImageTransp values in the UI manager actions doesn't really play nicely with perl syntax for enums, so there's a terrible, evil, horrible hack in its place. If you golf this down to more perlish code, using closures and such, you can sidestep the problem.
Do you mind my including this in an examples directory, attributing you? I was getting: No anim! Can't call method "set_sensitive" on an undefined value at ./examples/interactive.pl line 74. *** unhandled exception in callback: *** FATAL: invalid enum GtkImageTransp value 1, expecting: color / GTK_IMAGE_TRANSP_COLOR, background / GTK_IMAGE_TRANSP_BACKGROUND, grid / GTK_IMAGE_TRANSP_GRID at ./examples/interactive.pl line 206. *** ignoring at ./examples/interactive.pl line 602. which the attached patch fixes. But I don't see how to do it differently with a closure. I'd appreciate a hint. I attempted to clean up the namespace with the second patch, but now the tests fail: t/animview.............NOK 3# Failed test 'The object isa Gtk2::ImageView::Anim' # in t/animview.t at line 23. # The object isn't a 'Gtk2::ImageView::Anim' it's a 'Gtk2::ImageView' t/imagescrollwin.......ok 1/3Usage: Gtk2::Table::new(class, rows, columns, homogeneous=FALSE) at /usr/lib/perl5/Glib.pm line 211. t/imagetooldragger.....ok t/imagetoolselector....ok 1/4Can't locate object method "get_selection" via package "Gtk2::ImageView::Tool::Selector" at t/imagetoolselector.t line 29. I must have done something right, as t/imagetooldragger is OK, but t/imagescrollwin is particularly strange. Thanks for any clue. Jeff
Attachment:
interactive.patch
Description: Text Data
Attachment:
namespace.patch
Description: Text Data