Re: gnome_app_create_menu hack

The mnemonic's work, I must be on drugs.

On Thu, 17 Apr 2003, Chas Owens wrote:

Being my lazy self I have hacked together a quick Perl
based replacement for Gnome2::App->create_menus().  It
doesn't handle images yet and there seems to be something
wrong with the mnemonic (it underlines, but does work),
but at least I can test some more of Gtk2-Perl-XS.

This does raise a point though: should we implement this
(and possibly other things) in XS when when we can just
as easily do them in Perl?

package Gnome2::App;

sub create_menus {
        my $app = shift;
        my $menu = Gtk2::MenuBar->new;
        $app->set_menus(_create_menus($menu, @_));

sub _create_menus {
        my $menu = shift;
        for my $ui (@_) {
                if ($ui->{type} eq 'subtree') {
                        my $item    = Gtk2::MenuItem->new_with_mnemonic(
                        my $submenu = Gtk2::Menu->new;
                        _create_menus($submenu, @{$ui->{subtree}});
                } elsif ($ui->{type} eq 'item') {
                        my $item = Gtk2::MenuItem->new_with_mnemonic(
                        $item->signal_connect('activate', $ui->{callback});
        return $menu;
gtk-perl-list mailing list
gtk-perl-list gnome org

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