Re: menuitem confusion



On Tue, Jul 3, 2012 at 6:15 PM, Dave M <dave nerd gmail com> wrote:
On Tue, Jul 3, 2012 at 1:29 PM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
On 03.07.2012 14:04, Dave M wrote:

How is this look? Anything jump out as needing improvement or fixes?


Looking good in general.  The code is awfully repetitive, however. Would
something like this work?

  {
    no strict qw(refs);
    foreach my $ctor (qw/new new_with_label .../) {
      *{'Gtk3::RadioMenuItem::' . $ctor} = sub {
        my ($class, $group, @rest) = @_;

        $group = [] unless defined $group;
        return Glib::Object::Introspection->invoke (
          $_GTK_BASENAME, 'RadioMenuItem', $ctor,
          $class, $group, @rest);
      }
    }
  }

This would lose the custom usage error messages, but these should be
provided automatically by G:O:I (in theory, at least).


Sorry, one more time - left an important line out.  This is a noisier
diff file too, as I diff'ed it against the current stable Gtk3.pm.


That's OK, I can munge it to be of the right form.  However, if you have the
possibility to work against a git clone, that would make things even easier
for me.

  git clone git://git.gnome.org/perl-Gtk3
  cd perl-Gtk3
  git checkout -b radio-menu-item-overrides
  ... hack ...
  git commit -a
  git format-patch HEAD^

But the current patch format works just fine, too.

You're right; your way is much better.  I thought because the code was
minimal and contained custom error messages that it would work out.
I'll work on a diff for it and resend.

Here's the diff.  Passed all the tests and works with the example.

I don't think you needed me much for that one. ;)  I'll go look at the
others you listed.

http://git.gnome.org/browse/perl-Gtk2/tree/xs/GtkRadioButton.xs
http://git.gnome.org/browse/perl-Gtk2/tree/xs/GtkRadioToolButton.xs
http://git.gnome.org/browse/perl-Gtk2/tree/xs/GtkRadioAction.xs

Thanks,
Dave M

Attachment: radiomenuitem2.diff.gz
Description: GNU Zip compressed data



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