Re: Can't locate object method "add_actions"...
- From: Dave M <dave nerd gmail com>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: Can't locate object method "add_actions"...
- Date: Mon, 11 Jun 2012 19:11:27 -0500
On Mon, Jun 11, 2012 at 4:03 PM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
On 10.06.2012 17:49, Dave M wrote:
Ok, here's a first attempt. ÂMost everything works, but there's one
bug I haven't solved - the radio_actions signal_connect is on hyper
mode for some reason. ÂAny pointers as to why is appreciated.
See below.
Anyway, the tar.gz contains a diff, the Gtk3.pm, and a Gtk3 version of
UI Manager for testing. ÂThe uimanager.pl is set to use the Gtk3 from
the current directory (with use lib '.') and to be easily added to a
future Perl version of gtk3-demo.
Feedback is more than welcome.
Alright, let's get the trivial stuff out of the way first:
â Please avoid unrelated changes like these:
-use Carp qw/croak/;
+use Carp 'croak';
-our @ISA = qw(Exporter);
+our @ISA = 'Exporter';
â Please adapt to the style of the surrounding code. ÂIn this case this
means indentation with two spaces (not tabs) and slightly different spacing
around parens.
On to the actual meat. ÂIn general: looking good already! ÂSome comments:
â The XS code allowed the entries to be either array or hash references. ÂIt
would be nice to preserve this.
â To check the type of a reference, the XS code and your code look at
ref($entries). ÂThis does not work for things like overloading or tie-ing,
so it might be better to simply check whether the thing can be used as an
array ref. ÂSomething like:
Â$is_arrayref = eval { @$entries; 1 }
â The code
Âif( ! $user_data ) {
 Â$action->signal_connect( 'activate', $callback );
Â} else {
 Â$action->signal_connect( 'activate', $callback, $user_data );
Â}
should simply be
Â$action->signal_connect( 'activate', $callback, $user_data );
Even if the user data evaluates to false, it should still be passed to the
callback. Â(And signal_connect handles undef for the user data just fine.)
â Good idea to use add_action_with_accel to save code!
â Gtk3::ActionGroup::add_actions doesn't seem to translate the label and the
tooltip.
â Ah, now I see what you meant by "hyper mode" above. ÂThe problem is that
you connect to $first_action's changed signal anew each time the loop is
run. ÂThe code block should be moved outside the loop.
â The example program is very good to have, but it would also be good to
have unit tests for the three overrides.
Great! I'll work on some tests, finish the cleanup, and resubmit.
Thank you for providing the feedback!
Thanks,
Dave M
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]